Change: In the militia overview laptop website, do not display militia faces, instead colour their names. This way we can display more militia at once without losing information

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8514 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-01-04 18:57:33 +00:00
parent 8b41be236a
commit 70162ece95
3 changed files with 46 additions and 8 deletions
+10 -4
View File
@@ -15,6 +15,10 @@
#include "input.h" // for gfLeftButtonState
#include "insurance.h" // for DisplaySmallColouredLineWithShadow
#define TESTTABLE_FONT_MED FONT12ARIAL
#define TESTTABLE_OFFSET_ROW 20
#define TESTTABLE_FONT_COLOR_REGULAR 2
BaseTable::BaseTable( )
: WidgetBase( ),
mName(L""),
@@ -105,6 +109,11 @@ STR16 cdp_string_func_dummy( UINT32 aNum )
return L"nothing found";
}
UINT8 cdp_textcolour_func_dummy( UINT32 aNum )
{
return TESTTABLE_FONT_COLOR_REGULAR;
}
void cdp_image_func_dummy( UINT32 aNum, UINT32& arImageLib, UINT16& arImage )
{
@@ -194,9 +203,6 @@ ColumnDataProvider::DestroyMouseRegions( )
}
// Flugente: this unused page will now be a testbed for the BaseTable development
#define TESTTABLE_FONT_MED FONT12ARIAL
#define TESTTABLE_OFFSET_ROW 20
#define TESTTABLE_FONT_COLOR_REGULAR 2
////////////// TestPanel///////////////////////////////////////
TestPanel::TestPanel( )
@@ -575,7 +581,7 @@ TestTable::Display( )
{
swprintf( sText, (*it).GetString( i ) );
DrawTextToScreen( sText, usPosX, usPosY + 7, GetWidth( ), TESTTABLE_FONT_MED, TESTTABLE_FONT_COLOR_REGULAR, FONT_MCOLOR_BLACK, FALSE, 0 );
DrawTextToScreen( sText, usPosX, usPosY + 7, GetWidth( ), TESTTABLE_FONT_MED, (*it).GetColour( i ), FONT_MCOLOR_BLACK, FALSE, 0 );
}
else if ( it->GetProviderType( ) == ColumnDataProvider::CDP_IMAGE )
{
+7 -1
View File
@@ -163,6 +163,9 @@ public:
typedef STR16( *cdp_string_func )(UINT32 aNum);
STR16 cdp_string_func_dummy( UINT32 aNum );
typedef UINT8( *cdp_textcolour_func )( UINT32 aNum );
UINT8 cdp_textcolour_func_dummy( UINT32 aNum );
typedef void( *cdp_image_func )(UINT32 aNum, UINT32& arImageLib, UINT16& arImage );
void cdp_image_func_dummy( UINT32 aNum, UINT32& arImageLib, UINT16& arImage );
@@ -176,7 +179,7 @@ class ColumnDataProvider
public:
ColumnDataProvider( STR16 aName ) : mName( aName ), mNumberOfEntries( 0 ), mRequiredLength(20), mRequiredHeigth( 20 ),
mType( CDP_STRING ), mCallbackType( CDP_DEFAULT ),
mFuncString( cdp_string_func_dummy ), mFuncImage( cdp_image_func_dummy )
mFuncString( cdp_string_func_dummy ), mFuncTextColour( cdp_textcolour_func_dummy ), mFuncImage( cdp_image_func_dummy ), mFuncStatusBar( cdp_statusbar_func_dummy )
{
for ( int i = 0; i < COLUMNDATAPROVIDER_MOUSEREGIONS; ++i )
{
@@ -216,6 +219,8 @@ public:
// functions for handling string contents
void SetMethodString( cdp_string_func afunc ) { mFuncString = afunc; SetProviderType( CDP_STRING ); CalcRequiredLength( ); }
STR16 GetString( UINT32 aNum ) { return mFuncString( aNum ); }
void SetMethodTextColour( cdp_textcolour_func afunc ) { mFuncTextColour = afunc; }
UINT8 GetColour( UINT32 aNum ) { return mFuncTextColour( aNum ); }
// functions for handling images
void SetMethodImage( cdp_image_func afunc ) { mFuncImage = afunc; SetProviderType( CDP_IMAGE ); CalcRequiredLength( ); }
@@ -252,6 +257,7 @@ private:
CDP_CALLBACKTYPE mCallbackType;
cdp_string_func mFuncString;
cdp_textcolour_func mFuncTextColour;
cdp_image_func mFuncImage;
cdp_statusbar_func mFuncStatusBar;
};
+29 -3
View File
@@ -458,6 +458,31 @@ STR16 Profilenamegetter( UINT32 aNum )
return L"No entry found in database";
}
// a militia's name is written in a different colour, depending on their rank and whether they are dead
UINT8 MilitiaNameTextColourGetter( UINT32 aNum )
{
if ( aNum < gIndividualMilitiaFilteredIdsVector.size() )
{
UINT32 militiaid = gIndividualMilitiaFilteredIdsVector[aNum];
MILITIA militia;
if ( GetMilitia( militiaid, &militia ) )
{
if ( militia.flagmask & MILITIAFLAG_DEAD )
return 243;
switch ( militia.militiarank )
{
case GREEN_MILITIA: return 184; break;
case REGULAR_MILITIA: return 201; break;
case ELITE_MILITIA: return 203; break;
}
}
}
return 2;
}
STR16 Sectornamegetter( UINT32 aNum )
{
if ( aNum < gIndividualMilitiaFilteredIdsVector.size( ) )
@@ -728,13 +753,13 @@ template<> void TestTableTemplate<3>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End
ColumnDataProvider healthbarcol( L"" );
healthbarcol.SetMethodStatusBar( MilitiaHealthBar );
healthbarcol.SetNumberOfEntries( gIndividualMilitiaFilteredIdsVector.size( ) );
healthbarcol.SetRequiredHeigth( 29 );
//healthbarcol.SetRequiredHeigth( 29 );
healthbarcol.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
AddColumnDataProvider( healthbarcol );
}
// face
/*// face
ColumnDataProvider imagecol( L"" );
imagecol.SetMethodImage( AutoResolveFaces );
imagecol.SetNumberOfEntries( gIndividualMilitiaFilteredIdsVector.size( ) );
@@ -742,11 +767,12 @@ template<> void TestTableTemplate<3>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End
imagecol.SetRequiredLength( 35 );
imagecol.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
AddColumnDataProvider( imagecol );
AddColumnDataProvider( imagecol );*/
// name
ColumnDataProvider namcol( szIdividualMilitiaWebsiteText[12] );
namcol.SetMethodString( Profilenamegetter );
namcol.SetMethodTextColour( MilitiaNameTextColourGetter );
namcol.SetNumberOfEntries( gIndividualMilitiaFilteredIdsVector.size( ) );
namcol.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );