mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fixed buffer overrun for LUA strings
Made direction variables more consistent as unsigned chars. Several function prototypes updated for this. Many memory leaks plugged: External options, video overlays, laptop file lists, tactical message queue, strategic pathing, autobandage, merc hiring, detailed placements, crate in Drassen, tactical placement New functions and attributes for soldiers in LUA (still for debugging at best): Soldier.APs (current APs), Soldier.changestance (changes stance, uses game heights) File catalog ignores .SVN directories (game load speedup) Fix CTD in mouse regions JA2 window now refuses to move to negative coords Checks to prevent DirectX-related infinite loops due to minimizing and task switching Invading enemies should now appear on the borders even when reinforcements disabled in .ini Suppression should no longer work on mercs in medium water Infant/Young creatures use restored spit instead of Molotov Creatures begin with their 'guns' (spit) 'locked and loaded' (cartridge in chamber) Further fix to AXP and AlaarDB's weapon ready check: Now 'firing' is always counted as 'ready'. Prevent mercs from falling and flying back through obstacles Check whether battle group is even set before testing its location for battle setup Burst spread locations now limited to 6, the limit within the soldier struct Extra burst spread locations zeroed out so that they aren't used unless necessary Spread code now only shoots at locations in the spread, and will shoot at all 6 Only mercs in the sector where autobandage happens will be made to stand up after it's done Throwing a grenade at the tail of the plane in Drassen should not result in a CTD Reset attack busy count when loading a new sector git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1347 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+19
-19
@@ -44,7 +44,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
UINT32 uiLoop2;
|
||||
INT16 sTempGridNo, sNextTempGridNo, sVeryTemporaryGridNo;
|
||||
INT16 sStartGridNo, sCurrGridNo, sPrevGridNo = NOWHERE, sRightGridNo;
|
||||
INT8 bDirection, bTempDirection;
|
||||
UINT8 ubDirection, ubTempDirection;
|
||||
BOOLEAN fFoundDir, fFoundWall;
|
||||
UINT32 uiChanceIn = ROOF_LOCATION_CHANCE; // chance of a location being considered
|
||||
INT16 sWallGridNo;
|
||||
@@ -77,13 +77,13 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
RoofReachableTest( sDesiredSpot, ubBuildingID );
|
||||
|
||||
// From sGridNo, search until we find a spot that isn't part of the building
|
||||
bDirection = NORTHWEST;
|
||||
ubDirection = NORTHWEST;
|
||||
sTempGridNo = sDesiredSpot;
|
||||
// using diagonal directions to hopefully prevent picking a
|
||||
// spot that
|
||||
while( (gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE ) )
|
||||
{
|
||||
sNextTempGridNo = NewGridNo( sTempGridNo, DirectionInc( bDirection ) );
|
||||
sNextTempGridNo = NewGridNo( sTempGridNo, DirectionInc( ubDirection ) );
|
||||
if ( sTempGridNo == sNextTempGridNo )
|
||||
{
|
||||
// hit edge of map!??!
|
||||
@@ -103,12 +103,12 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
if ( gpWorldLevelData[ sVeryTemporaryGridNo ].uiFlags & MAPELEMENT_REACHABLE )
|
||||
{
|
||||
// go north first
|
||||
bDirection = NORTH;
|
||||
ubDirection = NORTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
// go that way (east)
|
||||
bDirection = EAST;
|
||||
ubDirection = EAST;
|
||||
}
|
||||
|
||||
gpWorldLevelData[ sStartGridNo ].ubExtFlags[0] |= MAPELEMENT_EXT_ROOFCODE_VISITED;
|
||||
@@ -118,7 +118,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
{
|
||||
// if point to (2 clockwise) is not part of building and is not visited,
|
||||
// or is starting point, turn!
|
||||
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ bDirection ] ) );
|
||||
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||
sTempGridNo = sRightGridNo;
|
||||
if ( ( ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) && !(gpWorldLevelData[ sTempGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_ROOFCODE_VISITED) ) || (sTempGridNo == sStartGridNo) ) && (sCurrGridNo != sStartGridNo) )
|
||||
{
|
||||
@@ -128,47 +128,47 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
{
|
||||
return( NULL );
|
||||
}
|
||||
bDirection = gTwoCDirection[ bDirection ];
|
||||
ubDirection = gTwoCDirection[ ubDirection ];
|
||||
// try in that direction
|
||||
continue;
|
||||
}
|
||||
iLoopCount = 0;
|
||||
|
||||
// if spot ahead is part of building, turn
|
||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( bDirection ) );
|
||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( ubDirection ) );
|
||||
if ( gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE )
|
||||
{
|
||||
// first search for a spot that is neither part of the building or visited
|
||||
|
||||
// we KNOW that the spot in the original direction is blocked, so only loop 3 times
|
||||
bTempDirection = gTwoCDirection[ bDirection ];
|
||||
ubTempDirection = gTwoCDirection[ ubDirection ];
|
||||
fFoundDir = FALSE;
|
||||
for ( uiLoop = 0; uiLoop < 3; uiLoop++ )
|
||||
{
|
||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( bTempDirection ) );
|
||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( ubTempDirection ) );
|
||||
if ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) && !(gpWorldLevelData[ sTempGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_ROOFCODE_VISITED) )
|
||||
{
|
||||
// this is the way to go!
|
||||
fFoundDir = TRUE;
|
||||
break;
|
||||
}
|
||||
bTempDirection = gTwoCDirection[ bTempDirection ];
|
||||
ubTempDirection = gTwoCDirection[ ubTempDirection ];
|
||||
}
|
||||
if (!fFoundDir)
|
||||
{
|
||||
// now search for a spot that is just not part of the building
|
||||
bTempDirection = gTwoCDirection[ bDirection ];
|
||||
ubTempDirection = gTwoCDirection[ ubDirection ];
|
||||
fFoundDir = FALSE;
|
||||
for ( uiLoop = 0; uiLoop < 3; uiLoop++ )
|
||||
{
|
||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( bTempDirection ) );
|
||||
sTempGridNo = NewGridNo( sCurrGridNo, DirectionInc( ubTempDirection ) );
|
||||
if ( !(gpWorldLevelData[ sTempGridNo ].uiFlags & MAPELEMENT_REACHABLE) )
|
||||
{
|
||||
// this is the way to go!
|
||||
fFoundDir = TRUE;
|
||||
break;
|
||||
}
|
||||
bTempDirection = gTwoCDirection[ bTempDirection ];
|
||||
ubTempDirection = gTwoCDirection[ ubTempDirection ];
|
||||
}
|
||||
if (!fFoundDir)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
return( NULL );
|
||||
}
|
||||
}
|
||||
bDirection = bTempDirection;
|
||||
ubDirection = ubTempDirection;
|
||||
// try in that direction
|
||||
continue;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
// move ahead
|
||||
sPrevGridNo = sCurrGridNo;
|
||||
sCurrGridNo = sTempGridNo;
|
||||
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ bDirection ] ) );
|
||||
sRightGridNo = NewGridNo( sCurrGridNo, DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||
|
||||
#ifdef ROOF_DEBUG
|
||||
if (gsCoverValue[sCurrGridNo] == 0x7F7F)
|
||||
@@ -219,7 +219,7 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
// if south or west, the wall would be in the gridno two clockwise
|
||||
fFoundWall = FALSE;
|
||||
|
||||
switch( bDirection )
|
||||
switch( ubDirection )
|
||||
{
|
||||
case NORTH:
|
||||
sWallGridNo = sCurrGridNo;
|
||||
@@ -230,11 +230,11 @@ BUILDING * GenerateBuilding( INT16 sDesiredSpot )
|
||||
bDesiredOrientation = OUTSIDE_TOP_LEFT;
|
||||
break;
|
||||
case SOUTH:
|
||||
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ bDirection ] ) );
|
||||
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||
bDesiredOrientation = OUTSIDE_TOP_RIGHT;
|
||||
break;
|
||||
case WEST:
|
||||
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ bDirection ] ) );
|
||||
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
|
||||
bDesiredOrientation = OUTSIDE_TOP_LEFT;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -406,7 +406,7 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion )
|
||||
AniParams.sStartFrame = pExplosion->sCurrentFrame;
|
||||
AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_EXPLOSION;
|
||||
|
||||
if ( ubTerrainType == LOW_WATER || ubTerrainType == MED_WATER || ubTerrainType == DEEP_WATER )
|
||||
if ( TERRAIN_IS_WATER(ubTerrainType) )
|
||||
{
|
||||
// Change type to water explosion...
|
||||
ubTypeID = WATER_BLAST;
|
||||
@@ -1209,7 +1209,6 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
|
||||
|
||||
STRUCTURE *gStruct;
|
||||
|
||||
// Lesh: somewhere here once I got CTD when militia stepped on mine in cambria sam
|
||||
void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
|
||||
{
|
||||
STRUCTURE * pCurrent, *pNextCurrent, *pStructure;
|
||||
@@ -1233,7 +1232,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
||||
// (1) we might need to destroy the currently-examined structure
|
||||
while (pCurrent != NULL)
|
||||
{
|
||||
// ATE: These are for the chacks below for multi-structs....
|
||||
// ATE: These are for the checks below for multi-structs....
|
||||
pBaseStructure = FindBaseStructure( pCurrent );
|
||||
|
||||
if ( pBaseStructure )
|
||||
@@ -1243,7 +1242,6 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
||||
fMultiStructure = ( ( pBaseStructure->fFlags & STRUCTURE_MULTI ) != 0 );
|
||||
ppTile = (DB_STRUCTURE_TILE **) MemAlloc( sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles );
|
||||
|
||||
// Lesh: CTD was in next line once
|
||||
memcpy( ppTile, pBaseStructure->pDBStructureRef->ppTile, sizeof( DB_STRUCTURE_TILE* ) * ubNumberOfTiles );
|
||||
|
||||
if ( bMultiStructSpecialFlag == -1 )
|
||||
@@ -1271,7 +1269,7 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
||||
{
|
||||
fExplodeDamageReturn = ExplosiveDamageStructureAtGridNo( pCurrent, &pNextCurrent, sGridNo, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, 0, ubOwner, bLevel );
|
||||
|
||||
// Are we overwritting damage due to multi-tile...?
|
||||
// Are we overwriting damage due to multi-tile...?
|
||||
if ( fExplodeDamageReturn )
|
||||
{
|
||||
if ( fSubSequentMultiTilesTransitionDamage == 2)
|
||||
@@ -1288,65 +1286,74 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
|
||||
{
|
||||
fToBreak = TRUE;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// OK, for multi-structs...
|
||||
// AND we took damage...
|
||||
if ( fMultiStructure && !fOnlyWalls && fExplodeDamageReturn == 0 )
|
||||
{
|
||||
// ATE: Don't after first attack...
|
||||
if ( uiDist > 1 )
|
||||
// 0verhaul: The following was combined with the previous code block. I don't think they intended to execute this
|
||||
// part unless fExplodeDamageReturn was actually set. When it was being executed, tossing a grenade just behind the
|
||||
// plane in Drassen, for instance, would cause an infinite recursion in this code. The reason is that the plane's
|
||||
// armor is (amazingly enough) stronger than a grenade blast can even damage. This code here seems to rely on the
|
||||
// structure in question being destroyed by the blast since it indiscriminently recurses on neighbors, creating a
|
||||
// ping pong on two adjacent parts of the plane. Probably the reason this was not found before is that fExplodeDamageReturn
|
||||
// was uninitialized before and usually was non-zero. Now it is initialized to false.
|
||||
|
||||
// OK, for multi-structs...
|
||||
// AND we took damage...
|
||||
if ( fMultiStructure && !fOnlyWalls && fExplodeDamageReturn == 0 )
|
||||
{
|
||||
if ( pBaseStructure )
|
||||
// ATE: Don't after first attack...
|
||||
if ( uiDist > 1 )
|
||||
{
|
||||
MemFree( ppTile );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
|
||||
{
|
||||
sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
|
||||
|
||||
// look in adjacent tiles
|
||||
for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ )
|
||||
if ( pBaseStructure )
|
||||
{
|
||||
sNewGridNo2 = NewGridNo( sNewGridNo, DirectionInc( ubLoop2 ) );
|
||||
if ( sNewGridNo2 != sNewGridNo && sNewGridNo2 != sGridNo )
|
||||
MemFree( ppTile );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
for ( ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
|
||||
{
|
||||
sNewGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
|
||||
|
||||
// look in adjacent tiles
|
||||
for ( ubLoop2 = 0; ubLoop2 < NUM_WORLD_DIRECTIONS; ubLoop2++ )
|
||||
{
|
||||
pStructure = FindStructure( sNewGridNo2, STRUCTURE_MULTI );
|
||||
if ( pStructure )
|
||||
sNewGridNo2 = NewGridNo( sNewGridNo, DirectionInc( ubLoop2 ) );
|
||||
if ( sNewGridNo2 != sNewGridNo && sNewGridNo2 != sGridNo )
|
||||
{
|
||||
fMultiStructSpecialFlag = ( ( pStructure->fFlags & STRUCTURE_SPECIAL ) != 0 );
|
||||
|
||||
if ( ( bMultiStructSpecialFlag == fMultiStructSpecialFlag ) )
|
||||
pStructure = FindStructure( sNewGridNo2, STRUCTURE_MULTI );
|
||||
if ( pStructure )
|
||||
{
|
||||
// If we just damaged it, use same damage value....
|
||||
if ( fMultiStructSpecialFlag )
|
||||
{
|
||||
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 1, ubOwner, bLevel );
|
||||
}
|
||||
else
|
||||
{
|
||||
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 2, ubOwner, bLevel );
|
||||
}
|
||||
fMultiStructSpecialFlag = ( ( pStructure->fFlags & STRUCTURE_SPECIAL ) != 0 );
|
||||
|
||||
if ( ( bMultiStructSpecialFlag == fMultiStructSpecialFlag ) )
|
||||
{
|
||||
InternalIgniteExplosion( ubOwner, CenterX( sNewGridNo2 ), CenterY( sNewGridNo2 ), 0, sNewGridNo2, RDX, FALSE, bLevel );
|
||||
}
|
||||
// If we just damaged it, use same damage value....
|
||||
if ( fMultiStructSpecialFlag )
|
||||
{
|
||||
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 1, ubOwner, bLevel );
|
||||
}
|
||||
else
|
||||
{
|
||||
ExplosiveDamageGridNo( sNewGridNo2, sWoundAmt, uiDist, pfRecompileMovementCosts, fOnlyWalls, bMultiStructSpecialFlag, 2, ubOwner, bLevel );
|
||||
}
|
||||
|
||||
fToBreak = TRUE;
|
||||
{
|
||||
InternalIgniteExplosion( ubOwner, CenterX( sNewGridNo2 ), CenterY( sNewGridNo2 ), 0, sNewGridNo2, RDX, FALSE, bLevel );
|
||||
}
|
||||
|
||||
fToBreak = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( fToBreak )
|
||||
{
|
||||
break;
|
||||
if ( fToBreak )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2862,7 +2869,7 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
|
||||
{
|
||||
|
||||
// stop the merc...
|
||||
EVENT_StopMerc( MercPtrs[ ubID ], MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->bDirection );
|
||||
EVENT_StopMerc( MercPtrs[ ubID ], MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection );
|
||||
|
||||
switch( sGridNo )
|
||||
{
|
||||
@@ -3673,7 +3680,7 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL
|
||||
INT8 bNumTurns;
|
||||
UINT16 usHeadItem1, usHeadItem2;
|
||||
|
||||
bNumTurns = FindNumTurnsBetweenDirs(pSoldier->bDirection, ubExplosionDir);
|
||||
bNumTurns = FindNumTurnsBetweenDirs(pSoldier->ubDirection, ubExplosionDir);
|
||||
usHeadItem1 = pSoldier->inv[ HEAD1POS ].usItem;
|
||||
usHeadItem2 = pSoldier->inv[ HEAD2POS ].usItem;
|
||||
|
||||
|
||||
@@ -549,9 +549,9 @@ INT16 NewGridNo(INT16 sGridno, INT16 sDirInc)
|
||||
}
|
||||
|
||||
|
||||
INT16 DirectionInc(INT16 sDirection)
|
||||
INT16 DirectionInc(UINT8 ubDirection)
|
||||
{
|
||||
if ((sDirection < 0) || (sDirection > 7))
|
||||
if ((ubDirection < 0) || (ubDirection > 7))
|
||||
{
|
||||
|
||||
//#ifdef BETAVERSION
|
||||
@@ -559,11 +559,11 @@ INT16 DirectionInc(INT16 sDirection)
|
||||
//#endif
|
||||
|
||||
//direction = random(8); // replace garbage with random direction
|
||||
sDirection = 1;
|
||||
ubDirection = 1;
|
||||
}
|
||||
|
||||
|
||||
return(DirIncrementer[sDirection]);
|
||||
return(DirIncrementer[ubDirection]);
|
||||
}
|
||||
|
||||
BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY)
|
||||
|
||||
@@ -42,7 +42,7 @@ void ConvertGridNoToCenterCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
|
||||
|
||||
// GRID NO MANIPULATION FUNCTIONS
|
||||
INT16 NewGridNo(INT16 sGridno, INT16 sDirInc);
|
||||
INT16 DirectionInc(INT16 sDirection);
|
||||
INT16 DirectionInc(UINT8 ubDirection);
|
||||
INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno);
|
||||
|
||||
|
||||
|
||||
@@ -1166,7 +1166,7 @@ void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategic
|
||||
psArray = psTempArray;
|
||||
for (i = 0; i < usArraySize; i++)
|
||||
{
|
||||
if (GetTerrainType(psArray[ i ]) == MED_WATER || GetTerrainType(psArray[ i ]) == DEEP_WATER)
|
||||
if (TERRAIN_IS_HIGH_WATER( GetTerrainType(psArray[ i ]) ) )
|
||||
{
|
||||
if (i == usArraySize - 1)
|
||||
{
|
||||
|
||||
@@ -1145,6 +1145,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
|
||||
if( uiNumBytesRead != uiFileSize )
|
||||
{
|
||||
FileClose( hFile );
|
||||
MemFree( pTempArrayOfMaps);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -1180,6 +1181,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
|
||||
if( hFile == 0 )
|
||||
{
|
||||
//Error opening map modification file,
|
||||
MemFree( pTempArrayOfMaps);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
@@ -1188,11 +1190,14 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
|
||||
if( uiNumBytesWritten != uiFileSize )
|
||||
{
|
||||
FileClose( hFile );
|
||||
MemFree( pTempArrayOfMaps);
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
FileClose( hFile );
|
||||
|
||||
MemFree( pTempArrayOfMaps);
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -359,14 +359,16 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng
|
||||
MAP_ELEMENT * pMapElement;
|
||||
UINT8 ubOldStrength=0;
|
||||
UINT8 ubNewStrength=0;
|
||||
UINT8 bOverTerrainType;
|
||||
|
||||
/*
|
||||
* Dropping some blood;
|
||||
* We can check the type of blood by consulting the type in the smell byte
|
||||
*/
|
||||
|
||||
bOverTerrainType = GetTerrainType( sGridNo);
|
||||
// If we are in water...
|
||||
if ( GetTerrainType( sGridNo ) == DEEP_WATER || GetTerrainType( sGridNo ) == LOW_WATER || GetTerrainType( sGridNo ) == MED_WATER )
|
||||
if ( TERRAIN_IS_WATER( bOverTerrainType) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -831,6 +831,8 @@ void KillTacticalPlacementGUI()
|
||||
ScreenMsg( FONT_RED, MSG_ERROR, L"Substituted different entry side due to invalid entry points or map edgepoints. KM, LC : 1" );
|
||||
}
|
||||
#endif
|
||||
|
||||
MemFree( gMercPlacement);
|
||||
}
|
||||
|
||||
void ChooseRandomEdgepoints()
|
||||
@@ -1178,7 +1180,7 @@ void PutDownMercPiece( INT32 iPlacement )
|
||||
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
|
||||
EVENT_SetSoldierPosition( pSoldier, (FLOAT)sCellX, (FLOAT)sCellY );
|
||||
EVENT_SetSoldierDirection( pSoldier, ubDirection );
|
||||
pSoldier->ubInsertionDirection = pSoldier->bDirection;
|
||||
pSoldier->ubInsertionDirection = pSoldier->ubDirection;
|
||||
gMercPlacement[ iPlacement ].fPlaced = TRUE;
|
||||
gMercPlacement[ iPlacement ].pSoldier->bInSector = TRUE;
|
||||
}
|
||||
|
||||
@@ -2297,7 +2297,7 @@ void CheckForObjectHittingMerc( REAL_OBJECT *pObject, UINT16 usStructureID )
|
||||
sDamage = 1;
|
||||
sBreath = 0;
|
||||
|
||||
EVENT_SoldierGotHit( pSoldier, NOTHING, sDamage, sBreath, pSoldier->bDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE );
|
||||
EVENT_SoldierGotHit( pSoldier, NOTHING, sDamage, sBreath, pSoldier->ubDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE );
|
||||
|
||||
pObject->ubLastTargetTakenDamage = (UINT8)( usStructureID );
|
||||
}
|
||||
|
||||
@@ -1602,7 +1602,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
|
||||
}
|
||||
else
|
||||
{
|
||||
sMultiTransShadowZBlitterIndex = gOneCDirection[ pSoldier->bDirection ];
|
||||
sMultiTransShadowZBlitterIndex = gOneCDirection[ pSoldier->ubDirection ];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+10
-6
@@ -108,20 +108,20 @@ typedef struct
|
||||
UINT8 bZOffsetY;
|
||||
|
||||
// This union contains different data based on tile type
|
||||
union
|
||||
{
|
||||
// union
|
||||
// {
|
||||
// Land and overlay type
|
||||
struct
|
||||
{
|
||||
// struct
|
||||
// {
|
||||
INT16 sOffsetHeight;
|
||||
UINT16 usWallOrientation;
|
||||
UINT8 ubFullTile;
|
||||
|
||||
// For animated tiles
|
||||
TILE_ANIMATION_DATA *pAnimData;
|
||||
};
|
||||
// };
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
// Reserved for added room and 32-byte boundaries
|
||||
BYTE bReserved[ 3 ];
|
||||
@@ -139,6 +139,10 @@ typedef struct
|
||||
} land_undo_struct;
|
||||
|
||||
|
||||
#define TERRAIN_IS_WATER(x) ((x) == LOW_WATER || (x) == MED_WATER || (x) == DEEP_WATER)
|
||||
#define TERRAIN_IS_SHALLOW_WATER(x) ((x) == LOW_WATER || (x) == MED_WATER)
|
||||
#define TERRAIN_IS_HIGH_WATER(x) ((x) == MED_WATER || (x) == DEEP_WATER)
|
||||
#define TERRAIN_IS_DEEP_WATER(x) ((x) == DEEP_WATER)
|
||||
|
||||
// Globals used
|
||||
extern TILE_ELEMENT gTileDatabase[ NUMBEROFTILES ];
|
||||
|
||||
@@ -3295,6 +3295,9 @@ void TrashWorld( void )
|
||||
}
|
||||
}
|
||||
|
||||
// Reset attack busy since a militia might have been in the middle of radioing
|
||||
gTacticalStatus.ubAttackBusyCount = 0;
|
||||
|
||||
RemoveCorpses( );
|
||||
|
||||
// Remove all ani tiles...
|
||||
|
||||
@@ -2208,18 +2208,18 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie
|
||||
}
|
||||
else
|
||||
{
|
||||
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->bDirection ] ] ), pSoldier->pLevelNode );
|
||||
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode );
|
||||
}
|
||||
/*
|
||||
if ( fReturn == FALSE )
|
||||
{
|
||||
// try to add default
|
||||
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"FAILED: add struct info for merc: %d, at %d direction %d, trying default instead", pSoldier->ubID, sGridNo, pSoldier->bDirection );
|
||||
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"FAILED: add struct info for merc: %d, at %d direction %d, trying default instead", pSoldier->ubID, sGridNo, pSoldier->ubDirection );
|
||||
|
||||
pStructureFileRef = GetDefaultStructureRef( pSoldier->ubID );
|
||||
if ( pStructureFileRef )
|
||||
{
|
||||
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->bDirection ] ] ), pSoldier->pLevelNode );
|
||||
fReturn = AddStructureToWorld( sGridNo, pSoldier->bLevel, &( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ] ), pSoldier->pLevelNode );
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -2228,9 +2228,9 @@ BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldie
|
||||
{
|
||||
|
||||
// Debug msg
|
||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"FAILED: add struct info for merc %d (%s), at %d direction %d", pSoldier->ubID, pSoldier->name, sGridNo, pSoldier->bDirection );
|
||||
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"FAILED: add struct info for merc %d (%s), at %d direction %d", pSoldier->ubID, pSoldier->name, sGridNo, pSoldier->ubDirection );
|
||||
|
||||
if ( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->bDirection ] ].pDBStructure->ubNumberOfTiles > 1 )
|
||||
if ( pStructureFileRef->pDBStructureRef[ gOneCDirection[ pSoldier->ubDirection ] ].pDBStructure->ubNumberOfTiles > 1 )
|
||||
{
|
||||
// If we have more than one tile
|
||||
pSoldier->uiStatusFlags |= SOLDIER_MULTITILE_Z;
|
||||
@@ -3441,7 +3441,7 @@ BOOLEAN Water( INT16 sGridNo )
|
||||
}
|
||||
|
||||
pMapElement = &(gpWorldLevelData[sGridNo]);
|
||||
if ( pMapElement->ubTerrainID == LOW_WATER || pMapElement->ubTerrainID == MED_WATER || pMapElement->ubTerrainID == DEEP_WATER )
|
||||
if ( TERRAIN_IS_WATER( pMapElement->ubTerrainID) )
|
||||
{
|
||||
// check for a bridge! otherwise...
|
||||
return( TRUE );
|
||||
@@ -3457,7 +3457,7 @@ BOOLEAN DeepWater( INT16 sGridNo )
|
||||
MAP_ELEMENT * pMapElement;
|
||||
|
||||
pMapElement = &(gpWorldLevelData[sGridNo]);
|
||||
if (pMapElement->ubTerrainID == DEEP_WATER)
|
||||
if (TERRAIN_IS_DEEP_WATER( pMapElement->ubTerrainID) )
|
||||
{
|
||||
// check for a bridge! otherwise...
|
||||
return( TRUE );
|
||||
|
||||
Reference in New Issue
Block a user