From 6a05d44d8504ff731a89360a259734164cd7232b Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 27 Aug 2012 20:25:50 +0000 Subject: [PATCH] - added second weapon cleaning operation to clean all guns - added missing texts - cleaned up tripwire-related code git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5538 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle Items.cpp | 15 ++++++++++----- Tactical/Item Types.h | 4 ++-- Tactical/Soldier Control.cpp | 13 +++++++------ Tactical/Soldier Control.h | 4 ++-- TileEngine/Explosion Control.cpp | 31 ++++++++++++++----------------- Utils/_ChineseText.cpp | 5 ++++- Utils/_DutchText.cpp | 5 ++++- Utils/_EnglishText.cpp | 2 +- Utils/_FrenchText.cpp | 5 ++++- Utils/_GermanText.cpp | 5 ++++- Utils/_ItalianText.cpp | 5 ++++- Utils/_PolishText.cpp | 5 ++++- Utils/_RussianText.cpp | 5 ++++- Utils/_TaiwaneseText.cpp | 5 ++++- 14 files changed, 68 insertions(+), 41 deletions(-) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index e52a1fc7..ad9b87d6 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -132,7 +132,7 @@ BOOLEAN gfJustFoundBoobyTrap = FALSE; void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ); void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel ); // added by Flugente -void CleanWeapons(); +void CleanWeapons( BOOLEAN fCleanAll ); void StartCorpseMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo, INT8 bLevel ); // added by Flugente @@ -4535,7 +4535,7 @@ void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGr DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL ); } -void CleanWeapons() +void CleanWeapons( BOOLEAN fCleanAll ) { if ( !gGameExternalOptions.fDirtSystem ) return; @@ -4553,7 +4553,7 @@ void CleanWeapons() SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ]; if ( pSoldier->bActive ) - pSoldier->CleanWeapon(); + pSoldier->CleanWeapon(fCleanAll); } else // peform action for every merc in this sector { @@ -4569,7 +4569,7 @@ void CleanWeapons() //if the merc is in this sector if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bInSector && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { - pSoldier->CleanWeapon(); + pSoldier->CleanWeapon(fCleanAll); } } } @@ -4686,7 +4686,12 @@ void TacticalFunctionSelectionMessageBoxCallBack( UINT8 ubExitValue ) SectorFillCanteens(); break; case 2: - CleanWeapons(); + // clean a single weapon + CleanWeapons(FALSE); + break; + case 3: + // clean all weapons + CleanWeapons(TRUE); break; default: break; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 1d916dd4..c6b73077 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -665,7 +665,7 @@ extern OBJECTTYPE gTempObject; #define AC_IRONSIGHT 0x00400000 //4194304 // for attachable Iron Sights #define AC_FEEDER 0x00800000 //8388608 // allow external feeding #define AC_MODPOUCH 0x01000000 //16777216 // for new modular pouches -#define AC_RIFLEGRENADE 0x02000000 //33554432 // rifle grenades are oneshot grenade launchers that launch themselves (and need bullet) +#define AC_RIFLEGRENADE 0x02000000 //33554432 // GL, needs a bullet and blocks other firing modes #define AC_MISC15 0x04000000 //67108864 #define AC_MISC16 0x08000000 //134217728 #define AC_MISC17 0x10000000 //268435456 @@ -800,7 +800,7 @@ extern OBJECTTYPE gTempObject; #define CORPSE_PANTS_BLUE 0x10000000 //268435456 #define CORPSE_PANTS_BEIGE 0x20000000 //536870912 #define CORPSE_STRIPPED 0x40000000 //1073741824 -//#define unused 0x80000000 //2147483648*/ +#define TRIPWIRE_ACTIVATED 0x80000000 //2147483648 // for tripwire activation (gets set and unset when activating tripwire) // ---------------------------------------------------------------- // replaces candamage diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index a2d8e92f..70963d33 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -14346,8 +14346,8 @@ OBJECTTYPE* SOLDIERTYPE::GetCleaningKit() return( pObj ); } -// use any cleaning kits to clean weapons in inventory -void SOLDIERTYPE::CleanWeapon() +// use cleaning kits to clean weapons in inventory. fCleanAll = TRUE: clean all eapons found, otherwise just the first one +void SOLDIERTYPE::CleanWeapon( BOOLEAN fCleanAll ) { // in turnbased, this action costs APs. remove them if possible, otherwise, return INT16 apcost = APBPConstants[AP_CLEANINGKIT]; @@ -14396,12 +14396,13 @@ void SOLDIERTYPE::CleanWeapon() // use up APs DeductPoints( this, apcost, 0, AFTERACTION_INTERRUPT ); - // only clean one weapon, we don't want to clean weapons if we didn't plan to - return; + // if fCleanAll is false, only clean one weapon + if (!fCleanAll ) + return; // get out of here if we dont have enough APs for another cleaning operation - //if ( !EnoughPoints( this, apcost, 0, TRUE ) ) - //return; + if ( !EnoughPoints( this, apcost, 0, TRUE ) ) + return; } } } diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 108fb528..1888d317 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1454,8 +1454,8 @@ public: // Flugente: return a cleaning kit from our inventory OBJECTTYPE* GetCleaningKit(); - // use any cleaning kits to clean weapons in inventory - void CleanWeapon(); + // use cleaning kits to clean weapons in inventory. fCleanAll = TRUE: clean all eapons found, otherwise just the first one + void CleanWeapon( BOOLEAN fCleanAll ); // Flugente: functions for the covert ops trait diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 48c0ee18..843bceb1 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -3676,9 +3676,8 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN // tripwire just gets activated if ( Item[pObj->usItem].tripwire == 1 ) { - // this is important - we have to check for the tripwire's temperature. - // The temperature serves as a temporary flag replacement, marking that a tripwire has already been activated, and shouldn't be activated again - if ( (*pObj)[0]->data.bTemperature < 1 ) + // this is important - we have to check wether the wire has already been activated + if ( ( (*pObj)[0]->data.sObjectFlag & TRIPWIRE_ACTIVATED ) == 0 ) { // determine this tripwire's flag UINT32 ubWireNetworkFlag = (*pObj)[0]->data.ubWireNetworkFlag; @@ -3725,10 +3724,9 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN } // Flugente hack: the tripwire will get removed in HandleExplosionQueue (it is still needed in there until the bomb gets called). - // Because of this, ActivateSurroundingTripwire wouldm normally find this wire again, a loop would occur. - // As i do not want to create an itm flag for this purpose right now (but its on my TODO-list), we set the temperature of the wire to a higher value - // (temperature for tripwire isn't needed anywhere else, so its ok) - (*pObj)[0]->data.bTemperature = 1000.0; + // Because of this, ActivateSurroundingTripwire would normally find this wire again, thus a loop would occur. + // So we mark the wire with this flag + (*pObj)[0]->data.sObjectFlag |= TRIPWIRE_ACTIVATED; // activate surrounding tripwires, unless tripwire is too much damaged and we are unlucky.. if ( (*pObj)[0]->data.objectStatus > (INT16)Random(50) ) @@ -3872,13 +3870,13 @@ void HandleExplosionQueue( void ) if ( fgunfound && pAttGun && pAttGun->exists() ) { - // Flugente 2012-06-16: I ran into a weird bug. If activating multiple guntraps, an errro would occur when placing a gun on the floor. + // Flugente 2012-06-16: I ran into a weird bug. If activating multiple guntraps, an error would occur when placing a gun on the floor. // The problem is the function GetFreeWorldItemIndex( ) in AddItemToWorld() in World Items.cpp. // It gets a free index for the item that should be placed. If there is no free index, it creates a bigger array, copies the current array into it, and then deletes the old index. // For some reason still unknown to me, this corrupts the pObj-pointer. It also corrupts the pAttGun-pointer, this is the reason I create a new object. - // I had to move some functions here to take care of that. It would be good if spmeone with more knowledge could take a look at this. + // I had to move some functions here to take care of that. It would be good if someone with more knowledge could take a look at this. - // fire with this gun, if possible. Afterwards palce it on the floor + // fire with this gun, if possible. Afterwards place it on the floor OBJECTTYPE object(*pAttGun); CheckAndFireTripwireGun( &object, sGridNo, ubLevel, (*pObj)[0]->data.misc.ubBombOwner, (*pObj)[0]->data.ubDirection ); } @@ -3896,9 +3894,9 @@ void HandleExplosionQueue( void ) } gpWorldLevelData[sGridNo].uiFlags &= ~(MAPELEMENT_ENEMY_MINE_PRESENT); } - - // we have to set the wire's temperature back to 0, otherwise tripwire will only work once - (newtripwireObject)[0]->data.bTemperature = 0; + + // delete the flag, otherwise wire will only work once + (newtripwireObject)[0]->data.sObjectFlag &= ~TRIPWIRE_ACTIVATED; // now add a tripwire item to the floor, simulating that activating tripwire deactivates it AddItemToPool( sGridNo, &newtripwireObject, 1, ubLevel, 0, -1 ); @@ -4380,10 +4378,9 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 } // Flugente hack: the tripwire will get removed in HandleExplosionQueue (it is still needed in there until the bomb gets called). - // Because of this, ActivateSurroundingTripwire wouldm normally find this wire again, a loop would occur. - // As i do not want to create an item flag for this purpose right now (but its on my TODO-list), we set the temperature of the wire to a higher value - // (temperature for tripwire isn't needed anywhere else, so its ok) - (*pObj)[0]->data.bTemperature = 1000.0; + // Because of this, ActivateSurroundingTripwire would normally find this wire again, thus a loop would occur. + // So we mark the wire with this flag + (*pObj)[0]->data.sObjectFlag |= TRIPWIRE_ACTIVATED; // activate surrounding tripwires and tripwire-activated mines, unless tripwire is too much damaged and we are unlucky.. if ( (*pObj)[0]->data.objectStatus > (INT16)Random(50) ) diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 69bc5287..a1b260d6 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -2935,7 +2935,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"生命: %d/%d\n毒性: %d/%d\n精力: %d/%d\n士气: %s\n口渴: %d%s\n饥饿: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 03414990..aeb7721d 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -2932,7 +2932,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index d924d5c5..bd9dd051 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2937,7 +2937,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // added by Flugente: decide what to do with the corpses L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 951ae453..9734510f 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -2934,7 +2934,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 33e7f9dd..41040e00 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -2938,7 +2938,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Ges.: %d/%d\nGift: %d/%d\nAusd.: %d/%d\nMoral: %s\nWasser: %d%s\nEssen: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 09a084bb..d433154d 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -2927,7 +2927,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 338fec59..79ffa1fb 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2942,7 +2942,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 77c60628..b0f14abb 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -2935,7 +2935,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface. diff --git a/Utils/_TaiwaneseText.cpp b/Utils/_TaiwaneseText.cpp index 24e1e3a9..cb3a776e 100644 --- a/Utils/_TaiwaneseText.cpp +++ b/Utils/_TaiwaneseText.cpp @@ -2936,7 +2936,10 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] = L"Health: %d/%d\nPoison: %d/%d\nEnergy: %d/%d\nMorale: %s\nWater: %d%s\nFood: %d%s", // added by Flugente: selection of a function to call in tactical - L"1 - Fill Canteens 2 - Clean Weapons 3,4 - Nothing", // TODO.Translate + L"1 - Fill Canteens 2 - Clean one gun 3 - Clean all guns 4 - Nothing", // TODO.Translate + + // added by Flugente: decide what to do with the corpses + L"1 - Decapitate 2 - Gut 3 - Take Clothes 4 - Take Body", }; //Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.