From 16e08d1eb9a546b2ab5df1b8f0c055d28361b398 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sun, 16 Jul 2023 03:02:12 -0700 Subject: [PATCH 01/27] Add growth rates to TEMPPROFILETYPE --- Tactical/Soldier Profile.h | 11 +++++ Tactical/XML_Profiles.cpp | 82 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 9eef607994..cdca85cd8b 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -315,6 +315,17 @@ typedef struct INT8 bExpLevel; INT8 bEvolution; + UINT8 bGrowthRateLife; + UINT8 bGrowthRateStrength; + UINT8 bGrowthRateAgility; + UINT8 bGrowthRateDexterity; + UINT8 bGrowthRateWisdom; + UINT8 bGrowthRateMarksmanship; + UINT8 bGrowthRateExplosive; + UINT8 bGrowthRateLeadership; + UINT8 bGrowthRateMedical; + UINT8 bGrowthRateMechanical; + UINT8 bGrowthRateExpLevel; // changed by SANDRO INT8 bOldSkillTrait; INT8 bOldSkillTrait2; diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index ba3aafbb3e..7528eaf9fd 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -102,6 +102,18 @@ profileStartElementHandle(void *userData, const XML_Char *name, const XML_Char * strcmp(name, "bMechanical") == 0 || strcmp(name, "bExpLevel") == 0 || strcmp(name, "bEvolution") == 0 || + // rftr: growth rates are intended to replace the evolution tag, letting each stat have its own growth modifier + strcmp(name, "bGrowthRateLife") == 0 || + strcmp(name, "bGrowthRateStrength") == 0 || + strcmp(name, "bGrowthRateAgility") == 0 || + strcmp(name, "bGrowthRateDexterity") == 0 || + strcmp(name, "bGrowthRateWisdom") == 0 || + strcmp(name, "bGrowthRateMarksmanship") == 0 || + strcmp(name, "bGrowthRateExplosive") == 0 || + strcmp(name, "bGrowthRateLeadership") == 0 || + strcmp(name, "bGrowthRateMedical") == 0 || + strcmp(name, "bGrowthRateMechanical") == 0 || + strcmp(name, "bGrowthRateExpLevel") == 0 || // added by SANDRO strcmp(name, "bOldSkillTrait") == 0 || strcmp(name, "bOldSkillTrait2") == 0 || @@ -281,6 +293,17 @@ profileEndElementHandle(void *userData, const XML_Char *name) tempProfiles[pData->curIndex].bExpLevel = pData->curProfile.bExpLevel; tempProfiles[pData->curIndex].bEvolution = pData->curProfile.bEvolution; + tempProfiles[pData->curIndex].bGrowthRateLife = pData->curProfile.bGrowthRateLife; + tempProfiles[pData->curIndex].bGrowthRateStrength = pData->curProfile.bGrowthRateStrength; + tempProfiles[pData->curIndex].bGrowthRateAgility = pData->curProfile.bGrowthRateAgility; + tempProfiles[pData->curIndex].bGrowthRateDexterity = pData->curProfile.bGrowthRateDexterity; + tempProfiles[pData->curIndex].bGrowthRateWisdom = pData->curProfile.bGrowthRateWisdom; + tempProfiles[pData->curIndex].bGrowthRateMarksmanship = pData->curProfile.bGrowthRateMarksmanship; + tempProfiles[pData->curIndex].bGrowthRateExplosive = pData->curProfile.bGrowthRateExplosive; + tempProfiles[pData->curIndex].bGrowthRateLeadership = pData->curProfile.bGrowthRateLeadership; + tempProfiles[pData->curIndex].bGrowthRateMedical = pData->curProfile.bGrowthRateMedical; + tempProfiles[pData->curIndex].bGrowthRateMechanical = pData->curProfile.bGrowthRateMechanical; + tempProfiles[pData->curIndex].bGrowthRateExpLevel = pData->curProfile.bGrowthRateExpLevel; // added by SANDRO tempProfiles[pData->curIndex].bOldSkillTrait = pData->curProfile.bOldSkillTrait; tempProfiles[pData->curIndex].bOldSkillTrait2 = pData->curProfile.bOldSkillTrait2; @@ -592,6 +615,65 @@ profileEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curProfile.bEvolution = (UINT32) strtoul(pData->szCharData, NULL, 0); } + + else if (strncmp(name, "bGrowthRate", 11) == 0) // doing this to avoid C1061 + { + if (strcmp(name, "bGrowthRateLife") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateLife = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateStrength") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateStrength = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateAgility") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateAgility = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateDexterity") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateDexterity = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateWisdom") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateWisdom = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateMarksmanship") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateMarksmanship = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateExplosive") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateExplosive = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateLeadership") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateLeadership = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateMedical") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateMedical = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateMechanical") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateMechanical = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + else if(strcmp(name, "bGrowthRateExpLevel") == 0) + { + pData->curElement = ELEMENT; + pData->curProfile.bGrowthRateExpLevel = (UINT32)strtoul(pData->szCharData, NULL, 0); + } + } //////////////////////////////////////////////////////////////////////////// // SANDRO was here - messed this a bit else if(strcmp(name, "bOldSkillTrait") == 0) From 7f94f09df2af7b54c55cd3820b906330684333ab Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sun, 16 Jul 2023 23:15:16 -0700 Subject: [PATCH 02/27] Change growth rates from UINT8 to INT8 (to support devolving) --- Tactical/Soldier Profile.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index cdca85cd8b..387c75087b 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -315,17 +315,17 @@ typedef struct INT8 bExpLevel; INT8 bEvolution; - UINT8 bGrowthRateLife; - UINT8 bGrowthRateStrength; - UINT8 bGrowthRateAgility; - UINT8 bGrowthRateDexterity; - UINT8 bGrowthRateWisdom; - UINT8 bGrowthRateMarksmanship; - UINT8 bGrowthRateExplosive; - UINT8 bGrowthRateLeadership; - UINT8 bGrowthRateMedical; - UINT8 bGrowthRateMechanical; - UINT8 bGrowthRateExpLevel; + INT8 bGrowthRateLife; + INT8 bGrowthRateStrength; + INT8 bGrowthRateAgility; + INT8 bGrowthRateDexterity; + INT8 bGrowthRateWisdom; + INT8 bGrowthRateMarksmanship; + INT8 bGrowthRateExplosive; + INT8 bGrowthRateLeadership; + INT8 bGrowthRateMedical; + INT8 bGrowthRateMechanical; + INT8 bGrowthRateExpLevel; // changed by SANDRO INT8 bOldSkillTrait; INT8 bOldSkillTrait2; From e2ded08d6d715dd36a81ec0e0543b70e4c85e8a7 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sun, 16 Jul 2023 23:45:34 -0700 Subject: [PATCH 03/27] Add todo --- Tactical/Campaign.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 3da28dd61a..7e669df4ed 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1,3 +1,4 @@ +#pragma optimize("",off) #include "builddefines.h" #include #include @@ -305,14 +306,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100; } -/* - // if the stat is Marksmanship, and the guy is a hopeless shot - if ((ubStat == MARKAMT) && (pProfile->bSpecialTrait == HOPELESS_SHOT)) - { - usChance /= 5; // MUCH slower to improve, divide usChance by 5 - } -*/ - // SANDRO - penalty for primitive people, they get lesser chance to gain point for certain skills if ( gGameOptions.fNewTraitSystem && (usChance > 10) && (ubStat != EXPERAMT) && (pProfile->bCharacterTrait == CHAR_TRAIT_PRIMITIVE) ) { @@ -335,6 +328,8 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh usChance = max(1, usChance * 0.5); else if ( evolution == ONEQUARTER_EVOLUTION) usChance = max(1, usChance * 0.25); + + // rftr todo: we can further modify usChance here based on growth rate modifier // maximum possible usChance is 99% if (usChance > 99) From d63665e6eaaf02055c4b7c2a8c439340bb90f74e Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Mon, 17 Jul 2023 00:57:33 -0700 Subject: [PATCH 04/27] Add GROWTH_MODIFIERS savegame version Renamed "growth rate" to "growth modifier" --- GameVersion.h | 3 +- Tactical/Soldier Profile.h | 22 ++++---- Tactical/XML_Profiles.cpp | 90 ++++++++++++++++----------------- Tactical/soldier profile type.h | 2 + 4 files changed, 60 insertions(+), 57 deletions(-) diff --git a/GameVersion.h b/GameVersion.h index d322980c19..b516b22556 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -23,6 +23,7 @@ extern CHAR16 zBuildInformation[256]; // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file +#define GROWTH_MODIFIERS 184 #define REBELCOMMAND 183 #define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us #define DISABILITYFLAGMASK 181 // Flugente: disabilities get a flagmask @@ -104,7 +105,7 @@ extern CHAR16 zBuildInformation[256]; #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 REBELCOMMAND +#define SAVE_GAME_VERSION GROWTH_MODIFIERS //#define RUSSIANGOLD #ifdef __cplusplus diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 387c75087b..ab460c88c0 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -315,17 +315,17 @@ typedef struct INT8 bExpLevel; INT8 bEvolution; - INT8 bGrowthRateLife; - INT8 bGrowthRateStrength; - INT8 bGrowthRateAgility; - INT8 bGrowthRateDexterity; - INT8 bGrowthRateWisdom; - INT8 bGrowthRateMarksmanship; - INT8 bGrowthRateExplosive; - INT8 bGrowthRateLeadership; - INT8 bGrowthRateMedical; - INT8 bGrowthRateMechanical; - INT8 bGrowthRateExpLevel; + INT8 bGrowthModifierLife; + INT8 bGrowthModifierStrength; + INT8 bGrowthModifierAgility; + INT8 bGrowthModifierDexterity; + INT8 bGrowthModifierWisdom; + INT8 bGrowthModifierMarksmanship; + INT8 bGrowthModifierExplosive; + INT8 bGrowthModifierLeadership; + INT8 bGrowthModifierMedical; + INT8 bGrowthModifierMechanical; + INT8 bGrowthModifierExpLevel; // changed by SANDRO INT8 bOldSkillTrait; INT8 bOldSkillTrait2; diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index 7528eaf9fd..2d29511543 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -103,17 +103,17 @@ profileStartElementHandle(void *userData, const XML_Char *name, const XML_Char * strcmp(name, "bExpLevel") == 0 || strcmp(name, "bEvolution") == 0 || // rftr: growth rates are intended to replace the evolution tag, letting each stat have its own growth modifier - strcmp(name, "bGrowthRateLife") == 0 || - strcmp(name, "bGrowthRateStrength") == 0 || - strcmp(name, "bGrowthRateAgility") == 0 || - strcmp(name, "bGrowthRateDexterity") == 0 || - strcmp(name, "bGrowthRateWisdom") == 0 || - strcmp(name, "bGrowthRateMarksmanship") == 0 || - strcmp(name, "bGrowthRateExplosive") == 0 || - strcmp(name, "bGrowthRateLeadership") == 0 || - strcmp(name, "bGrowthRateMedical") == 0 || - strcmp(name, "bGrowthRateMechanical") == 0 || - strcmp(name, "bGrowthRateExpLevel") == 0 || + strcmp(name, "bGrowthModifierLife") == 0 || + strcmp(name, "bGrowthModifierStrength") == 0 || + strcmp(name, "bGrowthModifierAgility") == 0 || + strcmp(name, "bGrowthModifierDexterity") == 0 || + strcmp(name, "bGrowthModifierWisdom") == 0 || + strcmp(name, "bGrowthModifierMarksmanship") == 0 || + strcmp(name, "bGrowthModifierExplosive") == 0 || + strcmp(name, "bGrowthModifierLeadership") == 0 || + strcmp(name, "bGrowthModifierMedical") == 0 || + strcmp(name, "bGrowthModifierMechanical") == 0 || + strcmp(name, "bGrowthModifierExpLevel") == 0 || // added by SANDRO strcmp(name, "bOldSkillTrait") == 0 || strcmp(name, "bOldSkillTrait2") == 0 || @@ -293,17 +293,17 @@ profileEndElementHandle(void *userData, const XML_Char *name) tempProfiles[pData->curIndex].bExpLevel = pData->curProfile.bExpLevel; tempProfiles[pData->curIndex].bEvolution = pData->curProfile.bEvolution; - tempProfiles[pData->curIndex].bGrowthRateLife = pData->curProfile.bGrowthRateLife; - tempProfiles[pData->curIndex].bGrowthRateStrength = pData->curProfile.bGrowthRateStrength; - tempProfiles[pData->curIndex].bGrowthRateAgility = pData->curProfile.bGrowthRateAgility; - tempProfiles[pData->curIndex].bGrowthRateDexterity = pData->curProfile.bGrowthRateDexterity; - tempProfiles[pData->curIndex].bGrowthRateWisdom = pData->curProfile.bGrowthRateWisdom; - tempProfiles[pData->curIndex].bGrowthRateMarksmanship = pData->curProfile.bGrowthRateMarksmanship; - tempProfiles[pData->curIndex].bGrowthRateExplosive = pData->curProfile.bGrowthRateExplosive; - tempProfiles[pData->curIndex].bGrowthRateLeadership = pData->curProfile.bGrowthRateLeadership; - tempProfiles[pData->curIndex].bGrowthRateMedical = pData->curProfile.bGrowthRateMedical; - tempProfiles[pData->curIndex].bGrowthRateMechanical = pData->curProfile.bGrowthRateMechanical; - tempProfiles[pData->curIndex].bGrowthRateExpLevel = pData->curProfile.bGrowthRateExpLevel; + tempProfiles[pData->curIndex].bGrowthModifierLife = pData->curProfile.bGrowthModifierLife; + tempProfiles[pData->curIndex].bGrowthModifierStrength = pData->curProfile.bGrowthModifierStrength; + tempProfiles[pData->curIndex].bGrowthModifierAgility = pData->curProfile.bGrowthModifierAgility; + tempProfiles[pData->curIndex].bGrowthModifierDexterity = pData->curProfile.bGrowthModifierDexterity; + tempProfiles[pData->curIndex].bGrowthModifierWisdom = pData->curProfile.bGrowthModifierWisdom; + tempProfiles[pData->curIndex].bGrowthModifierMarksmanship = pData->curProfile.bGrowthModifierMarksmanship; + tempProfiles[pData->curIndex].bGrowthModifierExplosive = pData->curProfile.bGrowthModifierExplosive; + tempProfiles[pData->curIndex].bGrowthModifierLeadership = pData->curProfile.bGrowthModifierLeadership; + tempProfiles[pData->curIndex].bGrowthModifierMedical = pData->curProfile.bGrowthModifierMedical; + tempProfiles[pData->curIndex].bGrowthModifierMechanical = pData->curProfile.bGrowthModifierMechanical; + tempProfiles[pData->curIndex].bGrowthModifierExpLevel = pData->curProfile.bGrowthModifierExpLevel; // added by SANDRO tempProfiles[pData->curIndex].bOldSkillTrait = pData->curProfile.bOldSkillTrait; tempProfiles[pData->curIndex].bOldSkillTrait2 = pData->curProfile.bOldSkillTrait2; @@ -616,62 +616,62 @@ profileEndElementHandle(void *userData, const XML_Char *name) pData->curProfile.bEvolution = (UINT32) strtoul(pData->szCharData, NULL, 0); } - else if (strncmp(name, "bGrowthRate", 11) == 0) // doing this to avoid C1061 + else if (strncmp(name, "bGrowthModifier", 11) == 0) // doing this to avoid C1061 { - if (strcmp(name, "bGrowthRateLife") == 0) + if (strcmp(name, "bGrowthModifierLife") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateLife = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierLife = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateStrength") == 0) + else if(strcmp(name, "bGrowthModifierStrength") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateStrength = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierStrength = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateAgility") == 0) + else if(strcmp(name, "bGrowthModifierAgility") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateAgility = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierAgility = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateDexterity") == 0) + else if(strcmp(name, "bGrowthModifierDexterity") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateDexterity = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierDexterity = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateWisdom") == 0) + else if(strcmp(name, "bGrowthModifierWisdom") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateWisdom = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierWisdom = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateMarksmanship") == 0) + else if(strcmp(name, "bGrowthModifierMarksmanship") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateMarksmanship = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierMarksmanship = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateExplosive") == 0) + else if(strcmp(name, "bGrowthModifierExplosive") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateExplosive = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierExplosive = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateLeadership") == 0) + else if(strcmp(name, "bGrowthModifierLeadership") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateLeadership = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierLeadership = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateMedical") == 0) + else if(strcmp(name, "bGrowthModifierMedical") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateMedical = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierMedical = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateMechanical") == 0) + else if(strcmp(name, "bGrowthModifierMechanical") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateMechanical = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierMechanical = (UINT32)strtoul(pData->szCharData, NULL, 0); } - else if(strcmp(name, "bGrowthRateExpLevel") == 0) + else if(strcmp(name, "bGrowthModifierExpLevel") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bGrowthRateExpLevel = (UINT32)strtoul(pData->szCharData, NULL, 0); + pData->curProfile.bGrowthModifierExpLevel = (UINT32)strtoul(pData->szCharData, NULL, 0); } } //////////////////////////////////////////////////////////////////////////// diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index a85653eaed..071adcdf16 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -1009,6 +1009,8 @@ class MERCPROFILESTRUCT { // Flugente: type of profile UINT32 Type; + + // rftr: growth modifiers }; // MERCPROFILESTRUCT; // WANNE - BMP: DONE! From d1aa9386f21dbf3d67f3cd8741ab2abf4d292fa3 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Mon, 17 Jul 2023 01:08:17 -0700 Subject: [PATCH 05/27] Update save/load with growth rates --- SaveLoadGame.cpp | 95 +++++++++++++++++++++++++++++++++ Tactical/soldier profile type.h | 11 ++++ 2 files changed, 106 insertions(+) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 5c245e8465..a94c7918a3 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -1637,6 +1637,55 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for return( FALSE ); } } + + // rftr: growth modifiers + if (guiCurrentSaveGameVersion >= GROWTH_MODIFIERS) + { + if (!FileRead(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesRead)) + { + return(FALSE); + } + if ( !FileRead( hFile, &this->bGrowthModifierStrength, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierAgility, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierDexterity, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierWisdom, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierMarksmanship, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierExplosive, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierLeadership, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierMedical, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierMechanical, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + if ( !FileRead( hFile, &this->bGrowthModifierExpLevel, sizeof(INT8), &uiNumBytesRead) ) + { + return( FALSE ); + } + } } if ( this->uiProfileChecksum != this->GetChecksum() ) @@ -1753,6 +1802,52 @@ BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile) { return( FALSE ); } + + // rftr: growth modifiers + if (!FileWrite(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesWritten)) + { + return(FALSE); + } + if ( !FileWrite( hFile, &this->bGrowthModifierStrength, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierAgility, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierDexterity, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierWisdom, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierMarksmanship, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierExplosive, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierLeadership, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierMedical, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierMechanical, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } + if ( !FileWrite( hFile, &this->bGrowthModifierExpLevel, sizeof(INT8), &uiNumBytesWritten) ) + { + return( FALSE ); + } return TRUE; } diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 071adcdf16..ebd1b4a5db 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -1011,6 +1011,17 @@ class MERCPROFILESTRUCT { UINT32 Type; // rftr: growth modifiers + INT8 bGrowthModifierLife; + INT8 bGrowthModifierStrength; + INT8 bGrowthModifierAgility; + INT8 bGrowthModifierDexterity; + INT8 bGrowthModifierWisdom; + INT8 bGrowthModifierMarksmanship; + INT8 bGrowthModifierExplosive; + INT8 bGrowthModifierLeadership; + INT8 bGrowthModifierMedical; + INT8 bGrowthModifierMechanical; + INT8 bGrowthModifierExpLevel; }; // MERCPROFILESTRUCT; // WANNE - BMP: DONE! From e0da202a275ab4d141a56b924993950531f8c04a Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 01:07:22 -0700 Subject: [PATCH 06/27] Changed modifiers from INT8 to INT16 Removed CharacterEvolution enum --- Tactical/Campaign.cpp | 40 +++++++++++++++------------------ Tactical/Soldier Profile.h | 22 +++++++++--------- Tactical/soldier profile type.h | 35 ++++++++++------------------- 3 files changed, 41 insertions(+), 56 deletions(-) diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 7e669df4ed..f62d87caeb 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -168,20 +168,10 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh INT8 bCurrentRating; UINT16 *psStatGainPtr; BOOLEAN fAffectedByWisdom = TRUE; - INT8 evolution = NORMAL_EVOLUTION; + INT16 growthModifier = 1; Assert(pProfile != NULL); - if ( !gGameExternalOptions.bDisableEvolution ) - evolution = pProfile->bEvolution; - - if ( evolution == NO_EVOLUTION ) - return; // No change possible, quit right away - - // if this is a Reverse-Evolving merc who attempting to train - if ( ( ubReason == FROM_TRAINING ) && ( evolution == DEVOLVE ) ) - return; // he doesn't get any benefit, but isn't penalized either - if (usNumChances == 0) return; @@ -191,6 +181,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh switch (ubStat) { case HEALTHAMT: + growthModifier = pProfile->bGrowthModifierLife; bCurrentRating = pProfile->bLifeMax; psStatGainPtr = (UINT16 *)&(pProfile->sLifeGain); // NB physical stat checks not affected by wisdom, unless training is going on @@ -198,54 +189,64 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh break; case AGILAMT: + growthModifier = pProfile->bGrowthModifierAgility; bCurrentRating = pProfile->bAgility; psStatGainPtr = (UINT16 *)&(pProfile->sAgilityGain); fAffectedByWisdom = FALSE; break; case DEXTAMT: + growthModifier = pProfile->bGrowthModifierDexterity; bCurrentRating = pProfile->bDexterity; psStatGainPtr = (UINT16 *)&(pProfile->sDexterityGain); fAffectedByWisdom = FALSE; break; case WISDOMAMT: + growthModifier = pProfile->bGrowthModifierWisdom; bCurrentRating = pProfile->bWisdom; psStatGainPtr = (UINT16 *)&(pProfile->sWisdomGain); break; case MEDICALAMT: + growthModifier = pProfile->bGrowthModifierMedical; bCurrentRating = pProfile->bMedical; psStatGainPtr = (UINT16 *)&(pProfile->sMedicalGain); break; case EXPLODEAMT: + growthModifier = pProfile->bGrowthModifierExplosive; bCurrentRating = pProfile->bExplosive; psStatGainPtr = (UINT16 *)&(pProfile->sExplosivesGain); break; case MECHANAMT: + growthModifier = pProfile->bGrowthModifierMechanical; bCurrentRating = pProfile->bMechanical; psStatGainPtr = (UINT16 *)&(pProfile->sMechanicGain); break; case MARKAMT: + growthModifier = pProfile->bGrowthModifierMarksmanship; bCurrentRating = pProfile->bMarksmanship; psStatGainPtr = (UINT16 *)&(pProfile->sMarksmanshipGain); break; case EXPERAMT: + growthModifier = pProfile->bGrowthModifierExpLevel; bCurrentRating = pProfile->bExpLevel; psStatGainPtr = (UINT16 *)&(pProfile->sExpLevelGain); break; case STRAMT: + growthModifier = pProfile->bGrowthModifierStrength; bCurrentRating = pProfile->bStrength; psStatGainPtr = (UINT16 *)&(pProfile->sStrengthGain); fAffectedByWisdom = FALSE; break; case LDRAMT: + growthModifier = pProfile->bGrowthModifierLeadership; bCurrentRating = pProfile->bLeadership; psStatGainPtr = (UINT16 *)&(pProfile->sLeadershipGain); break; @@ -256,6 +257,9 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh return; } + // no stat growth + if (growthModifier == 0) + return; if (ubReason == FROM_TRAINING) { @@ -272,7 +276,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh // loop once for each chance to improve for (uiCnt = 0; uiCnt < usNumChances; ++uiCnt) { - if ( evolution != DEVOLVE) // Evolves! + if (growthModifier > 0) // Evolves! { // if this is improving from a failure, and a successful roll would give us enough to go up a point if ((ubReason == FROM_FAILURE) && ((*psStatGainPtr + 1) >= usSubpointsPerPoint)) @@ -306,6 +310,8 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100; } + // rftr todo: we can further modify usChance here based on growth rate modifier + // SANDRO - penalty for primitive people, they get lesser chance to gain point for certain skills if ( gGameOptions.fNewTraitSystem && (usChance > 10) && (ubStat != EXPERAMT) && (pProfile->bCharacterTrait == CHAR_TRAIT_PRIMITIVE) ) { @@ -321,16 +327,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh } } - // Buggler: more evolution rate choices - if ( evolution == THREEQUARTER_EVOLUTION) - usChance = max(1, usChance * 0.75); - else if ( evolution == HALF_EVOLUTION) - usChance = max(1, usChance * 0.5); - else if ( evolution == ONEQUARTER_EVOLUTION) - usChance = max(1, usChance * 0.25); - - // rftr todo: we can further modify usChance here based on growth rate modifier - // maximum possible usChance is 99% if (usChance > 99) { diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index ab460c88c0..b2c8e0a49b 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -315,17 +315,17 @@ typedef struct INT8 bExpLevel; INT8 bEvolution; - INT8 bGrowthModifierLife; - INT8 bGrowthModifierStrength; - INT8 bGrowthModifierAgility; - INT8 bGrowthModifierDexterity; - INT8 bGrowthModifierWisdom; - INT8 bGrowthModifierMarksmanship; - INT8 bGrowthModifierExplosive; - INT8 bGrowthModifierLeadership; - INT8 bGrowthModifierMedical; - INT8 bGrowthModifierMechanical; - INT8 bGrowthModifierExpLevel; + INT16 bGrowthModifierLife; + INT16 bGrowthModifierStrength; + INT16 bGrowthModifierAgility; + INT16 bGrowthModifierDexterity; + INT16 bGrowthModifierWisdom; + INT16 bGrowthModifierMarksmanship; + INT16 bGrowthModifierExplosive; + INT16 bGrowthModifierLeadership; + INT16 bGrowthModifierMedical; + INT16 bGrowthModifierMechanical; + INT16 bGrowthModifierExpLevel; // changed by SANDRO INT8 bOldSkillTrait; INT8 bOldSkillTrait2; diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index ebd1b4a5db..bf212ad4a5 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -402,18 +402,7 @@ typedef enum NUM_SEXIST } SexistLevels; - - -// training defines for evolution, no stat increase, stat decrease( de-evolve ) -typedef enum -{ - NORMAL_EVOLUTION =0, - NO_EVOLUTION, - DEVOLVE, - THREEQUARTER_EVOLUTION, - HALF_EVOLUTION, - ONEQUARTER_EVOLUTION, -} CharacterEvolution; +// rftr: removed the CharacterEvolution enum as it was replaced by growth modifiers #define BUDDY_MERC( prof, bud ) ((prof)->bBuddy[0] == (bud) || (prof)->bBuddy[1] == (bud) || (prof)->bBuddy[2] == (bud) || (prof)->bBuddy[3] == (bud) || (prof)->bBuddy[4] == (bud) || ( (prof)->bLearnToLike == (bud) && (prof)->bLearnToLikeCount == 0 ) ) #define HATED_MERC( prof, hat ) ((prof)->bHated[0] == (hat) || (prof)->bHated[1] == (hat) || (prof)->bHated[2] == (hat) || (prof)->bHated[3] == (hat) || (prof)->bHated[4] == (hat) || ( (prof)->bLearnToHate == (hat) && (prof)->bLearnToHateCount == 0 ) ) @@ -1011,17 +1000,17 @@ class MERCPROFILESTRUCT { UINT32 Type; // rftr: growth modifiers - INT8 bGrowthModifierLife; - INT8 bGrowthModifierStrength; - INT8 bGrowthModifierAgility; - INT8 bGrowthModifierDexterity; - INT8 bGrowthModifierWisdom; - INT8 bGrowthModifierMarksmanship; - INT8 bGrowthModifierExplosive; - INT8 bGrowthModifierLeadership; - INT8 bGrowthModifierMedical; - INT8 bGrowthModifierMechanical; - INT8 bGrowthModifierExpLevel; + INT16 bGrowthModifierLife; + INT16 bGrowthModifierStrength; + INT16 bGrowthModifierAgility; + INT16 bGrowthModifierDexterity; + INT16 bGrowthModifierWisdom; + INT16 bGrowthModifierMarksmanship; + INT16 bGrowthModifierExplosive; + INT16 bGrowthModifierLeadership; + INT16 bGrowthModifierMedical; + INT16 bGrowthModifierMechanical; + INT16 bGrowthModifierExpLevel; }; // MERCPROFILESTRUCT; // WANNE - BMP: DONE! From c267b616eda760e74d0b510cc3ac38aa49a2d674 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 17:38:46 -0700 Subject: [PATCH 07/27] Apply growth modifier --- Tactical/Campaign.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index f62d87caeb..84f89551bb 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -310,7 +310,11 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100; } - // rftr todo: we can further modify usChance here based on growth rate modifier + // we can further modify usChance here based on growth rate modifier + if (usChance > 0) + { + usChance *= (growthModifier / 100.f); + } // SANDRO - penalty for primitive people, they get lesser chance to gain point for certain skills if ( gGameOptions.fNewTraitSystem && (usChance > 10) && (ubStat != EXPERAMT) && (pProfile->bCharacterTrait == CHAR_TRAIT_PRIMITIVE) ) From ea65bfb78f5e484ef1773bb9b478e63ca5c0582d Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 17:39:41 -0700 Subject: [PATCH 08/27] Randomise growth modifiers --- Tactical/Soldier Profile.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index c307da6ded..4f89477d42 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -98,6 +98,7 @@ extern UINT8 gubItemDroppableFlag[NUM_INV_SLOTS]; //Random Stats RANDOM_STATS_VALUES gRandomStatsValue[NUM_PROFILES]; void RandomStats(); +void RandomGrowthModifiers(); void RandomStartSalary(); //Jenilee @@ -459,6 +460,33 @@ void RandomStats() ExitRandomMercs(); } } +void RandomGrowthModifiers() +{ + UINT32 cnt; + MERCPROFILESTRUCT * pProfile; + BOOLEAN useBellCurve = TRUE; + + // if (gGameExternalptions.fMercRandomGrowthModifiers == TRUE) // rftr todo - add settings + { + for (cnt = 0; cnt < NUM_PROFILES; cnt++) + { + pProfile = &(gMercProfiles[cnt]); + + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 500, 50, useBellCurve ); + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 500, 50, useBellCurve ); + } + } +} + void RandomStartSalary() { UINT32 cnt; @@ -996,6 +1024,8 @@ for( int i = 0; i < NUM_PROFILES; i++ ) // --------------- RandomStats (); //random stats by Jazz + + RandomGrowthModifiers(); // Buggler: random starting salary RandomStartSalary (); From ff6e342bf5ef79aa3b7010b86404604c4bfc242e Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 17:46:47 -0700 Subject: [PATCH 09/27] Don't modify zeroed growth modifiers --- Tactical/Soldier Profile.cpp | 43 +++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 4f89477d42..987a63ca49 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -472,17 +472,38 @@ void RandomGrowthModifiers() { pProfile = &(gMercProfiles[cnt]); - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 500, 50, useBellCurve ); - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 500, 50, useBellCurve ); + if (pProfile->bGrowthModifierExpLevel != 0) + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierLife != 0) + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierAgility != 0) + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierDexterity != 0) + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierStrength != 0) + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierLeadership != 0) + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierWisdom != 0) + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierMarksmanship != 0) + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierMechanical != 0) + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierExplosive != 0) + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 500, 50, useBellCurve ); + + if (pProfile->bGrowthModifierMedical != 0) + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 500, 50, useBellCurve ); } } } From 32777afee77fca819b594c9edc28f0aa7c453c3f Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 18:00:09 -0700 Subject: [PATCH 10/27] Update growth modifier randomisation --- Tactical/Soldier Profile.cpp | 86 ++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 987a63ca49..ce3f0304a2 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -472,38 +472,60 @@ void RandomGrowthModifiers() { pProfile = &(gMercProfiles[cnt]); - if (pProfile->bGrowthModifierExpLevel != 0) - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierLife != 0) - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierAgility != 0) - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierDexterity != 0) - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierStrength != 0) - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierLeadership != 0) - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierWisdom != 0) - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierMarksmanship != 0) - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierMechanical != 0) - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierExplosive != 0) - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 500, 50, useBellCurve ); - - if (pProfile->bGrowthModifierMedical != 0) - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 500, 50, useBellCurve ); + if (pProfile->bGrowthModifierExpLevel > 0) + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierExpLevel < 0) + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierLife > 0) + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierLife < 0) + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierAgility > 0) + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierAgility < 0) + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierDexterity > 0) + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierDexterity < 0) + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierStrength > 0) + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierStrength < 0) + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierLeadership > 0) + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierLeadership < 0) + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierWisdom > 0) + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierWisdom < 0) + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierMarksmanship > 0) + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierMarksmanship < 0) + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierMechanical > 0) + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierMechanical < 0) + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierExplosive > 0) + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierExplosive < 0) + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 0, 50, useBellCurve ); + + if (pProfile->bGrowthModifierMedical > 0) + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, 0, 500, 50, useBellCurve ); + else if (pProfile->bGrowthModifierMedical < 0) + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 0, 50, useBellCurve ); } } } From 275271a2a507135e0fda35891519f7f783f1d573 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 22:20:23 -0700 Subject: [PATCH 11/27] Add todos (text) --- Laptop/personnel.cpp | 1 + Utils/_EnglishText.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index beb0e87335..85aa9d5a5d 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2233,6 +2233,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) ++region; } + // rftr todo: replace this with growth modifier text if ( !gGameExternalOptions.bDisableEvolution ) { CHAR16 sStr2[200]; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 5f4b9f5e73..a4e86f1c04 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -11638,6 +11638,7 @@ STR16 szInteractiveActionText[] = L"This machine doesn't seem to be working.", }; +// rftr todo: add growth modifier text STR16 szLaptopStatText[] = { L"threaten effectiveness %d\n", From 58e2bf4ece6cf8ed673ccb83dd9f13a09bbc9fc1 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 19 Jul 2023 23:17:37 -0700 Subject: [PATCH 12/27] Add ini settings --- GameSettings.cpp | 2 ++ GameSettings.h | 3 +++ Tactical/Soldier Profile.cpp | 46 ++++++++++++++++++------------------ 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 4ba69e16f6..b206d34012 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1079,6 +1079,8 @@ void LoadGameExternalOptions() gGameExternalOptions.ubMercRandomExpRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_EXP_RANGE", 1, 0, 4); gGameExternalOptions.fMercRandomStartSalary = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_START_SALARY", FALSE); gGameExternalOptions.ubMercRandomStartSalaryPercentMod = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_START_SALARY_PERCENTAGE_MAX_MODIFIER", 30, 0, 100); + gGameExternalOptions.fMercRandomGrowthModifiers = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS", FALSE); + gGameExternalOptions.iMercRandomGrowthModifiersRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS_RANGE", 100, 0, 500); //################# Financial Settings ################# diff --git a/GameSettings.h b/GameSettings.h index 8ca4097e31..d26f16e1d8 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -1436,6 +1436,9 @@ typedef struct UINT8 ubMercRandomStartSalaryPercentMod; + BOOLEAN fMercRandomGrowthModifiers; + INT16 iMercRandomGrowthModifiersRange; + BOOLEAN fBobbyRayFastShipments; BOOLEAN fGridExitInTurnBased; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index ce3f0304a2..0a2e590a2a 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -466,66 +466,66 @@ void RandomGrowthModifiers() MERCPROFILESTRUCT * pProfile; BOOLEAN useBellCurve = TRUE; - // if (gGameExternalptions.fMercRandomGrowthModifiers == TRUE) // rftr todo - add settings + if (gGameExternalOptions.fMercRandomGrowthModifiers == TRUE) // rftr todo - add settings { for (cnt = 0; cnt < NUM_PROFILES; cnt++) { pProfile = &(gMercProfiles[cnt]); if (pProfile->bGrowthModifierExpLevel > 0) - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierExpLevel < 0) - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierLife > 0) - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierLife < 0) - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierAgility > 0) - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierAgility < 0) - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierDexterity > 0) - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierDexterity < 0) - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierStrength > 0) - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierStrength < 0) - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierLeadership > 0) - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierLeadership < 0) - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierWisdom > 0) - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierWisdom < 0) - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierMarksmanship > 0) - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierMarksmanship < 0) - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierMechanical > 0) - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierMechanical < 0) - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierExplosive > 0) - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierExplosive < 0) - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); if (pProfile->bGrowthModifierMedical > 0) - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, 0, 500, 50, useBellCurve ); + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); else if (pProfile->bGrowthModifierMedical < 0) - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 0, 50, useBellCurve ); + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); } } } From 5f1d7a4b51b6b19858e06b6470845cf88813dfd4 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 22 Jul 2023 01:56:04 -0700 Subject: [PATCH 13/27] Change growth modifier back to INT8 The intention now is that it modifies each merc's stat subpoint target rather than the chance to get a stat subpoint Chance SubpointsPerPoint to take a MERCPROFILESTRUCT rather than a merc's level and returns the modified subpoints for the specified profile Revert evolution check for stat growth, but will need to figure out how to handle stat regressions now --- Strategic/mapscreen.cpp | 20 ++++++------- Tactical/Campaign.cpp | 51 +++++++++++++-------------------- Tactical/Campaign.h | 4 +-- Tactical/Interface Panels.cpp | 20 ++++++------- Tactical/soldier profile type.h | 22 +++++++------- 5 files changed, 53 insertions(+), 64 deletions(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 11c3956341..4d387161c1 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -3372,7 +3372,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.AGL.iX; const auto y = UI_CHARPANEL.Attr.AGL.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3387,7 +3387,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.DEX.iX; const auto y = UI_CHARPANEL.Attr.DEX.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3402,7 +3402,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.STR.iX; const auto y = UI_CHARPANEL.Attr.STR.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3417,7 +3417,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.WIS.iX; const auto y = UI_CHARPANEL.Attr.WIS.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3432,7 +3432,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.MRK.iX; const auto y = UI_CHARPANEL.Attr.MRK.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3447,7 +3447,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.LDR.iX; const auto y = UI_CHARPANEL.Attr.LDR.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3462,7 +3462,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.MEC.iX; const auto y = UI_CHARPANEL.Attr.MEC.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3477,7 +3477,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.EXP.iX; const auto y = UI_CHARPANEL.Attr.EXP.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3492,7 +3492,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.MED.iX; const auto y = UI_CHARPANEL.Attr.MED.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT,0); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; @@ -3507,7 +3507,7 @@ void DisplayCharacterInfo( void ) const auto x = UI_CHARPANEL.Attr.LVL.iX; const auto y = UI_CHARPANEL.Attr.LVL.iY; - ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, pSoldier->stats.bExpLevel); + ubBarWidth = (STAT_WIDTH * (gMercProfiles[ pSoldier->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, &gMercProfiles[pSoldier->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, STAT_WIDTH)); ClipRect.iTop = (y-1); ClipRect.iBottom = (y-1) + STAT_HEIGHT; diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index ebc6e4eb47..82995adc6a 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -168,20 +168,18 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh INT8 bCurrentRating; UINT16 *psStatGainPtr; BOOLEAN fAffectedByWisdom = TRUE; - INT16 growthModifier = 1; Assert(pProfile != NULL); if (usNumChances == 0) return; - usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile->bExpLevel); - usSubpointsPerLevel = SubpointsPerPoint(EXPERAMT, pProfile->bExpLevel); + usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile); + usSubpointsPerLevel = SubpointsPerPoint(EXPERAMT, pProfile); switch (ubStat) { case HEALTHAMT: - growthModifier = pProfile->bGrowthModifierLife; bCurrentRating = pProfile->bLifeMax; psStatGainPtr = (UINT16 *)&(pProfile->sLifeGain); // NB physical stat checks not affected by wisdom, unless training is going on @@ -189,64 +187,54 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh break; case AGILAMT: - growthModifier = pProfile->bGrowthModifierAgility; bCurrentRating = pProfile->bAgility; psStatGainPtr = (UINT16 *)&(pProfile->sAgilityGain); fAffectedByWisdom = FALSE; break; case DEXTAMT: - growthModifier = pProfile->bGrowthModifierDexterity; bCurrentRating = pProfile->bDexterity; psStatGainPtr = (UINT16 *)&(pProfile->sDexterityGain); fAffectedByWisdom = FALSE; break; case WISDOMAMT: - growthModifier = pProfile->bGrowthModifierWisdom; bCurrentRating = pProfile->bWisdom; psStatGainPtr = (UINT16 *)&(pProfile->sWisdomGain); break; case MEDICALAMT: - growthModifier = pProfile->bGrowthModifierMedical; bCurrentRating = pProfile->bMedical; psStatGainPtr = (UINT16 *)&(pProfile->sMedicalGain); break; case EXPLODEAMT: - growthModifier = pProfile->bGrowthModifierExplosive; bCurrentRating = pProfile->bExplosive; psStatGainPtr = (UINT16 *)&(pProfile->sExplosivesGain); break; case MECHANAMT: - growthModifier = pProfile->bGrowthModifierMechanical; bCurrentRating = pProfile->bMechanical; psStatGainPtr = (UINT16 *)&(pProfile->sMechanicGain); break; case MARKAMT: - growthModifier = pProfile->bGrowthModifierMarksmanship; bCurrentRating = pProfile->bMarksmanship; psStatGainPtr = (UINT16 *)&(pProfile->sMarksmanshipGain); break; case EXPERAMT: - growthModifier = pProfile->bGrowthModifierExpLevel; bCurrentRating = pProfile->bExpLevel; psStatGainPtr = (UINT16 *)&(pProfile->sExpLevelGain); break; case STRAMT: - growthModifier = pProfile->bGrowthModifierStrength; bCurrentRating = pProfile->bStrength; psStatGainPtr = (UINT16 *)&(pProfile->sStrengthGain); fAffectedByWisdom = FALSE; break; case LDRAMT: - growthModifier = pProfile->bGrowthModifierLeadership; bCurrentRating = pProfile->bLeadership; psStatGainPtr = (UINT16 *)&(pProfile->sLeadershipGain); break; @@ -257,10 +245,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh return; } - // no stat growth - if (growthModifier == 0) - return; - if (ubReason == FROM_TRAINING) { // training always affected by wisdom @@ -276,7 +260,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh // loop once for each chance to improve for (uiCnt = 0; uiCnt < usNumChances; ++uiCnt) { - if (growthModifier > 0) // Evolves! + if (pProfile->bEvolution != 2) // Evolves! { // if this is improving from a failure, and a successful roll would give us enough to go up a point if ((ubReason == FROM_FAILURE) && ((*psStatGainPtr + 1) >= usSubpointsPerPoint)) @@ -307,7 +291,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh // if there IS a usChance, adjust it for high or low wisdom (50 is avg) if (usChance > 0 && fAffectedByWisdom) { - usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100; + usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile)) - 50)) / 100; } // rftr: reduced growth rates at 80+ and 90+ (to make mercs with higher base stats more valuable) @@ -320,12 +304,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh usChance = min(gGameExternalOptions.ubMaxGrowthChanceAt80, usChance); } - // we can further modify usChance here based on growth rate modifier - if (usChance > 0) - { - usChance *= (growthModifier / 100.f); - } - // SANDRO - penalty for primitive people, they get lesser chance to gain point for certain skills if ( gGameOptions.fNewTraitSystem && (usChance > 10) && (ubStat != EXPERAMT) && (pProfile->bCharacterTrait == CHAR_TRAIT_PRIMITIVE) ) { @@ -408,7 +386,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh // if there IS a usChance, adjust it for high or low wisdom (50 is avg) if (usChance > 0 && fAffectedByWisdom) { - usChance -= (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100; + usChance -= (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile)) - 50)) / 100; } // if there's ANY usChance, minimum usChance is 1% regardless of wisdom @@ -492,7 +470,7 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta UINT16 usSubpointsPerPoint; INT8 bDamagedStatToRaise = -1; // added by SANDRO - usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile->bExpLevel ); + usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile ); // build ptrs to appropriate profiletype stat fields switch( ubStat ) @@ -918,7 +896,7 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UIN // set default min & max, subpoints/pt. bMinStatValue = 1; bMaxStatValue = MAX_STAT_VALUE; - usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile->bExpLevel); + usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile); // build ptrs to appropriate profiletype stat fields switch( ubStat ) @@ -1161,7 +1139,7 @@ UINT32 RoundOffSalary(UINT32 uiSalary) } -UINT16 SubpointsPerPoint(UINT8 ubStat, INT8 bExpLevel) +UINT16 SubpointsPerPoint(UINT8 ubStat, MERCPROFILESTRUCT* pProfile) { UINT16 usSubpointsPerPoint; @@ -1182,40 +1160,51 @@ UINT16 SubpointsPerPoint(UINT8 ubStat, INT8 bExpLevel) // Attributes case HEALTHAMT: usSubpointsPerPoint = HEALTH_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierLife; break; case AGILAMT: usSubpointsPerPoint = AGILITY_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierAgility; break; case DEXTAMT: usSubpointsPerPoint = DEXTERITY_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierDexterity; break; case WISDOMAMT: usSubpointsPerPoint = WISDOM_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierWisdom; break; case STRAMT: usSubpointsPerPoint = STRENGTH_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierStrength; break; // Skills case MEDICALAMT: usSubpointsPerPoint = MEDICAL_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierMedical; break; case EXPLODEAMT: usSubpointsPerPoint = EXPLOSIVES_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierExplosive; break; case MECHANAMT: usSubpointsPerPoint = MECHANICAL_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierMechanical; break; case MARKAMT: usSubpointsPerPoint = MARKSMANSHIP_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierMarksmanship; break; case LDRAMT: usSubpointsPerPoint = LEADERSHIP_SUBPOINTS_TO_IMPROVE; + usSubpointsPerPoint += pProfile->bGrowthModifierLeadership; break; // Experience case EXPERAMT: - usSubpointsPerPoint = LEVEL_SUBPOINTS_TO_IMPROVE * bExpLevel; + usSubpointsPerPoint = LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel; + usSubpointsPerPoint += pProfile->bGrowthModifierExpLevel; break; default: diff --git a/Tactical/Campaign.h b/Tactical/Campaign.h index a5f54276a3..7523fb1104 100644 --- a/Tactical/Campaign.h +++ b/Tactical/Campaign.h @@ -73,7 +73,7 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UIN UINT32 CalcNewSalary(UINT32 uiOldSalary, BOOLEAN fIncrease, UINT32 uiMaxLimit, UINT32 uiIncreaseCap); UINT32 RoundOffSalary(UINT32 uiSalary); -UINT16 SubpointsPerPoint(UINT8 ubStat, INT8 bExpLevel); +UINT16 SubpointsPerPoint(UINT8 ubStat, MERCPROFILESTRUCT* pProfile); void HandleUnhiredMercImprovement( MERCPROFILESTRUCT *pProfile ); void HandleUnhiredMercDeaths( INT32 iProfileID ); @@ -92,4 +92,4 @@ void BuildStatChangeString( STR16 wString, STR16 wName, BOOLEAN fIncrease, INT16 void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index e3757a037e..4bbbeebda1 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -2598,7 +2598,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // AGI if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sAgilityGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_AGI_Y-1); ClipRect.iBottom = (SM_AGI_Y-1) + SM_STATS_HEIGHT; @@ -2610,7 +2610,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // DEX if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sDexterityGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_DEX_Y-1); ClipRect.iBottom = (SM_DEX_Y-1) + SM_STATS_HEIGHT; @@ -2622,7 +2622,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // STR if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sStrengthGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_STR_Y-1); ClipRect.iBottom = (SM_STR_Y-1) + SM_STATS_HEIGHT; @@ -2634,7 +2634,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // WIS if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sWisdomGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_WIS_Y-1); ClipRect.iBottom = (SM_WIS_Y-1) + SM_STATS_HEIGHT; @@ -2646,7 +2646,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // MRK if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMarksmanshipGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_MRKM_Y-1); ClipRect.iBottom = (SM_MRKM_Y-1) + SM_STATS_HEIGHT; @@ -2658,7 +2658,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // LDR if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sLeadershipGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_CHAR_Y-1); ClipRect.iBottom = (SM_CHAR_Y-1) + SM_STATS_HEIGHT; @@ -2670,7 +2670,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // MECH if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMechanicGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_MECH_Y-1); ClipRect.iBottom = (SM_MECH_Y-1) + SM_STATS_HEIGHT; @@ -2682,7 +2682,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // EXPLO if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExplosivesGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_EXPL_Y-1); ClipRect.iBottom = (SM_EXPL_Y-1) + SM_STATS_HEIGHT; @@ -2694,7 +2694,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // MED if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMedicalGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT,0); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_MED_Y-1); ClipRect.iBottom = (SM_MED_Y-1) + SM_STATS_HEIGHT; @@ -2706,7 +2706,7 @@ void RenderSMPanel( BOOLEAN *pfDirty ) // EXPLEVEL if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExpLevelGain) { - ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, gpSMCurrentMerc->stats.bExpLevel); + ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]); ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH)); ClipRect.iTop = (SM_EXPLVL_Y-1); ClipRect.iBottom = (SM_EXPLVL_Y-1) + SM_STATS_HEIGHT; diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index bf212ad4a5..e48604ef1a 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -1000,17 +1000,17 @@ class MERCPROFILESTRUCT { UINT32 Type; // rftr: growth modifiers - INT16 bGrowthModifierLife; - INT16 bGrowthModifierStrength; - INT16 bGrowthModifierAgility; - INT16 bGrowthModifierDexterity; - INT16 bGrowthModifierWisdom; - INT16 bGrowthModifierMarksmanship; - INT16 bGrowthModifierExplosive; - INT16 bGrowthModifierLeadership; - INT16 bGrowthModifierMedical; - INT16 bGrowthModifierMechanical; - INT16 bGrowthModifierExpLevel; + INT8 bGrowthModifierLife; + INT8 bGrowthModifierStrength; + INT8 bGrowthModifierAgility; + INT8 bGrowthModifierDexterity; + INT8 bGrowthModifierWisdom; + INT8 bGrowthModifierMarksmanship; + INT8 bGrowthModifierExplosive; + INT8 bGrowthModifierLeadership; + INT8 bGrowthModifierMedical; + INT8 bGrowthModifierMechanical; + INT8 bGrowthModifierExpLevel; }; // MERCPROFILESTRUCT; // WANNE - BMP: DONE! From aa2eca81db3783ebcd70e63556aaa86f7e9c9a3b Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Mon, 24 Jul 2023 00:49:10 -0700 Subject: [PATCH 14/27] Rename bEvolution to _old_bEvolution Add fRegresses bool to MERCPROFILESTRUCT TEMPPROFILESTRUCT no longer reads bEvolution; fRegresses instead --- Laptop/personnel.cpp | 2 +- SaveLoadGame.cpp | 10 +++++++++- Tactical/Campaign.cpp | 4 ++-- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Profile.cpp | 2 +- Tactical/Soldier Profile.h | 2 +- Tactical/XML_Profiles.cpp | 14 +++++++------- Tactical/soldier profile type.h | 3 ++- 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 85aa9d5a5d..3ab4759f9c 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2237,7 +2237,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) if ( !gGameExternalOptions.bDisableEvolution ) { CHAR16 sStr2[200]; - swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile].bEvolution], pSoldier->GetName() ); + swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile]._old_bEvolution], pSoldier->GetName() ); mprintf( (INT16)( pPersonnelScreenPoints[loc].x + ( iSlot*TEXT_BOX_WIDTH ) ), ( pPersonnelScreenPoints[loc].y + 15 ), sStr2 ); diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index a94c7918a3..ed9f43a7dc 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -1294,7 +1294,7 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead = ReadFieldByField( hFile, &this->bSex, sizeof(this->bSex), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bArmourAttractiveness, sizeof(this->bArmourAttractiveness), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags2, sizeof(this->ubMiscFlags2), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->bEvolution, sizeof(this->bEvolution), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField( hFile, &this->_old_bEvolution, sizeof(this->_old_bEvolution), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags, sizeof(this->ubMiscFlags), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSexist, sizeof(this->bSexist), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bLearnToHate, sizeof(this->bLearnToHate), sizeof(UINT8), numBytesRead); @@ -1641,6 +1641,10 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for // rftr: growth modifiers if (guiCurrentSaveGameVersion >= GROWTH_MODIFIERS) { + if (!FileRead(hFile, &this->fRegresses, sizeof(BOOLEAN), &uiNumBytesRead)) + { + return(FALSE); + } if (!FileRead(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesRead)) { return(FALSE); @@ -1804,6 +1808,10 @@ BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile) } // rftr: growth modifiers + if (!FileWrite(hFile, &this->fRegresses, sizeof(BOOLEAN), &uiNumBytesWritten)) + { + return(FALSE); + } if (!FileWrite(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesWritten)) { return(FALSE); diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 82995adc6a..9d97258f10 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -260,7 +260,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh // loop once for each chance to improve for (uiCnt = 0; uiCnt < usNumChances; ++uiCnt) { - if (pProfile->bEvolution != 2) // Evolves! + if (pProfile->fRegresses == FALSE) // Evolves! { // if this is improving from a failure, and a successful roll would give us enough to go up a point if ((ubReason == FROM_FAILURE) && ((*psStatGainPtr + 1) >= usSubpointsPerPoint)) @@ -1781,7 +1781,7 @@ void TestDumpStatChanges(void) // print days served fprintf(FDump, "%3d ", pProfile->usTotalDaysServed); // print evolution type - fprintf(FDump, "%c ", cEvolutionChars[ pProfile->bEvolution ]); + fprintf(FDump, "%c ", cEvolutionChars[ pProfile->_old_bEvolution ]); // now print all non-zero stats for( ubStat = FIRST_CHANGEABLE_STAT; ubStat <= LAST_CHANGEABLE_STAT; ubStat++ ) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index d6c3738c65..71083a2338 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1339,7 +1339,7 @@ MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const OLD_MERCPROFILESTRUCT_101& this->bSex = src.bSex; this->bArmourAttractiveness = src.bArmourAttractiveness; this->ubMiscFlags2 = src.ubMiscFlags2; - this->bEvolution = src.bEvolution; + this->_old_bEvolution = src.bEvolution; this->ubMiscFlags = src.ubMiscFlags; this->bSexist = src.bSexist; this->bLearnToHate = src.bLearnToHate; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 0a2e590a2a..3171d7ce34 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -2595,7 +2595,7 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop ) gMercProfiles[ uiLoop ].bMechanical = tempProfiles[ uiLoop ].bMechanical ; gMercProfiles[ uiLoop ].bExpLevel = tempProfiles[ uiLoop ].bExpLevel ; - gMercProfiles[ uiLoop ].bEvolution = tempProfiles[ uiLoop ].bEvolution ; + gMercProfiles[uiLoop]._old_bEvolution = 0; ////////////////////////////////////////////////////////////////////////////////////// // SANDRO - Check old/new traits and repair possible errors if (gGameOptions.fNewTraitSystem) diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index b2c8e0a49b..39e0860e0e 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -314,7 +314,7 @@ typedef struct INT8 bExpLevel; - INT8 bEvolution; + BOOLEAN fRegresses; INT16 bGrowthModifierLife; INT16 bGrowthModifierStrength; INT16 bGrowthModifierAgility; diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index 2d29511543..2a9afd67d5 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -101,8 +101,8 @@ profileStartElementHandle(void *userData, const XML_Char *name, const XML_Char * strcmp(name, "bMedical") == 0 || strcmp(name, "bMechanical") == 0 || strcmp(name, "bExpLevel") == 0 || - strcmp(name, "bEvolution") == 0 || - // rftr: growth rates are intended to replace the evolution tag, letting each stat have its own growth modifier + strcmp(name, "fRegresses") == 0 || + // rftr: growth rates are intended to replace the tag, letting each stat have its own growth modifier strcmp(name, "bGrowthModifierLife") == 0 || strcmp(name, "bGrowthModifierStrength") == 0 || strcmp(name, "bGrowthModifierAgility") == 0 || @@ -292,7 +292,7 @@ profileEndElementHandle(void *userData, const XML_Char *name) tempProfiles[pData->curIndex].bMechanical = pData->curProfile.bMechanical; tempProfiles[pData->curIndex].bExpLevel = pData->curProfile.bExpLevel; - tempProfiles[pData->curIndex].bEvolution = pData->curProfile.bEvolution; + tempProfiles[pData->curIndex].fRegresses = pData->curProfile.fRegresses; tempProfiles[pData->curIndex].bGrowthModifierLife = pData->curProfile.bGrowthModifierLife; tempProfiles[pData->curIndex].bGrowthModifierStrength = pData->curProfile.bGrowthModifierStrength; tempProfiles[pData->curIndex].bGrowthModifierAgility = pData->curProfile.bGrowthModifierAgility; @@ -609,11 +609,11 @@ profileEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curProfile.bExpLevel = (UINT32) strtoul(pData->szCharData, NULL, 0); } - - else if(strcmp(name, "bEvolution") == 0) + + else if(strcmp(name, "fRegresses") == 0) { pData->curElement = ELEMENT; - pData->curProfile.bEvolution = (UINT32) strtoul(pData->szCharData, NULL, 0); + pData->curProfile.fRegresses = (BOOLEAN) strtoul(pData->szCharData, NULL, 0); } else if (strncmp(name, "bGrowthModifier", 11) == 0) // doing this to avoid C1061 @@ -1682,7 +1682,7 @@ BOOLEAN WriteMercProfiles() FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bMedical); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bMechanical); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bExpLevel); - FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bEvolution); + FilePrintf(hFile,"\t\t<_old_bEvolution>%d\r\n", gMercProfiles[ cnt ]._old_bEvolution); //////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - old/new traits if (gGameOptions.fNewTraitSystem) diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index e48604ef1a..99ed71d364 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -778,7 +778,7 @@ class MERCPROFILESTRUCT { INT8 bSex; INT8 bArmourAttractiveness; UINT8 ubMiscFlags2; - INT8 bEvolution; + INT8 _old_bEvolution; UINT8 ubMiscFlags; UINT8 bSexist; UINT8 bLearnToHate; @@ -1000,6 +1000,7 @@ class MERCPROFILESTRUCT { UINT32 Type; // rftr: growth modifiers + BOOLEAN fRegresses; // if TRUE, the following growth modifiers are not used and instead the merc loses stats over time INT8 bGrowthModifierLife; INT8 bGrowthModifierStrength; INT8 bGrowthModifierAgility; From afae0480e072fe76a2d84a2dcaa4d285cabf0f82 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Tue, 25 Jul 2023 00:54:51 -0700 Subject: [PATCH 15/27] Add regression and growth modifiers to merc profile overwrite --- Tactical/Soldier Profile.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 3171d7ce34..aaf28afe1f 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -2710,6 +2710,19 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop ) gMercProfiles[ uiLoop ].usVoiceIndex = tempProfiles[uiLoop].usVoiceIndex; gMercProfiles[ uiLoop ].Type = tempProfiles[uiLoop].Type; + gMercProfiles[uiLoop].fRegresses = tempProfiles[uiLoop].fRegresses; + gMercProfiles[uiLoop].bGrowthModifierLife = tempProfiles[uiLoop].bGrowthModifierLife; + gMercProfiles[uiLoop].bGrowthModifierStrength = tempProfiles[uiLoop].bGrowthModifierStrength; + gMercProfiles[uiLoop].bGrowthModifierAgility = tempProfiles[uiLoop].bGrowthModifierAgility; + gMercProfiles[uiLoop].bGrowthModifierDexterity = tempProfiles[uiLoop].bGrowthModifierDexterity; + gMercProfiles[uiLoop].bGrowthModifierWisdom = tempProfiles[uiLoop].bGrowthModifierWisdom; + gMercProfiles[uiLoop].bGrowthModifierMarksmanship = tempProfiles[uiLoop].bGrowthModifierMarksmanship; + gMercProfiles[uiLoop].bGrowthModifierExplosive = tempProfiles[uiLoop].bGrowthModifierExplosive; + gMercProfiles[uiLoop].bGrowthModifierLeadership = tempProfiles[uiLoop].bGrowthModifierLeadership; + gMercProfiles[uiLoop].bGrowthModifierMedical = tempProfiles[uiLoop].bGrowthModifierMedical; + gMercProfiles[uiLoop].bGrowthModifierMechanical = tempProfiles[uiLoop].bGrowthModifierMechanical; + gMercProfiles[uiLoop].bGrowthModifierExpLevel = tempProfiles[uiLoop].bGrowthModifierExpLevel; + gProfileType[uiLoop] = gMercProfiles[uiLoop].Type; switch ( tempProfiles[uiLoop].Type ) From d68d58e2049f874dd7395d0e09ae3c46b65a6066 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Fri, 28 Jul 2023 01:41:31 -0700 Subject: [PATCH 16/27] Remove the new fRegresses member and change INT8 _old_bEvolution to BOOLEAN fRegresses --- Laptop/personnel.cpp | 2 +- SaveLoadGame.cpp | 19 ++++++++++--------- Tactical/Campaign.cpp | 2 +- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Profile.cpp | 2 +- Tactical/XML_Profiles.cpp | 2 +- Tactical/soldier profile type.h | 5 ++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 3ab4759f9c..1b11286fc1 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2237,7 +2237,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) if ( !gGameExternalOptions.bDisableEvolution ) { CHAR16 sStr2[200]; - swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile]._old_bEvolution], pSoldier->GetName() ); + swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile].fRegresses], pSoldier->GetName() ); mprintf( (INT16)( pPersonnelScreenPoints[loc].x + ( iSlot*TEXT_BOX_WIDTH ) ), ( pPersonnelScreenPoints[loc].y + 15 ), sStr2 ); diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index ed9f43a7dc..38be4c6c20 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -1294,7 +1294,16 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead = ReadFieldByField( hFile, &this->bSex, sizeof(this->bSex), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bArmourAttractiveness, sizeof(this->bArmourAttractiveness), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags2, sizeof(this->ubMiscFlags2), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->_old_bEvolution, sizeof(this->_old_bEvolution), sizeof(INT8), numBytesRead); + if (guiCurrentSaveGameVersion < GROWTH_MODIFIERS) + { + numBytesRead = ReadFieldByField( hFile, &this->fRegresses, sizeof(this->fRegresses), sizeof(INT8), numBytesRead); + // convert old evolution to regresses boolean + this->fRegresses = this->fRegresses == 2 ? TRUE : FALSE; // 2 == CharacterEvolution::DEVOLVES + } + else + { + numBytesRead = ReadFieldByField( hFile, &this->fRegresses, sizeof(this->fRegresses), sizeof(INT8), numBytesRead); + } numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags, sizeof(this->ubMiscFlags), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSexist, sizeof(this->bSexist), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bLearnToHate, sizeof(this->bLearnToHate), sizeof(UINT8), numBytesRead); @@ -1641,10 +1650,6 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for // rftr: growth modifiers if (guiCurrentSaveGameVersion >= GROWTH_MODIFIERS) { - if (!FileRead(hFile, &this->fRegresses, sizeof(BOOLEAN), &uiNumBytesRead)) - { - return(FALSE); - } if (!FileRead(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesRead)) { return(FALSE); @@ -1808,10 +1813,6 @@ BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile) } // rftr: growth modifiers - if (!FileWrite(hFile, &this->fRegresses, sizeof(BOOLEAN), &uiNumBytesWritten)) - { - return(FALSE); - } if (!FileWrite(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesWritten)) { return(FALSE); diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 9d97258f10..88944242af 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1781,7 +1781,7 @@ void TestDumpStatChanges(void) // print days served fprintf(FDump, "%3d ", pProfile->usTotalDaysServed); // print evolution type - fprintf(FDump, "%c ", cEvolutionChars[ pProfile->_old_bEvolution ]); + fprintf(FDump, "%c ", cEvolutionChars[ pProfile->fRegresses ]); // now print all non-zero stats for( ubStat = FIRST_CHANGEABLE_STAT; ubStat <= LAST_CHANGEABLE_STAT; ubStat++ ) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 71083a2338..9a594ee2fa 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1339,7 +1339,7 @@ MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const OLD_MERCPROFILESTRUCT_101& this->bSex = src.bSex; this->bArmourAttractiveness = src.bArmourAttractiveness; this->ubMiscFlags2 = src.ubMiscFlags2; - this->_old_bEvolution = src.bEvolution; + this->fRegresses = src.bEvolution == 2; // formerly, 2 == CharacterEvolution::DEVOLVES this->ubMiscFlags = src.ubMiscFlags; this->bSexist = src.bSexist; this->bLearnToHate = src.bLearnToHate; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index aaf28afe1f..a3838605be 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -2595,7 +2595,7 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop ) gMercProfiles[ uiLoop ].bMechanical = tempProfiles[ uiLoop ].bMechanical ; gMercProfiles[ uiLoop ].bExpLevel = tempProfiles[ uiLoop ].bExpLevel ; - gMercProfiles[uiLoop]._old_bEvolution = 0; + gMercProfiles[uiLoop].fRegresses = tempProfiles[ uiLoop ].fRegresses; ////////////////////////////////////////////////////////////////////////////////////// // SANDRO - Check old/new traits and repair possible errors if (gGameOptions.fNewTraitSystem) diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index 2a9afd67d5..380fffb1a9 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -1682,7 +1682,7 @@ BOOLEAN WriteMercProfiles() FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bMedical); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bMechanical); FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].bExpLevel); - FilePrintf(hFile,"\t\t<_old_bEvolution>%d\r\n", gMercProfiles[ cnt ]._old_bEvolution); + FilePrintf(hFile,"\t\t%d\r\n", gMercProfiles[ cnt ].fRegresses); //////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - old/new traits if (gGameOptions.fNewTraitSystem) diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 99ed71d364..81808236ef 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -778,7 +778,7 @@ class MERCPROFILESTRUCT { INT8 bSex; INT8 bArmourAttractiveness; UINT8 ubMiscFlags2; - INT8 _old_bEvolution; + BOOLEAN fRegresses; UINT8 ubMiscFlags; UINT8 bSexist; UINT8 bLearnToHate; @@ -999,8 +999,7 @@ class MERCPROFILESTRUCT { // Flugente: type of profile UINT32 Type; - // rftr: growth modifiers - BOOLEAN fRegresses; // if TRUE, the following growth modifiers are not used and instead the merc loses stats over time + // rftr: growth modifiers - ignored if fRegresses is TRUE INT8 bGrowthModifierLife; INT8 bGrowthModifierStrength; INT8 bGrowthModifierAgility; From 6d506499015ada1527a9ebd667146a0291168652 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 00:35:23 -0700 Subject: [PATCH 17/27] Update growth modifiers random range from [0,500] to [-50,50] --- GameSettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 6ecc274053..5d5c62ec45 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1080,7 +1080,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fMercRandomStartSalary = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_START_SALARY", FALSE); gGameExternalOptions.ubMercRandomStartSalaryPercentMod = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_START_SALARY_PERCENTAGE_MAX_MODIFIER", 30, 0, 100); gGameExternalOptions.fMercRandomGrowthModifiers = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS", FALSE); - gGameExternalOptions.iMercRandomGrowthModifiersRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS_RANGE", 100, 0, 500); + gGameExternalOptions.iMercRandomGrowthModifiersRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS_RANGE", 5, -50, 50); //################# Financial Settings ################# From aee92d7f279e4e35397704ece1aa892541d27506 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:23:45 -0700 Subject: [PATCH 18/27] Update random growth modifiers bounds --- Tactical/Soldier Profile.cpp | 69 ++++++++---------------------------- 1 file changed, 14 insertions(+), 55 deletions(-) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index a3838605be..50f75adef8 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -466,66 +466,25 @@ void RandomGrowthModifiers() MERCPROFILESTRUCT * pProfile; BOOLEAN useBellCurve = TRUE; - if (gGameExternalOptions.fMercRandomGrowthModifiers == TRUE) // rftr todo - add settings + if (gGameExternalOptions.fMercRandomGrowthModifiers == TRUE) { for (cnt = 0; cnt < NUM_PROFILES; cnt++) { pProfile = &(gMercProfiles[cnt]); - if (pProfile->bGrowthModifierExpLevel > 0) - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierExpLevel < 0) - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierLife > 0) - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierLife < 0) - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierAgility > 0) - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierAgility < 0) - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierDexterity > 0) - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierDexterity < 0) - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierStrength > 0) - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierStrength < 0) - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierLeadership > 0) - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierLeadership < 0) - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierWisdom > 0) - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierWisdom < 0) - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierMarksmanship > 0) - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierMarksmanship < 0) - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierMechanical > 0) - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierMechanical < 0) - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierExplosive > 0) - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierExplosive < 0) - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - - if (pProfile->bGrowthModifierMedical > 0) - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, 0, 500, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - else if (pProfile->bGrowthModifierMedical < 0) - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -500, 0, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + // cap minimum growth modifier to negative half subpoints. this is effectively double speed using default values (subpoints = 50) + // cap maximum growth modifier to 125. this would make a merc take 3.5x as long to level up a stat using default values + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -gGameExternalOptions.usLevelSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -gGameExternalOptions.usHealthSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -gGameExternalOptions.usAgilitySubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -gGameExternalOptions.usDexteritySubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -gGameExternalOptions.usStrengthSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -gGameExternalOptions.usLeadershipSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -gGameExternalOptions.usWisdomSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -gGameExternalOptions.usMarksmanshipSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -gGameExternalOptions.usMechanicalSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -gGameExternalOptions.usExplosivesSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -gGameExternalOptions.usMedicalSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); } } } From e386c9cdb3833e0f72b3b1e157c52a20f3317f15 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:57:17 -0700 Subject: [PATCH 19/27] Remove DISABLE_EVOLUTION ini setting --- GameSettings.cpp | 2 -- GameSettings.h | 3 --- Laptop/personnel.cpp | 3 ++- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 5d5c62ec45..a89dbb418c 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -2482,8 +2482,6 @@ void LoadGameExternalOptions() gGameExternalOptions.ubTeachBonusToTrain = iniReader.ReadInteger("Strategic Assignment Settings","TEACHER_TRAIT_BONUS_TO_TRAINING_EFFICIENCY",30, 0, 100); gGameExternalOptions.ubMinSkillToTeach = iniReader.ReadInteger("Strategic Assignment Settings","MIN_SKILL_REQUIRED_TO_TEACH_OTHER",25, 0, 100); - gGameExternalOptions.bDisableEvolution = iniReader.ReadBoolean("Strategic Assignment Settings", "DISABLE_EVOLUTION", TRUE ); - // HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainees will go to sleep when their trainer goes to sleep. 3 = Trainer will go to sleep if all trainees are asleep. 1 = Both. 0 = Neither. gGameExternalOptions.ubSmartTrainingSleep = iniReader.ReadInteger("Strategic Assignment Settings","SYNCHRONIZED_SLEEPING_HOURS_WHEN_TRAINING_TOGETHER", 0, 0, 3); diff --git a/GameSettings.h b/GameSettings.h index 726d88f5aa..cb2003e59d 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -816,9 +816,6 @@ typedef struct INT32 ubRpcBonusToTrainMilitia; INT32 ubMinSkillToTeach; - // Flugente: disable evolution setting in MercProfiles.xml - BOOLEAN bDisableEvolution; - INT32 ubLowActivityLevel; INT32 ubMediumActivityLevel; INT32 ubHighActivityLevel; diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 1b11286fc1..14ca5a44c3 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2234,7 +2234,8 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) } // rftr todo: replace this with growth modifier text - if ( !gGameExternalOptions.bDisableEvolution ) + // keywords: fRegresses, GrowthModifier + //if ( !gGameExternalOptions.bDisableEvolution ) { CHAR16 sStr2[200]; swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile].fRegresses], pSoldier->GetName() ); From af44c18a031581a57264880aab22772c8f940107 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:57:34 -0700 Subject: [PATCH 20/27] Change growth modifiers in MERCPROFILESTRUCT to INT16 --- Tactical/soldier profile type.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 81808236ef..8d427a5bb9 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -1000,17 +1000,17 @@ class MERCPROFILESTRUCT { UINT32 Type; // rftr: growth modifiers - ignored if fRegresses is TRUE - INT8 bGrowthModifierLife; - INT8 bGrowthModifierStrength; - INT8 bGrowthModifierAgility; - INT8 bGrowthModifierDexterity; - INT8 bGrowthModifierWisdom; - INT8 bGrowthModifierMarksmanship; - INT8 bGrowthModifierExplosive; - INT8 bGrowthModifierLeadership; - INT8 bGrowthModifierMedical; - INT8 bGrowthModifierMechanical; - INT8 bGrowthModifierExpLevel; + INT16 bGrowthModifierLife; + INT16 bGrowthModifierStrength; + INT16 bGrowthModifierAgility; + INT16 bGrowthModifierDexterity; + INT16 bGrowthModifierWisdom; + INT16 bGrowthModifierMarksmanship; + INT16 bGrowthModifierExplosive; + INT16 bGrowthModifierLeadership; + INT16 bGrowthModifierMedical; + INT16 bGrowthModifierMechanical; + INT16 bGrowthModifierExpLevel; }; // MERCPROFILESTRUCT; // WANNE - BMP: DONE! From 2354b9e0f9a59f1da0ad22a5434d11a59b0b8b22 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:59:02 -0700 Subject: [PATCH 21/27] Update max random growth modifier --- Tactical/Soldier Profile.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 50f75adef8..37052fb0a2 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -473,18 +473,18 @@ void RandomGrowthModifiers() pProfile = &(gMercProfiles[cnt]); // cap minimum growth modifier to negative half subpoints. this is effectively double speed using default values (subpoints = 50) - // cap maximum growth modifier to 125. this would make a merc take 3.5x as long to level up a stat using default values - pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -gGameExternalOptions.usLevelSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -gGameExternalOptions.usHealthSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -gGameExternalOptions.usAgilitySubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -gGameExternalOptions.usDexteritySubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -gGameExternalOptions.usStrengthSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -gGameExternalOptions.usLeadershipSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -gGameExternalOptions.usWisdomSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -gGameExternalOptions.usMarksmanshipSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -gGameExternalOptions.usMechanicalSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -gGameExternalOptions.usExplosivesSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); - pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -gGameExternalOptions.usMedicalSubpointsToImprove/2, 125, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + // cap maximum growth modifier to 30000. this would make a merc take 600x as long to level up a stat using default values + pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -gGameExternalOptions.usLevelSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -gGameExternalOptions.usHealthSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -gGameExternalOptions.usAgilitySubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -gGameExternalOptions.usDexteritySubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -gGameExternalOptions.usStrengthSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -gGameExternalOptions.usLeadershipSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -gGameExternalOptions.usWisdomSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -gGameExternalOptions.usMarksmanshipSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -gGameExternalOptions.usMechanicalSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -gGameExternalOptions.usExplosivesSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); + pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -gGameExternalOptions.usMedicalSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve ); } } } From 44fabcf2c3ef088defe7ef27cc727b2b83a93a58 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 13:27:51 -0700 Subject: [PATCH 22/27] Apply zeroed growth modifiers when upgrading savegames --- SaveLoadGame.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 38be4c6c20..37eca4c555 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -1695,6 +1695,21 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for return( FALSE ); } } + else + { + // zero out growth modifiers for upgrading savegames + this->bGrowthModifierLife = 0; + this->bGrowthModifierStrength = 0; + this->bGrowthModifierAgility = 0; + this->bGrowthModifierDexterity = 0; + this->bGrowthModifierWisdom = 0; + this->bGrowthModifierMarksmanship = 0; + this->bGrowthModifierExplosive = 0; + this->bGrowthModifierLeadership = 0; + this->bGrowthModifierMedical = 0; + this->bGrowthModifierMechanical = 0; + this->bGrowthModifierExpLevel = 0; + } } if ( this->uiProfileChecksum != this->GetChecksum() ) From 101010857a299018a69fa3c8681bb1fb6503b058 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Sat, 29 Jul 2023 14:59:57 -0700 Subject: [PATCH 23/27] Apply max stat gain speed to 2x configured (x_SUBPOINTS_TO_IMPROVE) --- Tactical/Campaign.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 88944242af..9ac10e945e 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1161,50 +1161,61 @@ UINT16 SubpointsPerPoint(UINT8 ubStat, MERCPROFILESTRUCT* pProfile) case HEALTHAMT: usSubpointsPerPoint = HEALTH_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierLife; + usSubpointsPerPoint = max(usSubpointsPerPoint, HEALTH_SUBPOINTS_TO_IMPROVE/2); break; case AGILAMT: usSubpointsPerPoint = AGILITY_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierAgility; + usSubpointsPerPoint = max(usSubpointsPerPoint, AGILITY_SUBPOINTS_TO_IMPROVE/2); break; case DEXTAMT: usSubpointsPerPoint = DEXTERITY_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierDexterity; + usSubpointsPerPoint = max(usSubpointsPerPoint, DEXTERITY_SUBPOINTS_TO_IMPROVE/2); break; case WISDOMAMT: usSubpointsPerPoint = WISDOM_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierWisdom; + usSubpointsPerPoint = max(usSubpointsPerPoint, WISDOM_SUBPOINTS_TO_IMPROVE/2); break; case STRAMT: usSubpointsPerPoint = STRENGTH_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierStrength; + usSubpointsPerPoint = max(usSubpointsPerPoint, STRENGTH_SUBPOINTS_TO_IMPROVE/2); break; // Skills case MEDICALAMT: usSubpointsPerPoint = MEDICAL_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierMedical; + usSubpointsPerPoint = max(usSubpointsPerPoint, MEDICAL_SUBPOINTS_TO_IMPROVE/2); break; case EXPLODEAMT: usSubpointsPerPoint = EXPLOSIVES_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierExplosive; + usSubpointsPerPoint = max(usSubpointsPerPoint, EXPLOSIVES_SUBPOINTS_TO_IMPROVE/2); break; case MECHANAMT: usSubpointsPerPoint = MECHANICAL_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierMechanical; + usSubpointsPerPoint = max(usSubpointsPerPoint, MECHANICAL_SUBPOINTS_TO_IMPROVE/2); break; case MARKAMT: usSubpointsPerPoint = MARKSMANSHIP_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierMarksmanship; + usSubpointsPerPoint = max(usSubpointsPerPoint, MARKSMANSHIP_SUBPOINTS_TO_IMPROVE/2); break; case LDRAMT: usSubpointsPerPoint = LEADERSHIP_SUBPOINTS_TO_IMPROVE; usSubpointsPerPoint += pProfile->bGrowthModifierLeadership; + usSubpointsPerPoint = max(usSubpointsPerPoint, LEADERSHIP_SUBPOINTS_TO_IMPROVE/2); break; // Experience case EXPERAMT: usSubpointsPerPoint = LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel; usSubpointsPerPoint += pProfile->bGrowthModifierExpLevel; + usSubpointsPerPoint = max(usSubpointsPerPoint, LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel / 2); break; default: From ba36db671c623df102a1ccf6dba35427a582aa74 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 2 Aug 2023 01:08:04 -0700 Subject: [PATCH 24/27] Add LAPTOP_STAT_TEXT enum and update szLaptopStatText usage Check for regression in personnel info --- Laptop/personnel.cpp | 8 ++++---- TacticalAI/NPC.cpp | 12 ++++++------ Utils/Text.h | 16 ++++++++++++++++ Utils/_ChineseText.cpp | 8 +------- Utils/_DutchText.cpp | 8 +------- Utils/_EnglishText.cpp | 8 +------- Utils/_FrenchText.cpp | 8 +------- Utils/_GermanText.cpp | 8 +------- Utils/_ItalianText.cpp | 8 +------- Utils/_PolishText.cpp | 8 +------- Utils/_RussianText.cpp | 8 +------- 11 files changed, 34 insertions(+), 66 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 14ca5a44c3..9c198eefd6 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2205,10 +2205,10 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) if ( (gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) ) { CHAR16 sStr1[200]; - swprintf( sStr1, szLaptopStatText[6] ); + swprintf( sStr1, szLaptopStatText[LAPTOP_STAT_TEXT_GOOD_GUY] ); CHAR16 sStr2[200]; - swprintf( sStr2, szLaptopStatText[7], pSoldier->GetName( ) ); + swprintf( sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_REFUSES_TO_ATTACK_NON_HOSTILES], pSoldier->GetName( ) ); sX = pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH); @@ -2235,10 +2235,10 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) // rftr todo: replace this with growth modifier text // keywords: fRegresses, GrowthModifier - //if ( !gGameExternalOptions.bDisableEvolution ) + if (gMercProfiles[pSoldier->ubProfile].fRegresses) { CHAR16 sStr2[200]; - swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile].fRegresses], pSoldier->GetName() ); + swprintf( sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES], pSoldier->GetName() ); mprintf( (INT16)( pPersonnelScreenPoints[loc].x + ( iSlot*TEXT_BOX_WIDTH ) ), ( pPersonnelScreenPoints[loc].y + 15 ), sStr2 ); diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index cf8d86c48e..55606e27d5 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -808,7 +808,7 @@ INT32 GetEffectiveApproachValue( UINT8 usProfile, UINT8 usApproach, CHAR16* apSt if ( apStr ) { - swprintf( atStr, szLaptopStatText[0], threateneffectiveness ); + swprintf( atStr, szLaptopStatText[LAPTOP_STAT_TEXT_THREATEN_EFFECTIVENESS], threateneffectiveness ); wcscat( apStr, atStr ); } @@ -818,7 +818,7 @@ INT32 GetEffectiveApproachValue( UINT8 usProfile, UINT8 usApproach, CHAR16* apSt { if ( apStr ) { - swprintf( atStr, szLaptopStatText[1], gMercProfiles[usProfile].bLeadership ); + swprintf( atStr, szLaptopStatText[LAPTOP_STAT_TEXT_LEADERSHIP], gMercProfiles[usProfile].bLeadership ); wcscat( apStr, atStr ); } @@ -829,7 +829,7 @@ INT32 GetEffectiveApproachValue( UINT8 usProfile, UINT8 usApproach, CHAR16* apSt if ( apStr ) { - swprintf( atStr, szLaptopStatText[2], approachfactor ); + swprintf( atStr, szLaptopStatText[LAPTOP_STAT_TEXT_APPROACH_MODIFIER], approachfactor ); wcscat( apStr, atStr ); } @@ -855,7 +855,7 @@ INT32 GetEffectiveApproachValue( UINT8 usProfile, UINT8 usApproach, CHAR16* apSt if ( apStr ) { - swprintf( atStr, szLaptopStatText[3], bgmodifier ); + swprintf( atStr, szLaptopStatText[LAPTOP_STAT_TEXT_BACKGROUND_MODIFIER], bgmodifier ); wcscat( apStr, atStr ); } @@ -868,7 +868,7 @@ INT32 GetEffectiveApproachValue( UINT8 usProfile, UINT8 usApproach, CHAR16* apSt swprintf( atStr, L" \n" ); wcscat( apStr, atStr ); - swprintf( atStr, szLaptopStatText[4] ); + swprintf( atStr, szLaptopStatText[LAPTOP_STAT_TEXT_ASSERTIVE] ); wcscat( apStr, atStr ); } else if ( DoesMercHavePersonality( pSoldier, CHAR_TRAIT_MALICIOUS ) ) @@ -876,7 +876,7 @@ INT32 GetEffectiveApproachValue( UINT8 usProfile, UINT8 usApproach, CHAR16* apSt swprintf( atStr, L" \n" ); wcscat( apStr, atStr ); - swprintf( atStr, szLaptopStatText[5] ); + swprintf( atStr, szLaptopStatText[LAPTOP_STAT_TEXT_MALICIOUS] ); wcscat( apStr, atStr ); } } diff --git a/Utils/Text.h b/Utils/Text.h index 21037737a0..14093133e2 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -3084,6 +3084,22 @@ extern STR16 szSMilitiaResourceText[]; extern STR16 szInteractiveActionText[]; extern STR16 szLaptopStatText[]; +enum +{ + LAPTOP_STAT_TEXT_THREATEN_EFFECTIVENESS, + LAPTOP_STAT_TEXT_LEADERSHIP, + LAPTOP_STAT_TEXT_APPROACH_MODIFIER, + LAPTOP_STAT_TEXT_BACKGROUND_MODIFIER, + LAPTOP_STAT_TEXT_ASSERTIVE, + LAPTOP_STAT_TEXT_MALICIOUS, + LAPTOP_STAT_TEXT_GOOD_GUY, + LAPTOP_STAT_TEXT_REFUSES_TO_ATTACK_NON_HOSTILES, + LAPTOP_STAT_TEXT_FRIENDLY_APPROACH, + LAPTOP_STAT_TEXT_DIRECT_APPROACH, + LAPTOP_STAT_TEXT_THREATEN_APPROACH, + LAPTOP_STAT_TEXT_RECRUIT_APPROACH, + LAPTOP_STAT_TEXT_MERC_REGRESSES, +}; // Flugente: gear templates extern STR16 szGearTemplateText[]; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 2a943df5ec..7469695b91 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -11655,13 +11655,7 @@ STR16 szLaptopStatText[] = L"威胁对话", //L"Threaten approach", L"招募对话", //L"Recruit approach", - L"%s正以正常速度学习。", //L"%s learns with normal speed.", - L"%s根本没有在学习。", //L"%s does not learn at all.", - L"%s遗忘了技能。", //L"%s unlearns his skills.", - L"%s正以3/4的速度学习。", //L"%s learns with 3/4 speed.", - - L"%s正以1/2的速度学习。", //L"%s learns with 1/2 speed.", - L"%s正以1/4的速度学习。", //L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 00abf9fcbc..dd5348c3b9 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -11664,13 +11664,7 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", // TODO.Translate - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index a4e86f1c04..53a992cd34 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -11656,13 +11656,7 @@ STR16 szLaptopStatText[] = L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index f97f68de8d..d90b158f46 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -11646,13 +11646,7 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", // TODO.Translate - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 0e86f7f69a..b324781ed0 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -11560,13 +11560,7 @@ STR16 szLaptopStatText[] = L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", // TODO.Translate - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; // TODO.Translate diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 272ff9da77..0ecd0f6ffd 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -11655,13 +11655,7 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", // TODO.Translate - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 35548ba153..98ea07117d 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -11668,13 +11668,7 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", // TODO.Translate - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 0345b83019..cfe62d9d9c 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -11650,13 +11650,7 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s learns with normal speed.", // TODO.Translate - L"%s does not learn at all.", - L"%s unlearns his skills.", - L"%s learns with 3/4 speed.", - - L"%s learns with 1/2 speed.", - L"%s learns with 1/4 speed.", + L"%s's stats will regress.", }; STR16 szGearTemplateText[] = // TODO.Translate From eb606d7fbdc8de6eed4829f0880d2df0151c4bdb Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:31:06 -0700 Subject: [PATCH 25/27] Add growth modifier text to personnel screen Update laptop stat text --- Laptop/personnel.cpp | 180 +++++++++++++++++++++++++++++++++++++++-- Utils/Text.h | 14 ++++ Utils/_ChineseText.cpp | 16 +++- Utils/_DutchText.cpp | 16 +++- Utils/_EnglishText.cpp | 17 +++- Utils/_FrenchText.cpp | 16 +++- Utils/_GermanText.cpp | 16 +++- Utils/_ItalianText.cpp | 16 +++- Utils/_PolishText.cpp | 16 +++- Utils/_RussianText.cpp | 16 +++- 10 files changed, 309 insertions(+), 14 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 9c198eefd6..bc68bc7c66 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -1,3 +1,4 @@ +#pragma optimize("",off) #include "laptop.h" #include "personnel.h" #include "Utilities.h" @@ -2170,7 +2171,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) for ( int i = APPROACH_FRIENDLY; i <= APPROACH_RECRUIT; ++i ) { - mprintf( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), szLaptopStatText[7 + i] ); + mprintf( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), szLaptopStatText[LAPTOP_STAT_TEXT_FRIENDLY_APPROACH-1 + i] ); // APPROACH_FRIENDLY is 1 so fix the offset CHAR16 sStr[200]; swprintf( sStr, L"" ); @@ -2180,7 +2181,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf( sStr, L"%d", val ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sStr, PERS_FONT, &sX, &sY ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, sStr, PERS_FONT, &sX, &sY ); mprintf( sX, (pPersonnelScreenPoints[loc].y + 15), sStr ); // Add specific region for fast help window @@ -2233,18 +2234,187 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) ++region; } - // rftr todo: replace this with growth modifier text - // keywords: fRegresses, GrowthModifier if (gMercProfiles[pSoldier->ubProfile].fRegresses) { CHAR16 sStr2[200]; - swprintf( sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES], pSoldier->GetName() ); + swprintf( sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES] ); mprintf( (INT16)( pPersonnelScreenPoints[loc].x + ( iSlot*TEXT_BOX_WIDTH ) ), ( pPersonnelScreenPoints[loc].y + 15 ), sStr2 ); ++loc; ++region; } + else + { + const int THRESHOLD_FAST = -3; // this value and below: "fast" + const int THRESHOLD_SLOW = 3; // this value and above: "slow" + int yOffset = 15; + CHAR16 statTxt[200]; + // health + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_HEALTH_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // strength + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_STRENGTH_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // agility + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_AGILITY_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // dexterity + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_DEXTERITY_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // wisdom + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_WISDOM_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // marksmanship + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MARKSMANSHIP_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // explosives + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPLOSIVES_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // leadership + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_LEADERSHIP_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // medical + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MEDICAL_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // mechanical + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MECHANICAL_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + yOffset += 10; + } + // exp level + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPERIENCE_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); + mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + } + } } diff --git a/Utils/Text.h b/Utils/Text.h index 14093133e2..e2c3251c5b 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -3099,6 +3099,20 @@ enum LAPTOP_STAT_TEXT_THREATEN_APPROACH, LAPTOP_STAT_TEXT_RECRUIT_APPROACH, LAPTOP_STAT_TEXT_MERC_REGRESSES, + LAPTOP_STAT_TEXT_FAST, + LAPTOP_STAT_TEXT_AVERAGE, + LAPTOP_STAT_TEXT_SLOW, + LAPTOP_STAT_TEXT_HEALTH_SPEED, + LAPTOP_STAT_TEXT_STRENGTH_SPEED, + LAPTOP_STAT_TEXT_AGILITY_SPEED, + LAPTOP_STAT_TEXT_DEXTERITY_SPEED, + LAPTOP_STAT_TEXT_WISDOM_SPEED, + LAPTOP_STAT_TEXT_MARKSMANSHIP_SPEED, + LAPTOP_STAT_TEXT_EXPLOSIVES_SPEED, + LAPTOP_STAT_TEXT_LEADERSHIP_SPEED, + LAPTOP_STAT_TEXT_MEDICAL_SPEED, + LAPTOP_STAT_TEXT_MECHANICAL_SPEED, + LAPTOP_STAT_TEXT_EXPERIENCE_SPEED, }; // Flugente: gear templates diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 7469695b91..e587df2def 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -11655,7 +11655,21 @@ STR16 szLaptopStatText[] = L"威胁对话", //L"Threaten approach", L"招募对话", //L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index dd5348c3b9..4c56a70b00 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -11664,7 +11664,21 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 53a992cd34..d2684b2845 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -11638,7 +11638,6 @@ STR16 szInteractiveActionText[] = L"This machine doesn't seem to be working.", }; -// rftr todo: add growth modifier text STR16 szLaptopStatText[] = { L"threaten effectiveness %d\n", @@ -11656,7 +11655,21 @@ STR16 szLaptopStatText[] = L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index d90b158f46..77fc295faf 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -11646,7 +11646,21 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index b324781ed0..62bc2deb02 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -11560,7 +11560,21 @@ STR16 szLaptopStatText[] = L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; // TODO.Translate diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 0ecd0f6ffd..1968ae2990 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -11655,7 +11655,21 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 98ea07117d..379f3f5a74 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -11668,7 +11668,21 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = // TODO.Translate diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index cfe62d9d9c..9b9b99e247 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -11650,7 +11650,21 @@ STR16 szLaptopStatText[] = // TODO.Translate L"Threaten approach", L"Recruit approach", - L"%s's stats will regress.", + L"Stats will regress.", + L"Fast", + L"Average", + L"Slow", + L"Health growth", + L"Strength growth", + L"Agility growth", + L"Dexterity growth", + L"Wisdom growth", + L"Marksmanship growth", + L"Explosives growth", + L"Leadership growth", + L"Medical growth", + L"Mechanical growth", + L"Experience growth", }; STR16 szGearTemplateText[] = // TODO.Translate From 9f823563b6b686bf173f69124624235b05c26fd5 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 9 Aug 2023 09:16:31 -0700 Subject: [PATCH 26/27] Add growth modifiers option --- GameSettings.cpp | 1 + GameSettings.h | 1 + Laptop/personnel.cpp | 331 +++++++++++++++++++++--------------------- Tactical/Campaign.cpp | 22 +-- 4 files changed, 180 insertions(+), 175 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index a89dbb418c..28bf115122 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1079,6 +1079,7 @@ void LoadGameExternalOptions() gGameExternalOptions.ubMercRandomExpRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_EXP_RANGE", 1, 0, 4); gGameExternalOptions.fMercRandomStartSalary = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_START_SALARY", FALSE); gGameExternalOptions.ubMercRandomStartSalaryPercentMod = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_START_SALARY_PERCENTAGE_MAX_MODIFIER", 30, 0, 100); + gGameExternalOptions.fMercGrowthModifiersEnabled = iniReader.ReadBoolean("Recruitment Settings", "MERCS_GROWTH_MODIFIERS_ENABLED", FALSE); gGameExternalOptions.fMercRandomGrowthModifiers = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS", FALSE); gGameExternalOptions.iMercRandomGrowthModifiersRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS_RANGE", 5, -50, 50); diff --git a/GameSettings.h b/GameSettings.h index cb2003e59d..735538f3b2 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -1437,6 +1437,7 @@ typedef struct UINT8 ubMercRandomStartSalaryPercentMod; + BOOLEAN fMercGrowthModifiersEnabled; BOOLEAN fMercRandomGrowthModifiers; INT16 iMercRandomGrowthModifiersRange; diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index bc68bc7c66..2d293c6cde 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2234,185 +2234,188 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) ++region; } - if (gMercProfiles[pSoldier->ubProfile].fRegresses) + if (gGameExternalOptions.fMercGrowthModifiersEnabled) { - CHAR16 sStr2[200]; - swprintf( sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES] ); - - mprintf( (INT16)( pPersonnelScreenPoints[loc].x + ( iSlot*TEXT_BOX_WIDTH ) ), ( pPersonnelScreenPoints[loc].y + 15 ), sStr2 ); - - ++loc; - ++region; - } - else - { - const int THRESHOLD_FAST = -3; // this value and below: "fast" - const int THRESHOLD_SLOW = 3; // this value and above: "slow" - int yOffset = 15; - CHAR16 statTxt[200]; - // health + if (gMercProfiles[pSoldier->ubProfile].fRegresses) { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_HEALTH_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + CHAR16 sStr2[200]; + swprintf(sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES]); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // strength - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_STRENGTH_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), sStr2); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; + ++loc; + ++region; } - // agility + else { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_AGILITY_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + const int THRESHOLD_FAST = -3; // this value and below: "fast" + const int THRESHOLD_SLOW = 3; // this value and above: "slow" + int yOffset = 15; + CHAR16 statTxt[200]; + // health + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_HEALTH_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // dexterity - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_DEXTERITY_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // strength + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_STRENGTH_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // wisdom - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_WISDOM_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // agility + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_AGILITY_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // marksmanship - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MARKSMANSHIP_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // dexterity + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_DEXTERITY_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // explosives - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPLOSIVES_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // wisdom + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_WISDOM_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // leadership - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_LEADERSHIP_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // marksmanship + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MARKSMANSHIP_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // medical - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MEDICAL_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // explosives + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPLOSIVES_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // mechanical - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MECHANICAL_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // leadership + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_LEADERSHIP_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); - yOffset += 10; - } - // exp level - { - swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPERIENCE_SPEED]); - mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // medical + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MEDICAL_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel <= THRESHOLD_FAST) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel >= THRESHOLD_SLOW) - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); - else - swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY ); - mprintf( sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt ); + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // mechanical + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MECHANICAL_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + yOffset += 10; + } + // exp level + { + swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPERIENCE_SPEED]); + mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + + if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel <= THRESHOLD_FAST) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); + else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel >= THRESHOLD_SLOW) + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); + else + swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY); + mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt); + } } } } diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 9ac10e945e..9645fd1d39 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1160,61 +1160,61 @@ UINT16 SubpointsPerPoint(UINT8 ubStat, MERCPROFILESTRUCT* pProfile) // Attributes case HEALTHAMT: usSubpointsPerPoint = HEALTH_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierLife; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierLife; usSubpointsPerPoint = max(usSubpointsPerPoint, HEALTH_SUBPOINTS_TO_IMPROVE/2); break; case AGILAMT: usSubpointsPerPoint = AGILITY_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierAgility; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierAgility; usSubpointsPerPoint = max(usSubpointsPerPoint, AGILITY_SUBPOINTS_TO_IMPROVE/2); break; case DEXTAMT: usSubpointsPerPoint = DEXTERITY_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierDexterity; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierDexterity; usSubpointsPerPoint = max(usSubpointsPerPoint, DEXTERITY_SUBPOINTS_TO_IMPROVE/2); break; case WISDOMAMT: usSubpointsPerPoint = WISDOM_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierWisdom; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierWisdom; usSubpointsPerPoint = max(usSubpointsPerPoint, WISDOM_SUBPOINTS_TO_IMPROVE/2); break; case STRAMT: usSubpointsPerPoint = STRENGTH_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierStrength; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierStrength; usSubpointsPerPoint = max(usSubpointsPerPoint, STRENGTH_SUBPOINTS_TO_IMPROVE/2); break; // Skills case MEDICALAMT: usSubpointsPerPoint = MEDICAL_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierMedical; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierMedical; usSubpointsPerPoint = max(usSubpointsPerPoint, MEDICAL_SUBPOINTS_TO_IMPROVE/2); break; case EXPLODEAMT: usSubpointsPerPoint = EXPLOSIVES_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierExplosive; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierExplosive; usSubpointsPerPoint = max(usSubpointsPerPoint, EXPLOSIVES_SUBPOINTS_TO_IMPROVE/2); break; case MECHANAMT: usSubpointsPerPoint = MECHANICAL_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierMechanical; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierMechanical; usSubpointsPerPoint = max(usSubpointsPerPoint, MECHANICAL_SUBPOINTS_TO_IMPROVE/2); break; case MARKAMT: usSubpointsPerPoint = MARKSMANSHIP_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierMarksmanship; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierMarksmanship; usSubpointsPerPoint = max(usSubpointsPerPoint, MARKSMANSHIP_SUBPOINTS_TO_IMPROVE/2); break; case LDRAMT: usSubpointsPerPoint = LEADERSHIP_SUBPOINTS_TO_IMPROVE; - usSubpointsPerPoint += pProfile->bGrowthModifierLeadership; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierLeadership; usSubpointsPerPoint = max(usSubpointsPerPoint, LEADERSHIP_SUBPOINTS_TO_IMPROVE/2); break; // Experience case EXPERAMT: usSubpointsPerPoint = LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel; - usSubpointsPerPoint += pProfile->bGrowthModifierExpLevel; + if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierExpLevel; usSubpointsPerPoint = max(usSubpointsPerPoint, LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel / 2); break; From 554a1ac5837113e15aa0ccad3ece3685de4114d9 Mon Sep 17 00:00:00 2001 From: rftrdev <102184004+rftrdev@users.noreply.github.com> Date: Wed, 9 Aug 2023 11:07:08 -0700 Subject: [PATCH 27/27] Remove #pragma --- Laptop/personnel.cpp | 1 - Tactical/Campaign.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 2d293c6cde..e2576e335c 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -1,4 +1,3 @@ -#pragma optimize("",off) #include "laptop.h" #include "personnel.h" #include "Utilities.h" diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 9645fd1d39..54d1c78c68 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1,4 +1,3 @@ -#pragma optimize("",off) #include "builddefines.h" #include #include