From bab3a586d7e813458ddddec1df8b22107b159676 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Fri, 30 May 2008 15:32:54 +0000 Subject: [PATCH] Added new weapon jam code from SpaceViking (think that's who wrote it). Updated the text files and moved a static phrase into the language specific files. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2207 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 6 +- Tactical/Soldier Control.cpp | 2 +- Tactical/Weapons.cpp | 194 +++++++++++++++++++---------------- Utils/Text.h | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 13 +-- Utils/_TaiwaneseText.cpp | 1 + ja2_2005Express.vcproj | 4 +- 13 files changed, 126 insertions(+), 101 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index c1be8004..43d8da9f 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -13,12 +13,12 @@ #ifdef JA2EDITOR //MAP EDITOR BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2196" }; +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2207" }; #elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Debug v1.13.2196" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.2207" }; #elif defined CRIPPLED_VERSION @@ -28,7 +28,7 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.2196" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.2207" }; #endif diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index efaee354..b93243f6 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -7936,7 +7936,7 @@ void SOLDIERTYPE::BeginSoldierClimbUpRoof( void ) //CHRISL: Disable climbing up to a roof while wearing a backpack if((UsingNewInventorySystem() == true) && this->inv[BPACKPOCKPOS].exists() == true) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Cannot climb while wearing a backpack" ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_NO_CLIMB] ); return; } INT8 bNewDirection; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 9970d3be..9911e35a 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1149,95 +1149,111 @@ void AdjustImpactByHitLocation( INT32 iImpact, UINT8 ubHitLocation, INT32 * piNe //rain extern INT8 gbCurrentRainIntensity; //end rain -BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) -{ - OBJECTTYPE * pObj; - INT32 iChance, iResult; - - // should jams apply to enemies? - if (pSoldier->flags.uiStatusFlags & SOLDIER_PC) - { - if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) ) - { - pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]); - if ((*pObj)[0]->data.gun.bGunAmmoStatus > 0) - { - // gun might jam, figure out the chance - //iChance = (80 - (*pObj)[0]->data.gun.bGunStatus); - - //rain - iChance = (80 - (*pObj)[0]->data.gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity; - //end rain - - - // CJC: removed reliability from formula... - - // jams can happen to unreliable guns "earlier" than normal or reliable ones. - //iChance = iChance - Item[pObj->usItem].bReliability * 2; - - // decrease the chance of a jam by 20% per point of reliability; - // increased by 20% per negative point... - //iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; - - //rain -// iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; // Madd: took it back out - //end rain - - if (pSoldier->bDoBurst > 1) - { - // if at bullet in a burst after the first, higher chance - iChance -= PreRandom( 80 ); - } - else - { - iChance -= PreRandom( 100 ); - } - -#ifdef TESTGUNJAM - if ( 1 ) -#else - if ((INT32) PreRandom( 100 ) < iChance || gfNextFireJam ) -#endif - { - gfNextFireJam = FALSE; - - // jam! negate the gun ammo status. - (*pObj)[0]->data.gun.bGunAmmoStatus *= -1; - - // Deduct AMMO! - DeductAmmo( pSoldier, pSoldier->ubAttackingHand ); - - TacticalCharacterDialogue( pSoldier, QUOTE_JAMMED_GUN ); - return( TRUE ); - } - } - else if ((*pObj)[0]->data.gun.bGunAmmoStatus < 0) - { - // try to unjam gun - iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[(*pObj)[0]->data.gun.usGunAmmoItem].bReliability)* 4) ); - if (iResult > 0) - { - // yay! unjammed the gun - (*pObj)[0]->data.gun.bGunAmmoStatus *= -1; - - // MECHANICAL/DEXTERITY GAIN: Unjammed a gun - StatChange( pSoldier, MECHANAMT, 5, FALSE ); - StatChange( pSoldier, DEXTAMT, 5, FALSE ); - - DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); - - // We unjammed gun, return appropriate value! - return( 255 ); - } - else - { - return( TRUE ); - } - } - } - } - return( FALSE ); -} +BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ) +{ + OBJECTTYPE * pObj; + // INT32 iChance, iResult; + + // should jams apply to enemies? + if (pSoldier->uiStatusFlags & SOLDIER_PC) + { + if ( Item[pSoldier->usAttackingWeapon].usItemClass == IC_GUN && !EXPLOSIVE_GUN( pSoldier->usAttackingWeapon ) ) + { + pObj = &(pSoldier->inv[pSoldier->ubAttackingHand]); + if (pObj->ItemData.Gun.bGunAmmoStatus > 0) + { + // Algorithm for jamming + int maxJamChance = 50; // Externalize this? + int reliability = Item[pObj->usItem].bReliability; + int condition = pObj->ItemData.Gun.bGunStatus; + int invertedBaseJamChance = condition + (reliability * 2) - + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity; + if (invertedBaseJamChance < 0) + invertedBaseJamChance = 0; + else if (invertedBaseJamChance > 100) + invertedBaseJamChance = 100; + int jamChance = 100 - (int)sqrt((double)invertedBaseJamChance * ((75.0-(int)(pSoldier->bDoBurst>1)*15) + (double)invertedBaseJamChance / 2.0)); + if (jamChance < 0) + jamChance = 0; + else if (jamChance > maxJamChance - reliability) + jamChance = maxJamChance - reliability; + + /* Old jam code + // gun might jam, figure out the chance + //iChance = (80 - pObj->bGunStatus); + + //rain + iChance = (80 - pObj->ItemData.Gun.bGunStatus) + gGameExternalOptions.ubWeaponReliabilityReductionPerRainIntensity * gbCurrentRainIntensity; + //end rain + + // CJC: removed reliability from formula... + + // jams can happen to unreliable guns "earlier" than normal or reliable ones. + //iChance = iChance - Item[pObj->usItem].bReliability * 2; + + // decrease the chance of a jam by 20% per point of reliability; + // increased by 20% per negative point... + //iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; + + //rain + // iChance = iChance * (10 - Item[pObj->usItem].bReliability * 2) / 10; // Madd: took it back out + //end rain + + if (pSoldier->bDoBurst > 1) + { + // if at bullet in a burst after the first, higher chance + iChance -= PreRandom( 80 ); + } + else + { + iChance -= PreRandom( 100 ); + } + */ +#ifdef TESTGUNJAM + if ( 1 ) +#else + if ((INT32) PreRandom( 100 ) < jamChance || gfNextFireJam ) +#endif + { + gfNextFireJam = FALSE; + + // jam! negate the gun ammo status. + pObj->ItemData.Gun.bGunAmmoStatus *= -1; + + // Deduct AMMO! + DeductAmmo( pSoldier, pSoldier->ubAttackingHand ); + + TacticalCharacterDialogue( pSoldier, QUOTE_JAMMED_GUN ); + return( TRUE ); + } + } + else if (pObj->ItemData.Gun.bGunAmmoStatus < 0) + { + // try to unjam gun + int iResult = SkillCheck( pSoldier, UNJAM_GUN_CHECK, (INT8) ((Item[pObj->usItem].bReliability + Item[pObj->ItemData.Gun.usGunAmmoItem].bReliability)* 4) ); + if (iResult > 0) + { + // yay! unjammed the gun + pObj->ItemData.Gun.bGunAmmoStatus *= -1; + + // MECHANICAL/DEXTERITY GAIN: Unjammed a gun + StatChange( pSoldier, MECHANAMT, 5, FALSE ); + StatChange( pSoldier, DEXTAMT, 5, FALSE ); + + DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); + + // We unjammed gun, return appropriate value! + return( 255 ); + } + else + { + return( TRUE ); + } + } + } + } + return( FALSE ); +} BOOLEAN OKFireWeapon( SOLDIERTYPE *pSoldier ) diff --git a/Utils/Text.h b/Utils/Text.h index 43ce851c..a7045e7e 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -1581,6 +1581,7 @@ enum NIV_ZIPPER_NO_MOVE, NIV_SELL_ALL, NIV_DELETE_ALL, + NIV_NO_CLIMB, }; #endif diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 26c0d89f..fbf796f8 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -4286,6 +4286,7 @@ STR16 NewInvMessage[] = L"Kan niet me bewegen terwijl actieve rugzakritssluiting", L"Bent zeker u u wilt alle sectorpunten verkopen?", L"Bent zeker u u wilt alle sectorpunten schr?", + L"Kan beklimmen niet terwijl het dragen van een rugzak", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index aab8e97d..1f24ce9a 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -4282,6 +4282,7 @@ STR16 NewInvMessage[] = L"Can not move while backpack zipper active", L"Are you sure you want to sell all sector items?", L"Are you sure you want to delete all sector items?", + L"Cannot climb while wearing a backpack", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 5030808b..d4ca90fe 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -4267,6 +4267,7 @@ STR16 NewInvMessage[] = L"Ne peut pas se dйplacer alors que la tirette de baluchon active", L"Кtes vous sыr vous voulez vendre tous les articles de secteur?", L"Кtes vous sыr vous voulez supprimer tous les articles de secteur?", + L"Ne peut pas s'йlever tout en utilisant un sac а dos", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index c89403c9..769d3bf9 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -4073,6 +4073,7 @@ STR16 NewInvMessage[] = L"Bewegung nicht mцglich, wдhrend ReiЯverschluss des Rucksacks offen ist", L"Sind Sie sicher, dass Sie alle Gegenstдnde im Sektor verkaufen wollen?", L"Sind Sie sicher, dass Sie alle Gegenstдnde im Sektor lцschen wollen?", + L"Kann nicht beim Tragen eines Rucksacks klettern", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index d7966801..d036a781 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -4264,6 +4264,7 @@ STR16 NewInvMessage[] = L"Non puт muoversi mentre la chiusura lampo del fagotto attiva", L"Siete sicuri voi desiderate vendere tutti gli articoli del settore?", L"Siete sicuri voi desiderate cancellare tutti gli articoli del settore?", + L"Non puт arrampicarsi mentre portano uno zaino", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index e5777982..b911139b 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -4260,6 +4260,7 @@ STR16 NewInvMessage[] = L"Can not move while backpack zipper active", L"Are you sure you want to sell all sector items?", L"Are you sure you want to delete all sector items?", + L"Cannot climb while wearing a backpack", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index ed2aa3be..9779e124 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -3387,7 +3387,7 @@ STR16 zSaveLoadText[] = L"Нормальный", L"Большой", L"Огромный", - L"Все, включая эксклюзив", + L"Все и сразу", L"Новый инвентарь, используемый в этом релизе, не работает при разрешении экрана 640х480. Измените разрешение и загрузите игру заново.", L"Новый инвентарь не работает, если выбрана по умолчанию игровая папка 'Data'.", @@ -3609,7 +3609,7 @@ STR16 gzGIOScreenText[] = L"Нормальный", L"Большой", L"Огромный", - L"Все, включая эксклюзив", + L"Все и сразу", L"Режим инвентаря", L"Классический", L"Новый вариант", @@ -3762,10 +3762,10 @@ STR16 pMessageStrings[] = L"Достигнут чит-уровень два.", //Toggling various stealth modes - L"Отряд перешел в режим скрытности.", - L"Отряд перешел в обычный режим.", - L"%s теперь в режиме скрытности.", - L"%s теперь в обычном режиме.", + L"Отряд идет тихим шагом.", + L"Отряд идет обычным шагом.", + L"%s идет тихим шагом.", + L"%s идет обычным шагом.", //Wireframes are shown through buildings to reveal doors and windows that can't otherwise be seen in //an isometric engine. You can toggle this mode freely in the game. @@ -4274,6 +4274,7 @@ STR16 NewInvMessage[] = L"Вы не можете передвигаться с открытым рюкзаком.", L"Вы уверены что находитесь в здравом уме и отвечаете за свои действия? И вы в самом деле хотите продать весь хлам этого сектора голодающему населению Арулько?", L"Вы уверены что находитесь в здравом уме и отвечаете за свои действия? И вы в самом деле хотите выбросить весь хлам, валяющийся в этом секторе?", + L"Тяжеловато будет взбираться с полным рюкзаком на крышу. Может снимем?", }; // WANNE - MP: Multiplayer messages diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index a570446d..46633a2b 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -4280,6 +4280,7 @@ STR16 NewInvMessage[] = L"Can not move while backpack zipper active", L"Are you sure you want to sell all sector items?", L"Are you sure you want to delete all sector items?", + L"Cannot climb while wearing a backpack", }; // WANNE - MP: Multiplayer messages diff --git a/ja2_2005Express.vcproj b/ja2_2005Express.vcproj index d76e6f01..13839674 100644 --- a/ja2_2005Express.vcproj +++ b/ja2_2005Express.vcproj @@ -1,7 +1,7 @@