- 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
This commit is contained in:
Flugente
2012-08-27 20:25:50 +00:00
parent 2ebe96ca59
commit 6a05d44d85
14 changed files with 68 additions and 41 deletions
+10 -5
View File
@@ -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;
+2 -2
View File
@@ -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
+7 -6
View File
@@ -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;
}
}
}
+2 -2
View File
@@ -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
+14 -17
View File
@@ -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) )
+4 -1
View File
@@ -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.
+4 -1
View File
@@ -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.
+1 -1
View File
@@ -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",
+4 -1
View File
@@ -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.
+4 -1
View File
@@ -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.
+4 -1
View File
@@ -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.
+4 -1
View File
@@ -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.
+4 -1
View File
@@ -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.
+4 -1
View File
@@ -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.