mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +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:
@@ -456,7 +456,8 @@ void AutoBandage( BOOLEAN fStart )
|
||||
cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
|
||||
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pSoldier++)
|
||||
{
|
||||
if ( pSoldier->bActive )
|
||||
// 0verhaul: Make sure the merc is also in the sector before making him stand up!
|
||||
if ( pSoldier->bActive && pSoldier->bInSector )
|
||||
{
|
||||
ActionDone( pSoldier );
|
||||
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
|
||||
@@ -523,7 +524,12 @@ void AutoBandage( BOOLEAN fStart )
|
||||
DoScreenIndependantMessageBox(pDoctorWarningString[ 1 ], MSG_BOX_FLAG_OK, NULL );
|
||||
gfAutoBandageFailed = FALSE;
|
||||
}
|
||||
|
||||
// Memory cleanup!
|
||||
MemFree( sAutoBandageString);
|
||||
sAutoBandageString = NULL;
|
||||
}
|
||||
|
||||
guiAutoBandageSeconds = 0;
|
||||
|
||||
ResetAllMercSpeeds( );
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ void BoxingPlayerDisqualified( SOLDIERTYPE * pOffender, INT8 bReason )
|
||||
{
|
||||
if (bReason == BOXER_OUT_OF_RING || bReason == NON_BOXER_IN_RING)
|
||||
{
|
||||
EVENT_StopMerc( pOffender, pOffender->sGridNo, pOffender->bDirection );
|
||||
EVENT_StopMerc( pOffender, pOffender->sGridNo, pOffender->ubDirection );
|
||||
}
|
||||
SetBoxingState( DISQUALIFIED );
|
||||
TriggerNPCRecord( DARREN, 21 );
|
||||
|
||||
@@ -437,7 +437,7 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT16 sGridNo, INT
|
||||
{
|
||||
// gTacticalStatus.ubAttackBusyCount++;
|
||||
DebugAttackBusy( "Killing off a queen ally.\n");
|
||||
EVENT_SoldierGotHit( pTeamSoldier, 0, 10000, 0, pTeamSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE );
|
||||
EVENT_SoldierGotHit( pTeamSoldier, 0, 10000, 0, pTeamSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile()
|
||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||
|
||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
||||
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||
@@ -332,7 +332,7 @@ BOOLEAN LoadEnemySoldiersFromTempFile()
|
||||
curr->pDetailedPlacement->sSectorX * 7 -
|
||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||
curr->pDetailedPlacement->bTeam * 7 +
|
||||
curr->pDetailedPlacement->bDirection * 5 +
|
||||
curr->pDetailedPlacement->ubDirection * 5 +
|
||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||
3;
|
||||
@@ -519,7 +519,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
||||
curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ;
|
||||
curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass;
|
||||
curr->pDetailedPlacement->bTeam = pSoldier->bTeam;
|
||||
curr->pDetailedPlacement->bDirection = pSoldier->bDirection;
|
||||
curr->pDetailedPlacement->ubDirection = pSoldier->ubDirection;
|
||||
|
||||
//we don't want the player to think that all the enemies start in the exact position when we
|
||||
//left the map, so randomize the start locations either current position or original position.
|
||||
@@ -729,7 +729,7 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto
|
||||
curr->pDetailedPlacement->sSectorX * 7 -
|
||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||
curr->pDetailedPlacement->bTeam * 7 +
|
||||
curr->pDetailedPlacement->bDirection * 5 +
|
||||
curr->pDetailedPlacement->ubDirection * 5 +
|
||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||
3;
|
||||
@@ -1016,7 +1016,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile()
|
||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||
|
||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
||||
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||
@@ -1059,7 +1059,7 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile()
|
||||
curr->pDetailedPlacement->sSectorX * 7 -
|
||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||
curr->pDetailedPlacement->bTeam * 7 +
|
||||
curr->pDetailedPlacement->bDirection * 5 +
|
||||
curr->pDetailedPlacement->ubDirection * 5 +
|
||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||
3;
|
||||
@@ -1376,7 +1376,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile()
|
||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||
|
||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
||||
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||
@@ -1419,7 +1419,7 @@ BOOLEAN NewWayOfLoadingCiviliansFromTempFile()
|
||||
curr->pDetailedPlacement->sSectorX * 7 -
|
||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||
curr->pDetailedPlacement->bTeam * 7 +
|
||||
curr->pDetailedPlacement->bDirection * 5 +
|
||||
curr->pDetailedPlacement->ubDirection * 5 +
|
||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||
3;
|
||||
@@ -1614,7 +1614,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY
|
||||
curr->pDetailedPlacement->bSectorZ = pSoldier->bSectorZ;
|
||||
curr->pDetailedPlacement->ubSoldierClass = pSoldier->ubSoldierClass;
|
||||
curr->pDetailedPlacement->bTeam = pSoldier->bTeam;
|
||||
curr->pDetailedPlacement->bDirection = pSoldier->bDirection;
|
||||
curr->pDetailedPlacement->ubDirection = pSoldier->ubDirection;
|
||||
|
||||
//we don't want the player to think that all the enemies start in the exact position when we
|
||||
//left the map, so randomize the start locations either current position or original position.
|
||||
@@ -1807,7 +1807,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY
|
||||
curr->pDetailedPlacement->sSectorX * 7 -
|
||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||
curr->pDetailedPlacement->bTeam * 7 +
|
||||
curr->pDetailedPlacement->bDirection * 5 +
|
||||
curr->pDetailedPlacement->ubDirection * 5 +
|
||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||
3;
|
||||
@@ -2073,7 +2073,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile(
|
||||
*curr->pDetailedPlacement = tempDetailedPlacement;
|
||||
|
||||
curr->pBasicPlacement->fPriorityExistance = TRUE;
|
||||
curr->pBasicPlacement->bDirection = curr->pDetailedPlacement->bDirection;
|
||||
curr->pBasicPlacement->ubDirection = curr->pDetailedPlacement->ubDirection;
|
||||
curr->pBasicPlacement->bOrders = curr->pDetailedPlacement->bOrders;
|
||||
curr->pBasicPlacement->bAttitude = curr->pDetailedPlacement->bAttitude;
|
||||
curr->pBasicPlacement->bBodyType = curr->pDetailedPlacement->bBodyType;
|
||||
@@ -2116,7 +2116,7 @@ BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile(
|
||||
curr->pDetailedPlacement->sSectorX * 7 -
|
||||
curr->pDetailedPlacement->ubSoldierClass * 4 +
|
||||
curr->pDetailedPlacement->bTeam * 7 +
|
||||
curr->pDetailedPlacement->bDirection * 5 +
|
||||
curr->pDetailedPlacement->ubDirection * 5 +
|
||||
curr->pDetailedPlacement->fOnRoof * 17 +
|
||||
curr->pDetailedPlacement->sInsertionGridNo * 1 +
|
||||
3;
|
||||
|
||||
@@ -307,7 +307,7 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U
|
||||
if ( pDoorStatus && (pDoorStatus->ubFlags & DOOR_BUSY) )
|
||||
{
|
||||
// Send this guy into stationary stance....
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
if ( pSoldier->bTeam == gbPlayerNum )
|
||||
{
|
||||
|
||||
@@ -2152,7 +2152,7 @@ OBJECTTYPE* InternalAddItemToPool( INT16 *psGridNo, OBJECTTYPE *pObject, INT8 bV
|
||||
// IF SO, DONT'T ADD!
|
||||
bTerrainID = GetTerrainType( *psGridNo );
|
||||
|
||||
if ( bTerrainID == DEEP_WATER || bTerrainID == LOW_WATER || bTerrainID == MED_WATER )
|
||||
if ( TERRAIN_IS_WATER( bTerrainID) )
|
||||
{
|
||||
// if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS )
|
||||
if ( Item[ pObject->usItem ].sinks )
|
||||
|
||||
@@ -115,7 +115,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID )
|
||||
bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ];
|
||||
|
||||
// Set direction
|
||||
pPlanSoldier->bDirection = bDirection;
|
||||
pPlanSoldier->ubDirection = bDirection;
|
||||
pPlanSoldier->bDesiredDirection = bDirection;
|
||||
|
||||
// Set walking animation
|
||||
@@ -194,7 +194,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID )
|
||||
bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ];
|
||||
|
||||
// Set direction
|
||||
pPlanSoldier->bDirection = bDirection;
|
||||
pPlanSoldier->ubDirection = bDirection;
|
||||
pPlanSoldier->bDesiredDirection = bDirection;
|
||||
|
||||
// Set walking animation
|
||||
@@ -220,7 +220,7 @@ BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID )
|
||||
bDirection = (INT8)GetDirectionFromGridNo( sGridNo, gpUIPlannedSoldier );
|
||||
|
||||
// Set direction
|
||||
gpUIPlannedSoldier->bDirection = bDirection;
|
||||
gpUIPlannedSoldier->ubDirection = bDirection;
|
||||
gpUIPlannedSoldier->bDesiredDirection = bDirection;
|
||||
|
||||
// Set to shooting animation
|
||||
|
||||
+11
-12
@@ -85,6 +85,7 @@
|
||||
#include "qarray.h"
|
||||
#include "environment.h"
|
||||
#include "Map Information.h"
|
||||
#include "Soldier Control.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -246,8 +247,6 @@ void SetUIbasedOnStance( SOLDIERTYPE *pSoldier, INT8 bNewStance );
|
||||
INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, UINT16 usMapPos, UINT32 uiFlags );
|
||||
INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT16 usMapPos, BOOLEAN fUseOKCursor, BOOLEAN fItemsOnlyIfOnIntTiles );
|
||||
|
||||
extern void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState );
|
||||
|
||||
extern BOOLEAN gfExitDebugScreen;
|
||||
extern INT8 gCurDebugPage;
|
||||
extern BOOLEAN gfGetNewPathThroughPeople;
|
||||
@@ -1238,7 +1237,7 @@ UINT32 UIHandleTestHit( UI_EVENT *pUIEvent )
|
||||
|
||||
// gTacticalStatus.ubAttackBusyCount++;
|
||||
DebugAttackBusy( "Testing a hit.\n" );
|
||||
EVENT_SoldierGotHit( pSoldier, 1, bDamage, 10, pSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE );
|
||||
EVENT_SoldierGotHit( pSoldier, 1, bDamage, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE );
|
||||
// callahan update end - put everything as it was
|
||||
}
|
||||
return( GAME_SCREEN );
|
||||
@@ -2136,7 +2135,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent )
|
||||
// IF we are on a basic level...(temp)
|
||||
if ( pSoldier->bLevel == 0 )
|
||||
{
|
||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||
{
|
||||
ubNearHeigherLevel = TRUE;
|
||||
}
|
||||
@@ -2145,7 +2144,7 @@ UINT32 UIHandleMAdjustStanceMode( UI_EVENT *pUIEvent )
|
||||
// IF we are higher...
|
||||
if ( pSoldier->bLevel > 0 )
|
||||
{
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||
{
|
||||
ubNearLowerLevel = TRUE;
|
||||
}
|
||||
@@ -3000,7 +2999,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU
|
||||
if ( pSoldier->bLevel == 0 )
|
||||
{
|
||||
// See if we are not in a building!
|
||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||
{
|
||||
*pfGoUp = TRUE;
|
||||
}
|
||||
@@ -3009,7 +3008,7 @@ void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoU
|
||||
// IF we are higher...
|
||||
if ( pSoldier->bLevel > 0 )
|
||||
{
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) )
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) )
|
||||
{
|
||||
*pfGoDown = TRUE;
|
||||
}
|
||||
@@ -4571,7 +4570,7 @@ UINT32 UIHandleLCOnTerrain( UI_EVENT *pUIEvent )
|
||||
sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
|
||||
|
||||
// Set # of APs
|
||||
if ( sFacingDir != pSoldier->bDirection )
|
||||
if ( sFacingDir != pSoldier->ubDirection )
|
||||
{
|
||||
gsCurrentActionPoints = GetAPsToLook( pSoldier );
|
||||
gfUIHandleShowMoveGrid = FALSE;
|
||||
@@ -4627,7 +4626,7 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos )
|
||||
// Get direction from mouse pos
|
||||
sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
|
||||
|
||||
if ( sFacingDir != pSoldier->bDirection )
|
||||
if ( sFacingDir != pSoldier->ubDirection )
|
||||
{
|
||||
sAPCost = GetAPsToLook( pSoldier );
|
||||
|
||||
@@ -5341,7 +5340,7 @@ UINT32 UIHandleJumpOver( UI_EVENT *pUIEvent )
|
||||
{
|
||||
SOLDIERTYPE *pSoldier;
|
||||
UINT16 usMapPos;
|
||||
INT8 bDirection;
|
||||
UINT8 ubDirection;
|
||||
|
||||
// Here, first get map screen
|
||||
if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
||||
@@ -5366,11 +5365,11 @@ UINT32 UIHandleJumpOver( UI_EVENT *pUIEvent )
|
||||
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
||||
|
||||
// Get direction to goto....
|
||||
bDirection = (INT8)GetDirectionFromGridNo( usMapPos, pSoldier );
|
||||
ubDirection = GetDirectionFromGridNo( usMapPos, pSoldier );
|
||||
|
||||
|
||||
pSoldier->fDontChargeTurningAPs = TRUE;
|
||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, bDirection, FALSE, pSoldier->usAnimState );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubDirection);
|
||||
pSoldier->fTurningUntilDone = TRUE;
|
||||
// ATE: Reset flag to go back to prone...
|
||||
//pSoldier->fTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
|
||||
|
||||
@@ -1775,7 +1775,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
// see if we are facing this person
|
||||
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(pSoldier2->sGridNo),CenterY(pSoldier2->sGridNo));
|
||||
// if not already facing in that direction,
|
||||
if (pSoldier->bDirection != ubDesiredMercDir)
|
||||
if (pSoldier->ubDirection != ubDesiredMercDir)
|
||||
{
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir );
|
||||
}
|
||||
@@ -1961,7 +1961,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE );
|
||||
if (pSoldier && pSoldier->inv[HANDPOS].usItem != NOTHING)
|
||||
{
|
||||
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->bDirection );
|
||||
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection );
|
||||
SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE );
|
||||
}
|
||||
break;
|
||||
@@ -2226,7 +2226,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
if (bItemIn != NO_SLOT && bItemIn != HANDPOS)
|
||||
{
|
||||
SwapObjs( &(pSoldier->inv[HANDPOS]), &(pSoldier->inv[bItemIn]) );
|
||||
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->bDirection );
|
||||
sGridNo = pSoldier->sGridNo + DirectionInc( pSoldier->ubDirection );
|
||||
SoldierReadyWeapon( pSoldier, (INT16) (sGridNo % WORLD_COLS), (INT16) (sGridNo / WORLD_COLS), FALSE );
|
||||
}
|
||||
// fall through so that the person faces the nearest merc!
|
||||
@@ -2240,7 +2240,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
// see if we are facing this person
|
||||
ubDesiredMercDir = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sGridNo),CenterY(sGridNo));
|
||||
// if not already facing in that direction,
|
||||
if (pSoldier->bDirection != ubDesiredMercDir)
|
||||
if (pSoldier->ubDirection != ubDesiredMercDir)
|
||||
{
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubDesiredMercDir );
|
||||
}
|
||||
@@ -2395,7 +2395,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
|
||||
if (pSoldier)
|
||||
{
|
||||
DeleteTalkingMenu();
|
||||
EVENT_SoldierGotHit( pSoldier, 1, 100, 10, pSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE );
|
||||
EVENT_SoldierGotHit( pSoldier, 1, 100, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -4455,7 +4455,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo )
|
||||
bTargetDirection = (INT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSrcGridNo );
|
||||
|
||||
// Look 3 directions Clockwise from what we are facing....
|
||||
bDirection = pSoldier->bDirection;
|
||||
bDirection = pSoldier->ubDirection;
|
||||
|
||||
for ( cnt = 0; cnt < 3; cnt++ )
|
||||
{
|
||||
@@ -4468,7 +4468,7 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo )
|
||||
}
|
||||
|
||||
// Look 3 directions CounterClockwise from what we are facing....
|
||||
bDirection = pSoldier->bDirection;
|
||||
bDirection = pSoldier->ubDirection;
|
||||
|
||||
for ( cnt = 0; cnt < 3; cnt++ )
|
||||
{
|
||||
@@ -4826,7 +4826,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos )
|
||||
}
|
||||
|
||||
// Don't allow if our soldier is a # of things...
|
||||
if ( AM_AN_EPC( gpItemPointerSoldier ) || gpItemPointerSoldier->bLife < OKLIFE || gpItemPointerSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( AM_AN_EPC( gpItemPointerSoldier ) || gpItemPointerSoldier->bLife < OKLIFE || MercInDeepWater( gpItemPointerSoldier) )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -5130,7 +5130,7 @@ BOOLEAN HandleItemPointerClick( UINT16 usMapPos )
|
||||
ubFacingDirection = (UINT8)GetDirectionFromGridNo( gpItemPointerSoldier->sGridNo, pSoldier );
|
||||
|
||||
// Stop merc first....
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
// WANNE: Also turn merc if he is crouched and he passes an item
|
||||
if ( !MercInWater( pSoldier ) )
|
||||
|
||||
@@ -900,7 +900,7 @@ void UpdateSMPanel( )
|
||||
}
|
||||
}
|
||||
|
||||
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bDirection, &bDirection ) )
|
||||
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) )
|
||||
{
|
||||
EnableButton( iSMPanelButtons[ CLIMB_BUTTON ] );
|
||||
}
|
||||
@@ -3140,7 +3140,7 @@ void BtnClimbCallback(GUI_BUTTON *btn,INT32 reason)
|
||||
BeginSoldierClimbUpRoof( gpSMCurrentMerc );
|
||||
}
|
||||
|
||||
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->bDirection, &bDirection ) )
|
||||
if ( FindFenceJumpDirection( gpSMCurrentMerc, gpSMCurrentMerc->sGridNo, gpSMCurrentMerc->ubDirection, &bDirection ) )
|
||||
{
|
||||
BeginSoldierClimbFence( gpSMCurrentMerc );
|
||||
}
|
||||
|
||||
@@ -586,10 +586,10 @@ typedef enum
|
||||
BIG_TEAR_GAS,
|
||||
SMALL_CREATURE_GAS,
|
||||
LARGE_CREATURE_GAS,
|
||||
VERY_SMALL_CREATURE_GAS,
|
||||
VERY_SMALL_CREATURE_GAS=995, // Renumbered because the original 160 was lost
|
||||
|
||||
// armor
|
||||
FLAK_JACKET, //= FIRST_ARMOUR, ( We're out of space! )
|
||||
FLAK_JACKET=161, //= FIRST_ARMOUR, ( We're out of space! )
|
||||
FLAK_JACKET_18,
|
||||
FLAK_JACKET_Y,
|
||||
KEVLAR_VEST,
|
||||
|
||||
+22
-32
@@ -4844,6 +4844,7 @@ BOOLEAN CreateGun( UINT16 usItem, INT8 bStatus, OBJECTTYPE * pObj )
|
||||
{
|
||||
pObj->ItemData.Gun.ubGunShotsLeft = GetMagSize(pObj);
|
||||
pObj->ItemData.Gun.ubGunAmmoType = AMMO_MONSTER;
|
||||
pObj->ItemData.Gun.ubGunState |= GS_CARTRIDGE_IN_CHAMBER; // 0verhaul: Monsters don't have to reload!
|
||||
}
|
||||
else if ( EXPLOSIVE_GUN( usItem ) )
|
||||
{
|
||||
@@ -5701,7 +5702,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
||||
INT8 bLoop, bDamage, bDieSize;
|
||||
UINT32 uiRoll;
|
||||
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
for ( bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++ )
|
||||
{
|
||||
@@ -5733,7 +5734,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// reduce camouflage by 2% per tile of deep water
|
||||
// and 1% for medium water
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
pSoldier->bCamo = __max( 0, pSoldier->bCamo - 2 );
|
||||
else
|
||||
pSoldier->bCamo = __max( 0, pSoldier->bCamo - 1 );
|
||||
@@ -5746,7 +5747,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// reduce camouflage by 2% per tile of deep water
|
||||
// and 1% for medium water
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 2 );
|
||||
else
|
||||
pSoldier->urbanCamo = __max( 0, pSoldier->urbanCamo - 1 );
|
||||
@@ -5759,7 +5760,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// reduce camouflage by 2% per tile of deep water
|
||||
// and 1% for medium water
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 2 );
|
||||
else
|
||||
pSoldier->desertCamo = __max( 0, pSoldier->desertCamo - 1 );
|
||||
@@ -5772,7 +5773,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// reduce camouflage by 2% per tile of deep water
|
||||
// and 1% for medium water
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 2 );
|
||||
else
|
||||
pSoldier->snowCamo = __max( 0, pSoldier->snowCamo - 1 );
|
||||
@@ -5798,7 +5799,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier )
|
||||
|
||||
if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bMonsterSmell > 0 )
|
||||
{
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
bDieSize = 10;
|
||||
}
|
||||
@@ -6557,8 +6558,6 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
||||
UINT16 usItem;
|
||||
INVTYPE *pItem;
|
||||
|
||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// Okay, it's time for some optimization here too
|
||||
@@ -6572,15 +6571,16 @@ INT16 GetVisionRangeBonus( SOLDIERTYPE * pSoldier )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
{
|
||||
bns += BonusReduceMore( pItem->visionrangebonus, pObj->ItemData.Generic.bStatus[0] );
|
||||
}
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
// Snap: check only attachments on a readied weapon!
|
||||
// 0verhaul: Moved this bug fix into WeaponReady so that all CTH modifier functions may benefit from this fix
|
||||
//AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6614,8 +6614,6 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
UINT16 usItem;
|
||||
INVTYPE *pItem;
|
||||
|
||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = HELMETPOS; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6629,7 +6627,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
{
|
||||
bns += BonusReduceMore(
|
||||
NightBonusScale( pItem->nightvisionrangebonus, bLightLevel ),
|
||||
@@ -6638,7 +6636,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6660,8 +6658,6 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
UINT16 usItem;
|
||||
INVTYPE *pItem;
|
||||
|
||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6676,7 +6672,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
{
|
||||
bns += BonusReduceMore(
|
||||
NightBonusScale( pItem->cavevisionrangebonus, bLightLevel ),
|
||||
@@ -6685,7 +6681,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6709,8 +6705,6 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
|
||||
// Snap: Scale the bonus with the light level
|
||||
|
||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6725,7 +6719,7 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
{
|
||||
bns += BonusReduceMore( idiv( pItem->dayvisionrangebonus
|
||||
* (NORMAL_LIGHTLEVEL_NIGHT - bLightLevel), NORMAL_LIGHTLEVEL_NIGHT ),
|
||||
@@ -6734,7 +6728,7 @@ INT16 GetDayVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6758,8 +6752,6 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
||||
|
||||
// Snap: Scale the bonus with the light level
|
||||
|
||||
//ADB and AXP 28.03.2007: CtH bug fix: We also want to check on a firing weapon, "raised" alone is not enough ;)
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
// More optimization
|
||||
@@ -6774,7 +6766,7 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && usingGunScope == true ) )
|
||||
if (!IsWeapon(usItem) || (IsWeapon(usItem) && WeaponReady(pSoldier) ) )
|
||||
{
|
||||
bns += BonusReduceMore( idiv( pItem->brightlightvisionrangebonus
|
||||
* (NORMAL_LIGHTLEVEL_DAY - bLightLevel), NORMAL_LIGHTLEVEL_DAY ),
|
||||
@@ -6783,7 +6775,7 @@ INT16 GetBrightLightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
pObj = &( pSoldier->inv[HANDPOS]);
|
||||
|
||||
@@ -6850,9 +6842,8 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
OBJECTTYPE *pInv = &(pSoldier->inv[HANDPOS]);
|
||||
usItem = pInv->usItem;
|
||||
@@ -6877,7 +6868,6 @@ UINT8 GetPercentTunnelVision( SOLDIERTYPE * pSoldier )
|
||||
BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
|
||||
bool usingGunScope = WeaponReady(pSoldier);
|
||||
for (int i = 0; i < BIGPOCK1POS; i++)
|
||||
{
|
||||
if ( (i == HANDPOS || i == SECONDHANDPOS) &&
|
||||
@@ -6886,7 +6876,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && usingGunScope == true) )
|
||||
if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && WeaponReady(pSoldier) ) )
|
||||
{
|
||||
if (Item[pSoldier->inv[i].usItem].thermaloptics)
|
||||
return TRUE;
|
||||
@@ -6894,7 +6884,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier )
|
||||
}
|
||||
|
||||
// Snap: check only attachments on a raised weapon!
|
||||
if ( usingGunScope == true )
|
||||
if ( WeaponReady(pSoldier) )
|
||||
{
|
||||
for (int i=0; i < MAX_ATTACHMENTS; i++)
|
||||
{
|
||||
|
||||
+8
-8
@@ -1410,12 +1410,12 @@ BOOLEAN CalculateSoldierZPos( SOLDIERTYPE * pSoldier, UINT8 ubPosType, FLOAT * p
|
||||
// Crow always as prone...
|
||||
ubHeight = ANIM_PRONE;
|
||||
}
|
||||
else if (pSoldier->bOverTerrainType == DEEP_WATER)
|
||||
else if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
// treat as prone
|
||||
ubHeight = ANIM_PRONE;
|
||||
}
|
||||
else if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER )
|
||||
else if ( MercInShallowWater(pSoldier) )
|
||||
{
|
||||
// treat as crouched
|
||||
ubHeight = ANIM_CROUCH;
|
||||
@@ -2020,7 +2020,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
if ( (pTarget->ubBodyType >= ADULTFEMALEMONSTER) && (pTarget->ubBodyType <= YAM_MONSTER) )
|
||||
{
|
||||
ubAttackDirection = (UINT8) GetDirectionToGridNoFromGridNo( pBullet->pFirer->sGridNo, pTarget->sGridNo );
|
||||
if ( ubAttackDirection == pTarget->bDirection || ubAttackDirection == gOneCCDirection[ pTarget->bDirection ] || ubAttackDirection == gOneCDirection[ pTarget->bDirection ] )
|
||||
if ( ubAttackDirection == pTarget->ubDirection || ubAttackDirection == gOneCCDirection[ pTarget->ubDirection ] || ubAttackDirection == gOneCDirection[ pTarget->ubDirection ] )
|
||||
{
|
||||
// may hit weak spot!
|
||||
if (0) // check fact
|
||||
@@ -2043,7 +2043,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
if (ubHitLocation == AIM_SHOT_RANDOM) // i.e. if not set yet
|
||||
{
|
||||
|
||||
if (pTarget->bOverTerrainType == DEEP_WATER)
|
||||
if (MercInDeepWater( pTarget) )
|
||||
{
|
||||
// automatic head hit!
|
||||
ubHitLocation = AIM_SHOT_HEAD;
|
||||
@@ -2054,7 +2054,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
{
|
||||
case ANIM_STAND:
|
||||
// Fall through to crouch if in shallow or medium water
|
||||
if ( pTarget->bOverTerrainType != LOW_WATER && pTarget->bOverTerrainType != MED_WATER )
|
||||
if ( !MercInShallowWater( pTarget) )
|
||||
{
|
||||
dZPosRelToMerc = FixedToFloat( pBullet->qCurrZ ) - CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[pBullet->sGridNo].sHeight );
|
||||
if ( dZPosRelToMerc > HEIGHT_UNITS )
|
||||
@@ -2110,7 +2110,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend
|
||||
ubAttackDirection = (UINT8) GetDirectionToGridNoFromGridNo( pBullet->pFirer->sGridNo, pTarget->sGridNo );
|
||||
ubOppositeDirection = gOppositeDirection[ ubAttackDirection ];
|
||||
|
||||
if ( ! ( ubOppositeDirection == pTarget->bDirection || ubAttackDirection == gOneCCDirection[ pTarget->bDirection ] || ubAttackDirection == gOneCDirection[ pTarget->bDirection ] ) )
|
||||
if ( ! ( ubOppositeDirection == pTarget->ubDirection || ubAttackDirection == gOneCCDirection[ pTarget->ubDirection ] || ubAttackDirection == gOneCDirection[ pTarget->ubDirection ] ) )
|
||||
{
|
||||
// lucky bastard was facing away!
|
||||
}
|
||||
@@ -4724,7 +4724,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel
|
||||
if (iCurrAboveLevelZ < 0)
|
||||
{
|
||||
// ground is in the way!
|
||||
if ( pMapElement->ubTerrainID == DEEP_WATER || pMapElement->ubTerrainID == LOW_WATER || pMapElement->ubTerrainID == MED_WATER )
|
||||
if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) )
|
||||
{
|
||||
return ( COLLISION_WATER );
|
||||
}
|
||||
@@ -4764,7 +4764,7 @@ INT32 CheckForCollision( FLOAT dX, FLOAT dY, FLOAT dZ, FLOAT dDeltaX, FLOAT dDel
|
||||
if ( dZ < iLandHeight)
|
||||
{
|
||||
// ground is in the way!
|
||||
if ( pMapElement->ubTerrainID == DEEP_WATER || pMapElement->ubTerrainID == LOW_WATER || pMapElement->ubTerrainID == MED_WATER )
|
||||
if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) )
|
||||
{
|
||||
return ( COLLISION_WATER );
|
||||
}
|
||||
|
||||
@@ -111,7 +111,8 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc)
|
||||
}
|
||||
|
||||
// BUILD STRUCTURES
|
||||
memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
|
||||
// MercCreateStruct has been C++'d
|
||||
//memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) );
|
||||
MercCreateStruct.ubProfile = ubCurrentSoldier;
|
||||
MercCreateStruct.fPlayerMerc = TRUE;
|
||||
MercCreateStruct.sSectorX = pHireMerc->sSectorX;
|
||||
|
||||
@@ -124,7 +124,7 @@ void ResetMilitia()
|
||||
UINT8 ubNumGreen = 0;
|
||||
UINT8 ubNumReg = 0;
|
||||
UINT8 ubNumVet = 0;
|
||||
UINT32 cnt;
|
||||
//UINT32 cnt;
|
||||
|
||||
// if ( gWorldSectorX !=0 && gWorldSectorY != 0 && NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) )
|
||||
// fBattleInProgress = TRUE;
|
||||
@@ -1096,7 +1096,7 @@ BOOLEAN CheckIfRadioIsEquipped( void )
|
||||
//sFacingDir = GetDirectionFromXY( sXPos, sYPos, pTMilitiaSoldier );
|
||||
//SendSoldierSetDesiredDirectionEvent( pTMilitiaSoldier, sFacingDir );
|
||||
//SendSoldierSetDesiredDirectionEvent( pTMilitiaSoldier, gOppositeDirection[ sFacingDir ] );
|
||||
//EVENT_StopMerc( pTMilitiaSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->bDirection );
|
||||
//EVENT_StopMerc( pTMilitiaSoldier, pTMilitiaSoldier->sGridNo, pTMilitiaSoldier->ubDirection );
|
||||
|
||||
//SendChangeSoldierStanceEvent( pTMilitiaSoldier, ANIM_PRONE );
|
||||
//SendChangeSoldierStanceEvent( pTMilitiaSoldier, ANIM_CROUCH );
|
||||
|
||||
+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 );
|
||||
|
||||
+4
-4
@@ -2384,11 +2384,11 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
|
||||
{
|
||||
if (fReverse)
|
||||
{
|
||||
iLastDir = gOppositeDirection[s->bDirection];
|
||||
iLastDir = gOppositeDirection[s->ubDirection];
|
||||
}
|
||||
else
|
||||
{
|
||||
iLastDir = s->bDirection;
|
||||
iLastDir = s->ubDirection;
|
||||
}
|
||||
// start prev-to-last dir at same as current (could cause a problem)
|
||||
iPrevToLastDir = iLastDir;
|
||||
@@ -2442,7 +2442,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo
|
||||
{
|
||||
if (trailTreeNdx < 2)
|
||||
{
|
||||
iLastDir = s->bDirection;
|
||||
iLastDir = s->ubDirection;
|
||||
}
|
||||
else if ( trailTree[pCurrPtr->sPathNdx].fFlags & STEP_BACKWARDS )
|
||||
{
|
||||
@@ -3866,7 +3866,7 @@ INT16 PlotPath( SOLDIERTYPE *pSold, INT16 sDestGridno, INT8 bCopyRoute, INT8 bPl
|
||||
usMovementModeToUseForAPs = usMovementMode;
|
||||
|
||||
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
||||
if ( gpWorldLevelData[ sTempGrid ].ubTerrainID == DEEP_WATER || gpWorldLevelData[ sTempGrid ].ubTerrainID == MED_WATER || gpWorldLevelData[ sTempGrid ].ubTerrainID == LOW_WATER )
|
||||
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sTempGrid ].ubTerrainID) )
|
||||
{
|
||||
usMovementModeToUseForAPs = WALKING;
|
||||
}
|
||||
|
||||
+6
-6
@@ -216,7 +216,7 @@ INT16 TerrainBreathPoints(SOLDIERTYPE * pSoldier, INT16 sGridno,INT8 bDir, UINT1
|
||||
iPoints = iPoints * BreathPointAdjustmentForCarriedWeight( pSoldier ) / 100;
|
||||
|
||||
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
||||
if ( gpWorldLevelData[ sGridno ].ubTerrainID == DEEP_WATER || gpWorldLevelData[ sGridno ].ubTerrainID == MED_WATER || gpWorldLevelData[ sGridno ].ubTerrainID == LOW_WATER )
|
||||
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridno ].ubTerrainID) )
|
||||
{
|
||||
usMovementMode = WALKING;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bDir, UINT16 u
|
||||
}
|
||||
|
||||
// ATE - MAKE MOVEMENT ALWAYS WALK IF IN WATER
|
||||
if ( gpWorldLevelData[ sGridNo ].ubTerrainID == DEEP_WATER || gpWorldLevelData[ sGridNo ].ubTerrainID == MED_WATER || gpWorldLevelData[ sGridNo ].ubTerrainID == LOW_WATER )
|
||||
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridNo ].ubTerrainID) )
|
||||
{
|
||||
usMovementMode = WALKING;
|
||||
}
|
||||
@@ -1257,7 +1257,7 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT16 sGridNo
|
||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||
|
||||
// Is it the same as he's facing?
|
||||
if ( ubDirection != pSoldier->bDirection )
|
||||
if ( ubDirection != pSoldier->ubDirection )
|
||||
{
|
||||
fAddingTurningCost = TRUE;
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ UINT8 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCost
|
||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||
|
||||
// Is it the same as he's facing?
|
||||
if ( ubDirection != pSoldier->bDirection )
|
||||
if ( ubDirection != pSoldier->ubDirection )
|
||||
{
|
||||
bAPCost += AP_LOOK_STANDING;
|
||||
}
|
||||
@@ -1520,7 +1520,7 @@ INT8 PtsToMoveDirection(SOLDIERTYPE *pSoldier, INT8 bDirection )
|
||||
// ATE: Check if the new place is watter and we were tying to run....
|
||||
bOverTerrainType = GetTerrainType( sGridno );
|
||||
|
||||
if ( bOverTerrainType == MED_WATER || bOverTerrainType == DEEP_WATER || bOverTerrainType == LOW_WATER )
|
||||
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||
{
|
||||
usMoveModeToUse = WALKING;
|
||||
}
|
||||
@@ -2222,7 +2222,7 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos
|
||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||
|
||||
// Is it the same as he's facing?
|
||||
if ( ubDirection != pSoldier->bDirection )
|
||||
if ( ubDirection != pSoldier->ubDirection )
|
||||
{
|
||||
//Lalien: disabled it again
|
||||
//AXP 25.03.2007: Reenabled look cost
|
||||
|
||||
@@ -412,7 +412,7 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor
|
||||
case HUMMER_DEAD:
|
||||
|
||||
// OK , these have 2 directions....
|
||||
bDirection = gb2DirectionsFrom8[ pCorpseDef->bDirection ];
|
||||
bDirection = gb2DirectionsFrom8[ pCorpseDef->ubDirection ];
|
||||
if ( fForImage )
|
||||
{
|
||||
bDirection = gOneCDirection[ bDirection ];
|
||||
@@ -427,7 +427,7 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor
|
||||
case FMERC_FALLF:
|
||||
|
||||
// OK , these have 4 directions....
|
||||
bDirection = gb4DirectionsFrom8[ pCorpseDef->bDirection ];
|
||||
bDirection = gb4DirectionsFrom8[ pCorpseDef->ubDirection ];
|
||||
|
||||
// if ( fForImage )
|
||||
// {
|
||||
@@ -438,7 +438,7 @@ UINT16 GetCorpseStructIndex( ROTTING_CORPSE_DEFINITION *pCorpseDef, BOOLEAN fFor
|
||||
default:
|
||||
|
||||
// Uses 8
|
||||
bDirection = pCorpseDef->bDirection;
|
||||
bDirection = pCorpseDef->ubDirection;
|
||||
|
||||
if ( fForImage )
|
||||
{
|
||||
@@ -541,7 +541,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef )
|
||||
AniParams.sX = CenterX( pCorpse->def.sGridNo );
|
||||
AniParams.sY = CenterY( pCorpse->def.sGridNo );
|
||||
AniParams.sZ = (INT16)pCorpse->def.sHeightAdjustment;
|
||||
AniParams.uiUserData3 = pCorpse->def.bDirection;
|
||||
AniParams.uiUserData3 = pCorpse->def.ubDirection;
|
||||
|
||||
|
||||
if ( !gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] )
|
||||
@@ -847,7 +847,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
|
||||
// Determine corpse type!
|
||||
ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ];
|
||||
|
||||
Corpse.bDirection = pSoldier->bDirection;
|
||||
Corpse.ubDirection = pSoldier->ubDirection;
|
||||
|
||||
// If we are a vehicle.... only use 1 direction....
|
||||
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
||||
@@ -856,17 +856,17 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
|
||||
|
||||
if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE )
|
||||
{
|
||||
Corpse.bDirection = 7;
|
||||
Corpse.ubDirection = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
Corpse.bDirection = gb2DirectionsFrom8[ Corpse.bDirection ];
|
||||
Corpse.ubDirection = gb2DirectionsFrom8[ Corpse.ubDirection ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD )
|
||||
{
|
||||
Corpse.bDirection = 7;
|
||||
Corpse.ubDirection = 7;
|
||||
}
|
||||
|
||||
|
||||
@@ -1077,7 +1077,7 @@ void AddCrowToCorpse( ROTTING_CORPSE *pCorpse )
|
||||
MercCreateStruct.sSectorY = gWorldSectorY;
|
||||
MercCreateStruct.bSectorZ = gbWorldSectorZ;
|
||||
MercCreateStruct.bBodyType = bBodyType;
|
||||
MercCreateStruct.bDirection = SOUTH;
|
||||
MercCreateStruct.ubDirection = SOUTH;
|
||||
MercCreateStruct.bTeam = CIV_TEAM;
|
||||
MercCreateStruct.sInsertionGridNo = pCorpse->def.sGridNo;
|
||||
RandomizeNewSoldierStats( &MercCreateStruct );
|
||||
@@ -1693,7 +1693,7 @@ INT16 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8
|
||||
{
|
||||
if ( fSetDirection )
|
||||
{
|
||||
pDef->bDirection = ubBestDirection;
|
||||
pDef->ubDirection = ubBestDirection;
|
||||
}
|
||||
|
||||
return sLowestGridNo;
|
||||
|
||||
@@ -99,7 +99,7 @@ typedef struct
|
||||
PaletteRepID VestPal;
|
||||
PaletteRepID SkinPal;
|
||||
|
||||
INT8 bDirection;
|
||||
UINT8 ubDirection;
|
||||
UINT32 uiTimeOfDeath;
|
||||
|
||||
UINT16 usFlags;
|
||||
|
||||
@@ -296,7 +296,7 @@ UINT16 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAn
|
||||
// If we are already at this gridno....
|
||||
if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
|
||||
{
|
||||
*pubDirection = pSoldier->bDirection;
|
||||
*pubDirection = pSoldier->ubDirection;
|
||||
return( sSweetGridNo );
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ UINT16 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYP
|
||||
// If we are already at this gridno....
|
||||
if ( pSoldier->sGridNo == sSweetGridNo && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) )
|
||||
{
|
||||
*pubDirection = pSoldier->bDirection;
|
||||
*pubDirection = pSoldier->ubDirection;
|
||||
return( sSweetGridNo );
|
||||
}
|
||||
|
||||
@@ -1219,7 +1219,7 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
|
||||
|
||||
//Add
|
||||
if(gTacticalStatus.uiFlags & LOADING_SAVED_GAME )
|
||||
AddSoldierToSectorGridNo( pSoldier, sGridNo, pSoldier->bDirection, fUseAnimation, usAnimState, usAnimCode );
|
||||
AddSoldierToSectorGridNo( pSoldier, sGridNo, pSoldier->ubDirection, fUseAnimation, usAnimState, usAnimCode );
|
||||
else
|
||||
AddSoldierToSectorGridNo( pSoldier, sGridNo, ubDirection, fUseAnimation, usAnimState, usAnimCode );
|
||||
|
||||
@@ -1279,7 +1279,7 @@ void InternalSoldierInSectorSleep( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN
|
||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||
|
||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
|
||||
if ( AM_AN_EPC( pSoldier ) )
|
||||
{
|
||||
@@ -1320,7 +1320,7 @@ void SoldierInSectorIncompaciated( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||
|
||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
|
||||
EVENT_InitNewSoldierAnim( pSoldier, STAND_FALLFORWARD_STOP, 1, TRUE );
|
||||
}
|
||||
@@ -1356,7 +1356,7 @@ void SoldierInSectorPatient( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||
|
||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
|
||||
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
||||
{
|
||||
@@ -1391,7 +1391,7 @@ void SoldierInSectorDoctor( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||
|
||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
|
||||
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
||||
{
|
||||
@@ -1426,7 +1426,7 @@ void SoldierInSectorRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo )
|
||||
EVENT_SetSoldierDirection( pSoldier, ubNewDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection );
|
||||
|
||||
//pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
//pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
|
||||
if ( !IS_MERC_BODY_TYPE( pSoldier ) )
|
||||
{
|
||||
|
||||
+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 )
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ BOOLEAN CheckForAndHandleSoldierDyingNotFromHit( SOLDIERTYPE *pSoldier );
|
||||
|
||||
BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse );
|
||||
|
||||
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, INT8 bTestDirection, UINT16 usAnimState );
|
||||
BOOLEAN OKFallDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bLevel, UINT8 ubTestDirection, UINT16 usAnimState );
|
||||
|
||||
BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier );
|
||||
|
||||
|
||||
+190
-107
@@ -839,7 +839,7 @@ UINT16 *CreateEnemyGreyGlow16BPPPalette( SGPPaletteEntry *pPalette, UINT32 rscal
|
||||
void SoldierBleed( SOLDIERTYPE *pSoldier, BOOLEAN fBandagedBleed );
|
||||
INT32 CheckBleeding( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState );
|
||||
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState );
|
||||
|
||||
#ifdef JA2BETAVERSION
|
||||
extern void ValidatePlayersAreInOneGroupOnly();
|
||||
@@ -961,7 +961,7 @@ void HandleCrowShadowNewGridNo( SOLDIERTYPE *pSoldier )
|
||||
AniParams.sZ = 0;
|
||||
strcpy( AniParams.zCachedFile, "TILECACHE\\FLY_SHDW.STI" );
|
||||
|
||||
AniParams.uiUserData3 = pSoldier->bDirection;
|
||||
AniParams.uiUserData3 = pSoldier->ubDirection;
|
||||
|
||||
pSoldier->pAniTile = CreateAnimationTile( &AniParams );
|
||||
|
||||
@@ -996,7 +996,7 @@ void HandleCrowShadowNewDirection( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
if ( pSoldier->pAniTile != NULL )
|
||||
{
|
||||
pSoldier->pAniTile->uiUserData3 = pSoldier->bDirection;
|
||||
pSoldier->pAniTile->uiUserData3 = pSoldier->ubDirection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2181,7 +2181,7 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
||||
if ( usNewState == WALKING || usNewState == RUNNING || usNewState == SWATTING )
|
||||
{
|
||||
// CHECK FOR SIDEWAYS!
|
||||
if ( pSoldier->bDirection == gPurpendicularDirection[ pSoldier->bDirection ][ pSoldier->usPathingData[ pSoldier->usPathIndex ] ] )
|
||||
if ( pSoldier->ubDirection == gPurpendicularDirection[ pSoldier->ubDirection ][ pSoldier->usPathingData[ pSoldier->usPathIndex ] ] )
|
||||
{
|
||||
// We are perpendicular!
|
||||
usNewState = SIDE_STEP;
|
||||
@@ -2220,7 +2220,7 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
||||
}
|
||||
|
||||
// If we are in water.....and trying to run, change to run
|
||||
if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER )
|
||||
if ( MercInWater( pSoldier) )
|
||||
{
|
||||
// Check animation
|
||||
// Change to walking
|
||||
@@ -2638,14 +2638,14 @@ BOOLEAN EVENT_InitNewSoldierAnim( SOLDIERTYPE *pSoldier, UINT16 usNewState, UINT
|
||||
|
||||
DeductPoints( pSoldier, AP_JUMP_OVER, BP_JUMP_OVER );
|
||||
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->bDirection ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->bDirection ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( pSoldier->ubDirection ) );
|
||||
|
||||
pSoldier->usPathDataSize = 0;
|
||||
pSoldier->usPathIndex = 0;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->bDirection;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection;
|
||||
pSoldier->usPathDataSize++;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->bDirection;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = pSoldier->ubDirection;
|
||||
pSoldier->usPathDataSize++;
|
||||
pSoldier->sFinalDestination = usNewGridNo;
|
||||
// Set direction
|
||||
@@ -3243,7 +3243,7 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
|
||||
|
||||
|
||||
// OK, If we were not in deep water but we are now, handle deep animations!
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER && pSoldier->bOldOverTerrainType != DEEP_WATER )
|
||||
if ( TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType) && !TERRAIN_IS_DEEP_WATER( pSoldier->bOldOverTerrainType) )
|
||||
{
|
||||
// Based on our current animation, change!
|
||||
switch( pSoldier->usAnimState )
|
||||
@@ -3263,13 +3263,13 @@ void SetSoldierGridNo( SOLDIERTYPE *pSoldier, INT16 sNewGridNo, BOOLEAN fForceRe
|
||||
}
|
||||
|
||||
// Damage water if in deep water....
|
||||
if ( pSoldier->bOverTerrainType == MED_WATER || pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInHighWater( pSoldier) )
|
||||
{
|
||||
WaterDamage( pSoldier );
|
||||
}
|
||||
|
||||
// OK, If we were in deep water but we are NOT now, handle mid animations!
|
||||
if ( pSoldier->bOverTerrainType != DEEP_WATER && pSoldier->bOldOverTerrainType == DEEP_WATER )
|
||||
if ( !TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType) && TERRAIN_IS_DEEP_WATER( pSoldier->bOldOverTerrainType) )
|
||||
{
|
||||
// Make transition from low to deep
|
||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_TO_LOW_WATER, 0 , FALSE );
|
||||
@@ -3791,7 +3791,7 @@ void SelectFallAnimation( SOLDIERTYPE *pSoldier )
|
||||
|
||||
BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
return( InternalSoldierReadyWeapon( pSoldier, (INT8)pSoldier->bDirection, FALSE ) );
|
||||
return( InternalSoldierReadyWeapon( pSoldier, (INT8)pSoldier->ubDirection, FALSE ) );
|
||||
}
|
||||
|
||||
BOOLEAN SoldierReadyWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetXPos, INT16 sTargetYPos, BOOLEAN fEndReady )
|
||||
@@ -3839,7 +3839,7 @@ BOOLEAN InternalSoldierReadyWeapon( SOLDIERTYPE *pSoldier, UINT8 sFacingDir, BOO
|
||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, sFacingDir, FALSE, usAnimState );
|
||||
|
||||
// Check if facing dir is different from ours and change direction if so!
|
||||
//if ( sFacingDir != pSoldier->bDirection )
|
||||
//if ( sFacingDir != pSoldier->ubDirection )
|
||||
//{
|
||||
// DeductPoints( pSoldier, AP_CHANGE_FACING, 0 );
|
||||
//}//
|
||||
@@ -3859,7 +3859,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady )
|
||||
return( INVALID_ANIMATION );
|
||||
}
|
||||
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
return( INVALID_ANIMATION );
|
||||
}
|
||||
@@ -4490,12 +4490,12 @@ void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDa
|
||||
}
|
||||
|
||||
// If here, we are a merc, check if we are in water
|
||||
if ( pSoldier->bOverTerrainType == LOW_WATER )
|
||||
if ( MercInShallowWater( pSoldier) )
|
||||
{
|
||||
EVENT_InitNewSoldierAnim( pSoldier, WATER_HIT, 0 , FALSE );
|
||||
return;
|
||||
}
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_HIT, 0 , FALSE );
|
||||
return;
|
||||
@@ -4573,7 +4573,7 @@ void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirection )
|
||||
{
|
||||
//SetSoldierDesiredDirection( pSoldier, bDirection );
|
||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
EVENT_InitNewSoldierAnim( pSoldier, STANDING_BURST_HIT, 0 , FALSE );
|
||||
}
|
||||
@@ -4623,14 +4623,14 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD
|
||||
{
|
||||
if (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_DISTANCE_FOR_MESSY_DEATH || (SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= MAX_BARRETT_DISTANCE_FOR_MESSY_DEATH && usWeaponIndex == BARRETT ))
|
||||
{
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT8)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
|
||||
// CHECK OK DESTINATION!
|
||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->bDirection, JFK_HITDEATH ) )
|
||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, JFK_HITDEATH ) )
|
||||
{
|
||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (INT8)( DirectionInc( pSoldier->bDirection ) ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (INT8)( DirectionInc( pSoldier->ubDirection ) ) );
|
||||
|
||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->bDirection, pSoldier->usAnimState ) )
|
||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, pSoldier->ubDirection, pSoldier->usAnimState ) )
|
||||
{
|
||||
fHeadHit = TRUE;
|
||||
}
|
||||
@@ -4646,9 +4646,9 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD
|
||||
{
|
||||
|
||||
// possibly play torso explosion anim!
|
||||
if (pSoldier->bDirection == bDirection)
|
||||
if (pSoldier->ubDirection == bDirection)
|
||||
{
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ pSoldier->bDirection ] ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ pSoldier->ubDirection ] ) );
|
||||
|
||||
if ( OKFallDirection( pSoldier, usNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
||||
{
|
||||
@@ -4824,7 +4824,7 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16
|
||||
if ( OKFallDirection( pSoldier, sNewGridNo, pSoldier->bLevel, gOppositeDirection[ bDirection ], FLYBACK_HIT ) )
|
||||
{
|
||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
ChangeToFallbackAnimation( pSoldier, (INT8)bDirection );
|
||||
}
|
||||
else
|
||||
@@ -4855,7 +4855,7 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16
|
||||
}
|
||||
|
||||
EVENT_SetSoldierDirection( pSoldier, (INT8)bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->bDirection );
|
||||
EVENT_SetSoldierDesiredDirection( pSoldier, pSoldier->ubDirection );
|
||||
|
||||
// Check behind us!
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
||||
@@ -5067,7 +5067,7 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid
|
||||
|
||||
usMoveAnimState = pSoldier->usUIMovementMode;
|
||||
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
usMoveAnimState = DEEP_WATER_SWIM;
|
||||
}
|
||||
@@ -5120,7 +5120,7 @@ BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGrid
|
||||
|
||||
// If true, we're OK, if not, WAIT for a guy to pass!
|
||||
// If we are in deep water, we can only swim!
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
usMoveAnimState = DEEP_WATER_SWIM;
|
||||
}
|
||||
@@ -5168,7 +5168,7 @@ void StopSoldier( SOLDIERTYPE *pSoldier )
|
||||
if ( !( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) )
|
||||
{
|
||||
//SoldierGotoStationaryStance( pSoldier );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
|
||||
// Set desination
|
||||
@@ -5196,7 +5196,7 @@ void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// Check if we are in deep water!
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
// IN deep water, tred!
|
||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_TRED, 0 , FALSE );
|
||||
@@ -5258,6 +5258,12 @@ void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance )
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsValidStance( pSoldier, ubDesiredStance))
|
||||
{
|
||||
AssertMsg( 0, "Attempted to set soldier to an invalid stance.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Set UI Busy
|
||||
SetUIBusy( pSoldier->ubID );
|
||||
|
||||
@@ -5285,22 +5291,22 @@ void ChangeSoldierStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance )
|
||||
}
|
||||
}
|
||||
|
||||
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState )
|
||||
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fFromMove, UINT16 usAnimState )
|
||||
{
|
||||
UINT16 usNewGridNo;
|
||||
INT16 sNewGridNo;
|
||||
INT16 sXPos, sYPos;
|
||||
|
||||
// Get dest gridno, convert to center coords
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( usNewDirection ) );
|
||||
sNewGridNo = NewGridNo( pSoldier->sGridNo, DirectionInc( ubNewDirection ) );
|
||||
|
||||
ConvertMapPosToWorldTileCenter( usNewGridNo, &sXPos, &sYPos );
|
||||
ConvertMapPosToWorldTileCenter( sNewGridNo, &sXPos, &sYPos );
|
||||
|
||||
// Save new dest gridno, x, y
|
||||
pSoldier->sDestination = usNewGridNo;
|
||||
pSoldier->sDestination = sNewGridNo;
|
||||
pSoldier->sDestXPos = sXPos;
|
||||
pSoldier->sDestYPos = sYPos;
|
||||
|
||||
pSoldier->bMovementDirection = (INT8)usNewDirection;
|
||||
pSoldier->bMovementDirection = (INT8)ubNewDirection;
|
||||
|
||||
|
||||
// OK, ATE: If we are side_stepping, calculate a NEW desired direction....
|
||||
@@ -5309,17 +5315,17 @@ void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDir
|
||||
UINT8 ubPerpDirection;
|
||||
|
||||
// Get a new desired direction,
|
||||
ubPerpDirection = gPurpendicularDirection[ pSoldier->bDirection ][ usNewDirection ];
|
||||
ubPerpDirection = gPurpendicularDirection[ pSoldier->ubDirection ][ ubNewDirection ];
|
||||
|
||||
// CHange actual and desired direction....
|
||||
EVENT_SetSoldierDirection( pSoldier, ubPerpDirection );
|
||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !( gAnimControl[ usAnimState ].uiFlags & ANIM_SPECIALMOVE ) )
|
||||
{
|
||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, usNewDirection, fFromMove, usAnimState );
|
||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, ubNewDirection, fFromMove, usAnimState );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5409,17 +5415,17 @@ INT8 MultiTiledTurnDirection( SOLDIERTYPE * pSoldier, INT8 bStartDirection, INT8
|
||||
|
||||
|
||||
|
||||
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState )
|
||||
void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fInitalMove, UINT16 usAnimState )
|
||||
{
|
||||
//if ( usAnimState == WALK_BACKWARDS )
|
||||
if ( pSoldier->bReverse && usAnimState != SIDE_STEP )
|
||||
{
|
||||
// OK, check if we are going to go in the exact opposite than our facing....
|
||||
usNewDirection = gOppositeDirection[ usNewDirection ];
|
||||
ubNewDirection = gOppositeDirection[ ubNewDirection ];
|
||||
}
|
||||
|
||||
|
||||
pSoldier->bDesiredDirection = (INT8)usNewDirection;
|
||||
pSoldier->bDesiredDirection = (INT8)ubNewDirection;
|
||||
|
||||
// If we are prone, goto crouched first!
|
||||
// ONly if we are stationary, and only if directions are differnet!
|
||||
@@ -5434,7 +5440,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usN
|
||||
AdjustNoAPToFinishMove( pSoldier, FALSE );
|
||||
}
|
||||
|
||||
if ( pSoldier->bDesiredDirection != pSoldier->bDirection )
|
||||
if ( pSoldier->bDesiredDirection != pSoldier->ubDirection )
|
||||
{
|
||||
if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) && !fInitalMove && !pSoldier->fDontChargeTurningAPs )
|
||||
{
|
||||
@@ -5492,7 +5498,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usN
|
||||
// Set desired direction for the extended directions...
|
||||
pSoldier->ubHiResDesiredDirection = ubExtDirection[ pSoldier->bDesiredDirection ];
|
||||
|
||||
if ( pSoldier->bDesiredDirection != pSoldier->bDirection )
|
||||
if ( pSoldier->bDesiredDirection != pSoldier->ubDirection )
|
||||
{
|
||||
if ( pSoldier->uiStatusFlags & ( SOLDIER_VEHICLE ) || CREATURE_OR_BLOODCAT( pSoldier ) )
|
||||
{
|
||||
@@ -5509,20 +5515,20 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usN
|
||||
{
|
||||
if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
|
||||
{
|
||||
pSoldier->bTurningIncrement = (INT8) MultiTiledTurnDirection( pSoldier, pSoldier->bDirection, pSoldier->bDesiredDirection );
|
||||
pSoldier->bTurningIncrement = (INT8) MultiTiledTurnDirection( pSoldier, pSoldier->ubDirection, pSoldier->bDesiredDirection );
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->bTurningIncrement = (INT8) QuickestDirection( pSoldier->bDirection, pSoldier->bDesiredDirection );
|
||||
pSoldier->bTurningIncrement = (INT8) QuickestDirection( pSoldier->ubDirection, pSoldier->bDesiredDirection );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection )
|
||||
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection )
|
||||
{
|
||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, usNewDirection, FALSE, pSoldier->usAnimState );
|
||||
EVENT_InternalSetSoldierDesiredDirection( pSoldier, ubNewDirection, FALSE, pSoldier->usAnimState );
|
||||
}
|
||||
|
||||
|
||||
@@ -5531,10 +5537,10 @@ void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection )
|
||||
// Remove old location data
|
||||
HandleAnimationProfile( pSoldier, pSoldier->usAnimState, TRUE );
|
||||
|
||||
pSoldier->bDirection = (INT8)usNewDirection;
|
||||
pSoldier->ubDirection = (INT8)usNewDirection;
|
||||
|
||||
// Updated extended direction.....
|
||||
pSoldier->ubHiResDirection = ubExtDirection[ pSoldier->bDirection ];
|
||||
pSoldier->ubHiResDirection = ubExtDirection[ pSoldier->ubDirection ];
|
||||
|
||||
// Add new stuff
|
||||
HandleAnimationProfile( pSoldier, pSoldier->usAnimState, FALSE );
|
||||
@@ -5809,7 +5815,7 @@ BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame )
|
||||
CHECKF( usAnimSurface != INVALID_ANIMATION_SURFACE );
|
||||
|
||||
// COnvert world direction into sprite direction
|
||||
ubTempDir = gOneCDirection[ pSoldier->bDirection ];
|
||||
ubTempDir = gOneCDirection[ pSoldier->ubDirection ];
|
||||
|
||||
//If we are only one frame, ignore what the script is telling us!
|
||||
if ( gAnimSurfaceDatabase[ usAnimSurface ].ubFlags & ANIM_DATA_FLAG_NOFRAMES )
|
||||
@@ -5834,22 +5840,22 @@ BOOLEAN ConvertAniCodeToAniFrame( SOLDIERTYPE *pSoldier, UINT16 usAniFrame )
|
||||
// Check # of directions /surface, adjust if ness.
|
||||
else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 3 )
|
||||
{
|
||||
if ( pSoldier->bDirection == NORTHWEST )
|
||||
if ( pSoldier->ubDirection == NORTHWEST )
|
||||
{
|
||||
ubTempDir = 1;
|
||||
}
|
||||
if ( pSoldier->bDirection == WEST )
|
||||
if ( pSoldier->ubDirection == WEST )
|
||||
{
|
||||
ubTempDir = 0;
|
||||
}
|
||||
if ( pSoldier->bDirection == EAST )
|
||||
if ( pSoldier->ubDirection == EAST )
|
||||
{
|
||||
ubTempDir = 2;
|
||||
}
|
||||
}
|
||||
else if ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumDirections == 2 )
|
||||
{
|
||||
ubTempDir = gDirectionFrom8to2[ pSoldier->bDirection ];
|
||||
ubTempDir = gDirectionFrom8to2[ pSoldier->ubDirection ];
|
||||
}
|
||||
|
||||
pSoldier->usAniFrame = usAniFrame + (UINT16) ( ( gAnimSurfaceDatabase[ usAnimSurface ].uiNumFramesPerDir * ubTempDir ) );
|
||||
@@ -5892,7 +5898,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
if ( pSoldier->bDesiredDirection > 7 || pSoldier->bDesiredDirection < 0)
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("TurnSoldier() Warinig: Invalid desired direction for non-vehicle unit") );
|
||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
}
|
||||
}
|
||||
// Lesh: patch ended
|
||||
@@ -5914,7 +5920,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
|
||||
if ( pSoldier->fTurningToShoot )
|
||||
{
|
||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
||||
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||
{
|
||||
if ( ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) && !pSoldier->fTurningFromPronePosition ) || pSoldier->ubBodyType == ROBOTNOWEAPON || pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
||||
{
|
||||
@@ -5946,7 +5952,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
|
||||
if ( pSoldier->fTurningToFall )
|
||||
{
|
||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
||||
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||
{
|
||||
SelectFallAnimation( pSoldier );
|
||||
pSoldier->fTurningToFall = FALSE;
|
||||
@@ -5955,7 +5961,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
|
||||
if ( pSoldier->fTurningUntilDone && ( pSoldier->ubPendingStanceChange != NO_PENDING_STANCE ) )
|
||||
{
|
||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
||||
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||
{
|
||||
SendChangeSoldierStanceEvent( pSoldier, pSoldier->ubPendingStanceChange );
|
||||
pSoldier->ubPendingStanceChange = NO_PENDING_STANCE;
|
||||
@@ -5965,7 +5971,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
|
||||
if ( pSoldier->fTurningUntilDone && ( pSoldier->usPendingAnimation != NO_PENDING_ANIMATION ) )
|
||||
{
|
||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
||||
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||
{
|
||||
UINT16 usPendingAnimation;
|
||||
|
||||
@@ -5978,7 +5984,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
// Don't do anything if we are at dest direction!
|
||||
if ( pSoldier->bDirection == pSoldier->bDesiredDirection )
|
||||
if ( pSoldier->ubDirection == pSoldier->bDesiredDirection )
|
||||
{
|
||||
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
||||
{
|
||||
@@ -6124,8 +6130,8 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
else
|
||||
{
|
||||
// Get new direction
|
||||
//sDirection = pSoldier->bDirection + QuickestDirection( pSoldier->bDirection, pSoldier->bDesiredDirection );
|
||||
sDirection = pSoldier->bDirection + pSoldier->bTurningIncrement;
|
||||
//sDirection = pSoldier->ubDirection + QuickestDirection( pSoldier->ubDirection, pSoldier->bDesiredDirection );
|
||||
sDirection = pSoldier->ubDirection + pSoldier->bTurningIncrement;
|
||||
if (sDirection > 7)
|
||||
{
|
||||
sDirection = 0;
|
||||
@@ -6180,7 +6186,7 @@ void TurnSoldier( SOLDIERTYPE *pSoldier)
|
||||
// If we are a creature, or multi-tiled, cancel AI action.....?
|
||||
else if ( pSoldier->uiStatusFlags & SOLDIER_MULTITILE )
|
||||
{
|
||||
pSoldier->bDesiredDirection = pSoldier->bDirection;
|
||||
pSoldier->bDesiredDirection = pSoldier->ubDirection;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6972,7 +6978,7 @@ void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMo
|
||||
FLOAT dAngle = (FLOAT)0;
|
||||
|
||||
// Determine which direction we are in
|
||||
switch( pSoldier->bDirection )
|
||||
switch( pSoldier->ubDirection )
|
||||
{
|
||||
case NORTH:
|
||||
dAngle = (FLOAT)( -1 * PI );
|
||||
@@ -7024,7 +7030,7 @@ void BeginSoldierClimbUpRoof( SOLDIERTYPE *pSoldier )
|
||||
UINT8 ubWhoIsThere;
|
||||
|
||||
|
||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel == 0 ) )
|
||||
if ( FindHeigherLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel == 0 ) )
|
||||
{
|
||||
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, FALSE ), 0, TRUE ) )
|
||||
{
|
||||
@@ -7074,7 +7080,7 @@ void BeginSoldierClimbFence( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
else
|
||||
{
|
||||
bDirection = pSoldier->bDirection;
|
||||
bDirection = pSoldier->ubDirection;
|
||||
}
|
||||
|
||||
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, bDirection, &bDirection ) )
|
||||
@@ -8215,7 +8221,7 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||
{
|
||||
// ONly if standing!
|
||||
if ( gAnimControl[ pSoldier->usAnimState ].ubHeight == ANIM_STAND )
|
||||
@@ -8237,11 +8243,11 @@ BOOLEAN CheckSoldierHitRoof( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// Are wee near enough to fall forwards....
|
||||
if ( pSoldier->bDirection == gOneCDirection[ bNewDirection ] ||
|
||||
pSoldier->bDirection == gTwoCDirection[ bNewDirection ] ||
|
||||
pSoldier->bDirection == bNewDirection ||
|
||||
pSoldier->bDirection == gOneCCDirection[ bNewDirection ] ||
|
||||
pSoldier->bDirection == gTwoCCDirection[ bNewDirection ] )
|
||||
if ( pSoldier->ubDirection == gOneCDirection[ bNewDirection ] ||
|
||||
pSoldier->ubDirection == gTwoCDirection[ bNewDirection ] ||
|
||||
pSoldier->ubDirection == bNewDirection ||
|
||||
pSoldier->ubDirection == gOneCCDirection[ bNewDirection ] ||
|
||||
pSoldier->ubDirection == gTwoCCDirection[ bNewDirection ] )
|
||||
{
|
||||
// Do backwards...
|
||||
fDoForwards = FALSE;
|
||||
@@ -8290,7 +8296,7 @@ void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier )
|
||||
UINT8 ubWhoIsThere;
|
||||
|
||||
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||
{
|
||||
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
|
||||
{
|
||||
@@ -8334,7 +8340,7 @@ INT8 bNewDirection;
|
||||
UINT8 ubWhoIsThere;
|
||||
|
||||
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||
if ( FindLowerLevel( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && ( pSoldier->bLevel > 0 ) )
|
||||
{
|
||||
if ( EnoughPoints( pSoldier, GetAPsToClimbRoof( pSoldier, TRUE ), 0, TRUE ) )
|
||||
{
|
||||
@@ -8487,7 +8493,7 @@ void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLE
|
||||
|
||||
}
|
||||
|
||||
INT16 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier )
|
||||
UINT8 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT16 sXPos, sYPos;
|
||||
|
||||
@@ -8508,7 +8514,7 @@ INT16 GetDirectionToGridNoFromGridNo( INT16 sGridNoDest, INT16 sGridNoSrc )
|
||||
|
||||
}
|
||||
|
||||
INT16 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier )
|
||||
UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
INT16 sXPos2, sYPos2;
|
||||
|
||||
@@ -8812,7 +8818,7 @@ void AdjustForFastTurnAnimation( SOLDIERTYPE *pSoldier )
|
||||
// ATE: Mod: Only fastturn for OUR guys!
|
||||
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FASTTURN && pSoldier->bTeam == gbPlayerNum && !( pSoldier->uiStatusFlags & SOLDIER_TURNINGFROMHIT ) )
|
||||
{
|
||||
if ( pSoldier->bDirection != pSoldier->bDesiredDirection )
|
||||
if ( pSoldier->ubDirection != pSoldier->bDesiredDirection )
|
||||
{
|
||||
pSoldier->sAniDelay = FAST_TURN_ANIM_SPEED;
|
||||
}
|
||||
@@ -8989,7 +8995,7 @@ void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier )
|
||||
BOOLEAN MercInWater( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// Our water texture , for now is of a given type
|
||||
if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER || pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( TERRAIN_IS_WATER( pSoldier->bOverTerrainType))
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -8999,6 +9005,47 @@ BOOLEAN MercInWater( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// Our water texture , for now is of a given type
|
||||
if ( TERRAIN_IS_SHALLOW_WATER( pSoldier->bOverTerrainType))
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// Our water texture , for now is of a given type
|
||||
if ( TERRAIN_IS_DEEP_WATER( pSoldier->bOverTerrainType))
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN MercInHighWater( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// Our water texture , for now is of a given type
|
||||
if ( TERRAIN_IS_HIGH_WATER( pSoldier->bOverTerrainType))
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void RevivePlayerTeam( )
|
||||
{
|
||||
@@ -9083,7 +9130,7 @@ void HandleAnimationProfile( SOLDIERTYPE *pSoldier, UINT16 usAnimState, BOOLEAN
|
||||
pProfile = &(gpAnimProfiles[ bProfileID ] );
|
||||
|
||||
// Get direction
|
||||
pProfileDir = &( pProfile->Dirs[ pSoldier->bDirection ] );
|
||||
pProfileDir = &( pProfile->Dirs[ pSoldier->ubDirection ] );
|
||||
|
||||
// Loop tiles and set accordingly into world
|
||||
for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ )
|
||||
@@ -9180,7 +9227,7 @@ BOOLEAN GetProfileFlagsFromGridno( SOLDIERTYPE *pSoldier, UINT16 usAnimState, UI
|
||||
pProfile = &(gpAnimProfiles[ bProfileID ] );
|
||||
|
||||
// Get direction
|
||||
pProfileDir = &( pProfile->Dirs[ pSoldier->bDirection ] );
|
||||
pProfileDir = &( pProfile->Dirs[ pSoldier->ubDirection ] );
|
||||
|
||||
// Loop tiles and set accordingly into world
|
||||
for( iTileCount = 0; iTileCount < pProfileDir->ubNumTiles; iTileCount++ )
|
||||
@@ -9214,7 +9261,7 @@ void EVENT_SoldierBeginGiveItem( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
// CHANGE DIRECTION AND GOTO ANIMATION NOW
|
||||
pSoldier->bDesiredDirection = pSoldier->bPendingActionData3;
|
||||
pSoldier->bDirection = pSoldier->bPendingActionData3;
|
||||
pSoldier->ubDirection = pSoldier->bPendingActionData3;
|
||||
|
||||
// begin animation
|
||||
EVENT_InitNewSoldierAnim( pSoldier, GIVE_ITEM, 0 , FALSE );
|
||||
@@ -9330,7 +9377,7 @@ void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8
|
||||
if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) )
|
||||
{
|
||||
// OK, stop merc....
|
||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->bDirection );
|
||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection );
|
||||
|
||||
if ( pTSoldier->bTeam != gbPlayerNum )
|
||||
{
|
||||
@@ -9487,7 +9534,7 @@ void EVENT_SoldierBeginPunchAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8
|
||||
if ( !( pTSoldier->uiStatusFlags & ( SOLDIER_MONSTER | SOLDIER_ANIMAL | SOLDIER_VEHICLE ) ) )
|
||||
{
|
||||
// OK, stop merc....
|
||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->bDirection );
|
||||
EVENT_StopMerc( pTSoldier, pTSoldier->sGridNo, pTSoldier->ubDirection );
|
||||
|
||||
if ( pTSoldier->bTeam != gbPlayerNum )
|
||||
{
|
||||
@@ -10004,7 +10051,7 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy
|
||||
//EV_S_STOP_MERC SStopMerc;
|
||||
|
||||
//SStopMerc.sGridNo = pSoldier->sGridNo;
|
||||
//SStopMerc.bDirection = pSoldier->bDirection;
|
||||
//SStopMerc.bDirection = pSoldier->ubDirection;
|
||||
//SStopMerc.usSoldierID = pSoldier->ubID;
|
||||
//AddGameEvent( S_STOP_MERC, 0, &SStopMerc );
|
||||
|
||||
@@ -10065,7 +10112,7 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy
|
||||
|
||||
if ( !( gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||
{
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10595,7 +10642,7 @@ BOOLEAN InternalIsValidStance( SOLDIERTYPE *pSoldier, INT8 bDirection, INT8 bNew
|
||||
|
||||
BOOLEAN IsValidStance( SOLDIERTYPE *pSoldier, INT8 bNewStance )
|
||||
{
|
||||
return( InternalIsValidStance( pSoldier, pSoldier->bDirection, bNewStance ) );
|
||||
return( InternalIsValidStance( pSoldier, pSoldier->ubDirection, bNewStance ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -10915,11 +10962,11 @@ void SoldierCollapse( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
case ANIM_STAND:
|
||||
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
EVENT_InitNewSoldierAnim( pSoldier, DEEP_WATER_DIE, 0, FALSE );
|
||||
}
|
||||
else if ( pSoldier->bOverTerrainType == LOW_WATER )
|
||||
else if ( MercInShallowWater( pSoldier) )
|
||||
{
|
||||
EVENT_InitNewSoldierAnim( pSoldier, WATER_DIE, 0, FALSE );
|
||||
}
|
||||
@@ -11218,7 +11265,7 @@ void PickPickupAnimation( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT16 sGridNo
|
||||
|
||||
default:
|
||||
|
||||
bDirection = pSoldier->bDirection;
|
||||
bDirection = pSoldier->ubDirection;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -11486,13 +11533,33 @@ void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
|
||||
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
||||
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection )
|
||||
{
|
||||
UINT16 usNewGridNo;
|
||||
INT16 sNewGridNo;
|
||||
UINT8 ubOppositeDir;
|
||||
INT16 sDirectionInc;
|
||||
|
||||
ubOppositeDir = gOppositeDirection[ ubDirection ];
|
||||
sDirectionInc = DirectionInc( ubOppositeDir);
|
||||
|
||||
// Get dest gridno, convert to center coords
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
||||
usNewGridNo = NewGridNo( (UINT16)usNewGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
||||
sNewGridNo = NewGridNo( pSoldier->sGridNo, sDirectionInc );
|
||||
if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED )
|
||||
{
|
||||
// No room to fly back. Pretend we hit the wall and fall forward instead
|
||||
BeginTyingToFall( pSoldier );
|
||||
ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE );
|
||||
return;
|
||||
}
|
||||
|
||||
sNewGridNo = NewGridNo( sNewGridNo, sDirectionInc );
|
||||
if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED )
|
||||
{
|
||||
// No room to fly back. Fall back instead
|
||||
BeginTyingToFall( pSoldier );
|
||||
ChangeSoldierState( pSoldier, FALLBACK_HIT_STAND, 0, FALSE );
|
||||
}
|
||||
|
||||
|
||||
// Remove any previous actions
|
||||
pSoldier->ubPendingAction = NO_PENDING_ACTION;
|
||||
@@ -11500,23 +11567,38 @@ void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
||||
// Set path....
|
||||
pSoldier->usPathDataSize = 0;
|
||||
pSoldier->usPathIndex = 0;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = gOppositeDirection[ pSoldier->bDirection ];
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir;
|
||||
pSoldier->usPathDataSize++;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = gOppositeDirection[ pSoldier->bDirection ];
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir;
|
||||
pSoldier->usPathDataSize++;
|
||||
pSoldier->sFinalDestination = usNewGridNo;
|
||||
pSoldier->sFinalDestination = sNewGridNo;
|
||||
EVENT_InternalSetSoldierDestination( pSoldier, pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, FLYBACK_HIT );
|
||||
|
||||
// Get a new direction based on direction
|
||||
EVENT_InitNewSoldierAnim( pSoldier, FLYBACK_HIT, 0 , FALSE );
|
||||
}
|
||||
|
||||
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
||||
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection )
|
||||
{
|
||||
UINT16 usNewGridNo;
|
||||
INT16 sNewGridNo;
|
||||
UINT8 ubOppositeDir;
|
||||
INT16 sDirection;
|
||||
|
||||
ubOppositeDir = gOppositeDirection[ ubDirection ];
|
||||
sDirection = DirectionInc( ubOppositeDir);
|
||||
|
||||
// Get dest gridno, convert to center coords
|
||||
usNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, DirectionInc( gOppositeDirection[ bDirection ] ) );
|
||||
sNewGridNo = NewGridNo( pSoldier->sGridNo, sDirection );
|
||||
if ( gubWorldMovementCosts[ sNewGridNo ][ ubOppositeDir ][ pSoldier->bLevel ] >= TRAVELCOST_BLOCKED )
|
||||
{
|
||||
// No room to fly back. Pretend we hit the wall and fall forward instead
|
||||
BeginTyingToFall( pSoldier );
|
||||
ChangeSoldierState( pSoldier, FALLFORWARD_FROMHIT_STAND, 0, FALSE );
|
||||
return;
|
||||
}
|
||||
|
||||
// Get dest gridno, convert to center coords
|
||||
//sNewGridNo = NewGridNo( sNewGridNo, sDirection );
|
||||
//usNewGridNo = NewGridNo( (UINT16)usNewGridNo, (UINT16)(-1 * DirectionInc( bDirection ) ) );
|
||||
|
||||
// Remove any previous actions
|
||||
@@ -11525,10 +11607,11 @@ void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection )
|
||||
// Set path....
|
||||
pSoldier->usPathDataSize = 0;
|
||||
pSoldier->usPathIndex = 0;
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = gOppositeDirection[ pSoldier->bDirection ];
|
||||
pSoldier->usPathingData[ pSoldier->usPathDataSize ] = ubOppositeDir;
|
||||
pSoldier->usPathDataSize++;
|
||||
pSoldier->sFinalDestination = usNewGridNo;
|
||||
EVENT_InternalSetSoldierDestination( pSoldier, pSoldier->usPathingData[ pSoldier->usPathIndex ], FALSE, FALLBACK_HIT_STAND );
|
||||
pSoldier->sFinalDestination = sNewGridNo;
|
||||
//pSoldier->sFinalDestination = pSoldier->sGridNo;
|
||||
EVENT_InternalSetSoldierDestination( pSoldier, ubOppositeDir, FALSE, FALLBACK_HIT_STAND );
|
||||
|
||||
// Get a new direction based on direction
|
||||
EVENT_InitNewSoldierAnim( pSoldier, FALLBACK_HIT_STAND, 0 , FALSE );
|
||||
@@ -11664,7 +11747,7 @@ BOOLEAN PlayerSoldierStartTalking( SOLDIERTYPE *pSoldier, UINT8 ubTargetID, BOOL
|
||||
SendSoldierSetDesiredDirectionEvent( pTSoldier, gOppositeDirection[ sFacingDir ] );
|
||||
|
||||
// Stop our guys...
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
|
||||
pTMilitiaSoldier = pTSoldier; //lal
|
||||
@@ -12051,12 +12134,12 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier )
|
||||
{
|
||||
ubSoundBase = WALK_LEFT_ROAD;
|
||||
}
|
||||
else if ( pSoldier->bOverTerrainType == LOW_WATER || pSoldier->bOverTerrainType == MED_WATER )
|
||||
else if ( MercInShallowWater( pSoldier) )
|
||||
{
|
||||
ubSoundBase = WATER_WALK1_IN;
|
||||
ubRandomMax = 2;
|
||||
}
|
||||
else if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
else if ( MercInDeepWater( pSoldier) )
|
||||
{
|
||||
ubSoundBase = SWIM_1;
|
||||
ubRandomMax = 2;
|
||||
@@ -12208,7 +12291,7 @@ void DebugValidateSoldierData( )
|
||||
|
||||
void BeginTyingToFall( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
pSoldier->bStartFallDir = pSoldier->bDirection;
|
||||
pSoldier->bStartFallDir = pSoldier->ubDirection;
|
||||
pSoldier->fTryingToFall = TRUE;
|
||||
|
||||
// Randomize direction
|
||||
|
||||
@@ -503,7 +503,7 @@ public:
|
||||
FLOAT dOldYPos;
|
||||
INT16 sInitialGridNo;
|
||||
INT16 sGridNo;
|
||||
INT8 bDirection;
|
||||
UINT8 ubDirection;
|
||||
INT16 sHeightAdjustment;
|
||||
INT16 sDesiredHeight;
|
||||
INT16 sTempNewGridNo; // New grid no for advanced animations
|
||||
@@ -1158,7 +1158,7 @@ void EVENT_GetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16
|
||||
BOOLEAN EVENT_InternalGetNewSoldierPath( SOLDIERTYPE *pSoldier, UINT16 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestart );
|
||||
|
||||
void EVENT_SetSoldierDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection );
|
||||
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT16 usNewDirection );
|
||||
void EVENT_SetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection );
|
||||
void EVENT_FireSoldierWeapon( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo );
|
||||
void EVENT_SoldierGotHit( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection , UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT16 sLocationGridNo );
|
||||
void EVENT_SoldierBeginBladeAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubDirection );
|
||||
@@ -1204,8 +1204,8 @@ BOOLEAN DeletePaletteData( );
|
||||
// UTILITY FUNCTUIONS
|
||||
void MoveMerc( SOLDIERTYPE *pSoldier, FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckRange );
|
||||
void MoveMercFacingDirection( SOLDIERTYPE *pSoldier, BOOLEAN fReverse, FLOAT dMovementDist );
|
||||
INT16 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier );
|
||||
INT16 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier );
|
||||
UINT8 GetDirectionFromXY( INT16 sXPos, INT16 sYPos, SOLDIERTYPE *pSoldier );
|
||||
UINT8 GetDirectionFromGridNo( INT16 sGridNo, SOLDIERTYPE *pSoldier );
|
||||
UINT8 atan8( INT16 sXPos, INT16 sYPos, INT16 sXPos2, INT16 sYPos2 );
|
||||
UINT8 atan8FromAngle( DOUBLE dAngle );
|
||||
INT8 CalcActionPoints(SOLDIERTYPE *pSold );
|
||||
@@ -1214,6 +1214,9 @@ INT16 GetDirectionToGridNoFromGridNo( INT16 sGridNoDest, INT16 sGridNoSrc );
|
||||
// This function is now obsolete. Call ReduceAttackBusyCount instead.
|
||||
// void ReleaseSoldiersAttacker( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN MercInWater( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN MercInShallowWater( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN MercInDeepWater( SOLDIERTYPE *pSoldier );
|
||||
BOOLEAN MercInHighWater( SOLDIERTYPE *pSoldier );
|
||||
UINT16 GetNewSoldierStateFromNewStance( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance );
|
||||
UINT16 GetMoveStateBasedOnStance( SOLDIERTYPE *pSoldier, UINT8 ubStanceHeight );
|
||||
void SoldierGotoStationaryStance( SOLDIERTYPE *pSoldier );
|
||||
@@ -1270,10 +1273,10 @@ void PositionSoldierLight( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void SetCheckSoldierLightFlag( SOLDIERTYPE *pSoldier );
|
||||
|
||||
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT16 usNewDirection, BOOLEAN fFromMove, UINT16 usAnimState );
|
||||
void EVENT_InternalSetSoldierDestination( SOLDIERTYPE *pSoldier, UINT8 ubNewDirection, BOOLEAN fFromMove, UINT16 usAnimState );
|
||||
|
||||
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection );
|
||||
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, INT8 bDirection );
|
||||
void ChangeToFlybackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection );
|
||||
void ChangeToFallbackAnimation( SOLDIERTYPE *pSoldier, UINT8 ubDirection );
|
||||
|
||||
//reset soldier timers
|
||||
void ResetSoldierChangeStatTimer( SOLDIERTYPE *pSoldier );
|
||||
|
||||
+11
-10
@@ -414,10 +414,10 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
|
||||
Soldier.sSectorX = pCreateStruct->sSectorX;
|
||||
Soldier.sSectorY = pCreateStruct->sSectorY;
|
||||
Soldier.bSectorZ = pCreateStruct->bSectorZ;
|
||||
Soldier.ubInsertionDirection = pCreateStruct->bDirection;
|
||||
Soldier.bDesiredDirection = pCreateStruct->bDirection;
|
||||
Soldier.bDominantDir = pCreateStruct->bDirection;
|
||||
Soldier.bDirection = pCreateStruct->bDirection;
|
||||
Soldier.ubInsertionDirection = pCreateStruct->ubDirection;
|
||||
Soldier.bDesiredDirection = pCreateStruct->ubDirection;
|
||||
Soldier.bDominantDir = pCreateStruct->ubDirection;
|
||||
Soldier.ubDirection = pCreateStruct->ubDirection;
|
||||
|
||||
Soldier.sInsertionGridNo = pCreateStruct->sInsertionGridNo;
|
||||
Soldier.bOldLife = Soldier.bLifeMax;
|
||||
@@ -812,7 +812,7 @@ BOOLEAN TacticalCopySoldierFromProfile( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STR
|
||||
|
||||
pSoldier->bOrders = pCreateStruct->bOrders;
|
||||
pSoldier->bAttitude = pCreateStruct->bAttitude;
|
||||
pSoldier->bDirection = pCreateStruct->bDirection;
|
||||
pSoldier->ubDirection = pCreateStruct->ubDirection;
|
||||
pSoldier->bPatrolCnt = pCreateStruct->bPatrolCnt;
|
||||
memcpy( pSoldier->usPatrolGrid, pCreateStruct->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS );
|
||||
|
||||
@@ -1642,7 +1642,7 @@ void CreateDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT *pp, B
|
||||
//Pass over mandatory information specified from the basic placement
|
||||
pp->bOrders = bp->bOrders;
|
||||
pp->bAttitude = bp->bAttitude;
|
||||
pp->bDirection = bp->bDirection;
|
||||
pp->ubDirection = bp->ubDirection;
|
||||
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("CreateDetailedPlacementGivenBasicPlacementInfo: determine soldier's class"));
|
||||
@@ -1861,7 +1861,7 @@ void CreateStaticDetailedPlacementGivenBasicPlacementInfo( SOLDIERCREATE_STRUCT
|
||||
//Pass over mandatory information specified from the basic placement
|
||||
spp->bOrders = bp->bOrders;
|
||||
spp->bAttitude = bp->bAttitude;
|
||||
spp->bDirection = bp->bDirection;
|
||||
spp->ubDirection = bp->ubDirection;
|
||||
|
||||
//Only creatures have mandatory body types specified.
|
||||
if( spp->bTeam == CREATURE_TEAM )
|
||||
@@ -1929,7 +1929,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
|
||||
// Copy over team
|
||||
pp->bTeam = bp->bTeam;
|
||||
|
||||
pp->bDirection = bp->bDirection;
|
||||
pp->ubDirection = bp->ubDirection;
|
||||
pp->sInsertionGridNo = bp->usStartingGridNo;
|
||||
|
||||
//ATE: Copy over sector coordinates from profile to create struct
|
||||
@@ -1941,7 +1941,7 @@ void CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo(
|
||||
|
||||
pp->bOrders = bp->bOrders;
|
||||
pp->bAttitude = bp->bAttitude;
|
||||
pp->bDirection = bp->bDirection;
|
||||
pp->ubDirection = bp->ubDirection;
|
||||
pp->bPatrolCnt = bp->bPatrolCnt;
|
||||
memcpy( pp->sPatrolGrid, bp->sPatrolGrid, sizeof( INT16 ) * MAXPATROLGRIDS );
|
||||
pp->fHasKeys = bp->fHasKeys;
|
||||
@@ -2383,7 +2383,8 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass )
|
||||
UINT8 ubID;
|
||||
SOLDIERTYPE * pSoldier;
|
||||
|
||||
if (gpBattleGroup->ubSectorZ == gbWorldSectorZ &&
|
||||
if (gpBattleGroup &&
|
||||
gpBattleGroup->ubSectorZ == gbWorldSectorZ &&
|
||||
gpBattleGroup->ubSectorX == gWorldSectorX &&
|
||||
gpBattleGroup->ubSectorY == gWorldSectorY &&
|
||||
guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI )
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef struct
|
||||
INT8 bTeam; //The team this individual is part of.
|
||||
INT8 bRelativeAttributeLevel;
|
||||
INT8 bRelativeEquipmentLevel;
|
||||
INT8 bDirection; //1 of 8 values (always mandatory)
|
||||
UINT8 ubDirection; //1 of 8 values (always mandatory)
|
||||
INT8 bOrders;
|
||||
INT8 bAttitude;
|
||||
INT8 bBodyType; //up to 128 body types, -1 means random
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
//Location information
|
||||
INT16 sSectorX;
|
||||
INT16 sSectorY;
|
||||
INT8 bDirection;
|
||||
UINT8 ubDirection;
|
||||
INT16 sInsertionGridNo;
|
||||
|
||||
// Can force a team, but needs flag set
|
||||
|
||||
@@ -2368,7 +2368,9 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated()
|
||||
{
|
||||
if( curr->pBasicPlacement->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
MemFree( curr->pDetailedPlacement );
|
||||
// pDetailedPlacement has been C++'d
|
||||
//MemFree( curr->pDetailedPlacement );
|
||||
delete curr->pDetailedPlacement;
|
||||
curr->pDetailedPlacement = NULL;
|
||||
curr->pBasicPlacement->fDetailedPlacement = FALSE;
|
||||
curr->pBasicPlacement->fPriorityExistance = FALSE;
|
||||
|
||||
@@ -915,7 +915,7 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam )
|
||||
MercCreateStruct.sSectorY = pSoldier->sSectorY;
|
||||
MercCreateStruct.bSectorZ = pSoldier->bSectorZ;
|
||||
MercCreateStruct.sInsertionGridNo = pSoldier->sGridNo;
|
||||
MercCreateStruct.bDirection = pSoldier->bDirection;
|
||||
MercCreateStruct.ubDirection = pSoldier->ubDirection;
|
||||
|
||||
if ( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ void SetFinalTile( SOLDIERTYPE *pSoldier, INT16 sGridNo, BOOLEAN fGivenUp )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ NO_PATH_FOR_MERC ], pSoldier->name );
|
||||
}
|
||||
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I
|
||||
OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier );
|
||||
}
|
||||
#endif
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
// Restore...
|
||||
pSoldier->sFinalDestination = sOldFinalDest;
|
||||
|
||||
@@ -449,7 +449,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I
|
||||
OutputDebugInfoForTurnBasedNextTileWaiting( pSoldier );
|
||||
}
|
||||
#endif
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
// Restore...
|
||||
pSoldier->sFinalDestination = sOldFinalDest;
|
||||
|
||||
@@ -471,7 +471,7 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT16 sGridNo, I
|
||||
bOverTerrainType = GetTerrainType( sGridNo );
|
||||
|
||||
// Check if we are going into water!
|
||||
if ( bOverTerrainType == LOW_WATER || bOverTerrainType == MED_WATER || bOverTerrainType == DEEP_WATER )
|
||||
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||
{
|
||||
// Check if we are of prone or crawl height and change stance accordingly....
|
||||
switch( gAnimControl[ pSoldier->usAnimState ].ubHeight )
|
||||
|
||||
@@ -122,7 +122,7 @@ void AccumulateBurstLocation( INT16 sGridNo )
|
||||
void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
UINT8 ubShotsPerBurst = 0;
|
||||
FLOAT dAccululator = 0;
|
||||
FLOAT dAccumulator = 0;
|
||||
FLOAT dStep = 0;
|
||||
INT32 cnt;
|
||||
UINT8 ubLocationNum;
|
||||
@@ -147,7 +147,7 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||
while(EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) && pSoldier->inv[ pSoldier->ubAttackingHand ].ItemData.Gun.ubGunShotsLeft >= pSoldier->bDoAutofire && gbNumBurstLocations >= pSoldier->bDoAutofire);
|
||||
pSoldier->bDoAutofire--;
|
||||
|
||||
ubShotsPerBurst = __min(pSoldier->bDoAutofire,MAX_BURST_SPREAD_TARGETS);
|
||||
ubShotsPerBurst = pSoldier->bDoAutofire;
|
||||
}
|
||||
else if ( gbNumBurstLocations > 0 )
|
||||
ubShotsPerBurst = pSoldier->bDoAutofire / gbNumBurstLocations;
|
||||
@@ -156,11 +156,13 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||
else
|
||||
{
|
||||
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST )
|
||||
ubShotsPerBurst = __min(Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS])].ubShotsPerBurst,MAX_BURST_SPREAD_TARGETS);
|
||||
ubShotsPerBurst = Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS])].ubShotsPerBurst;
|
||||
else
|
||||
ubShotsPerBurst = __min(GetShotsPerBurst(&pSoldier->inv[ HANDPOS ]),MAX_BURST_SPREAD_TARGETS);
|
||||
ubShotsPerBurst = GetShotsPerBurst(&pSoldier->inv[ HANDPOS ]);
|
||||
}
|
||||
|
||||
ubShotsPerBurst = __min( ubShotsPerBurst, MAX_BURST_SPREAD_TARGETS);
|
||||
|
||||
// Use # gridnos accululated and # burst shots to determine accululator
|
||||
dStep = gbNumBurstLocations / (FLOAT)ubShotsPerBurst;
|
||||
|
||||
@@ -168,13 +170,18 @@ void PickBurstLocations( SOLDIERTYPE *pSoldier )
|
||||
for ( cnt = 0; cnt < ubShotsPerBurst; cnt++ )
|
||||
{
|
||||
// Get index into list
|
||||
ubLocationNum = (UINT8)( dAccululator );
|
||||
ubLocationNum = (UINT8)( dAccumulator );
|
||||
|
||||
// Add to merc location
|
||||
pSoldier->sSpreadLocations[ cnt ] = gsBurstLocations[ ubLocationNum ].sGridNo;
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickBurstLocations: loc#%d = %d", cnt, pSoldier->sSpreadLocations[ cnt ]));
|
||||
// Acculuate index value
|
||||
dAccululator += dStep;
|
||||
dAccumulator += dStep;
|
||||
}
|
||||
|
||||
for (; cnt < MAX_BURST_SPREAD_TARGETS; cnt++)
|
||||
{
|
||||
pSoldier->sSpreadLocations[ cnt ] = 0;
|
||||
}
|
||||
|
||||
// OK, they have been added
|
||||
@@ -219,6 +226,10 @@ void AIPickBurstLocations( SOLDIERTYPE *pSoldier, INT8 bTargets, SOLDIERTYPE *pT
|
||||
dAccululator += dStep;
|
||||
}
|
||||
|
||||
for (; cnt < MAX_BURST_SPREAD_TARGETS; cnt++)
|
||||
{
|
||||
pSoldier->sSpreadLocations[ cnt ] = 0;
|
||||
}
|
||||
// OK, they have been added
|
||||
}
|
||||
|
||||
|
||||
@@ -2779,7 +2779,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S
|
||||
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
|
||||
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
|
||||
|
||||
Corpse.bDirection = pSoldier->bDirection;
|
||||
Corpse.ubDirection = pSoldier->ubDirection;
|
||||
|
||||
// Set time of death
|
||||
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
|
||||
|
||||
@@ -2358,7 +2358,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
BeginSoldierClimbUpRoof( pjSoldier );
|
||||
}
|
||||
|
||||
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->bDirection, &bDirection ) )
|
||||
if ( FindFenceJumpDirection( pjSoldier, pjSoldier->sGridNo, pjSoldier->ubDirection, &bDirection ) )
|
||||
{
|
||||
BeginSoldierClimbFence( pjSoldier );
|
||||
}
|
||||
@@ -4392,7 +4392,7 @@ void TeleportSelectedSoldier()
|
||||
{
|
||||
SetSoldierHeight( pSoldier, 0 );
|
||||
TeleportSoldier( pSoldier, usMapPos, FALSE );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4402,7 +4402,7 @@ void TeleportSelectedSoldier()
|
||||
SetSoldierHeight( pSoldier, 50.0 );
|
||||
|
||||
TeleportSoldier( pSoldier, usMapPos, TRUE );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4519,7 +4519,7 @@ void ObliterateSector()
|
||||
// CreateAnimationTile( &AniParams );
|
||||
//PlayJA2Sample( EXPLOSION_1, RATE_11025, MIDVOLUME, 1, MIDDLEPAN );
|
||||
|
||||
EVENT_SoldierGotHit( pTSoldier, 0, 400, 0, pTSoldier->bDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE );
|
||||
EVENT_SoldierGotHit( pTSoldier, 0, 400, 0, pTSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4544,7 +4544,7 @@ void JumpFence()
|
||||
INT8 bDirection;
|
||||
if ( GetSoldier( &pSoldier, gusSelectedSoldier ) )
|
||||
{
|
||||
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bDirection ) )
|
||||
if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bDirection ) )
|
||||
{
|
||||
BeginSoldierClimbFence( pSoldier );
|
||||
}
|
||||
@@ -4568,7 +4568,7 @@ void CreateNextCivType()
|
||||
MercCreateStruct.sSectorY = gWorldSectorY;
|
||||
MercCreateStruct.bSectorZ = gbWorldSectorZ;
|
||||
MercCreateStruct.bBodyType = bBodyType;
|
||||
MercCreateStruct.bDirection = SOUTH;
|
||||
MercCreateStruct.ubDirection = SOUTH;
|
||||
|
||||
bBodyType++;
|
||||
|
||||
|
||||
@@ -2347,7 +2347,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier )
|
||||
}
|
||||
|
||||
// Now check our terrain to see if we cannot do the action now...
|
||||
if ( pSoldier->bOverTerrainType == DEEP_WATER )
|
||||
if ( WaterTooDeepForAttacks( pSoldier->sGridNo) )
|
||||
{
|
||||
ubCursor = INVALIDCURS;
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId )
|
||||
EVENT_SetSoldierPosition( pSoldier, pVehicleSoldier->dXPos, pVehicleSoldier->dYPos );
|
||||
|
||||
// Stop from any movement.....
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
|
||||
// can't call SetCurrentSquad OR SelectSoldier in mapscreen, that will initialize interface panels!!!
|
||||
if ( guiCurrentScreen == GAME_SCREEN )
|
||||
|
||||
+88
-62
@@ -1314,28 +1314,36 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
else
|
||||
{
|
||||
// ATE: PAtch up - bookkeeping for spreading done out of whak
|
||||
if ( pSoldier->fDoSpread && !pSoldier->bDoBurst )
|
||||
if ( pSoldier->fDoSpread)
|
||||
{
|
||||
pSoldier->fDoSpread = FALSE;
|
||||
}
|
||||
|
||||
if ( pSoldier->fDoSpread >= MAX_BURST_SPREAD_TARGETS )
|
||||
{
|
||||
//If we have more than MAX_BURST_SPREAD_TARGETS bullets, loop over and start again from the first target location
|
||||
pSoldier->fDoSpread = 1;
|
||||
if (pSoldier->bDoBurst )
|
||||
{
|
||||
pSoldier->fDoSpread = FALSE;
|
||||
}
|
||||
// 0verhaul: The original code seemed brain damaged: If the current spread target was 0 it would shoot at the
|
||||
// non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS,
|
||||
// but was actually reset before it got there. So the final spread target would never be shot at. Hopefully this
|
||||
// will work better.
|
||||
else if (pSoldier->fDoSpread > MAX_BURST_SPREAD_TARGETS ||
|
||||
pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] == 0)
|
||||
{
|
||||
if (pSoldier->fDoSpread == 1)
|
||||
{
|
||||
// If no spread locations are defined, don't spread
|
||||
pSoldier->fDoSpread = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we hit the end of the array, either by finding a 0 or by exceeding its size, reset
|
||||
pSoldier->fDoSpread = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( pSoldier->fDoSpread )
|
||||
{
|
||||
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
||||
{
|
||||
UseGun( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
UseGun( pSoldier, sTargetGridNo );
|
||||
}
|
||||
UseGun( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
||||
pSoldier->fDoSpread++;
|
||||
}
|
||||
else
|
||||
@@ -1357,28 +1365,36 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
UseGun( pSoldier, sTargetGridNo );
|
||||
else
|
||||
// ATE: PAtch up - bookkeeping for spreading done out of whak
|
||||
if ( pSoldier->fDoSpread && !pSoldier->bDoBurst )
|
||||
if ( pSoldier->fDoSpread)
|
||||
{
|
||||
pSoldier->fDoSpread = FALSE;
|
||||
}
|
||||
if (!pSoldier->bDoBurst )
|
||||
{
|
||||
pSoldier->fDoSpread = FALSE;
|
||||
}
|
||||
|
||||
if ( pSoldier->fDoSpread >= MAX_BURST_SPREAD_TARGETS )
|
||||
{
|
||||
//If we have more than MAX_BURST_SPREAD_TARGETS bullets, loop over and start again from the first target location
|
||||
pSoldier->fDoSpread = 1;
|
||||
// 0verhaul: The original code seemed brain damaged: If the current spread target was 0 it would shoot at the
|
||||
// non-spread target grid # instead. Also fDoSpread is used as a counter from 1 to MAX_BURST_SPREAD_TARGETS,
|
||||
// but was actually reset before it got there. So the final spread target would never be shot at. Hopefully this
|
||||
// will work better.
|
||||
else if ( pSoldier->fDoSpread > MAX_BURST_SPREAD_TARGETS ||
|
||||
pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] == 0)
|
||||
{
|
||||
if (pSoldier->fDoSpread == 1)
|
||||
{
|
||||
// If no spread locations are defined, don't spread
|
||||
pSoldier->fDoSpread = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we hit the end of the array, either by finding a 0 or by exceeding its size, reset
|
||||
pSoldier->fDoSpread = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( pSoldier->fDoSpread )
|
||||
{
|
||||
if ( pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] != 0 )
|
||||
{
|
||||
UseLauncher( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
UseLauncher( pSoldier, sTargetGridNo );
|
||||
}
|
||||
UseLauncher( pSoldier, pSoldier->sSpreadLocations[ pSoldier->fDoSpread - 1 ] );
|
||||
pSoldier->fDoSpread++;
|
||||
}
|
||||
else
|
||||
@@ -1917,7 +1933,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
}
|
||||
|
||||
// Direction to center of explosion
|
||||
ubDirection = gOppositeDirection[ pSoldier->bDirection ];
|
||||
ubDirection = gOppositeDirection[ pSoldier->ubDirection ];
|
||||
sNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)(1 * DirectionInc( ubDirection ) ) );
|
||||
|
||||
// Check if a person exists here and is not prone....
|
||||
@@ -1932,7 +1948,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo )
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Exaust from LAW", gTacticalStatus.ubAttackBusyCount ) );
|
||||
DebugAttackBusy( "Incrementing Attack: Exaust from LAW\n" );
|
||||
|
||||
EVENT_SoldierGotHit( MercPtrs[ ubMerc ], MINI_GRENADE, 10, 200, pSoldier->bDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo );
|
||||
EVENT_SoldierGotHit( MercPtrs[ ubMerc ], MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2602,7 +2618,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo )
|
||||
|
||||
//AXP 25.03.2007: Cleaned up throwing AP costs. Now only turning + stance change AP
|
||||
// costs are deducted. Final throw cost is deducted on creating the grenade object
|
||||
if ( (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ) != pSoldier->bDirection )
|
||||
if ( (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ) != pSoldier->ubDirection )
|
||||
sAPCost += (INT16)GetAPsToLook( pSoldier );
|
||||
sAPCost += (INT16)GetAPsToChangeStance( pSoldier, ANIM_STAND );
|
||||
|
||||
@@ -2897,29 +2913,30 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, INT16 sGridNo, INT16 sXPos,
|
||||
// gTacticalStatus.ubAttackBusyCount++;
|
||||
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Explosion gone off, COunt now %d", gTacticalStatus.ubAttackBusyCount ) );
|
||||
|
||||
PlayJA2Sample( CREATURE_GAS_NOISE, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||
PlayJA2Sample( CREATURE_GAS_NOISE, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||
// 0verhaul: Not ready to simplify this to a single call yet. What we need in order to
|
||||
// fix this correctly is to detach 'alien spit' as a special caliber and instead add 3 new calibers for actual "ammo":
|
||||
// very small spit, small spit, and large spit. Then we need to add a special effect miss index to point to the
|
||||
// appropriate smoke effect to disperse.
|
||||
//NewSmokeEffect( sGridNo, usItem, 0, ubAttackerID);
|
||||
|
||||
// WDS fix 07/25/2007
|
||||
// Don't have monsters cause explosions
|
||||
// NewSmokeEffect( sGridNo, usItem, 0, ubAttackerID );
|
||||
// Do Spread effect.......
|
||||
switch( usItem )
|
||||
{
|
||||
case CREATURE_YOUNG_MALE_SPIT:
|
||||
case CREATURE_INFANT_SPIT:
|
||||
|
||||
// // Do Spread effect.......
|
||||
// switch( usItem )
|
||||
// {
|
||||
// case CREATURE_YOUNG_MALE_SPIT:
|
||||
//case CREATURE_INFANT_SPIT:
|
||||
NewSmokeEffect( sGridNo, VERY_SMALL_CREATURE_GAS, 0, ubAttackerID );
|
||||
break;
|
||||
case CREATURE_OLD_MALE_SPIT:
|
||||
NewSmokeEffect( sGridNo, SMALL_CREATURE_GAS, 0, ubAttackerID );
|
||||
break;
|
||||
|
||||
// NewSmokeEffect( sGridNo, VERY_SMALL_CREATURE_GAS, 0, ubAttackerID );
|
||||
// break;
|
||||
// case CREATURE_OLD_MALE_SPIT:
|
||||
// NewSmokeEffect( sGridNo, SMALL_CREATURE_GAS, 0, ubAttackerID );
|
||||
// break;
|
||||
|
||||
// case CREATURE_QUEEN_SPIT:
|
||||
// NewSmokeEffect( sGridNo, LARGE_CREATURE_GAS, 0, ubAttackerID );
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
case CREATURE_QUEEN_SPIT:
|
||||
NewSmokeEffect( sGridNo, LARGE_CREATURE_GAS, 0, ubAttackerID );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
@@ -2980,7 +2997,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
|
||||
DoSpecialEffectAmmoMiss( ubAttackerID, pTargetSoldier->sGridNo, sXPos, sYPos, sZPos, FALSE, FALSE, 0 );
|
||||
|
||||
// OK, SHOT HAS HIT, DO THINGS APPROPRIATELY
|
||||
// ATE: This is 'cause of that darn smoke effect that could potnetially kill
|
||||
// ATE: This is 'cause of that darn smoke effect that could potentially kill
|
||||
// the poor bastard .. so check
|
||||
if ( !pTargetSoldier->fDoingExternalDeath )
|
||||
{
|
||||
@@ -2988,7 +3005,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// Buddy had died from additional dammage - free up attacker here...
|
||||
// Buddy had died from additional damage - free up attacker here...
|
||||
// ReduceAttackBusyCount( pTargetSoldier->ubAttackerID, FALSE );
|
||||
// DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Special effect killed before bullet impact, attack count now %d", gTacticalStatus.ubAttackBusyCount) );
|
||||
// OutputDebugString( "Special effect killed before bullet impact\n" );
|
||||
@@ -3228,7 +3245,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT8 bWeaponStatus, UINT
|
||||
usMissTileType = FIRSTMISS;
|
||||
|
||||
// Check if we are in water...
|
||||
if ( gpWorldLevelData[ sGridNo ].ubTerrainID == LOW_WATER || gpWorldLevelData[ sGridNo ].ubTerrainID == DEEP_WATER )
|
||||
if ( TERRAIN_IS_WATER( gpWorldLevelData[ sGridNo ].ubTerrainID) )
|
||||
{
|
||||
usMissTileIndex = SECONDMISS1;
|
||||
usMissTileType = SECONDMISS;
|
||||
@@ -3688,7 +3705,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime
|
||||
{
|
||||
iSightRange = SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, pSoldier->bTargetLevel, pSoldier->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT );
|
||||
}
|
||||
|
||||
|
||||
//restore old flag
|
||||
gAnimControl[ pSoldier->usAnimState ].uiFlags = oldFlag;
|
||||
|
||||
@@ -4498,7 +4515,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocat
|
||||
break;
|
||||
case AIM_SHOT_LEGS:
|
||||
// is the damage enough to make us fall over?
|
||||
if ( pubSpecial && IS_MERC_BODY_TYPE( pTarget ) && gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_STAND && pTarget->bOverTerrainType != LOW_WATER && pTarget->bOverTerrainType != MED_WATER && pTarget->bOverTerrainType != DEEP_WATER )
|
||||
if ( pubSpecial && IS_MERC_BODY_TYPE( pTarget ) && gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_STAND && !MercInWater( pTarget) )
|
||||
{
|
||||
if (iImpactForCrits > MIN_DAMAGE_FOR_AUTO_FALL_OVER )
|
||||
{
|
||||
@@ -5355,6 +5372,14 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed )
|
||||
// better max range due to expertise
|
||||
iRange = iRange * (100 + gbSkillTraitBonus[THROWING] * NUM_SKILL_TRAITS( pSoldier, THROWING ) ) / 100;
|
||||
}
|
||||
|
||||
// Adjust for thrower's stance
|
||||
if (gAnimControl[ pSoldier->usAnimState ].ubEndHeight < ANIM_STAND)
|
||||
{
|
||||
// For now we just assume the thrower is crouched since we don't allow prone tossing at the moment
|
||||
// So dock 30% from the distance
|
||||
iRange = (iRange * 70) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (iRange < 1)
|
||||
@@ -5768,12 +5793,13 @@ BOOLEAN WeaponReady(SOLDIERTYPE * pSoldier)
|
||||
if ( AM_A_ROBOT( pSoldier) )
|
||||
return TRUE;
|
||||
#endif
|
||||
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY )
|
||||
if ( (gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIREREADY ) ||
|
||||
(gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_FIRE ) )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
INT8 GetAPsToReload( OBJECTTYPE *pObj )
|
||||
{
|
||||
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("GetAPsToReload"));
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ typedef struct
|
||||
BOOLEAN antiTank;
|
||||
BOOLEAN dart;
|
||||
BOOLEAN knife;
|
||||
BOOLEAN monsterSpit;
|
||||
UINT16 monsterSpit;
|
||||
BOOLEAN ignoreArmour;
|
||||
BOOLEAN acidic;
|
||||
INT16 lockBustingPower;
|
||||
|
||||
+2
-2
@@ -351,7 +351,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo
|
||||
|
||||
|
||||
who = pSoldier->ubID;
|
||||
dir = pSoldier->bDirection;
|
||||
dir = pSoldier->ubDirection;
|
||||
|
||||
//NumMessage("good old reveal",dir);
|
||||
|
||||
@@ -374,7 +374,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo
|
||||
|
||||
// create gridno increment for NOVIEW - in other words, no increment!
|
||||
Inc[5] = 0;
|
||||
Dir[5] = pSoldier->bDirection;
|
||||
Dir[5] = pSoldier->ubDirection;
|
||||
|
||||
if (dir % 2 == 1) /* even numbers use ViewPath2 */
|
||||
Path2 = TRUE;
|
||||
|
||||
+29
-29
@@ -1151,7 +1151,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
bSubjectDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sSubjectGridNo );
|
||||
}
|
||||
if (bFacingDir == DIRECTION_IRRELEVANT) {
|
||||
bFacingDir = pSoldier->bDirection;
|
||||
bFacingDir = pSoldier->ubDirection;
|
||||
}
|
||||
|
||||
sDistVisible = gbLookDistance[bFacingDir][bSubjectDir];
|
||||
@@ -1205,8 +1205,8 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
// valid map references then use the ambient light level instead.
|
||||
if(0 > sSubjectGridNo || sSubjectGridNo > WORLD_MAX)
|
||||
{
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d",
|
||||
pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel));
|
||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("113/UC Warning! Tried to detect the light level when character %ls[%d] looks at a location outside of the valid map (gridno %d). Assigning default %d",
|
||||
pSoldier->name, pSoldier->ubID, pSoldier->sGridNo, ubAmbientLightLevel));
|
||||
|
||||
bLightLevel = ubAmbientLightLevel;
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
sDistVisible += sDistVisible * GetTotalVisionRangeBonus(pSoldier, bLightLevel) / 100;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// give one step better vision for people with nightops
|
||||
if (HAS_SKILL_TRAIT( pSoldier, NIGHTOPS ))
|
||||
{
|
||||
@@ -1254,7 +1254,7 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir,
|
||||
if ( TANK(pSoldier) && sDistVisible > 0 && pSubject)
|
||||
{
|
||||
sDistVisible = __max( sDistVisible + 5, pSubject->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->bLevel) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
sDistVisible = __max( sDistVisible + 5, pSoldier->GetMaxDistanceVisible() );
|
||||
}
|
||||
@@ -2111,7 +2111,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno,
|
||||
{
|
||||
CancelAIAction( pSoldier, TRUE );
|
||||
pSoldier->sAbsoluteFinalDestination = NOWHERE;
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
|
||||
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection );
|
||||
TriggerNPCRecord( ANGEL, 20 );
|
||||
// trigger Angel to walk off afterwards
|
||||
//TriggerNPCRecord( ANGEL, 24 );
|
||||
@@ -3852,7 +3852,7 @@ void DebugSoldierPage2( )
|
||||
SetFontShade(LARGEFONT1, FONT_SHADE_GREEN);
|
||||
gprintf( 0, LINE_HEIGHT * ubLine, L"Direction:");
|
||||
SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL);
|
||||
gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzDirectionStr[ pSoldier->bDirection] );
|
||||
gprintf( 150, LINE_HEIGHT * ubLine, L"%S", gzDirectionStr[ pSoldier->ubDirection] );
|
||||
ubLine++;
|
||||
|
||||
SetFontShade(LARGEFONT1, FONT_SHADE_GREEN);
|
||||
@@ -5688,14 +5688,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b
|
||||
sNoiseX = CenterX(sGridNo);
|
||||
sNoiseY = CenterY(sGridNo);
|
||||
bDirection = atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY);
|
||||
if ( pSoldier->bDirection != bDirection && pSoldier->bDirection != gOneCDirection[ bDirection ] && pSoldier->bDirection != gOneCCDirection[ bDirection ] )
|
||||
if ( pSoldier->ubDirection != bDirection && pSoldier->ubDirection != gOneCDirection[ bDirection ] && pSoldier->ubDirection != gOneCCDirection[ bDirection ] )
|
||||
{
|
||||
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
||||
MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = FALSE;
|
||||
fMuzzleFlash = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int sDistVisible = pSoldier->GetMaxDistanceVisible(sGridNo, bLevel, CALC_FROM_WANTED_DIR );
|
||||
|
||||
if ( fMuzzleFlash )
|
||||
@@ -5703,14 +5703,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b
|
||||
// turn flash on again
|
||||
MercPtrs[ ubNoiseMaker ]->fMuzzleFlash = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= sDistVisible )
|
||||
{
|
||||
// just use the XXadjustedXX center of the gridno
|
||||
sNoiseX = CenterX(sGridNo);
|
||||
sNoiseY = CenterY(sGridNo);
|
||||
|
||||
if (pSoldier->bDirection != atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY))
|
||||
if (pSoldier->ubDirection != atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY))
|
||||
{
|
||||
bHadToTurn = TRUE;
|
||||
}
|
||||
@@ -6530,27 +6530,27 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT
|
||||
}
|
||||
|
||||
bOldOppList = pDefender->bOppList[ pAttacker->ubID ];
|
||||
// check LOS, considering we are now aware of the attacker
|
||||
// ignore muzzle flashes when must turning head
|
||||
if ( pAttacker->fMuzzleFlash )
|
||||
{
|
||||
bDirection = atan8( pDefender->sX,pDefender->sY, pAttacker->sX, pAttacker->sY );
|
||||
if ( pDefender->bDirection != bDirection && pDefender->bDirection != gOneCDirection[ bDirection ] && pDefender->bDirection != gOneCCDirection[ bDirection ] )
|
||||
// check LOS, considering we are now aware of the attacker
|
||||
// ignore muzzle flashes when must turning head
|
||||
if ( pAttacker->fMuzzleFlash )
|
||||
{
|
||||
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
||||
pAttacker->fMuzzleFlash = FALSE;
|
||||
fMuzzleFlash = TRUE;
|
||||
bDirection = atan8( pDefender->sX,pDefender->sY, pAttacker->sX, pAttacker->sY );
|
||||
if ( pDefender->ubDirection != bDirection && pDefender->ubDirection != gOneCDirection[ bDirection ] && pDefender->ubDirection != gOneCCDirection[ bDirection ] )
|
||||
{
|
||||
// temporarily turn off muzzle flash so DistanceVisible can be calculated without it
|
||||
pAttacker->fMuzzleFlash = FALSE;
|
||||
fMuzzleFlash = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SoldierToSoldierLineOfSightTest( pDefender, pAttacker, TRUE, CALC_FROM_WANTED_DIR ) != 0)
|
||||
{
|
||||
fSeesAttacker = TRUE;
|
||||
}
|
||||
if ( fMuzzleFlash )
|
||||
{
|
||||
pAttacker->fMuzzleFlash = TRUE;
|
||||
}
|
||||
{
|
||||
fSeesAttacker = TRUE;
|
||||
}
|
||||
if ( fMuzzleFlash )
|
||||
{
|
||||
pAttacker->fMuzzleFlash = TRUE;
|
||||
}
|
||||
|
||||
if (fSeesAttacker)
|
||||
{
|
||||
@@ -7011,4 +7011,4 @@ BOOLEAN SoldierHasLimitedVision(SOLDIERTYPE * pSoldier)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user