From cb36b3db6d95cd039278024217124f543c2e68a2 Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Tue, 26 Feb 2008 02:37:23 +0000 Subject: [PATCH] -updated game version -suppressed soldier action data messages in cheat mode -enabled enemy / militia ammo choosing to be limited by coolness git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1853 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 6 +++--- Tactical/Inventory Choosing.cpp | 12 ++++++++++-- Tactical/Items.cpp | 32 ++++++++++++++++++++------------ Tactical/Items.h | 4 ++-- TacticalAI/AIMain.cpp | 2 +- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 9043ef31..e4dcf7f3 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -17,18 +17,18 @@ CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.1202" }; #elif defined CRIPPLED_VERSION -//RELEASE BUILD VERSION +//RELEASE BUILD VERSION s CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.1796" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.1797" }; #endif -CHAR8 czVersionNumber[16] = { "Build 08.02.16" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 08.02.24" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index 125b4cd6..b2fa35c4 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -659,7 +659,11 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC { usGunIndex = pp->Inv[ i ].usItem; ubChanceStandardAmmo = 100 - (bWeaponClass * -9); // weapon class is negative! - usAmmoIndex = RandomMagazine( usGunIndex, ubChanceStandardAmmo ); + usAmmoIndex = RandomMagazine( usGunIndex, ubChanceStandardAmmo, max(Item[usGunIndex].ubCoolness, HighestPlayerProgressPercentage() / 10 + 3)); + + if ( usAmmoIndex <= 0 ) + usAmmoIndex = DefaultMagazine(usGunIndex); + pp->Inv[ i ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ i ].ItemData.Gun.usGunAmmoItem = usAmmoIndex; @@ -928,7 +932,11 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC // break; //} - usAmmoIndex = RandomMagazine( &pp->Inv[HANDPOS], ubChanceStandardAmmo ); + usAmmoIndex = RandomMagazine( &pp->Inv[HANDPOS], ubChanceStandardAmmo, max(Item[usGunIndex].ubCoolness, HighestPlayerProgressPercentage() / 10 + 3 )); + + if ( usAmmoIndex <= 0 ) + usAmmoIndex = DefaultMagazine(usGunIndex); + pp->Inv[ HANDPOS ].ItemData.Gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ HANDPOS ].ItemData.Gun.usGunAmmoItem = usAmmoIndex; } diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 1b59cad7..2b091048 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -4709,7 +4709,7 @@ UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UI // increase this if any gun can have more types that this #define MAX_AMMO_TYPES_PER_GUN 24 // MADD MARKER -UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard ) +UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard, UINT8 maxCoolness ) { // Note: if any ammo items in the item table are separated from the main group, // this function will have to be rewritten to scan the item table for an item @@ -4717,10 +4717,11 @@ UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("RandomMagazine (by index)")); WEAPONTYPE * pWeapon; - UINT16 usLoop; - UINT16 usPossibleMagIndex[ MAX_AMMO_TYPES_PER_GUN ]; - UINT16 usPossibleMagCnt = 0; - UINT8 ubMagChosen; + UINT16 usLoop; + UINT16 loopItem; + UINT16 usPossibleMagIndex[ MAX_AMMO_TYPES_PER_GUN ]; + UINT16 usPossibleMagCnt = 0; + UINT8 ubMagChosen; if (!(Item[usItem].usItemClass & IC_GUN)) { @@ -4733,8 +4734,11 @@ UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard ) usLoop = 0; while ( Magazine[ usLoop ].ubCalibre != NOAMMO ) { + loopItem = MagazineClassIndexToItemType(usLoop); + if (Magazine[usLoop].ubCalibre == pWeapon->ubCalibre && - Magazine[usLoop].ubMagSize == pWeapon->ubMagSize && ItemIsLegal(MagazineClassIndexToItemType(usLoop))) + Magazine[usLoop].ubMagSize == pWeapon->ubMagSize && ItemIsLegal(loopItem) + && maxCoolness >= Item[loopItem].ubCoolness ) { // store it! (make sure array is big enough) Assert(usPossibleMagCnt < MAX_AMMO_TYPES_PER_GUN); @@ -4791,7 +4795,7 @@ UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard ) } } -UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard ) +UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard, UINT8 maxCoolness ) { // Note: if any ammo items in the item table are separated from the main group, // this function will have to be rewritten to scan the item table for an item @@ -4799,10 +4803,11 @@ UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("RandomMagazine")); WEAPONTYPE * pWeapon; - UINT16 usLoop; - UINT16 usPossibleMagIndex[ MAX_AMMO_TYPES_PER_GUN ]; - UINT16 usPossibleMagCnt = 0; - UINT8 ubMagChosen; + UINT16 usLoop; + UINT16 loopItem; + UINT16 usPossibleMagIndex[ MAX_AMMO_TYPES_PER_GUN ]; + UINT16 usPossibleMagCnt = 0; + UINT8 ubMagChosen; if (!(Item[pGun->usItem].usItemClass & IC_GUN)) { @@ -4815,8 +4820,11 @@ UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard ) usLoop = 0; while ( Magazine[ usLoop ].ubCalibre != NOAMMO ) { + loopItem = MagazineClassIndexToItemType(usLoop); + if (Magazine[usLoop].ubCalibre == pWeapon->ubCalibre && - Magazine[usLoop].ubMagSize == GetMagSize(pGun) && ItemIsLegal(MagazineClassIndexToItemType(usLoop))) + Magazine[usLoop].ubMagSize == GetMagSize(pGun) && ItemIsLegal(loopItem) + && maxCoolness >= Item[loopItem].ubCoolness ) { // store it! (make sure array is big enough) Assert(usPossibleMagCnt < MAX_AMMO_TYPES_PER_GUN); diff --git a/Tactical/Items.h b/Tactical/Items.h index 458768d9..668834c0 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -59,8 +59,8 @@ extern BOOLEAN CreateItem( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj ); extern BOOLEAN CreateItems( UINT16 usItem, INT8 bStatus, UINT8 ubNumber, OBJECTTYPE * pObj ); extern BOOLEAN CreateMoney( UINT32 uiMoney, OBJECTTYPE * pObj ); extern UINT16 DefaultMagazine( UINT16 usItem ); -UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard ); -UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard ); +UINT16 RandomMagazine( UINT16 usItem, UINT8 ubPercentStandard, UINT8 maxCoolness ); +UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard, UINT8 maxCoolness ); extern BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo ); extern BOOLEAN UnloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun); diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 0f3a2692..fe4ee853 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -1926,7 +1926,7 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier) if ( CHEATER_CHEAT_LEVEL( ) ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier %d decides action %d with data %d", pSoldier->ubID, pSoldier->bAction, pSoldier->usActionData ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Soldier %d decides action %d with data %d", pSoldier->ubID, pSoldier->bAction, pSoldier->usActionData ); } // see if we can afford to do this action