mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
- New command: On [Alt] + [N], all team members in the sector try to put on gas masks
- Fix: gasmask status was not always evaluated correctly git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8315 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -9250,30 +9250,14 @@ static int l_GetMercPtrsGroup (lua_State *L)
|
||||
}
|
||||
|
||||
static int l_WearGasMaskIfAvailable(lua_State *L)
|
||||
{
|
||||
UINT8 n = lua_gettop(L);
|
||||
int i = 0;
|
||||
UINT8 ubID = 0;
|
||||
BOOLEAN Bool = FALSE;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
{
|
||||
if ( lua_gettop( L ) >= 1 )
|
||||
{
|
||||
UINT8 ubID = lua_tointeger( L, 1 );
|
||||
|
||||
for (i= 1; i<=n; i++ )
|
||||
{
|
||||
if (i == 1 ) ubID = lua_tointeger(L,i);
|
||||
}
|
||||
|
||||
if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive)
|
||||
Bool = TRUE;
|
||||
else
|
||||
Bool = FALSE;
|
||||
|
||||
if ( Bool == TRUE )
|
||||
{
|
||||
pSoldier = MercPtrs[ ubID ];
|
||||
|
||||
if (pSoldier)
|
||||
if ( MercPtrs[ubID] && MercPtrs[ubID]->bInSector && MercPtrs[ubID]->bActive )
|
||||
{
|
||||
WearGasMaskIfAvailable(pSoldier);
|
||||
WearGasMaskIfAvailable( MercPtrs[ubID] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-10
@@ -2332,12 +2332,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
if ( (gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & ANY_SMOKE_EFFECT /* && PreRandom( 4 ) == 0*/ ) || gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS )
|
||||
{
|
||||
EXPLOSIVETYPE * pExplosive = NULL;
|
||||
INT8 bPosOfMask;
|
||||
|
||||
bPosOfMask = FindGasMask (pSoldier);
|
||||
|
||||
if(!DoesSoldierWearGasMask(pSoldier))//dnl ch40 200909
|
||||
bPosOfMask = NO_SLOT;
|
||||
BOOLEAN fWearsGasMask = DoesSoldierWearGasMask( pSoldier );
|
||||
|
||||
// WANNE: Only apply the following code for soldiers and not the ROBOT!!
|
||||
// TODO: Madd: This next section is pretty lame because it can't figure out which explosive was used to actually cause a gas effect
|
||||
@@ -2351,10 +2346,9 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
// as long as you have been affected once. This is now handled by function DishOutGasDamage() that is used below.
|
||||
if ( !AM_A_ROBOT( pSoldier ) )
|
||||
{
|
||||
|
||||
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_SMOKE )
|
||||
{
|
||||
if ( bPosOfMask == NO_SLOT ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_SMOKEGAS) )//dnl ch40 200909
|
||||
if ( !fWearsGasMask ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_SMOKEGAS) )//dnl ch40 200909
|
||||
{
|
||||
pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_SMOKE) ].ubClassIndex ]);
|
||||
}
|
||||
@@ -2363,7 +2357,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
|
||||
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_TEARGAS )
|
||||
{
|
||||
if ( bPosOfMask == NO_SLOT ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS) )
|
||||
if ( !fWearsGasMask ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_TEARGAS) )
|
||||
{
|
||||
pExplosive = &( Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_TEARGAS) ].ubClassIndex ]);
|
||||
}
|
||||
@@ -2372,7 +2366,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Overhead pExplosive: %d", pExplosive->ubType );
|
||||
if ( gpWorldLevelData[ pSoldier->sGridNo ].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_MUSTARDGAS )
|
||||
{
|
||||
if ( bPosOfMask == NO_SLOT ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS) )
|
||||
if ( !fWearsGasMask ) //&& !(pSoldier->flags.fHitByGasFlags & HIT_BY_MUSTARDGAS) )
|
||||
{
|
||||
pExplosive = &(Explosive[ Item[ GetFirstExplosiveOfType(EXPLOSV_MUSTGAS) ].ubClassIndex ]);
|
||||
}
|
||||
|
||||
@@ -3905,15 +3905,32 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
}
|
||||
break;
|
||||
|
||||
// swap sungoggles and nightgoggles
|
||||
// swap sungoggles and nightgoggles / put on gas masks
|
||||
case 'N':
|
||||
SOLDIERTYPE *pTeamSoldier;
|
||||
INT8 bLoop;
|
||||
BOOLEAN fToNightVision;
|
||||
|
||||
// HEADROCK HAM B2.8: Added call for CTRL-SHIFT-N to switch all soldiers to day/night.
|
||||
if ( fCtrl )
|
||||
// emergency command: everybody in this sector puts on gasmasks
|
||||
if ( fAlt )
|
||||
{
|
||||
for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++ )
|
||||
{
|
||||
if ( !AM_A_ROBOT( pTeamSoldier ) && pTeamSoldier->stats.bLife >= OKLIFE && (pTeamSoldier->sSectorX == gWorldSectorX) && (pTeamSoldier->sSectorY == gWorldSectorY) && (pTeamSoldier->bSectorZ == gbWorldSectorZ) )
|
||||
{
|
||||
WearGasMaskIfAvailable( pTeamSoldier );
|
||||
}
|
||||
}
|
||||
|
||||
// redraw panels
|
||||
fCharacterInfoPanelDirty = TRUE;
|
||||
fTeamPanelDirty = TRUE;
|
||||
fInterfacePanelDirty = DIRTYLEVEL2;
|
||||
}
|
||||
// HEADROCK HAM B2.8: Added call for CTRL-SHIFT-N to switch all soldiers to day/night.
|
||||
else if ( fCtrl )
|
||||
{
|
||||
BOOLEAN fToNightVision;
|
||||
|
||||
for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++)
|
||||
{
|
||||
if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) )
|
||||
|
||||
@@ -2063,6 +2063,13 @@ BOOLEAN WearGasMaskIfAvailable( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
|
||||
RearrangePocket( pSoldier, bSlot, bNewSlot, TRUE );
|
||||
|
||||
if ( pSoldier->bTeam == gbPlayerNum )
|
||||
{
|
||||
pSoldier->DeleteSoldierLight( );
|
||||
pSoldier->PositionSoldierLight( );
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "Reinforcement.h" // added by Flugente
|
||||
#include "Town Militia.h" // added by Flugente
|
||||
#include "Queen Command.h" // added by Flugente
|
||||
#include "Explosion Control.h" // added by Flugente for GASMASK_MIN_STATUS
|
||||
#endif
|
||||
|
||||
// anv: for enemy taunts
|
||||
@@ -2161,7 +2162,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE *
|
||||
iBreathDamage /= 2; // reduce effective breath damage by 1/2
|
||||
|
||||
bSlot = FindGasMask(pOpponent); //FindObj( pOpponent, GASMASK );
|
||||
if ((bSlot == HEAD1POS || bSlot == HEAD2POS || bSlot == HELMETPOS) && pSoldier->inv[bSlot][0]->data.objectStatus >= 70)
|
||||
if ( (bSlot == HEAD1POS || bSlot == HEAD2POS || bSlot == HELMETPOS) && pSoldier->inv[bSlot][0]->data.objectStatus >= GASMASK_MIN_STATUS )
|
||||
{
|
||||
// take condition of the gas mask into account - it could be leaking
|
||||
iBreathDamage = (iBreathDamage * (100 - pOpponent->inv[bSlot][0]->data.objectStatus)) / 100;
|
||||
|
||||
@@ -16,38 +16,10 @@ extern SECTOR_EXT_DATA SectorExternalData[256][4];
|
||||
|
||||
void CallAvailableEnemiesTo( INT32 sGridNo )
|
||||
{
|
||||
INT32 iLoop;
|
||||
INT32 iLoop2;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
|
||||
// All enemy teams become aware of a very important "noise" coming from here!
|
||||
for (iLoop = 0; iLoop < LAST_TEAM; iLoop++)
|
||||
for ( INT32 iLoop = 0; iLoop < LAST_TEAM; ++iLoop )
|
||||
{
|
||||
// if this team is active
|
||||
if (gTacticalStatus.Team[iLoop].bTeamActive)
|
||||
{
|
||||
// if this team is computer-controlled, and isn't the CIVILIAN "team"
|
||||
if (!(gTacticalStatus.Team[iLoop].bHuman) && (iLoop != CIV_TEAM))
|
||||
{
|
||||
// make this team (publicly) aware of the "noise"
|
||||
gsPublicNoiseGridNo[iLoop] = sGridNo;
|
||||
gubPublicNoiseVolume[iLoop] = MAX_MISC_NOISE_DURATION;
|
||||
|
||||
// new situation for everyone;
|
||||
iLoop2 = gTacticalStatus.Team[ iLoop ].bFirstID;
|
||||
for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ iLoop ].bLastID; iLoop2++, pSoldier++ )
|
||||
{
|
||||
if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE)
|
||||
{
|
||||
SetNewSituation( pSoldier );
|
||||
WearGasMaskIfAvailable( pSoldier );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CallAvailableTeamEnemiesTo( sGridNo, iLoop );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +49,6 @@ void CallAvailableTeamEnemiesTo( INT32 sGridNo, INT8 bTeam )
|
||||
WearGasMaskIfAvailable( pSoldier );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "Soldier macros.h"
|
||||
#include "Render Fun.h"
|
||||
#include "Soldier Functions.h" // added by Flugente
|
||||
#endif
|
||||
#include "connect.h"
|
||||
//forward declarations of common classes to eliminate includes
|
||||
@@ -87,10 +88,11 @@ int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubPathMode,
|
||||
|
||||
//Madd: added to prevent people from running into gas and fire
|
||||
if ( (gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS)) &&
|
||||
FindGasMask(pSoldier) == NO_SLOT )
|
||||
!DoesSoldierWearGasMask( pSoldier ) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
if ( gpWorldLevelData[sGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS )
|
||||
{
|
||||
return( FALSE );
|
||||
|
||||
Reference in New Issue
Block a user