mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Fix: VS2010 debug build issue with reading in StructureConstruct.xml
- replaced a few hardcoded values with enums - use TANK(...) macro instead of checking for bodytype by hand git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7959 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1833,32 +1833,32 @@ void HandleLaserLockResult( BOOLEAN fSuccess )
|
||||
|
||||
void SetupMaxActionPointsAnimation()
|
||||
{
|
||||
gubMaxActionPoints[0] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[1] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[2] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[3] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[4] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[5] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[6] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[7] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[8] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[9] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[10] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[11] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[12] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[13] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[14] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[15] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[16] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[17] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[18] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[19] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[20] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[21] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[22] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[23] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[24] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[25] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[26] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[27] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[REGMALE] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[BIGMALE] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[STOCKYMALE] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[REGFEMALE] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[ADULTFEMALEMONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[AM_MONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[YAF_MONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[YAM_MONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[LARVAE_MONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[INFANT_MONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[QUEENMONSTER] = APBPConstants[AP_MONSTER_MAXIMUM];
|
||||
gubMaxActionPoints[FATCIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[MANCIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[MINICIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[DRESSCIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[HATKIDCIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[KIDCIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[CRIPPLECIV] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[COW] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[CROW] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[BLOODCAT] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[ROBOTNOWEAPON] = APBPConstants[AP_MAXIMUM];
|
||||
gubMaxActionPoints[HUMVEE] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[TANK_NW] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[TANK_NE] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[ELDORADO] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[ICECREAMTRUCK] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
gubMaxActionPoints[JEEP] = APBPConstants[AP_VEHICLE_MAXIMUM];
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ INT32 FindStratPath(INT16 sStart, INT16 sDestination, INT16 sMvtGroupNumber, BOO
|
||||
|
||||
|
||||
//contemplate a new path in each direction
|
||||
for (iCnt=0; iCnt < 8; iCnt+=2)
|
||||
for ( iCnt = 0; iCnt < NUM_WORLD_DIRECTIONS; iCnt += 2 )
|
||||
{
|
||||
newLoc = curLoc + diStratDelta[iCnt];
|
||||
|
||||
|
||||
+2
-2
@@ -1423,7 +1423,7 @@ BOOLEAN AllMercsLookForDoor( INT32 sGridNo, BOOLEAN fUpdateValue )
|
||||
}
|
||||
|
||||
// Now try other adjacent gridnos...
|
||||
for ( cnt2 = 0; cnt2 < 8; cnt2++ )
|
||||
for ( cnt2 = 0; cnt2 < NUM_WORLD_DIRECTIONS; ++cnt2 )
|
||||
{
|
||||
usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) );
|
||||
// and we can trace a line of sight to his x,y coordinates?
|
||||
@@ -1482,7 +1482,7 @@ BOOLEAN MercLooksForDoors( SOLDIERTYPE *pSoldier, BOOLEAN fUpdateValue )
|
||||
}
|
||||
|
||||
// Now try other adjacent gridnos...
|
||||
for ( cnt2 = 0; cnt2 < 8; cnt2++ )
|
||||
for ( cnt2 = 0; cnt2 < NUM_WORLD_DIRECTIONS; ++cnt2 )
|
||||
{
|
||||
usNewGridNo = NewGridNo( sGridNo, DirectionInc( bDirs[ cnt2 ] ) );
|
||||
// and we can trace a line of sight to his x,y coordinates?
|
||||
|
||||
+1
-2
@@ -2638,8 +2638,7 @@ INT16 MinPtsToMove(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
// WANNE - BMP: FIX: Valid directions are only from 0-7!!
|
||||
//for (cnt=0; cnt <= 8; cnt++)
|
||||
for (cnt=0; cnt < 8; ++cnt)
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt )
|
||||
{
|
||||
sGridNo = NewGridNo(pSoldier->sGridNo,DirectionInc(cnt));
|
||||
if (sGridNo != pSoldier->sGridNo)
|
||||
|
||||
@@ -1759,7 +1759,7 @@ INT32 FindNearestAvailableGridNoForCorpse( ROTTING_CORPSE_DEFINITION *pDef, INT8
|
||||
}
|
||||
else
|
||||
{
|
||||
for( cnt3 = 0; cnt3 < 8; cnt3++ )
|
||||
for ( cnt3 = 0; cnt3 < NUM_WORLD_DIRECTIONS; ++cnt3 )
|
||||
{
|
||||
if ( OkayToAddStructureToWorld( sGridNo, pDef->bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), INVALID_STRUCTURE_ID ) )
|
||||
{
|
||||
|
||||
+22
-23
@@ -379,7 +379,7 @@ INT32 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAni
|
||||
}
|
||||
|
||||
// Check each struct in each direction
|
||||
for( cnt3 = 0; cnt3 < 8; cnt3++ )
|
||||
for ( cnt3 = 0; cnt3 < NUM_WORLD_DIRECTIONS; ++cnt3 )
|
||||
{
|
||||
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
|
||||
{
|
||||
@@ -501,7 +501,7 @@ INT32 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYPE
|
||||
{
|
||||
leftmost = ( ( sSweetGridNo + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS;
|
||||
|
||||
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
|
||||
for( cnt2 = sLeft; cnt2 <= sRight; ++cnt2 )
|
||||
{
|
||||
sGridNo = sSweetGridNo + ( WORLD_COLS * cnt1 ) + cnt2;
|
||||
if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS )
|
||||
@@ -545,34 +545,34 @@ INT32 FindGridNoFromSweetSpotWithStructDataUsingGivenDirectionFirst( SOLDIERTYPE
|
||||
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ bGivenDirection ]]), usOKToAddStructID ) )
|
||||
{
|
||||
fDirectionFound = TRUE;
|
||||
cnt3 = bGivenDirection;
|
||||
cnt3 = bGivenDirection;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check each struct in each direction
|
||||
for( cnt3 = 0; cnt3 < 8; cnt3++ )
|
||||
else
|
||||
{
|
||||
if ( cnt3 != bGivenDirection )
|
||||
{
|
||||
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
|
||||
{
|
||||
fDirectionFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Check each struct in each direction
|
||||
for( cnt3 = 0; cnt3 <NUM_WORLD_DIRECTIONS; ++cnt3 )
|
||||
{
|
||||
if ( cnt3 != bGivenDirection )
|
||||
{
|
||||
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
|
||||
{
|
||||
fDirectionFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( fDirectionFound )
|
||||
{
|
||||
if ( fClosestToMerc )
|
||||
{
|
||||
uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 );
|
||||
uiRange = FindBestPath( pSoldier, sGridNo, pSoldier->pathing.bLevel, pSoldier->usUIMovementMode, NO_COPYROUTE, 0 );
|
||||
|
||||
if (uiRange == 0 )
|
||||
{
|
||||
uiRange = 999;
|
||||
}
|
||||
if (uiRange == 0 )
|
||||
{
|
||||
uiRange = 999;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -702,14 +702,13 @@ INT32 FindGridNoFromSweetSpotWithStructDataFromSoldier( SOLDIERTYPE *pSoldier, U
|
||||
pStructureFileRef = GetAnimationStructureRef( pSoldier->ubID, usAnimSurface, usAnimState );
|
||||
|
||||
// Check each struct in each direction
|
||||
for( cnt3 = 0; cnt3 < 8; cnt3++ )
|
||||
for ( cnt3 = 0; cnt3 < NUM_WORLD_DIRECTIONS; ++cnt3 )
|
||||
{
|
||||
if (OkayToAddStructureToWorld( sGridNo, pSoldier->pathing.bLevel, &(pStructureFileRef->pDBStructureRef[gOneCDirection[ cnt3 ]]), usOKToAddStructID ) )
|
||||
{
|
||||
fDirectionFound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -5119,7 +5119,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight )
|
||||
return(TANK_SHOOT);
|
||||
}
|
||||
|
||||
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
||||
if ( TANK(pSoldier) )
|
||||
{
|
||||
return(TANK_BURST);
|
||||
}
|
||||
@@ -5471,7 +5471,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL
|
||||
return(INVALID_ANIMATION);
|
||||
}
|
||||
|
||||
if ( pSoldier->ubBodyType == TANK_NW || pSoldier->ubBodyType == TANK_NE )
|
||||
if ( TANK(pSoldier) )
|
||||
{
|
||||
return(INVALID_ANIMATION);
|
||||
}
|
||||
@@ -8023,8 +8023,7 @@ void SOLDIERTYPE::TurnSoldier( void )
|
||||
if ( ((gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) &&
|
||||
this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_OFF) ||
|
||||
this->ubBodyType == ROBOTNOWEAPON ||
|
||||
this->ubBodyType == TANK_NW ||
|
||||
this->ubBodyType == TANK_NE )
|
||||
TANK(this) )
|
||||
{
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "TurnSoldier: EVENT_InitNewSoldierAnim" ) );
|
||||
this->EVENT_InitNewSoldierAnim( SelectFireAnimation( this, gAnimControl[this->usAnimState].ubEndHeight ), 0, FALSE );
|
||||
@@ -8104,7 +8103,7 @@ void SOLDIERTYPE::TurnSoldier( void )
|
||||
// Don't do anything if we are at dest direction!
|
||||
if ( this->ubDirection == this->pathing.bDesiredDirection )
|
||||
{
|
||||
if ( this->ubBodyType == TANK_NW || this->ubBodyType == TANK_NE )
|
||||
if ( TANK(this) )
|
||||
{
|
||||
if ( this->iTuringSoundID != NO_SAMPLE )
|
||||
{
|
||||
@@ -8241,7 +8240,7 @@ void SOLDIERTYPE::TurnSoldier( void )
|
||||
this->ubHiResDirection = (UINT8)sDirection;
|
||||
|
||||
// Are we at a multiple of a 'cardnal' direction?
|
||||
for ( cnt = 0; cnt < 8; cnt++ )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt )
|
||||
{
|
||||
if ( sDirection == ubExtDirection[cnt] )
|
||||
{
|
||||
@@ -8253,7 +8252,7 @@ void SOLDIERTYPE::TurnSoldier( void )
|
||||
}
|
||||
}
|
||||
|
||||
if ( this->ubBodyType == TANK_NW || this->ubBodyType == TANK_NE )
|
||||
if ( TANK(this) )
|
||||
{
|
||||
if ( this->iTuringSoundID == NO_SAMPLE )
|
||||
{
|
||||
@@ -9816,19 +9815,19 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr
|
||||
{
|
||||
//sLifeDeduct = (sLifeDeduct * 2) / 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ubReason == TAKE_DAMAGE_GUNFIRE )
|
||||
else
|
||||
{
|
||||
if ( ubReason == TAKE_DAMAGE_GUNFIRE )
|
||||
{
|
||||
sLifeDeduct /= 3;
|
||||
}
|
||||
else if ( ubReason == TAKE_DAMAGE_EXPLOSION && sLifeDeduct > 50 )
|
||||
{
|
||||
// boom!
|
||||
sLifeDeduct *= 2;
|
||||
// boom!
|
||||
sLifeDeduct *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VehicleTakeDamage( this->bVehicleID, ubReason, sLifeDeduct, this->sGridNo, ubAttacker );
|
||||
HandleTakeDamageDeath( this, bOldLife, ubReason );
|
||||
return(0);
|
||||
|
||||
@@ -117,6 +117,11 @@ structureconstructEndElementHandle(void *userData, const XML_Char *name)
|
||||
staticsouthtilevector.clear();
|
||||
staticeasttilevector.clear();
|
||||
staticwesttilevector.clear();
|
||||
|
||||
staticnorthtilevector.resize(1);
|
||||
staticsouthtilevector.resize(1);
|
||||
staticeasttilevector.resize(1);
|
||||
staticwesttilevector.resize(1);
|
||||
}
|
||||
|
||||
++structureconstructcnt;
|
||||
|
||||
@@ -707,12 +707,12 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
|
||||
// should be close enough, try to find a legal->pathing.sDestination within 1 tile
|
||||
|
||||
// clear dirChecked flag for all 8 directions
|
||||
for (ubDirection = 0; ubDirection < 8; ubDirection++)
|
||||
for ( ubDirection = 0; ubDirection < NUM_WORLD_DIRECTIONS; ++ubDirection )
|
||||
{
|
||||
fDirChecked[ubDirection] = FALSE;
|
||||
}
|
||||
|
||||
ubDirsLeft = 8;
|
||||
ubDirsLeft = NUM_WORLD_DIRECTIONS;
|
||||
|
||||
// examine all 8 spots around 'ubFriendID'
|
||||
// keep looking while directions remain and a satisfactory one not found
|
||||
@@ -721,7 +721,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
|
||||
// randomly select a direction which hasn't been 'checked' yet
|
||||
do
|
||||
{
|
||||
ubDirection = (UINT8) Random(8);
|
||||
ubDirection = (UINT8)Random( NUM_WORLD_DIRECTIONS );
|
||||
}
|
||||
while (fDirChecked[ubDirection]);
|
||||
|
||||
@@ -752,7 +752,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
|
||||
|
||||
if (!fFound)
|
||||
{
|
||||
ubFriendCount--;
|
||||
--ubFriendCount;
|
||||
|
||||
// if we hadn't already picked the last friend currently in the list
|
||||
if (ubFriendCount != ubFriendID)
|
||||
|
||||
+34
-34
@@ -2651,7 +2651,7 @@ INT8 CountAdjacentSpreadTargets( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT
|
||||
|
||||
bDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sFirstTarget );
|
||||
|
||||
for (bDirLoop = 0; bDirLoop < 8; bDirLoop++)
|
||||
for ( bDirLoop = 0; bDirLoop < NUM_WORLD_DIRECTIONS; ++bDirLoop )
|
||||
{
|
||||
if (bDir % 2)
|
||||
{
|
||||
@@ -2659,37 +2659,37 @@ INT8 CountAdjacentSpreadTargets( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT
|
||||
switch( bDirLoop )
|
||||
{
|
||||
case 0:
|
||||
bCheckDir = (bDir + 6) % 8;
|
||||
bCheckDir = (bDir + 6) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 0;
|
||||
break;
|
||||
case 1:
|
||||
bCheckDir = (bDir + 5) % 8;
|
||||
bCheckDir = (bDir + 5) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 2:
|
||||
bCheckDir = (bDir + 7) % 8;
|
||||
bCheckDir = (bDir + 7) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 3:
|
||||
bCheckDir = (bDir + 3) % 8;
|
||||
bCheckDir = (bDir + 3) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 4:
|
||||
bCheckDir = (bDir + 1) % 8;
|
||||
bCheckDir = (bDir + 1) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 5:
|
||||
bCheckDir = (bDir + 2) % 8;
|
||||
bCheckDir = (bDir + 2) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 4;
|
||||
break;
|
||||
case 6:
|
||||
// check in front
|
||||
bCheckDir = (bDir + 4) % 8;
|
||||
bCheckDir = (bDir + 4) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 7:
|
||||
// check behind
|
||||
bCheckDir = (bDir) % 8;
|
||||
bCheckDir = (bDir) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
}
|
||||
@@ -2700,37 +2700,37 @@ INT8 CountAdjacentSpreadTargets( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT
|
||||
switch( bDirLoop )
|
||||
{
|
||||
case 0:
|
||||
bCheckDir = (bDir + 5) % 8;
|
||||
bCheckDir = (bDir + 5) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 1:
|
||||
bCheckDir = (bDir + 6) % 8;
|
||||
bCheckDir = (bDir + 6) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 2:
|
||||
bCheckDir = (bDir + 7) % 8;
|
||||
bCheckDir = (bDir + 7) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 3:
|
||||
bCheckDir = (bDir + 3) % 8;
|
||||
bCheckDir = (bDir + 3) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 4:
|
||||
bCheckDir = (bDir + 2) % 8;
|
||||
bCheckDir = (bDir + 2) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 5:
|
||||
bCheckDir = (bDir + 1) % 8;
|
||||
bCheckDir = (bDir + 1) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 6:
|
||||
// check in front
|
||||
bCheckDir = (bDir + 4) % 8;
|
||||
bCheckDir = (bDir + 4) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 7:
|
||||
// check behind
|
||||
bCheckDir = (bDir) % 8;
|
||||
bCheckDir = (bDir) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
|
||||
@@ -2780,7 +2780,7 @@ INT16 CalcSpreadBurst( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT8 bTargetL
|
||||
|
||||
bDir = (INT8) GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sFirstTarget );
|
||||
|
||||
for (bDirLoop = 0; bDirLoop < 8; bDirLoop++)
|
||||
for ( bDirLoop = 0; bDirLoop < NUM_WORLD_DIRECTIONS; ++bDirLoop )
|
||||
{
|
||||
if (bDir % 2)
|
||||
{
|
||||
@@ -2788,37 +2788,37 @@ INT16 CalcSpreadBurst( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT8 bTargetL
|
||||
switch( bDirLoop )
|
||||
{
|
||||
case 0:
|
||||
bCheckDir = (bDir + 6) % 8;
|
||||
bCheckDir = (bDir + 6) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 0;
|
||||
break;
|
||||
case 1:
|
||||
bCheckDir = (bDir + 5) % 8;
|
||||
bCheckDir = (bDir + 5) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 2:
|
||||
bCheckDir = (bDir + 7) % 8;
|
||||
bCheckDir = (bDir + 7) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 3:
|
||||
bCheckDir = (bDir + 3) % 8;
|
||||
bCheckDir = (bDir + 3) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 4:
|
||||
bCheckDir = (bDir + 1) % 8;
|
||||
bCheckDir = (bDir + 1) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 5:
|
||||
bCheckDir = (bDir + 2) % 8;
|
||||
bCheckDir = (bDir + 2) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 4;
|
||||
break;
|
||||
case 6:
|
||||
// check in front
|
||||
bCheckDir = (bDir + 4) % 8;
|
||||
bCheckDir = (bDir + 4) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 7:
|
||||
// check behind
|
||||
bCheckDir = (bDir) % 8;
|
||||
bCheckDir = (bDir) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
}
|
||||
@@ -2829,37 +2829,37 @@ INT16 CalcSpreadBurst( SOLDIERTYPE * pSoldier, INT16 sFirstTarget, INT8 bTargetL
|
||||
switch( bDirLoop )
|
||||
{
|
||||
case 0:
|
||||
bCheckDir = (bDir + 5) % 8;
|
||||
bCheckDir = (bDir + 5) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 1:
|
||||
bCheckDir = (bDir + 6) % 8;
|
||||
bCheckDir = (bDir + 6) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 2:
|
||||
bCheckDir = (bDir + 7) % 8;
|
||||
bCheckDir = (bDir + 7) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 3:
|
||||
bCheckDir = (bDir + 3) % 8;
|
||||
bCheckDir = (bDir + 3) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 4:
|
||||
bCheckDir = (bDir + 2) % 8;
|
||||
bCheckDir = (bDir + 2) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 5:
|
||||
bCheckDir = (bDir + 1) % 8;
|
||||
bCheckDir = (bDir + 1) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
case 6:
|
||||
// check in front
|
||||
bCheckDir = (bDir + 4) % 8;
|
||||
bCheckDir = (bDir + 4) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 1;
|
||||
break;
|
||||
case 7:
|
||||
// check behind
|
||||
bCheckDir = (bDir) % 8;
|
||||
bCheckDir = (bDir) % NUM_WORLD_DIRECTIONS;
|
||||
bTargetIndex = 3;
|
||||
break;
|
||||
|
||||
|
||||
@@ -1926,7 +1926,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
if ( pSoldier->flags.lastFlankLeft )
|
||||
{
|
||||
if ( origDir > currDir )
|
||||
origDir -= 8;
|
||||
origDir -= NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (currDir - origDir) >= 4 )
|
||||
{
|
||||
@@ -1944,7 +1944,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
else
|
||||
{
|
||||
if ( origDir < currDir )
|
||||
origDir += 8;
|
||||
origDir += NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (origDir - currDir) >= 4 )
|
||||
{
|
||||
@@ -3354,7 +3354,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
if ( pSoldier->flags.lastFlankLeft )
|
||||
{
|
||||
if ( origDir > currDir )
|
||||
origDir -= 8;
|
||||
origDir -= NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (currDir - origDir) >= 4 )
|
||||
{
|
||||
@@ -3373,7 +3373,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
|
||||
else
|
||||
{
|
||||
if ( origDir < currDir )
|
||||
origDir += 8;
|
||||
origDir += NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (origDir - currDir) >= 4 )
|
||||
{
|
||||
@@ -7141,7 +7141,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier )
|
||||
if ( pSoldier->flags.lastFlankLeft )
|
||||
{
|
||||
if ( origDir > currDir )
|
||||
origDir -= 8;
|
||||
origDir -= NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (currDir - origDir) >= 4 )
|
||||
{
|
||||
@@ -7159,7 +7159,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier )
|
||||
else
|
||||
{
|
||||
if ( origDir < currDir )
|
||||
origDir += 8;
|
||||
origDir += NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (origDir - currDir) >= 4 )
|
||||
{
|
||||
@@ -7296,7 +7296,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier )
|
||||
if ( pSoldier->flags.lastFlankLeft )
|
||||
{
|
||||
if ( origDir > currDir )
|
||||
origDir -= 8;
|
||||
origDir -= NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (currDir - origDir) >= 4 )
|
||||
{
|
||||
@@ -7315,7 +7315,7 @@ void DecideAlertStatus( SOLDIERTYPE *pSoldier )
|
||||
else
|
||||
{
|
||||
if ( origDir < currDir )
|
||||
origDir += 8;
|
||||
origDir += NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( (origDir - currDir) >= 4 )
|
||||
{
|
||||
|
||||
@@ -2543,16 +2543,16 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction )
|
||||
}
|
||||
|
||||
if ( sDesiredDir < 0 )
|
||||
sDesiredDir += 8;
|
||||
sDesiredDir += NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if ( sDesiredDir > 8 )
|
||||
sDesiredDir -= 8;
|
||||
if ( sDesiredDir > NUM_WORLD_DIRECTIONS )
|
||||
sDesiredDir -= NUM_WORLD_DIRECTIONS;
|
||||
|
||||
DebugMsg ( TOPIC_JA2AI , DBG_LEVEL_3 , String("FindFlankingSpot: direction to loc = %d, dir to flank = %d", sDir , sDesiredDir ));
|
||||
|
||||
for (sYOffset = -sMaxUp + 1; sYOffset <= sMaxDown - 1; sYOffset++)
|
||||
for (sYOffset = -sMaxUp + 1; sYOffset <= sMaxDown - 1; ++sYOffset)
|
||||
{
|
||||
for (sXOffset = -sMaxLeft + 1; sXOffset <= sMaxRight - 1; sXOffset++)
|
||||
for (sXOffset = -sMaxLeft + 1; sXOffset <= sMaxRight - 1; ++sXOffset)
|
||||
{
|
||||
// calculate the next potential gridno
|
||||
sGridNo = pSoldier->sGridNo + sXOffset + (MAXCOL * sYOffset);
|
||||
@@ -2686,7 +2686,7 @@ INT32 FindClosestClimbPoint (SOLDIERTYPE *pSoldier, BOOLEAN fClimbUp )
|
||||
if (gpWorldLevelData[ sGridNo].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
|
||||
{
|
||||
// Search for the destination climb point on the roof
|
||||
for (ubTestDir=0; ubTestDir < 8; ubTestDir += 2)
|
||||
for ( ubTestDir = 0; ubTestDir < NUM_WORLD_DIRECTIONS; ubTestDir += 2 )
|
||||
{
|
||||
INT32 sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
|
||||
// And see if it or the ground location is occupied
|
||||
@@ -2872,7 +2872,7 @@ INT8 FindDirectionForClimbing( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel
|
||||
{
|
||||
if (gpWorldLevelData[ sGridNo].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
|
||||
{
|
||||
for (ubClimbDir=0; ubClimbDir<8; ubClimbDir+=2)
|
||||
for ( ubClimbDir = 0; ubClimbDir < NUM_WORLD_DIRECTIONS; ubClimbDir += 2 )
|
||||
{
|
||||
sClimbSpot = NewGridNo( sGridNo, DirectionInc( ubClimbDir));
|
||||
if (gpWorldLevelData[ sClimbSpot].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT &&
|
||||
@@ -2893,7 +2893,7 @@ INT8 FindDirectionForClimbing( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel
|
||||
return DIRECTION_IRRELEVANT;
|
||||
if (gpWorldLevelData[ sGridNo].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT)
|
||||
{
|
||||
for (ubClimbDir=0; ubClimbDir<8; ubClimbDir+=2)
|
||||
for ( ubClimbDir = 0; ubClimbDir< NUM_WORLD_DIRECTIONS; ubClimbDir += 2 )
|
||||
{
|
||||
sClimbSpot = NewGridNo( sGridNo, DirectionInc( ubClimbDir));
|
||||
if (gpWorldLevelData[ sClimbSpot].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT &&
|
||||
|
||||
@@ -557,14 +557,14 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN
|
||||
// else look at the 8 nearest gridnos to sDesGrid for a valid destination
|
||||
|
||||
// clear ubDirChecked flag for all 8 directions
|
||||
for (ubDirection = 0; ubDirection < 8; ubDirection++)
|
||||
for ( ubDirection = 0; ubDirection < NUM_WORLD_DIRECTIONS; ++ubDirection )
|
||||
ubDirChecked[ubDirection] = FALSE;
|
||||
|
||||
ubDirsLeft = 8;
|
||||
ubDirsLeft = NUM_WORLD_DIRECTIONS;
|
||||
|
||||
// examine all 8 spots around 'sDesGrid'
|
||||
// keep looking while directions remain and a satisfactory one not found
|
||||
for (ubDirsLeft = 8; ubDirsLeft != 0; ubDirsLeft--)
|
||||
for ( ubDirsLeft = NUM_WORLD_DIRECTIONS; ubDirsLeft != 0; --ubDirsLeft )
|
||||
{
|
||||
if (fFound)
|
||||
{
|
||||
@@ -1137,7 +1137,7 @@ UINT16 RunAway( SOLDIERTYPE * pSoldier )
|
||||
bOkayDir[ atan8( pSoldier->sX, pSoldier->sY, pOpponent->sX, pOpponent->sY ) ] = FALSE;
|
||||
}
|
||||
|
||||
for (ubLoop = 0; ubLoop < 8; ubLoop += 2)
|
||||
for (ubLoop = 0; ubLoop < NUM_WORLD_DIRECTIONS; ubLoop += 2)
|
||||
{
|
||||
if (bOkayDir[ubLoop])
|
||||
{
|
||||
|
||||
@@ -193,7 +193,7 @@ INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sD
|
||||
// Found a climb point for this building
|
||||
if (fClimbUp)
|
||||
{
|
||||
for (ubTestDir = 0; ubTestDir < 8; ubTestDir += 2)
|
||||
for (ubTestDir = 0; ubTestDir < NUM_WORLD_DIRECTIONS; ubTestDir += 2)
|
||||
{
|
||||
sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
|
||||
if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
|
||||
@@ -216,7 +216,7 @@ INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sD
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ubTestDir = 0; ubTestDir < 8; ubTestDir += 2)
|
||||
for (ubTestDir = 0; ubTestDir < NUM_WORLD_DIRECTIONS; ubTestDir += 2)
|
||||
{
|
||||
sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
|
||||
if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
|
||||
|
||||
@@ -3012,7 +3012,7 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
|
||||
|
||||
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Explosion affects %d", uiNewSpot) );
|
||||
// ok, do what we do here...
|
||||
if ( ExpAffect( sGridNo, uiNewSpot, cnt / 2, usItem, ubOwner, fSubsequent, &fAnyMercHit, bLevel, iSmokeEffectID ) )
|
||||
if ( ExpAffect( sGridNo, uiNewSpot, cnt / 2, usItem, ubOwner, fSubsequent, &fAnyMercHit, bLevel, iSmokeEffectID ) )
|
||||
{
|
||||
fRecompileMovement = TRUE;
|
||||
}
|
||||
@@ -3026,7 +3026,7 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
|
||||
uiBranchSpot = uiNewSpot;
|
||||
|
||||
// figure the branch direction - which is one dir clockwise
|
||||
ubBranchDir = (ubDir + 1) % 8;
|
||||
ubBranchDir = (ubDir + 1) % NUM_WORLD_DIRECTIONS;
|
||||
|
||||
if (ubBranchDir & 1)
|
||||
{
|
||||
|
||||
@@ -217,7 +217,7 @@ BOOLEAN FindWindowJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bSta
|
||||
}
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
if (cnt != direction2)
|
||||
continue;
|
||||
@@ -284,7 +284,7 @@ BOOLEAN FindWallJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStart
|
||||
}
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
// go out *2* tiles
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
@@ -333,7 +333,7 @@ BOOLEAN FindHeigherLevelOkno( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStarti
|
||||
INT8 bMinDirection = 0;
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
@@ -385,7 +385,7 @@ BOOLEAN FindHeigherLevelOkno( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStarti
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt+= 2 )
|
||||
{
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
@@ -440,7 +440,7 @@ BOOLEAN FindHeigherLevelFence( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStart
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
@@ -485,7 +485,7 @@ BOOLEAN FindLowerLevelWall( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStarting
|
||||
INT8 bMinDirection = 0;
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
@@ -1100,7 +1100,7 @@ BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDi
|
||||
}
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
@@ -1142,7 +1142,7 @@ BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir,
|
||||
INT8 bMinDirection = 0;
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
@@ -1372,7 +1372,7 @@ BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStar
|
||||
}
|
||||
|
||||
// LOOP THROUGH ALL 8 DIRECTIONS
|
||||
for ( cnt = 0; cnt < 8; cnt+= 2 )
|
||||
for ( cnt = 0; cnt < NUM_WORLD_DIRECTIONS; cnt += 2 )
|
||||
{
|
||||
// go out *2* tiles
|
||||
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
|
||||
|
||||
+19
-20
@@ -900,13 +900,10 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
|
||||
UINT8 ubDirLoop;
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
if ( GridNoOnVisibleWorldTile( usGridNo ) )
|
||||
{
|
||||
// check for land of a different height in adjacent locations
|
||||
for ( ubDirLoop = 0; ubDirLoop < 8; ubDirLoop++ )
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
if ( gpWorldLevelData[ usGridNo ].sHeight !=
|
||||
gpWorldLevelData[ usGridNo + DirectionInc( ubDirLoop ) ].sHeight )
|
||||
@@ -918,21 +915,21 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
// check for exit grids
|
||||
if ( ExitGridAtGridNo( usGridNo ) )
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_EXITGRID );
|
||||
}
|
||||
// leave the roof alone, and continue, so that we can get values for the roof if traversable
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 0, TRAVELCOST_OFF_MAP );
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OFF_MAP );
|
||||
}
|
||||
|
||||
if (gpWorldLevelData[usGridNo].pStructureHead == NULL)
|
||||
{
|
||||
return;
|
||||
@@ -940,7 +937,8 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
}
|
||||
|
||||
if (gpWorldLevelData[usGridNo].pStructureHead != NULL)
|
||||
{ // structures in tile
|
||||
{
|
||||
// structures in tile
|
||||
// consider the land
|
||||
pLand = gpWorldLevelData[ usGridNo ].pLandHead;
|
||||
if ( pLand != NULL )
|
||||
@@ -952,7 +950,7 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
// Get terrain type
|
||||
ubTerrainID = gpWorldLevelData[usGridNo].ubTerrainID; // = GetTerrainType( (INT16)usGridNo );
|
||||
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++)
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop)
|
||||
{
|
||||
SET_CURRMOVEMENTCOST( ubDirLoop, gTileTypeMovementCost[ ubTerrainID ] );
|
||||
}
|
||||
@@ -1059,7 +1057,7 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
|
||||
default:
|
||||
// corners aren't jumpable
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++)
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop)
|
||||
{
|
||||
SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE );
|
||||
}
|
||||
@@ -1068,7 +1066,7 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
}
|
||||
else if ( pStructure->pDBStructureRef->pDBStructure->ubArmour == MATERIAL_SANDBAG && StructureHeight( pStructure ) <= 2 )
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++)
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop)
|
||||
{
|
||||
SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE );
|
||||
}
|
||||
@@ -1087,14 +1085,14 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
}
|
||||
else if ( (pStructure->fFlags & STRUCTURE_CAVEWALL ) )
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++)
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop)
|
||||
{
|
||||
SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_CAVEWALL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ubDirLoop++)
|
||||
for (ubDirLoop=0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop)
|
||||
{
|
||||
SET_CURRMOVEMENTCOST( ubDirLoop, TRAVELCOST_OBSTACLE );
|
||||
}
|
||||
@@ -1509,14 +1507,14 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
{
|
||||
if (!fStructuresOnRoof)
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_FLAT );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE );
|
||||
}
|
||||
@@ -1524,19 +1522,20 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // NO STRUCTURES IN TILE
|
||||
{
|
||||
// NO STRUCTURES IN TILE
|
||||
// consider just the land
|
||||
|
||||
// Get terrain type
|
||||
ubTerrainID = gpWorldLevelData[usGridNo].ubTerrainID; // = GetTerrainType( (INT16)usGridNo );
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo ,ubDirLoop, 0, gTileTypeMovementCost[ ubTerrainID ] );
|
||||
}
|
||||
@@ -1561,14 +1560,14 @@ void CompileTileMovementCosts( INT32 usGridNo )
|
||||
// HIGHEST LEVEL
|
||||
if (gpWorldLevelData[ usGridNo ].pRoofHead != NULL)
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_FLAT );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ubDirLoop=0; ubDirLoop < 8; ubDirLoop++)
|
||||
for ( ubDirLoop = 0; ubDirLoop < NUM_WORLD_DIRECTIONS; ++ubDirLoop )
|
||||
{
|
||||
SET_MOVEMENTCOST( usGridNo, ubDirLoop, 1, TRAVELCOST_OBSTACLE );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user