Fix: usBackGround is now UINT16 (was UINT8) to accommodate more than 255 backgrounds.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6513 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-10-19 20:45:05 +00:00
parent ac0e14beca
commit a71f8745ab
12 changed files with 64 additions and 63 deletions
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.6513 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.6513 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.6513 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.6513 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.6513 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.6513 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.6513 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.6484 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.6513 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 13.10.13" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 13.10.19" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+2 -1
View File
@@ -21,6 +21,7 @@ extern CHAR16 zTrackingNumber[16];
// Keeps track of the saved game version. Increment the saved game version whenever
// you will invalidate the saved game file
#define BACKGROUNDS_FIX_UINT8 146 // Flugente: had to change usBackground-vars from UINT8 to UINT16
#define BACKGROUNDS 145 // Flugente: background feature
#define NO_VEHICLE_SAVE 144 // Flugente: vehicle data isn't saved anymore, as it has long been externalised
#define SOLDIER_PROFILES 143 // Flugente: profiles for enemy and militia (possibly any non-NPC/RPC character)
@@ -64,7 +65,7 @@ extern CHAR16 zTrackingNumber[16];
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
#define SAVE_GAME_VERSION BACKGROUNDS
#define SAVE_GAME_VERSION BACKGROUNDS_FIX_UINT8
//#define RUSSIANGOLD
#ifdef __cplusplus
+1 -1
View File
@@ -79,7 +79,7 @@ INT32 iPersonality = 0;
INT32 iAttitude = 0;
// Flugente: background
UINT8 usBackground = 0;
UINT16 usBackground = 0;
// Flugente: sexism, racism etc.
INT8 bRace = 0;
+1 -1
View File
@@ -47,7 +47,7 @@ extern INT32 iPersonality;
extern INT32 iAttitude;
// Flugente: background
extern UINT8 usBackground;
extern UINT16 usBackground;
// Flugente: sexism, racism etc.
extern INT8 bRace;
+31 -41
View File
@@ -98,7 +98,7 @@ void BtnIMPBackgroundAnswerCallback(GUI_BUTTON *btn,INT32 reason);
void BtnIMPBackgroundFinishCallback(GUI_BUTTON *btn,INT32 reason);
void AddIMPBackgroundButtons();
void HandleBackgroundButtonStates( );
void HandleIMPBackgroundAnswers( UINT32 uiSkillPressed );
void HandleIMPBackgroundAnswers( UINT16 uiSkillPressed );
void IMPBackgroundDisplaySkills();
BOOLEAN CameBackToBackgroundPageButNotFinished();
@@ -109,7 +109,7 @@ void BtnIMPBackgroundNextCallback(GUI_BUTTON *btn,INT32 reason);
void BtnIMPBackgroundPreviousCallback(GUI_BUTTON *btn,INT32 reason);
void UpdateDisplaySkills( BOOLEAN fIncrease );
UINT8 GetDisplaySkill( UINT8 aNr );
UINT16 GetDisplaySkill( UINT16 aNr );
void ResetDisplaySkills();
//ppp
@@ -123,8 +123,6 @@ void ResetDisplaySkills();
void EnterIMPBackground( void )
{
UINT8 ubCnt;
VOBJECT_DESC VObjectDesc;
//add the skill trait buttons
@@ -152,7 +150,7 @@ void EnterIMPBackground( void )
//if we are not DONE and are just reviewing
if( iCurrentProfileMode != IMP__FINISH )
{
for (ubCnt = 0; ubCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ubCnt++ )
for (UINT16 ubCnt = 0; ubCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++ubCnt )
{
gfBackgroundQuestions[ ubCnt ] = FALSE;
}
@@ -164,7 +162,7 @@ void EnterIMPBackground( void )
// add regions for help texts
UINT16 usPosY = IMP_BACKGROUND_COLUMN_START_Y + 8;
for( ubCnt=0; ubCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++ubCnt )
for( UINT16 ubCnt=0; ubCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++ubCnt )
{
MSYS_DefineRegion( &gMR_BackgroundHelpTextRegions[ubCnt], ( IMP_BACKGROUND_COLUMN_START_X + 62 ), ( usPosY ),
(IMP_BACKGROUND_COLUMN_START_X + 218), ( usPosY + 17), MSYS_PRIORITY_HIGH,
@@ -197,7 +195,7 @@ void ExitIMPBackground( void )
DestroyIMPBackgroundButtons( );
//remove the skill buttons
for(INT32 iCnt = 0; iCnt < IMP_BACKGROUND_DISPLAYED_CHOICES; iCnt++)
for(UINT16 iCnt = 0; iCnt < IMP_BACKGROUND_DISPLAYED_CHOICES; iCnt++)
{
//if there is a button allocated
if( giIMPBackgroundAnswerButton[iCnt] != -1 )
@@ -227,7 +225,6 @@ void HandleIMPBackground( void )
void AddIMPBackgroundButtons()
{
INT32 iCnt = 0;
UINT16 usPosX, usPosY;
// next button
@@ -254,7 +251,7 @@ void AddIMPBackgroundButtons()
usPosX = IMP_BACKGROUND_COLUMN_START_X;
usPosY = IMP_BACKGROUND_COLUMN_START_Y;
for(iCnt = 0; iCnt < IMP_BACKGROUND_DISPLAYED_CHOICES; ++iCnt)
for(UINT16 iCnt = 0; iCnt < IMP_BACKGROUND_DISPLAYED_CHOICES; ++iCnt)
{
//reset
giIMPBackgroundAnswerButton[iCnt] = -1;
@@ -299,16 +296,14 @@ void BtnIMPBackgroundAnswerCallback(GUI_BUTTON *btn,INT32 reason)
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
INT32 iBackground = MSYS_GetBtnUserData( btn, 0 );
UINT16 usBackground = (UINT16)(MSYS_GetBtnUserData( btn, 0 ));
HandleIMPBackgroundAnswers( iBackground );
HandleIMPBackgroundAnswers( usBackground );
}
}
void HandleIMPBackgroundAnswers( UINT32 uiSkillPressed )
void HandleIMPBackgroundAnswers( UINT16 uiSkillPressed )
{
UINT32 uiCnt;
//if we are DONE and are just reviewing
if( iCurrentProfileMode == IMP__FINISH )
{
@@ -323,7 +318,7 @@ void HandleIMPBackgroundAnswers( UINT32 uiSkillPressed )
}
//reset all other buttons
for( uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
for( UINT16 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
{
gfBackgroundQuestions[ uiCnt ] = FALSE;
}
@@ -352,9 +347,7 @@ void HandleIMPBackgroundAnswers( UINT32 uiSkillPressed )
void HandleBackgroundButtonStates( )
{
UINT32 uiCnt;
for( uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
for( UINT16 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
{
//if the skill is selected ( ie depressed )
if( gfBackgroundQuestions[ uiCnt ] )
@@ -370,7 +363,6 @@ void HandleBackgroundButtonStates( )
void IMPBackgroundDisplaySkills()
{
UINT32 uiCnt;
UINT16 usPosX, usPosY;
UINT16 usBoxPosX, usBoxPosY;
HVOBJECT hImageHandle;
@@ -384,9 +376,9 @@ void IMPBackgroundDisplaySkills()
usPosX = IMP_BACKGROUND_COLUMN_START_X + IMP_BACKGROUND__TEXT_OFFSET_X;
usPosY = IMP_BACKGROUND_COLUMN_START_Y + IMP_BACKGROUND__TEXT_OFFSET_Y;
for( uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
for( UINT16 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
{
UINT8 background = GetDisplaySkill( uiCnt );
UINT16 background = GetDisplaySkill( uiCnt );
usBoxPosX = usPosX - IMP_BACKGROUND__GREY_BOX_OFFSET_X;
usBoxPosY = usPosY - IMP_BACKGROUND__GREY_BOX_OFFSET_Y;
@@ -471,7 +463,7 @@ BOOLEAN CameBackToBackgroundPageButNotFinished()
}
}
void AssignBackgroundHelpText( UINT8 ubNumber, MOUSE_REGION* pMouseregion )
void AssignBackgroundHelpText( UINT16 ubNumber, MOUSE_REGION* pMouseregion )
{
CHAR16 apStr[ 4500 ];
CHAR16 atStr[ 260 ];
@@ -522,17 +514,17 @@ void AssignBackgroundHelpText( UINT8 ubNumber, MOUSE_REGION* pMouseregion )
}
UINT8 displayedskills[IMP_BACKGROUND_DISPLAYED_CHOICES];
UINT8 gBackgroundFirstItem = 0;
UINT8 gBackgroundLastItem = 0;
UINT16 displayedskills[IMP_BACKGROUND_DISPLAYED_CHOICES];
UINT16 gBackgroundFirstItem = 0;
UINT16 gBackgroundLastItem = 0;
void UpdateDisplaySkills( BOOLEAN fIncrease )
{
// fill a helper array with all viable choices
UINT8 tmparray[NUM_BACKGROUND];
UINT8 arraycounter = 0;
UINT8 found = 0;
for (UINT8 ubCnt = 0; ubCnt<num_found_background + 1; ++ubCnt )
UINT16 tmparray[NUM_BACKGROUND];
UINT16 arraycounter = 0;
UINT16 found = 0;
for (UINT16 ubCnt = 0; ubCnt<num_found_background + 1; ++ubCnt )
{
if ( IsBackGroundAllowed(ubCnt) )
{
@@ -541,7 +533,7 @@ void UpdateDisplaySkills( BOOLEAN fIncrease )
}
}
UINT8 firstitem, lastitem;
UINT16 firstitem, lastitem;
// select the range from which we rebuild our array
if ( fIncrease )
{
@@ -557,8 +549,8 @@ void UpdateDisplaySkills( BOOLEAN fIncrease )
lastitem = min(found , firstitem + IMP_BACKGROUND_DISPLAYED_CHOICES - 1);
}
UINT8 i = 0;
for (UINT8 ubCnt = firstitem; ubCnt<lastitem; ++ubCnt )
UINT16 i = 0;
for (UINT16 ubCnt = firstitem; ubCnt<lastitem; ++ubCnt )
{
displayedskills[ i++ ] = tmparray[ ubCnt ];
}
@@ -567,7 +559,7 @@ void UpdateDisplaySkills( BOOLEAN fIncrease )
gBackgroundLastItem = lastitem;
}
UINT8 GetDisplaySkill( UINT8 aNr )
UINT16 GetDisplaySkill( UINT16 aNr )
{
if ( aNr >= IMP_BACKGROUND_DISPLAYED_CHOICES )
return 0;
@@ -577,7 +569,7 @@ UINT8 GetDisplaySkill( UINT8 aNr )
void ResetDisplaySkills()
{
for (UINT8 ubCnt = 0; ubCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++ubCnt )
for (UINT16 ubCnt = 0; ubCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++ubCnt )
displayedskills[ ubCnt ] = 0;
gBackgroundFirstItem = 0;
@@ -588,7 +580,7 @@ void ResetDisplaySkills()
extern INT32 SkillsList[ ATTITUDE_LIST_SIZE ];
BOOLEAN IsBackGroundAllowed( UINT8 ubNumber )
BOOLEAN IsBackGroundAllowed( UINT16 ubNumber )
{
if ( !ubNumber )
return FALSE;
@@ -733,7 +725,6 @@ void DestroyIMPBackgroundButtons( void )
void BtnIMPBackgroundNextCallback(GUI_BUTTON *btn,INT32 reason)
{
// btn callback for IMP attrbite begin button
if (!(btn->uiFlags & BUTTON_ENABLED))
return;
@@ -746,7 +737,7 @@ void BtnIMPBackgroundNextCallback(GUI_BUTTON *btn,INT32 reason)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// next picture!!
UpdateDisplaySkills( TRUE );
@@ -754,7 +745,7 @@ void BtnIMPBackgroundNextCallback(GUI_BUTTON *btn,INT32 reason)
gfIMPBackground_Redraw = TRUE;
//reset all other buttons
for( UINT8 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
for( UINT16 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
{
gfBackgroundQuestions[ uiCnt ] = FALSE;
}
@@ -769,7 +760,6 @@ void BtnIMPBackgroundNextCallback(GUI_BUTTON *btn,INT32 reason)
void BtnIMPBackgroundPreviousCallback(GUI_BUTTON *btn,INT32 reason)
{
// btn callback for IMP attrbite begin button
if (!(btn->uiFlags & BUTTON_ENABLED))
return;
@@ -782,7 +772,7 @@ void BtnIMPBackgroundPreviousCallback(GUI_BUTTON *btn,INT32 reason)
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags&=~(BUTTON_CLICKED_ON);
btn->uiFlags&=~(BUTTON_CLICKED_ON);
// previous picture, please!!!
UpdateDisplaySkills( FALSE );
@@ -790,7 +780,7 @@ void BtnIMPBackgroundPreviousCallback(GUI_BUTTON *btn,INT32 reason)
gfIMPBackground_Redraw = TRUE;
//reset all other buttons
for( UINT8 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
for( UINT16 uiCnt=0; uiCnt<IMP_BACKGROUND_DISPLAYED_CHOICES; ++uiCnt )
{
gfBackgroundQuestions[ uiCnt ] = FALSE;
}
+2 -2
View File
@@ -9,8 +9,8 @@ void RenderIMPBackground( void );
void ExitIMPBackground( void );
void HandleIMPBackground( void );
BOOLEAN IsBackGroundAllowed( UINT8 ubNumber );
BOOLEAN IsBackGroundAllowed( UINT16 ubNumber );
void AssignBackgroundHelpText( UINT8 ubNumber, MOUSE_REGION* pMouseregion );
void AssignBackgroundHelpText( UINT16 ubNumber, MOUSE_REGION* pMouseregion );
#endif
+1 -1
View File
@@ -174,7 +174,7 @@ void CreateACharacterFromPlayerEnteredStats( void )
gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bAttitude = ( INT8 )iAttitude;
// Flugente: background
gMercProfiles[ LaptopSaveInfo.iIMPIndex ].usBackground = ( INT8 )usBackground;
gMercProfiles[ LaptopSaveInfo.iIMPIndex ].usBackground = usBackground;
// Flugente: sexism, racsim etc.
gMercProfiles[ LaptopSaveInfo.iIMPIndex ].bRace = ( INT8 )bRace;
+13 -3
View File
@@ -1496,9 +1496,19 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for
// Flugente: backgrounds
if(guiCurrentSaveGameVersion >= BACKGROUNDS)
{
if ( !FileRead( hFile, &this->usBackground, sizeof(UINT8), &uiNumBytesRead ) )
if(guiCurrentSaveGameVersion >= BACKGROUNDS_FIX_UINT8)
{
return(FALSE);
if ( !FileRead( hFile, &this->usBackground, sizeof(UINT16), &uiNumBytesRead ) )
{
return(FALSE);
}
}
else
{
if ( !FileRead( hFile, &this->usBackground, sizeof(UINT8), &uiNumBytesRead ) )
{
return(FALSE);
}
}
}
}
@@ -1581,7 +1591,7 @@ BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile)
}
// Flugente: background
if ( !FileWrite( hFile, &this->usBackground, sizeof(UINT8), &uiNumBytesWritten ) )
if ( !FileWrite( hFile, &this->usBackground, sizeof(UINT16), &uiNumBytesWritten ) )
{
return(FALSE);
}
+1 -1
View File
@@ -1513,7 +1513,7 @@ void MERCPROFILESTRUCT::initialize()
clearInventory();
// SANDRO - added this
memset( &records, 0, sizeof(STRUCT_Records) );
memset( &usBackground, 0, sizeof(UINT8) );
memset( &usBackground, 0, sizeof(UINT16) );
}
// Initialize the soldier.
+1 -1
View File
@@ -418,7 +418,7 @@ typedef struct
INT8 bTownAttachment;
// Flugente: backgrounds
UINT8 usBackground;
UINT16 usBackground;
} TEMPPROFILETYPE;
+1 -1
View File
@@ -1085,7 +1085,7 @@ profileEndElementHandle(void *userData, const XML_Char *name)
else if(strcmp(name, "usBackground") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.usBackground = (UINT8) atol(pData->szCharData);
pData->curProfile.usBackground = (UINT16) atol(pData->szCharData);
}
+1 -1
View File
@@ -936,7 +936,7 @@ public:
STRUCT_Records records;
// Flugente: background
UINT8 usBackground;
UINT16 usBackground;
}; // MERCPROFILESTRUCT;