From a71f8745ab7b92f4c564ca7cbfc20b15fbd93a6a Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 19 Oct 2013 20:45:05 +0000 Subject: [PATCH] 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 --- GameVersion.cpp | 18 ++++---- GameVersion.h | 3 +- Laptop/CharProfile.cpp | 2 +- Laptop/CharProfile.h | 2 +- Laptop/IMP Background.cpp | 72 ++++++++++++++------------------ Laptop/IMP Background.h | 4 +- Laptop/IMP Compile Character.cpp | 2 +- SaveLoadGame.cpp | 16 +++++-- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Profile.h | 2 +- Tactical/XML_Profiles.cpp | 2 +- Tactical/soldier profile type.h | 2 +- 12 files changed, 64 insertions(+), 63 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 61e9ecc3..cd5cf40f 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -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 diff --git a/GameVersion.h b/GameVersion.h index e6bf35ab..7775384c 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -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 diff --git a/Laptop/CharProfile.cpp b/Laptop/CharProfile.cpp index 96a50823..0f55e488 100644 --- a/Laptop/CharProfile.cpp +++ b/Laptop/CharProfile.cpp @@ -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; diff --git a/Laptop/CharProfile.h b/Laptop/CharProfile.h index e0434b21..990cf4ff 100644 --- a/Laptop/CharProfile.h +++ b/Laptop/CharProfile.h @@ -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; diff --git a/Laptop/IMP Background.cpp b/Laptop/IMP Background.cpp index c6019fa1..57c0d3c2 100644 --- a/Laptop/IMP Background.cpp +++ b/Laptop/IMP Background.cpp @@ -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 ) return 0; @@ -577,7 +569,7 @@ UINT8 GetDisplaySkill( UINT8 aNr ) void ResetDisplaySkills() { - for (UINT8 ubCnt = 0; ubCntuiFlags & 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; uiCntuiFlags & 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= 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); } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 1313fb55..ceb29eb9 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -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. diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 189d1ce0..49a59bfc 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -418,7 +418,7 @@ typedef struct INT8 bTownAttachment; // Flugente: backgrounds - UINT8 usBackground; + UINT16 usBackground; } TEMPPROFILETYPE; diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index 7c7c67b5..1cdb937f 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -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); } diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 0f4cf002..8fe5b49f 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -936,7 +936,7 @@ public: STRUCT_Records records; // Flugente: background - UINT8 usBackground; + UINT16 usBackground; }; // MERCPROFILESTRUCT;