mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fixed buffer overrun for LUA strings
Made direction variables more consistent as unsigned chars. Several function prototypes updated for this. Many memory leaks plugged: External options, video overlays, laptop file lists, tactical message queue, strategic pathing, autobandage, merc hiring, detailed placements, crate in Drassen, tactical placement New functions and attributes for soldiers in LUA (still for debugging at best): Soldier.APs (current APs), Soldier.changestance (changes stance, uses game heights) File catalog ignores .SVN directories (game load speedup) Fix CTD in mouse regions JA2 window now refuses to move to negative coords Checks to prevent DirectX-related infinite loops due to minimizing and task switching Invading enemies should now appear on the borders even when reinforcements disabled in .ini Suppression should no longer work on mercs in medium water Infant/Young creatures use restored spit instead of Molotov Creatures begin with their 'guns' (spit) 'locked and loaded' (cartridge in chamber) Further fix to AXP and AlaarDB's weapon ready check: Now 'firing' is always counted as 'ready'. Prevent mercs from falling and flying back through obstacles Check whether battle group is even set before testing its location for battle setup Burst spread locations now limited to 6, the limit within the soldier struct Extra burst spread locations zeroed out so that they aren't used unless necessary Spread code now only shoots at locations in the spread, and will shoot at all 6 Only mercs in the sector where autobandage happens will be made to stand up after it's done Throwing a grenade at the tail of the plane in Drassen should not result in a CTD Reset attack busy count when loading a new sector git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1347 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+22
-22
@@ -2023,13 +2023,13 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
{
|
||||
if ( pSoldier2->bActive )
|
||||
{
|
||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
|
||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
|
||||
(*pfKeepMoving) = FALSE;
|
||||
@@ -2049,7 +2049,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
if (sMineGridNo != NOWHERE)
|
||||
{
|
||||
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
(*pfKeepMoving) = FALSE;
|
||||
|
||||
if (pSoldier->bSide != 0)
|
||||
@@ -2179,7 +2179,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
{
|
||||
if ( pExplosive )
|
||||
{
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
fDontContinue = TRUE;
|
||||
|
||||
DishOutGasDamage( pSoldier, pExplosive, TRUE, FALSE,
|
||||
@@ -2215,7 +2215,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
}
|
||||
|
||||
if ( (pSoldier->bBlindedCounter > 0) && (pSoldier->usAnimState == RUNNING) && (Random( 5 ) == 0) &&
|
||||
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
|
||||
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) )
|
||||
{
|
||||
// 20% chance of falling over!
|
||||
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
|
||||
@@ -2228,7 +2228,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
return( FALSE );
|
||||
}
|
||||
else if ( ( GetDrunkLevel( pSoldier ) == DRUNK ) && (Random( 5 ) == 0) &&
|
||||
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->bDirection ) ), pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
|
||||
OKFallDirection( pSoldier, (INT16) (pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection ) ), pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) )
|
||||
{
|
||||
// 20% chance of falling over!
|
||||
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
|
||||
@@ -2255,7 +2255,7 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE
|
||||
pSoldier->ubNumTilesMovesSinceLastForget = 0;
|
||||
|
||||
TacticalCharacterDialogue( pSoldier, QUOTE_PERSONALITY_TRAIT );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
if (pSoldier->bActionPoints > 0)
|
||||
{
|
||||
pSoldier->bActionPoints -= (INT8) (Random( pSoldier->bActionPoints ) + 1);
|
||||
@@ -2373,7 +2373,7 @@ void HandleMaryArrival( SOLDIERTYPE * pSoldier )
|
||||
// Mary has arrived
|
||||
SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED );
|
||||
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
TriggerNPCRecord( MARY, 13 );
|
||||
}
|
||||
@@ -2417,12 +2417,12 @@ void HandleJohnArrival( SOLDIERTYPE * pSoldier )
|
||||
|
||||
SetFactTrue( FACT_MARY_OR_JOHN_ARRIVED );
|
||||
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
// if Mary is alive/dead
|
||||
if ( pSoldier2 )
|
||||
{
|
||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
|
||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection );
|
||||
TriggerNPCRecord( JOHN, 13 );
|
||||
}
|
||||
else
|
||||
@@ -2519,7 +2519,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
||||
if (SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ) )
|
||||
{
|
||||
(*pfKeepMoving) = FALSE;
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -2615,13 +2615,13 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
||||
{
|
||||
if ( pSoldier2->bActive )
|
||||
{
|
||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->bDirection );
|
||||
EVENT_StopMerc( pSoldier2, pSoldier2->sGridNo, pSoldier2->ubDirection );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
|
||||
(*pfKeepMoving) = FALSE;
|
||||
@@ -2641,7 +2641,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
||||
if (sMineGridNo != NOWHERE)
|
||||
{
|
||||
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
(*pfKeepMoving) = FALSE;
|
||||
|
||||
gpWorldLevelData[ sMineGridNo ].uiFlags |= MAPELEMENT_ENEMY_MINE_PRESENT;
|
||||
@@ -2668,7 +2668,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
||||
if (PythSpacesAway( pSoldier->sGridNo, 8842 ) < 11)
|
||||
{
|
||||
// Skyrider has arrived!
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
SetFactTrue( FACT_SKYRIDER_CLOSE_TO_CHOPPER );
|
||||
TriggerNPCRecord( SKYRIDER, 15 );
|
||||
SetUpHelicopterForPlayer( 13, MAP_ROW_B );
|
||||
@@ -2698,7 +2698,7 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving )
|
||||
// if Joey walks near Martha then trigger Martha record 7
|
||||
if ( CheckFact( FACT_JOEY_NEAR_MARTHA, 0 ) )
|
||||
{
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
TriggerNPCRecord( JOEY, 9 );
|
||||
}
|
||||
}
|
||||
@@ -4603,7 +4603,7 @@ INT16 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pubDirect
|
||||
// Set default direction
|
||||
if (pubDirection)
|
||||
{
|
||||
*pubDirection = pSoldier->bDirection;
|
||||
*pubDirection = pSoldier->ubDirection;
|
||||
}
|
||||
|
||||
// CHECK IF WE WANT TO FORCE GRIDNO TO PERSON
|
||||
@@ -4896,7 +4896,7 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub
|
||||
// CHECK IF IT'S THE SAME ONE AS WE'RE ON, IF SO, RETURN THAT!
|
||||
if ( pSoldier->sGridNo == sGridNo )
|
||||
{
|
||||
*pubDirection = pSoldier->bDirection;
|
||||
*pubDirection = pSoldier->ubDirection;
|
||||
return( sGridNo );
|
||||
}
|
||||
|
||||
@@ -5023,7 +5023,7 @@ INT16 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 *pub
|
||||
{
|
||||
(*pubDirection) = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||
}
|
||||
//*pubDirection = pSoldier->bDirection;
|
||||
//*pubDirection = pSoldier->ubDirection;
|
||||
return( sSpot );
|
||||
}
|
||||
|
||||
@@ -5417,7 +5417,7 @@ void CommonEnterCombatModeCode( )
|
||||
pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_MULTIPLE_CREATURES);
|
||||
|
||||
// Hault!
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
// END AI actions
|
||||
CancelAIAction( pSoldier, TRUE );
|
||||
@@ -7053,7 +7053,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
|
||||
}
|
||||
break;
|
||||
default: // standing!
|
||||
if (pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == DEEP_WATER)
|
||||
if ( MercInWater( pSoldier ))
|
||||
{
|
||||
// can't change stance here!
|
||||
break;
|
||||
@@ -7900,7 +7900,7 @@ void CencelAllActionsForTimeCompression( void )
|
||||
if ( pSoldier->bInSector )
|
||||
{
|
||||
// Hault!
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
// END AI actions
|
||||
CancelAIAction( pSoldier, TRUE );
|
||||
|
||||
Reference in New Issue
Block a user