mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +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:
+59
-57
@@ -238,7 +238,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 406:
|
||||
|
||||
// Move merc up
|
||||
if ( pSoldier->bDirection == NORTH )
|
||||
if ( pSoldier->ubDirection == NORTH )
|
||||
{
|
||||
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->sHeightAdjustment + 2 ) );
|
||||
}
|
||||
@@ -257,14 +257,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT16 sXPos, sYPos;
|
||||
|
||||
//usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->bDirection ) );
|
||||
//usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc( pSoldier->ubDirection ) );
|
||||
ConvertMapPosToWorldTileCenter( pSoldier->sTempNewGridNo, &sXPos, &sYPos );
|
||||
EVENT_SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos );
|
||||
}
|
||||
// Move two CC directions
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->ubDirection ] );
|
||||
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
// Set desired anim height!
|
||||
pSoldier->ubDesiredHeight = ANIM_CROUCH;
|
||||
@@ -324,9 +324,9 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
// CODE: SPECIALMOVE CLIMB DOWN EVENT
|
||||
// Move two C directions
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->ubDirection ] );
|
||||
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
// Adjust height
|
||||
SetSoldierHeight( pSoldier, (FLOAT)gClimbDownRoofStartDist[ pSoldier->ubBodyType ] );
|
||||
// Adjust position
|
||||
@@ -479,14 +479,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 437:
|
||||
|
||||
// CHANGE DIRECTION AND GET-UP
|
||||
//sGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( pSoldier->bDirection ) ) );
|
||||
//sGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(-1 * DirectionInc( pSoldier->ubDirection ) ) );
|
||||
//ConvertMapPosToWorldTileCenter( pSoldier->sGridNo, &sXPos, &sYPos );
|
||||
//SetSoldierPosition( pSoldier, (FLOAT)sXPos, (FLOAT)sYPos );
|
||||
|
||||
|
||||
// Reverse direction
|
||||
EVENT_SetSoldierDirection( pSoldier, gOppositeDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDirection( pSoldier, gOppositeDirection[ pSoldier->ubDirection ] );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
ChangeSoldierState( pSoldier, GETUP_FROM_ROLLOVER, 0 , FALSE );
|
||||
return( TRUE );
|
||||
@@ -558,7 +558,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
UINT16 usNewGridNo;
|
||||
INT16 sXPos, sYPos;
|
||||
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->bDirection ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||
ConvertGridNoToCenterCellXY( usNewGridNo, &sXPos, &sYPos );
|
||||
LightSpritePosition( pSoldier->iMuzFlash, (INT16)(sXPos/CELL_X_SIZE), (INT16)(sYPos/CELL_Y_SIZE));
|
||||
|
||||
@@ -583,7 +583,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 443:
|
||||
|
||||
// MOVE GUY FORWARD FOR FENCE HOP ANIMATION
|
||||
switch( pSoldier->bDirection )
|
||||
switch( pSoldier->ubDirection )
|
||||
{
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
@@ -606,9 +606,9 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
sY = CenterY( pSoldier->sForcastGridno );
|
||||
|
||||
EVENT_InternalSetSoldierPosition( pSoldier, (FLOAT) sX, (FLOAT) sY, FALSE, FALSE, FALSE );
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCDirection[ pSoldier->ubDirection ] );
|
||||
pSoldier->sZLevelOverride = -1;
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
|
||||
if ( gTacticalStatus.bBoxingState == BOXING_WAITING_FOR_PLAYER || gTacticalStatus.bBoxingState == PRE_BOXING || gTacticalStatus.bBoxingState == BOXING )
|
||||
@@ -618,7 +618,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
if ( SetOffBombsInGridNo( pSoldier->ubID, pSoldier->sGridNo, FALSE, pSoldier->bLevel ))
|
||||
{
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 445:
|
||||
|
||||
// CODE: MOVE GUY FORWARD ONE TILE, BASED ON WHERE WE ARE FACING
|
||||
switch( pSoldier->bDirection )
|
||||
switch( pSoldier->ubDirection )
|
||||
{
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
@@ -684,14 +684,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
// TRY FORWARDS...
|
||||
// FIRST GRIDNO
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
|
||||
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->bDirection, FALLFORWARD_HITDEATH_STOP ) )
|
||||
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) )
|
||||
{
|
||||
// SECOND GRIDNO
|
||||
// sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
// sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
|
||||
// if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->bDirection, FALLFORWARD_HITDEATH_STOP ) )
|
||||
// if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, FALLFORWARD_HITDEATH_STOP ) )
|
||||
{
|
||||
// ALL'S OK HERE...
|
||||
pSoldier->fTryingToFall = FALSE;
|
||||
@@ -704,17 +704,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
// ATE: Added Feb1 - can be either direction....
|
||||
if ( pSoldier->fFallClockwise )
|
||||
{
|
||||
EVENT_SetSoldierDirection( pSoldier, gOneCDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDirection( pSoldier, gOneCDirection[ pSoldier->ubDirection ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
EVENT_SetSoldierDirection( pSoldier, gOneCCDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDirection( pSoldier, gOneCCDirection[ pSoldier->ubDirection ] );
|
||||
}
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
sLastAniFrame = gusAnimInst[ pSoldier->usAnimState ][ ( pSoldier->usAniCode - 2 ) ];
|
||||
ConvertAniCodeToAniFrame( pSoldier, (INT16)( sLastAniFrame ) );
|
||||
|
||||
if ( pSoldier->bDirection == pSoldier->bStartFallDir )
|
||||
if ( pSoldier->ubDirection == pSoldier->bStartFallDir )
|
||||
{
|
||||
// GO FORWARD HERE...
|
||||
pSoldier ->fTryingToFall = FALSE;
|
||||
@@ -852,7 +852,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
||||
{
|
||||
EVENT_SetSoldierDirection( pSoldier, (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] ) );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -869,8 +869,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
//CODE: BEGINHOPFENCE
|
||||
// MOVE TWO FACGIN GRIDNOS
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
sNewGridNo = NewGridNo( (UINT16)sNewGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
pSoldier->sForcastGridno = sNewGridNo;
|
||||
break;
|
||||
|
||||
@@ -878,7 +878,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 451:
|
||||
|
||||
// CODE: MANAGE START z-buffer override
|
||||
switch( pSoldier->bDirection )
|
||||
switch( pSoldier->ubDirection )
|
||||
{
|
||||
case NORTH:
|
||||
case WEST:
|
||||
@@ -891,7 +891,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 452:
|
||||
|
||||
// CODE: MANAGE END z-buffer override
|
||||
switch( pSoldier->bDirection )
|
||||
switch( pSoldier->ubDirection )
|
||||
{
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
@@ -919,7 +919,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
// CODE: HANDLE CLIMBING ROOF,
|
||||
// Move merc up
|
||||
if ( pSoldier->bDirection == NORTH )
|
||||
if ( pSoldier->ubDirection == NORTH )
|
||||
{
|
||||
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment + gClimbUpRoofDist[ pSoldier->ubBodyType ] ) );
|
||||
}
|
||||
@@ -943,7 +943,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
// CODE: HANDLE CLIMBING ROOF,
|
||||
// Move merc DOWN
|
||||
if ( pSoldier->bDirection == NORTH )
|
||||
if ( pSoldier->ubDirection == NORTH )
|
||||
{
|
||||
SetSoldierHeight( pSoldier, (FLOAT)(pSoldier->dHeightAdjustment - gClimbUpRoofDist[ pSoldier->ubBodyType ] ) );
|
||||
}
|
||||
@@ -1040,7 +1040,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
INT16 sTempGridNo, sNewX, sNewY;
|
||||
|
||||
//Get Next GridNo;
|
||||
sTempGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( DirectionInc(pSoldier->bDirection ) ) );
|
||||
sTempGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT16)( DirectionInc(pSoldier->ubDirection ) ) );
|
||||
|
||||
// Get center XY
|
||||
ConvertGridNoToCenterCellXY( sTempGridNo, &sNewX, &sNewY );
|
||||
@@ -1049,8 +1049,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
EVENT_SetSoldierPosition( pSoldier, sNewX, sNewY );
|
||||
|
||||
// Move two CC directions
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->bDirection ] );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDirection( pSoldier, gTwoCCDirection[ pSoldier->ubDirection ] );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
// Set desired anim height!
|
||||
pSoldier->ubDesiredHeight = ANIM_CROUCH;
|
||||
@@ -1112,7 +1112,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
///CODE: FOR HELIDROP, SET DIRECTION
|
||||
EVENT_SetSoldierDirection( pSoldier, EAST );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
gfIngagedInDrop = FALSE;
|
||||
|
||||
@@ -1267,7 +1267,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
if ( pSoldier->bLife >= OKLIFE )
|
||||
{
|
||||
InternalSoldierReadyWeapon( pSoldier, pSoldier->bDirection, FALSE );
|
||||
InternalSoldierReadyWeapon( pSoldier, pSoldier->ubDirection, FALSE );
|
||||
}
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -1359,7 +1359,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
if ( pSoldier->bLife >= OKLIFE && pSoldier->bBreath > 0 && pSoldier->bLevel == 0 )
|
||||
{
|
||||
// Save old direction
|
||||
pSoldier->uiPendingActionData1 = pSoldier->bDirection;
|
||||
pSoldier->uiPendingActionData1 = pSoldier->ubDirection;
|
||||
|
||||
// If we got a head shot...more chance of turning...
|
||||
if ( pSoldier->ubHitLocation != AIM_SHOT_HEAD )
|
||||
@@ -1369,21 +1369,21 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
// 30 % chance to change direction one way
|
||||
if ( uiChance < 30 )
|
||||
{
|
||||
bNewDirection = gOneCDirection[ pSoldier->bDirection ];
|
||||
bNewDirection = gOneCDirection[ pSoldier->ubDirection ];
|
||||
}
|
||||
// 30 % chance to change direction the other way
|
||||
else if ( uiChance >= 30 && uiChance < 60 )
|
||||
{
|
||||
bNewDirection = gOneCCDirection[ pSoldier->bDirection ];
|
||||
bNewDirection = gOneCCDirection[ pSoldier->ubDirection ];
|
||||
}
|
||||
// 30 % normal....
|
||||
else
|
||||
{
|
||||
bNewDirection = pSoldier->bDirection;
|
||||
bNewDirection = pSoldier->ubDirection;
|
||||
}
|
||||
|
||||
EVENT_SetSoldierDirection( pSoldier, bNewDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
}
|
||||
else
|
||||
@@ -1402,13 +1402,13 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
// Pick evenly between both
|
||||
if ( Random( 50 ) < 25 )
|
||||
{
|
||||
bNewDirection = gOneCDirection[ pSoldier->bDirection ];
|
||||
bNewDirection = gOneCDirection[ pSoldier->ubDirection ];
|
||||
bNewDirection = gOneCDirection[ bNewDirection ];
|
||||
bNewDirection = gOneCDirection[ bNewDirection ];
|
||||
}
|
||||
else
|
||||
{
|
||||
bNewDirection = gOneCCDirection[ pSoldier->bDirection ];
|
||||
bNewDirection = gOneCCDirection[ pSoldier->ubDirection ];
|
||||
bNewDirection = gOneCCDirection[ bNewDirection ];
|
||||
bNewDirection = gOneCCDirection[ bNewDirection ];
|
||||
}
|
||||
@@ -1431,7 +1431,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
//{
|
||||
/// if ( !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) )
|
||||
// {
|
||||
/// pSoldier->bDirection = (INT8)pSoldier->uiPendingActionData1;
|
||||
/// pSoldier->ubDirection = (INT8)pSoldier->uiPendingActionData1;
|
||||
// pSoldier->bDesiredDirection = (INT8)pSoldier->uiPendingActionData1;
|
||||
// }
|
||||
//}
|
||||
@@ -1715,7 +1715,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
if ( gAnimControl[ pTSoldier->usAnimState ].ubHeight == ANIM_STAND )
|
||||
{
|
||||
// OK, stop merc....
|
||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->bDirection );
|
||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection );
|
||||
|
||||
if ( pTSoldier->bTeam != gbPlayerNum )
|
||||
{
|
||||
@@ -2620,7 +2620,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
|
||||
{
|
||||
// Dish out damage!
|
||||
EVENT_SoldierGotHit( MercPtrs[ pSoldier->uiPendingActionData4 ], TAKE_DAMAGE_BLADE, (INT16) 25, (INT16) 25, gOppositeDirection[ pSoldier->bDirection ], 50, pSoldier->ubID, 0, ANIM_PRONE, 0, 0 );
|
||||
EVENT_SoldierGotHit( MercPtrs[ pSoldier->uiPendingActionData4 ], TAKE_DAMAGE_BLADE, (INT16) 25, (INT16) 25, gOppositeDirection[ pSoldier->ubDirection ], 50, pSoldier->ubID, 0, ANIM_PRONE, 0, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2671,7 +2671,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
InternalDropBlood( pSoldier->sGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 );
|
||||
|
||||
// Move forward one gridno....
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ pSoldier->bDirection ] ) ) );
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) ) );
|
||||
|
||||
InternalDropBlood( sNewGridNo, pSoldier->bLevel, 0, (UINT8)(MAXBLOODQUANTITY), 1 );
|
||||
|
||||
@@ -3503,7 +3503,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
|
||||
// Randomly fall back or forward, if we are in the standing hit animation
|
||||
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == STANDING_BURST_HIT || pSoldier->usAnimState == RIFLE_STAND_HIT )
|
||||
{
|
||||
INT8 bTestDirection = pSoldier->bDirection;
|
||||
INT8 bTestDirection = pSoldier->ubDirection;
|
||||
BOOLEAN fForceDirection = FALSE;
|
||||
BOOLEAN fDoFallback = FALSE;
|
||||
|
||||
@@ -3561,7 +3561,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, bTestDirection );
|
||||
EVENT_SetSoldierDirection( pSoldier, bTestDirection );
|
||||
}
|
||||
ChangeToFallbackAnimation( pSoldier, pSoldier->bDirection );
|
||||
ChangeToFallbackAnimation( pSoldier, pSoldier->ubDirection );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3749,7 +3749,7 @@ BOOLEAN CheckForImproperFireGunEnd( SOLDIERTYPE *pSoldier )
|
||||
if ( Item[ pSoldier->inv[ SECONDHANDPOS ].usItem ].usItemClass != IC_GUN )
|
||||
{
|
||||
// OK, put gun down....
|
||||
InternalSoldierReadyWeapon( pSoldier, pSoldier->bDirection, TRUE );
|
||||
InternalSoldierReadyWeapon( pSoldier, pSoldier->ubDirection, TRUE );
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
@@ -3846,7 +3846,7 @@ if ( pSoldier->bLife >= OKLIFE )
|
||||
// Randomly fall back or forward, if we are in the standing hit animation
|
||||
if ( pSoldier->usAnimState == GENERIC_HIT_STAND || pSoldier->usAnimState == RIFLE_STAND_HIT )
|
||||
{
|
||||
INT8 bTestDirection = pSoldier->bDirection;
|
||||
INT8 bTestDirection = pSoldier->ubDirection;
|
||||
BOOLEAN fForceDirection = FALSE;
|
||||
BOOLEAN fDoFallback = FALSE;
|
||||
|
||||
@@ -3882,20 +3882,22 @@ if ( pSoldier->bLife >= OKLIFE )
|
||||
|
||||
#endif
|
||||
|
||||
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8 bTestDirection, UINT16 usAnimState )
|
||||
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"OKFallDirection");
|
||||
STRUCTURE_FILE_REF * pStructureFileRef;
|
||||
UINT16 usAnimSurface;
|
||||
UINT8 bOverTerrainType;
|
||||
|
||||
// How are the movement costs?
|
||||
if ( gubWorldMovementCosts[ sGridNo ][ bTestDirection ][ bLevel ] > TRAVELCOST_SHORE )
|
||||
if ( gubWorldMovementCosts[ sGridNo ][ ubTestDirection ][ bLevel ] > TRAVELCOST_SHORE )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
bOverTerrainType = GetTerrainType( sGridNo);
|
||||
//NOT ok if in water....
|
||||
if ( GetTerrainType( sGridNo ) == MED_WATER || GetTerrainType( sGridNo ) == DEEP_WATER || GetTerrainType( sGridNo ) == LOW_WATER )
|
||||
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -3922,9 +3924,9 @@ BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8
|
||||
// work now. The function is passing in an adjacent gridno but we need to place the structure
|
||||
// data in the tile BEFORE. So we take one step back in the direction opposite to bTestDirection
|
||||
// and use that gridno
|
||||
sTestGridNo = NewGridNo( sGridNo, (UINT16)( DirectionInc( gOppositeDirection[ bTestDirection ] ) ) );
|
||||
sTestGridNo = NewGridNo( sGridNo, DirectionInc( gOppositeDirection[ ubTestDirection ] ) );
|
||||
|
||||
if ( ! OkayToAddStructureToWorld( sTestGridNo, bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ bTestDirection ] ]), usStructureID ) )
|
||||
if ( ! OkayToAddStructureToWorld( sTestGridNo, bLevel, &(pStructureFileRef->pDBStructureRef[ gOneCDirection[ ubTestDirection ] ]), usStructureID ) )
|
||||
{
|
||||
// can't go in that dir!
|
||||
return( FALSE );
|
||||
@@ -4071,7 +4073,7 @@ void KickOutWheelchair( SOLDIERTYPE *pSoldier )
|
||||
INT16 sNewGridNo;
|
||||
|
||||
// Move forward one gridno....
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
|
||||
// ATE: Make sure that the gridno is unoccupied!
|
||||
if ( !NewOKDestination( pSoldier, sNewGridNo, TRUE, pSoldier->bLevel ) )
|
||||
@@ -4080,7 +4082,7 @@ void KickOutWheelchair( SOLDIERTYPE *pSoldier )
|
||||
sNewGridNo = pSoldier->sGridNo;
|
||||
}
|
||||
|
||||
EVENT_StopMerc( pSoldier, sNewGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, sNewGridNo, pSoldier->ubDirection );
|
||||
pSoldier->ubBodyType = REGMALE;
|
||||
if ( pSoldier->ubProfile == SLAY && pSoldier->bTeam == CIV_TEAM && !pSoldier->bNeutral )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user