**********************************************************

** Big Maps Projects code (incl. Multiplayer v1.5 **
**********************************************************
- Merged Big Maps Project code from BMP+MP trunk (Revision: 3340)
o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- Before THIS merge, I made a branch of the existing 1.13 source
o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src
- Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago
- I will add VS 2010 projects and solution file in the next few days

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2010-02-28 18:38:52 +00:00
parent a98c44ac78
commit 14750c6903
461 changed files with 23615 additions and 120157 deletions
+292 -90
View File
@@ -16,20 +16,242 @@
#include "AIInternals.h"
#define ROOF_LOCATION_CHANCE 8
UINT8 gubBuildingInfo[ WORLD_MAX ];
UINT8* gubBuildingInfo = NULL;
BUILDING gBuildings[ MAX_BUILDINGS ];
UINT8 gubNumberOfBuildings;
UINT8 gubNumberOfBuildings;
#ifdef ROOF_DEBUG
extern INT16 gsCoverValue[WORLD_MAX];
#include "video.h"
#include "renderworld.h"
extern INT16 gsCoverValue[WORLD_MAX];
#include "video.h"
#include "renderworld.h"
#endif
// WANNE: Overhauls new building climbing only works with A* enabled
// -------------------------
// A* building climbing - BEGIN
// -------------------------
#ifdef USE_ASTAR_PATHS
BUILDING * CreateNewBuilding( UINT8 * pubBuilding )
{
if (gubNumberOfBuildings + 1 >= MAX_BUILDINGS)
{
return( NULL );
}
// increment # of buildings
gubNumberOfBuildings++;
// clear entry
gBuildings[ gubNumberOfBuildings ].ubNumClimbSpots = 0;
*pubBuilding = gubNumberOfBuildings;
// return pointer (have to subtract 1 since we just added 1
return( &(gBuildings[ gubNumberOfBuildings ]) );
}
BUILDING * FindBuilding( INT32 sGridNo )
{
UINT8 ubBuildingID;
if ( TileIsOutOfBounds( sGridNo ) )
{
return( NULL );
}
// id 0 indicates no building
ubBuildingID = gubBuildingInfo[ sGridNo ];
if ( ubBuildingID == NO_BUILDING )
{
return( NULL );
/*
// need extra checks to see if is valid spot...
// must have valid room information and be a flat-roofed
// building
if ( InARoom( sGridNo, &ubRoomNo ) && (FindStructure( sGridNo, STRUCTURE_NORMAL_ROOF ) != NULL) )
{
return( GenerateBuilding( sGridNo ) );
}
else
{
return( NULL );
}
*/
}
else if ( ubBuildingID > gubNumberOfBuildings ) // huh?
{
return( NULL );
}
return( &(gBuildings[ ubBuildingID ]) );
}
BOOLEAN InBuilding( INT32 sGridNo )
{
if ( FindBuilding( sGridNo ) == NULL )
{
return( FALSE );
}
return( TRUE );
}
BOOLEAN SameBuilding( INT32 sGridNo1, INT32 sGridNo2 )
{
if ( gubBuildingInfo[ sGridNo1 ] == NO_BUILDING )
{
return( FALSE );
}
if ( gubBuildingInfo[ sGridNo2 ] == NO_BUILDING )
{
return( FALSE );
}
return( (BOOLEAN) (gubBuildingInfo[ sGridNo1] == gubBuildingInfo[ sGridNo2 ]) );
}
BUILDING * GenerateBuilding( INT32 sDesiredSpot )
{
BUILDING * pBuilding;
UINT8 ubBuildingID = 0;
pBuilding = CreateNewBuilding( &ubBuildingID );
if (!pBuilding)
{
return( NULL );
}
// Set reachable
RoofReachableTest( sDesiredSpot, ubBuildingID );
// 0verhaul: The RoofReachableTest now finds ALL of the climb points for each climbable building, instead of a max of
// 21 climb points (and a min of 0) for each building. It claims an extended map flag to mark a tile as a climb point.
// So the array of up-climbs and down-climbs is now obsolete. FindClosestClimbPoint is now updated to search the map
// for these flags.
return( pBuilding );
}
void GenerateBuildings( void )
{
INT32 uiLoop;
// init building structures and variables
memset( gubBuildingInfo, 0, WORLD_MAX * sizeof( UINT8 ) );
memset( &gBuildings, 0, MAX_BUILDINGS * sizeof( BUILDING ) );
gubNumberOfBuildings = 0;
if ( (gbWorldSectorZ > 0) || gfEditMode)
{
return;
}
#ifdef ROOF_DEBUG
memset( gsCoverValue, 0x7F, sizeof( INT16 ) * WORLD_MAX );
#endif
// reset ALL reachable flags
// do once before we start building generation for
// whole map
for ( uiLoop = 0; uiLoop < WORLD_MAX; uiLoop++ )
{
gpWorldLevelData[ uiLoop ].uiFlags &= ~(MAPELEMENT_REACHABLE);
gpWorldLevelData[ uiLoop ].ubExtFlags[0] &= ~(MAPELEMENT_EXT_ROOFCODE_VISITED);
}
// search through world
// for each location in a room try to find building info
for ( uiLoop = 0; uiLoop < WORLD_MAX; uiLoop++ )
{
if ( (gubWorldRoomInfo[ uiLoop ] != NO_ROOM) && (gubBuildingInfo[ uiLoop ] == NO_BUILDING) && (FindStructure( uiLoop, STRUCTURE_NORMAL_ROOF ) != NULL) )
{
GenerateBuilding( uiLoop );
}
}
}
INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sDesiredGridNo, BOOLEAN fClimbUp )
{
BUILDING * pBuilding;
INT32 sGridNo;
INT32 sTestGridNo;
UINT8 ubTestDir;
INT32 sDistance, sClosestDistance = 1000, sClosestSpot= NOWHERE;
pBuilding = FindBuilding( sDesiredGridNo );
if (!pBuilding)
{
return( NOWHERE );
}
for (sGridNo = 0; sGridNo < WORLD_MAX; sGridNo++)
{
if (gubBuildingInfo[ sGridNo ] == gubBuildingInfo[ sDesiredGridNo ] &&
gpWorldLevelData[ sGridNo ].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT)
{
// Found a climb point for this building
if (fClimbUp)
{
for (ubTestDir = 0; ubTestDir < 8; ubTestDir += 2)
{
sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
{
// Found a matching climb point
if ( (WhoIsThere2( sTestGridNo, 0 ) == NOBODY || sTestGridNo == pSoldier->sGridNo)
&& (WhoIsThere2( sGridNo, 1 ) == NOBODY) &&
(!pSoldier || !InGas( pSoldier, sTestGridNo ) ) )
{
// And it's open
sDistance = PythSpacesAway( sStartGridNo, sTestGridNo );
if (sDistance < sClosestDistance )
{
sClosestDistance = sDistance;
sClosestSpot = sTestGridNo;
}
}
}
}
}
else
{
for (ubTestDir = 0; ubTestDir < 8; ubTestDir += 2)
{
sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
{
// Found a matching climb point
if ( (WhoIsThere2( sTestGridNo, 0 ) == NOBODY) &&
(WhoIsThere2( sGridNo, 1 ) == NOBODY || sGridNo == pSoldier->sGridNo) &&
(!pSoldier || !InGas( pSoldier, sTestGridNo ) ) )
{
// And it's open
sDistance = PythSpacesAway( sStartGridNo, sGridNo );
if (sDistance < sClosestDistance )
{
sClosestDistance = sDistance;
sClosestSpot = sGridNo;
}
}
}
}
}
}
}
return( sClosestSpot );
}
// -------------------------
// A* building climbing - END
// -------------------------
// -------------------------
// JA2 vanilla building climbing - BEGIN
// -------------------------
#else
BUILDING * CreateNewBuilding( UINT8 * pubBuilding )
{
if (gubNumberOfBuildings + 1 >= MAX_BUILDINGS)
@@ -38,33 +260,31 @@ BUILDING * CreateNewBuilding( UINT8 * pubBuilding )
}
// increment # of buildings
gubNumberOfBuildings++;
// clear entry
gBuildings[ gubNumberOfBuildings ].ubNumClimbSpots = 0;
*pubBuilding = gubNumberOfBuildings;
// return pointer (have to subtract 1 since we just added 1
return( &(gBuildings[ gubNumberOfBuildings ]) );
}
BUILDING * GenerateBuilding( INT16 sDesiredSpot )
BUILDING * GenerateBuilding( INT32 sDesiredSpot )
{
#ifdef VANILLA_BUILDING_CLIMBING
UINT32 uiLoop;
UINT32 uiLoop2;
INT16 sTempGridNo, sNextTempGridNo, sVeryTemporaryGridNo;
INT16 sStartGridNo, sCurrGridNo, sPrevGridNo = NOWHERE, sRightGridNo;
UINT8 ubDirection, ubTempDirection;
BOOLEAN fFoundDir, fFoundWall;
UINT32 uiChanceIn = ROOF_LOCATION_CHANCE; // chance of a location being considered
INT16 sWallGridNo;
INT8 bDesiredOrientation;
INT8 bSkipSpots = 0;
INT32 uiLoop;
INT32 uiLoop2;
INT32 sTempGridNo, sNextTempGridNo, sVeryTemporaryGridNo;
INT32 sStartGridNo, sCurrGridNo, sPrevGridNo = NOWHERE, sRightGridNo;
UINT8 ubDirection, ubTempDirection;
BOOLEAN fFoundDir, fFoundWall;
UINT32 uiChanceIn = ROOF_LOCATION_CHANCE; // chance of a location being considered
INT32 sWallGridNo;
INT8 bDesiredOrientation;
INT8 bSkipSpots = 0;
SOLDIERTYPE FakeSoldier;
INT32 iLoopCount = 0;
#endif
BUILDING * pBuilding;
UINT8 ubBuildingID = 0;
//INT32 iLoopCount = 0;
UINT8 ubBuildingID = 0;
INT32 iLoopCount = 0;
pBuilding = CreateNewBuilding( &ubBuildingID );
if (!pBuilding)
@@ -72,24 +292,13 @@ INT32 iLoopCount = 0;
return( NULL );
}
// WDS - Clean up inventory handling
// set up fake soldier for location testing
// memset( &FakeSoldier, 0, SIZEOF_SOLDIERTYPE );
#ifdef VANILLA_BUILDING_CLIMBING
FakeSoldier.initialize();
FakeSoldier.sGridNo = sDesiredSpot;
FakeSoldier.pathing.bLevel = 1;
FakeSoldier.bTeam = 1;
#endif
// Set reachable
RoofReachableTest( sDesiredSpot, ubBuildingID );
// 0verhaul: The RoofReachableTest now finds ALL of the climb points for each climbable building, instead of a max of
// 21 climb points (and a min of 0) for each building. It claims an extended map flag to mark a tile as a climb point.
// So the array of up-climbs and down-climbs is now obsolete. FindClosestClimbPoint is now updated to search the map
// for these flags.
#ifdef VANILLA_BUILDING_CLIMBING
// From sGridNo, search until we find a spot that isn't part of the building
ubDirection = NORTHWEST;
sTempGridNo = sDesiredSpot;
@@ -210,7 +419,7 @@ INT32 iLoopCount = 0;
gsCoverValue[sCurrGridNo]++;
}
//DebugAI( String( "Roof code visits %d", sCurrGridNo ) );
DebugAI( String( "Roof code visits %d", sCurrGridNo ) );
#endif
if (sCurrGridNo == sStartGridNo)
@@ -232,13 +441,12 @@ INT32 iLoopCount = 0;
// if the direction is east or north, the wall would be in our gridno;
// if south or west, the wall would be in the gridno two clockwise
fFoundWall = FALSE;
#ifndef VANILLA_BUILDING_CLIMBING
// There must not be roof here either. There are places where a pitched roof butts up against a flat roof.
// Don't mark such a border as a climb point. Otherwise AI units will get stuck.
if (FindStructure( sCurrGridNo, STRUCTURE_ROOF ) == NULL &&
NewOKDestination( &FakeSoldier, sCurrGridNo, FALSE, 0 ) )
{
#endif
switch( ubDirection )
{
case NORTH:
@@ -250,11 +458,11 @@ INT32 iLoopCount = 0;
bDesiredOrientation = OUTSIDE_TOP_LEFT;
break;
case SOUTH:
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
sWallGridNo = ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
bDesiredOrientation = OUTSIDE_TOP_RIGHT;
break;
case WEST:
sWallGridNo = (INT16) ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
sWallGridNo = ( sCurrGridNo + DirectionInc( gTwoCDirection[ ubDirection ] ) );
bDesiredOrientation = OUTSIDE_TOP_LEFT;
break;
default:
@@ -276,9 +484,7 @@ INT32 iLoopCount = 0;
fFoundWall = TRUE;
}
}
#ifndef VANILLA_BUILDING_CLIMBING
}
#endif
if (fFoundWall)
{
#ifdef ROOF_DEBUG
@@ -289,7 +495,7 @@ INT32 iLoopCount = 0;
bSkipSpots--;
}
else if ( Random( uiChanceIn ) == 0 )
{
{
pBuilding->sUpClimbSpots[ pBuilding->ubNumClimbSpots ] = sCurrGridNo;
pBuilding->sDownClimbSpots[ pBuilding->ubNumClimbSpots ] = sRightGridNo;
pBuilding->ubNumClimbSpots++;
@@ -307,7 +513,7 @@ INT32 iLoopCount = 0;
#endif
// skip the next spot
bSkipSpots = 1;
}
}
else
{
// didn't pick this location, so increase chance that next location
@@ -316,12 +522,12 @@ INT32 iLoopCount = 0;
{
uiChanceIn--;
}
}
}
}
else
{
// can't select this spot
if ( (sPrevGridNo != NOWHERE) && (pBuilding->ubNumClimbSpots > 0) )
// can't select this spot
if ( ( !TileIsOutOfBounds(sPrevGridNo)) && (pBuilding->ubNumClimbSpots > 0) )
{
if ( pBuilding->sDownClimbSpots[ pBuilding->ubNumClimbSpots - 1 ] == sCurrGridNo )
{
@@ -348,37 +554,24 @@ INT32 iLoopCount = 0;
{
UINT8 x = 0;
UINT8 y = 0;
while((sDesiredSpot - ((y + 1) * 160)) >= 0)
while((sDesiredSpot - ((y + 1) * WORLD_COLS)) >= 0)
{
y++;
}
x = sDesiredSpot - (y * 160);
x = sDesiredSpot - (y * WORLD_COLS);
DebugMsg (TOPIC_JA2,DBG_LEVEL_2,String( "113/UC Warning! Building Walk Algorithm has covered the entire map! Building %d located at [%d,%d] must be bogus.", ubBuildingID, x, y ));
}
// at end could prune # of locations if there are too many
/*
#ifdef ROOF_DEBUG
SetRenderFlags( RENDER_FLAG_FULL );
RenderWorld();
//RenderCoverDebug( );
InvalidateScreen( );
EndFrameBufferRender();
RefreshScreen( NULL );
#endif
*/
#endif
return( pBuilding );
}
BUILDING * FindBuilding( INT16 sGridNo )
BUILDING * FindBuilding( INT32 sGridNo )
{
UINT8 ubBuildingID;
//UINT8 ubRoomNo;
if (sGridNo <= 0 || sGridNo > WORLD_MAX)
if ( TileIsOutOfBounds( sGridNo ) )
{
return( NULL );
}
@@ -389,6 +582,7 @@ BUILDING * FindBuilding( INT16 sGridNo )
if ( ubBuildingID == NO_BUILDING )
{
return( NULL );
/*
// need extra checks to see if is valid spot...
// must have valid room information and be a flat-roofed
@@ -411,7 +605,7 @@ BUILDING * FindBuilding( INT16 sGridNo )
return( &(gBuildings[ ubBuildingID ]) );
}
BOOLEAN InBuilding( INT16 sGridNo )
BOOLEAN InBuilding( INT32 sGridNo )
{
if ( FindBuilding( sGridNo ) == NULL )
{
@@ -423,7 +617,7 @@ BOOLEAN InBuilding( INT16 sGridNo )
void GenerateBuildings( void )
{
UINT32 uiLoop;
INT32 uiLoop;
// init building structures and variables
memset( gubBuildingInfo, 0, WORLD_MAX * sizeof( UINT8 ) );
@@ -452,26 +646,17 @@ void GenerateBuildings( void )
// for each location in a room try to find building info
for ( uiLoop = 0; uiLoop < WORLD_MAX; uiLoop++ )
{
if ( (gubWorldRoomInfo[ uiLoop ] != NO_ROOM) && (gubBuildingInfo[ uiLoop ] == NO_BUILDING) && (FindStructure( (INT16) uiLoop, STRUCTURE_NORMAL_ROOF ) != NULL) )
if ( (gubWorldRoomInfo[ uiLoop ] != NO_ROOM) && (gubBuildingInfo[ uiLoop ] == NO_BUILDING) && (FindStructure( uiLoop, STRUCTURE_NORMAL_ROOF ) != NULL) )
{
GenerateBuilding( (INT16) uiLoop );
GenerateBuilding( uiLoop );
}
}
}
INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp )
INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sDesiredGridNo, BOOLEAN fClimbUp )
{
BUILDING * pBuilding;
#ifndef VANILLA_BUILDING_CLIMBING
INT16 sGridNo;
INT16 sTestGridNo;
UINT8 ubTestDir;
#else
UINT8 ubNumClimbSpots;
INT16 * psClimbSpots;
UINT8 ubLoop;
#endif
INT16 sDistance, sClosestDistance = 1000, sClosestSpot= NOWHERE;
BUILDING * pBuilding;
INT32 sDistance, sClosestDistance = 1000, sClosestSpot= NOWHERE;
pBuilding = FindBuilding( sDesiredGridNo );
if (!pBuilding)
@@ -479,11 +664,16 @@ INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sD
return( NOWHERE );
}
#ifndef VANILLA_BUILDING_CLIMBING
// WANNE: This code is from Overhauls A* climbing building, but also works here.
/*
INT32 sTestGridNo;
UINT8 ubTestDir;
INT32 sGridNo;
for (sGridNo = 0; sGridNo < WORLD_MAX; sGridNo++)
{
if (gubBuildingInfo[ sGridNo ] == gubBuildingInfo[ sDesiredGridNo ] &&
gpWorldLevelData[ sGridNo ].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT)
if (gubBuildingInfo[ sGridNo ] == gubBuildingInfo[ sDesiredGridNo ]) //&&
//gpWorldLevelData[ sGridNo ].ubExtFlags[1] & MAPELEMENT_EXT_CLIMBPOINT)
{
// Found a climb point for this building
if (fClimbUp)
@@ -491,7 +681,7 @@ INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sD
for (ubTestDir = 0; ubTestDir < 8; ubTestDir += 2)
{
sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
//if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
{
// Found a matching climb point
if ( (WhoIsThere2( sTestGridNo, 0 ) == NOBODY || sTestGridNo == pSoldier->sGridNo)
@@ -514,7 +704,7 @@ INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sD
for (ubTestDir = 0; ubTestDir < 8; ubTestDir += 2)
{
sTestGridNo = NewGridNo( sGridNo, DirectionInc( ubTestDir));
if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
//if (gpWorldLevelData[ sTestGridNo ].ubExtFlags[0] & MAPELEMENT_EXT_CLIMBPOINT)
{
// Found a matching climb point
if ( (WhoIsThere2( sTestGridNo, 0 ) == NOBODY) &&
@@ -534,7 +724,15 @@ INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sD
}
}
}
#else
return( sClosestSpot );
*/
// WANNE: This code is from "vanilla" climbing
UINT8 ubNumClimbSpots;
INT32 * psClimbSpots;
UINT8 ubLoop;
ubNumClimbSpots = pBuilding->ubNumClimbSpots;
if (fClimbUp)
@@ -560,12 +758,11 @@ INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sD
}
}
}
#endif
return( sClosestSpot );
}
BOOLEAN SameBuilding( INT16 sGridNo1, INT16 sGridNo2 )
BOOLEAN SameBuilding( INT32 sGridNo1, INT32 sGridNo2 )
{
if ( gubBuildingInfo[ sGridNo1 ] == NO_BUILDING )
{
@@ -577,3 +774,8 @@ BOOLEAN SameBuilding( INT16 sGridNo1, INT16 sGridNo2 )
}
return( (BOOLEAN) (gubBuildingInfo[ sGridNo1] == gubBuildingInfo[ sGridNo2 ]) );
}
#endif
// -------------------------
// JA2 vanilla building climbing - END
// -------------------------
+9 -21
View File
@@ -12,33 +12,21 @@
#define NO_BUILDING 0
#define MAX_BUILDINGS 31
// WANNE: If this is defined, this fixes the bug, that soldiers do not
// climb on roofs anymore if ASTAR is disabled.
// The "Bug" was introduced in Revision 1534 (TileEngine\Buildings.cpp)
// Overhaul wanted to improve the climbing on buildings, but introduced this bug
// If the VANILLA_BUILDING_CLIMBING is not defined, it uses Overhaul code,
// where enemies do not climb on buildings!!
// PS: I did not looked in Overhaul's Building code was causes the problem.
// If someone has time to debug and fixes the problem, Overhaul's code should
// be used -> Disable the define!
#define VANILLA_BUILDING_CLIMBING
typedef struct BUILDING
{
INT16 sUpClimbSpots[MAX_CLIMBSPOTS_PER_BUILDING];
INT16 sDownClimbSpots[MAX_CLIMBSPOTS_PER_BUILDING];
INT32 sUpClimbSpots[MAX_CLIMBSPOTS_PER_BUILDING];
INT32 sDownClimbSpots[MAX_CLIMBSPOTS_PER_BUILDING];
UINT8 ubNumClimbSpots;
} BUILDING;
extern UINT8 gubBuildingInfo[ WORLD_MAX ];
//extern UINT8 gubBuildingInfo[ WORLD_MAX ];
extern UINT8 * gubBuildingInfo;
BOOLEAN InBuilding( INT16 sGridNo );
BUILDING * GenerateBuilding( INT16 sDesiredSpot );
BUILDING * FindBuilding( INT16 sGridNo );
BOOLEAN InBuilding( INT32 sGridNo );
BUILDING * GenerateBuilding( INT32 sDesiredSpot );
BUILDING * FindBuilding( INT32 sGridNo );
void GenerateBuildings( void );
INT16 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT16 sStartGridNo, INT16 sDesiredGridNo, BOOLEAN fClimbUp );
BOOLEAN SameBuilding( INT16 sGridNo1, INT16 sGridNo2 );
INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sDesiredGridNo, BOOLEAN fClimbUp );
BOOLEAN SameBuilding( INT32 sGridNo1, INT32 sGridNo2 );
#endif
+152 -67
View File
@@ -30,35 +30,46 @@ EXITGRID gExitGrid = {0,1,1,0};
BOOLEAN gfOverrideInsertionWithExitGrid = FALSE;
INT32 ConvertExitGridToINT32( EXITGRID *pExitGrid )
{
INT32 iExitGridInfo;
iExitGridInfo = (pExitGrid->ubGotoSectorX-1)<< 28;
iExitGridInfo += (pExitGrid->ubGotoSectorY-1)<< 24;
iExitGridInfo += pExitGrid->ubGotoSectorZ << 20;
iExitGridInfo += pExitGrid->sGridNo & 0x0000ffff;
return iExitGridInfo;
}
//<SB>
void ConvertINT32ToExitGrid( INT32 iExitGridInfo, EXITGRID *pExitGrid )
{
//convert the int into 4 unsigned bytes.
pExitGrid->ubGotoSectorX = (UINT8)(((iExitGridInfo & 0xf0000000)>>28)+1);
pExitGrid->ubGotoSectorY = (UINT8)(((iExitGridInfo & 0x0f000000)>>24)+1);
pExitGrid->ubGotoSectorZ = (UINT8)((iExitGridInfo & 0x00f00000)>>20);
pExitGrid->sGridNo = (INT16)(iExitGridInfo & 0x0000ffff);
}
#define MAX_EXITGRIDS 4096
BOOLEAN GetExitGrid( INT16 sMapIndex, EXITGRID *pExitGrid )
EXITGRID gpExitGrids[MAX_EXITGRIDS];
UINT guiExitGridsCount = 0;
//INT32 ConvertExitGridToINT32( EXITGRID *pExitGrid )
//{
// INT32 iExitGridInfo;
// iExitGridInfo = (pExitGrid->ubGotoSectorX-1)<< 28;
// iExitGridInfo += (pExitGrid->ubGotoSectorY-1)<< 24;
// iExitGridInfo += pExitGrid->ubGotoSectorZ << 20;
// iExitGridInfo += pExitGrid->usGridNo & 0x0000ffff;
// return iExitGridInfo;
//}
//
//void ConvertINT32ToExitGrid( INT32 iExitGridInfo, EXITGRID *pExitGrid )
//{
// //convert the int into 4 unsigned bytes.
// pExitGrid->ubGotoSectorX = (UINT8)(((iExitGridInfo & 0xf0000000)>>28)+1);
// pExitGrid->ubGotoSectorY = (UINT8)(((iExitGridInfo & 0x0f000000)>>24)+1);
// pExitGrid->ubGotoSectorZ = (UINT8)((iExitGridInfo & 0x00f00000)>>20);
// pExitGrid->usGridNo = (UINT16)(iExitGridInfo & 0x0000ffff);
//}
BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid )
{
LEVELNODE *pShadow;
pShadow = gpWorldLevelData[ sMapIndex ].pShadowHead;
pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead;
//Search through object layer for an exitgrid
while( pShadow )
{
if ( pShadow->uiFlags & LEVELNODE_EXITGRID )
{
ConvertINT32ToExitGrid( pShadow->iExitGridInfo, pExitGrid );
//<SB>
// ConvertINT32ToExitGrid( pShadow->iExitGridInfo, pExitGrid );
memcpy(pExitGrid, pShadow->pExitGridInfo, sizeof(EXITGRID));
//</SB>
return TRUE;
}
pShadow = pShadow->pNext;
@@ -66,14 +77,14 @@ BOOLEAN GetExitGrid( INT16 sMapIndex, EXITGRID *pExitGrid )
pExitGrid->ubGotoSectorX = 0;
pExitGrid->ubGotoSectorY = 0;
pExitGrid->ubGotoSectorZ = 0;
pExitGrid->sGridNo = 0;
pExitGrid->usGridNo = 0;
return FALSE;
}
BOOLEAN ExitGridAtGridNo( INT16 sMapIndex )
BOOLEAN ExitGridAtGridNo( UINT32 usMapIndex )
{
LEVELNODE *pShadow;
pShadow = gpWorldLevelData[ sMapIndex ].pShadowHead;
pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead;
//Search through object layer for an exitgrid
while( pShadow )
{
@@ -86,10 +97,10 @@ BOOLEAN ExitGridAtGridNo( INT16 sMapIndex )
return FALSE;
}
BOOLEAN GetExitGridLevelNode( INT16 sMapIndex, LEVELNODE **ppLevelNode )
BOOLEAN GetExitGridLevelNode( UINT32 usMapIndex, LEVELNODE **ppLevelNode )
{
LEVELNODE *pShadow;
pShadow = gpWorldLevelData[ sMapIndex ].pShadowHead;
pShadow = gpWorldLevelData[ usMapIndex ].pShadowHead;
//Search through object layer for an exitgrid
while( pShadow )
{
@@ -115,7 +126,12 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid )
tail = pShadow;
if( pShadow->uiFlags & LEVELNODE_EXITGRID )
{ //we have found an existing exitgrid in this node, so replace it with the new information.
pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid );
//<SB>
// pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid );
memcpy(gpExitGrids + guiExitGridsCount, pExitGrid, sizeof(EXITGRID));
pShadow->pExitGridInfo = gpExitGrids + guiExitGridsCount;
guiExitGridsCount++;
//</SB>
//SmoothExitGridRadius( (INT16)iMapIndex, 0 );
return;
}
@@ -128,13 +144,18 @@ void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid )
pShadow = gpWorldLevelData[ iMapIndex ].pShadowHead;
//fill in the information for the new exitgrid levelnode.
pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid );
//<SB>
// pShadow->iExitGridInfo = ConvertExitGridToINT32( pExitGrid );
memcpy(gpExitGrids + guiExitGridsCount, pExitGrid, sizeof(EXITGRID));
pShadow->pExitGridInfo = gpExitGrids + guiExitGridsCount;
guiExitGridsCount++;
//</SB>
pShadow->uiFlags |= ( LEVELNODE_EXITGRID | LEVELNODE_HIDDEN );
//Add the exit grid to the sector, only if we call ApplyMapChangesToMapTempFile() first.
if( !gfEditMode && !gfLoadingExitGrids )
{
AddExitGridToMapTempFile( (INT16)iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
AddExitGridToMapTempFile( iMapIndex, pExitGrid, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
}
}
@@ -147,50 +168,114 @@ void RemoveExitGridFromWorld( INT32 iMapIndex )
}
}
void SaveExitGrids( HWFILE fp, UINT16 usNumExitGrids )
//dnl ch42 250909
EXITGRID& EXITGRID::operator=(const _OLD_EXITGRID& src)
{
EXITGRID exitGrid;
UINT16 usNumSaved = 0;
UINT16 x;
UINT32 uiBytesWritten;
FileWrite( fp, &usNumExitGrids, 2, &uiBytesWritten );
for( x = 0; x < WORLD_MAX; x++ )
if((void*)this != (void*)&src)
{
if( GetExitGrid( x, &exitGrid ) )
usGridNo = src.usGridNo;
ubGotoSectorX = src.ubGotoSectorX;
ubGotoSectorY = src.ubGotoSectorY;
ubGotoSectorZ = src.ubGotoSectorZ;
}
return(*this);
}
BOOLEAN EXITGRID::Load(INT8** hBuffer, FLOAT dMajorMapVersion)
{
if(dMajorMapVersion < 7.0)
{
_OLD_EXITGRID OldExitGrid;
LOADDATA(&OldExitGrid, *hBuffer, 5);// Never use sizeof(_OLD_EXITGRID) because return 6 and all maps was saved with 5 bytes
*this = OldExitGrid;
}
else
LOADDATA(this, *hBuffer, sizeof(EXITGRID));
return(TRUE);
}
BOOLEAN EXITGRID::Save(HWFILE hFile, FLOAT dMajorMapVersion, UINT8 ubMinorMapVersion)
{
PTR pData = this;
UINT32 uiBytesToWrite = sizeof(EXITGRID);
_OLD_EXITGRID OldExitGrid;
if(dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION)
{
OldExitGrid.usGridNo = usGridNo;
OldExitGrid.ubGotoSectorX = ubGotoSectorX;
OldExitGrid.ubGotoSectorY = ubGotoSectorY;
OldExitGrid.ubGotoSectorZ = ubGotoSectorZ;
pData = &OldExitGrid;
uiBytesToWrite = 5;// Never use sizeof(_OLD_EXITGRID) because return 6 and all maps was saved with 5 bytes
}
UINT32 uiBytesWritten = 0;
FileWrite(hFile, pData, uiBytesToWrite, &uiBytesWritten);
if(uiBytesToWrite == uiBytesWritten)
return(TRUE);
return(FALSE);
}
void LoadExitGrids(INT8** hBuffer, FLOAT dMajorMapVersion)
{
UINT16 usNumExitGrids;
INT32 usMapIndex;
EXITGRID ExitGrid;
// New world is loading so trash all old EXITGRID's
memset(gpExitGrids, 0, sizeof(gpExitGrids));
guiExitGridsCount = 0;
gfLoadingExitGrids = TRUE;
LOADDATA(&usNumExitGrids, *hBuffer, sizeof(usNumExitGrids));
for(int i=0; i<usNumExitGrids; i++)
{
if(dMajorMapVersion < 7.0)
{
FileWrite( fp, &x, 2, &uiBytesWritten );
FileWrite( fp, &exitGrid, 5, &uiBytesWritten );
UINT16 usOldMapIndex;
LOADDATA(&usOldMapIndex, *hBuffer, sizeof(usOldMapIndex));
usMapIndex = usOldMapIndex;
}
else
LOADDATA(&usMapIndex, *hBuffer, sizeof(usMapIndex));
ExitGrid.Load(hBuffer, dMajorMapVersion);
//dnl ch44 280909 EXITGRID translation
gMapTrn.GetTrnCnt(usMapIndex);
//gMapTrn.GetTrnCnt(ExitGrid.usGridNo);//dnl ch56 151009 This is gridno in sector which size you don't know, so no translation here
AddExitGridToWorld(usMapIndex, &ExitGrid);
}
gfLoadingExitGrids = FALSE;
}
void SaveExitGrids(HWFILE hFile, UINT16 usNumExitGrids, FLOAT dMajorMapVersion, UINT8 ubMinorMapVersion)
{
UINT32 uiBytesWritten;
FileWrite(hFile, &usNumExitGrids, sizeof(usNumExitGrids), &uiBytesWritten);
EXITGRID ExitGrid;
UINT32 usNumSaved = 0;
for(INT32 i=0; i<WORLD_MAX; i++)
{
if(GetExitGrid(i, &ExitGrid))
{
if(dMajorMapVersion < 7.0)
{
UINT16 usOldMapIndex = i;
FileWrite(hFile, &usOldMapIndex, sizeof(usOldMapIndex), &uiBytesWritten);
}
else
FileWrite(hFile, &i, sizeof(i), &uiBytesWritten);
ExitGrid.Save(hFile, dMajorMapVersion, ubMinorMapVersion);
usNumSaved++;
}
}
//If these numbers aren't equal, something is wrong!
Assert( usNumExitGrids == usNumSaved );
}
void LoadExitGrids( INT8 **hBuffer )
{
EXITGRID exitGrid;
UINT16 x;
UINT16 usNumSaved;
INT16 sMapIndex;
gfLoadingExitGrids = TRUE;
LOADDATA( &usNumSaved, *hBuffer, 2 );
//FileRead( hfile, &usNumSaved, 2, NULL);
for( x = 0; x < usNumSaved; x++ )
{
LOADDATA( &sMapIndex, *hBuffer, 2 );
//FileRead( hfile, &sMapIndex, 2, NULL);
LOADDATA( &exitGrid, *hBuffer, 5 );
//FileRead( hfile, &exitGrid, 5, NULL);
AddExitGridToWorld( sMapIndex, &exitGrid );
}
gfLoadingExitGrids = FALSE;
Assert(usNumExitGrids == usNumSaved);
}
void AttemptToChangeFloorLevel( INT8 bRelativeZLevel )
{
UINT8 ubLookForLevel=0;
UINT16 i;
INT32 i;
if( bRelativeZLevel != 1 && bRelativeZLevel != -1 )
return;
//Check if on ground level -- if so, can't go up!
@@ -230,14 +315,14 @@ void AttemptToChangeFloorLevel( INT8 bRelativeZLevel )
}
INT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection )
INT32 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT32 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sGridNo;
INT32 sGridNo;
INT32 uiRange, uiLowestRange = 999999;
INT16 sLowestGridNo=0;
INT32 sLowestGridNo=0;
INT32 leftmost;
BOOLEAN fFound = FALSE;
SOLDIERTYPE soldier;
@@ -294,7 +379,7 @@ INT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwee
//Now, find out which of these gridnos are reachable
//(use the fake soldier and the pathing settings)
FindBestPath( &soldier, NOWHERE, 0, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE );
FindBestPath( &soldier, GRIDSIZE, 0, WALKING, COPYREACHABLE, PATH_THROUGH_PEOPLE );//dnl ch50 071009
uiLowestRange = 999999;
@@ -350,14 +435,14 @@ INT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSwee
}
INT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sSrcGridNo, INT8 ubRadius )
INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT8 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sGridNo;
INT32 sGridNo;
INT32 uiRange, uiLowestRange = 999999;
INT16 sLowestGridNo=0;
INT32 sLowestGridNo=0;
INT32 leftmost;
BOOLEAN fFound = FALSE;
EXITGRID ExitGrid;
+26 -13
View File
@@ -4,25 +4,38 @@
#include "Fileman.h"
#include "Worlddef.h"
typedef struct //for exit grids (object level)
//dnl ch42 250909
typedef struct
{
//if an item pool is also in same gridno, then this would be a separate levelnode
//in the object level list
INT16 sGridNo; //sweet spot for placing mercs in new sector.
INT16 usGridNo;
UINT8 ubGotoSectorX;
UINT8 ubGotoSectorY;
UINT8 ubGotoSectorZ;
}EXITGRID;
}_OLD_EXITGRID;
BOOLEAN ExitGridAtGridNo( INT16 sMapIndex );
BOOLEAN GetExitGridLevelNode( INT16 sMapIndex, LEVELNODE **ppLevelNode );
BOOLEAN GetExitGrid( INT16 sMapIndex, EXITGRID *pExitGrid );
class EXITGRID// For exit grids (object level)
{
// If an item pool is also in same gridno, then this would be a separate levelnode in the object level list
public:
INT32 usGridNo;// Sweet spot for placing mercs in new sector.
UINT8 ubGotoSectorX;
UINT8 ubGotoSectorY;
UINT8 ubGotoSectorZ;
public:
EXITGRID& operator=(const _OLD_EXITGRID& src);
BOOLEAN Load(INT8** hBuffer, FLOAT dMajorMapVersion);
BOOLEAN Save(HWFILE hFile, FLOAT dMajorMapVersion, UINT8 ubMinorMapVersion);
};
BOOLEAN ExitGridAtGridNo( UINT32 usMapIndex );
BOOLEAN GetExitGridLevelNode( UINT32 usMapIndex, LEVELNODE **ppLevelNode );
BOOLEAN GetExitGrid( UINT32 usMapIndex, EXITGRID *pExitGrid );
void AddExitGridToWorld( INT32 iMapIndex, EXITGRID *pExitGrid );
void RemoveExitGridFromWorld( INT32 iMapIndex );
void SaveExitGrids( HWFILE fp, UINT16 usNumExitGrids );
void LoadExitGrids( INT8 **hBuffer );
//dnl ch42 250909
void SaveExitGrids(HWFILE hFile, UINT16 usNumExitGrids, FLOAT dMajorMapVersion, UINT8 ubMinorMapVersion);
void LoadExitGrids(INT8** hBuffer, FLOAT dMajorMapVersion);
void AttemptToChangeFloorLevel( INT8 bRelativeZLevel );
@@ -31,8 +44,8 @@ extern BOOLEAN gfOverrideInsertionWithExitGrid;
// Finds closest ExitGrid of same type as is at gridno, within a radius. Checks
// valid paths, destinations, etc.
INT16 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT16 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection );
INT32 FindGridNoFromSweetSpotCloseToExitGrid( SOLDIERTYPE *pSoldier, INT32 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection );
INT16 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 ubRadius );
INT32 FindClosestExitGrid( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo, INT8 ubRadius );
#endif
+265 -75
View File
@@ -66,10 +66,12 @@
#include "Morale.h"
#include "fov.h"
#include "Map Information.h"
#include "Soldier Functions.h"//dnl ch40 200909
#endif
#include "Soldier Macros.h"
#include "connect.h"
#include "debug control.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -79,14 +81,14 @@ class SOLDIERTYPE;
// MODULE FOR EXPLOSIONS
// Spreads the effects of explosions...
BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID );
BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID );
// Flashbang effect on soldier
UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOLEAN fInBuilding);
extern INT8 gbSAMGraphicList[ MAX_NUMBER_OF_SAMS ];
extern void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID );
extern void RecompileLocalMovementCostsForWall( INT16 sGridNo, UINT8 ubOrientation );
extern void RecompileLocalMovementCostsForWall( INT32 sGridNo, UINT8 ubOrientation );
void FatigueCharacter( SOLDIERTYPE *pSoldier );
#define NO_ALT_SOUND -1
@@ -184,7 +186,7 @@ BOOLEAN gfExplosionQueueActive = FALSE;
BOOLEAN gfExplosionQueueMayHaveChangedSight = FALSE;
UINT8 gubPersonToSetOffExplosions = NOBODY;
INT16 gsTempActionGridNo = NOWHERE;
INT32 gsTempActionGridNo = NOWHERE;
extern UINT8 gubInterruptProvoker;
@@ -198,7 +200,7 @@ UINT32 guiNumExplosions = 0;
INT32 GetFreeExplosion( void );
void RecountExplosions( void );
void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion );
void HandleBuldingDestruction( INT16 sGridNo, UINT8 ubOwner );
void HandleBuldingDestruction( INT32 sGridNo, UINT8 ubOwner );
INT32 GetFreeExplosion( void )
@@ -235,8 +237,16 @@ void RecountExplosions( void )
// GENERATE EXPLOSION
void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel )
void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel )
{
#ifdef JA2BETAVERSION
if (is_networked) {
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"InternalIgniteExplosion ( ubOwner : %i , sX : %i , sY : %i , sZ : %i , sGridNo : %i , usItem : %i , fLocate : %i , bLevel : %i )\n",ubOwner, sX , sY , sZ , sGridNo , usItem , (int)fLocate , bLevel );
MPDebugMsg(tmpMPDbgString);
}
#endif
EXPLOSION_PARAMS ExpParams ;
// Callahan start
@@ -303,7 +313,7 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16
void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 sGridNo, UINT16 usItem, INT8 bLevel )
void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel )
{
InternalIgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, usItem, TRUE, bLevel );
}
@@ -317,7 +327,7 @@ void GenerateExplosion( EXPLOSION_PARAMS *pExpParams )
INT16 sX;
INT16 sY;
INT16 sZ;
INT16 sGridNo;
INT32 sGridNo;
UINT16 usItem;
INT32 iIndex;
INT8 bLevel;
@@ -372,7 +382,7 @@ void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion )
INT16 sX;
INT16 sY;
INT16 sZ;
INT16 sGridNo;
INT32 sGridNo;
UINT16 usItem;
UINT8 ubTerrainType;
INT8 bLevel;
@@ -524,7 +534,7 @@ void RemoveExplosionData( INT32 iIndex )
}
void HandleFencePartnerCheck( INT16 sStructGridNo )
void HandleFencePartnerCheck( INT32 sStructGridNo )
{
STRUCTURE *pFenceStructure, *pFenceBaseStructure;
LEVELNODE *pFenceNode;
@@ -570,12 +580,20 @@ void HandleFencePartnerCheck( INT16 sStructGridNo )
BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
{
#ifdef JA2BETAVERSION
if (is_networked) {
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"ExplosiveDamageStructureAtGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompMoveCosts : %i , fOnlyWalls : %i , SubsMulTilTransDmg : %i , ubOwner : %i , bLevel : %i )\n",sGridNo, sWoundAmt , (int)*pfRecompileMovementCosts , (int)fOnlyWalls , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel );
MPDebugMsg(tmpMPDbgString);
}
#endif
INT16 sX, sY;
STRUCTURE *pBase, *pWallStruct, *pAttached, *pAttachedBase;
LEVELNODE *pNode = NULL, *pNewNode = NULL, *pAttachedNode;
INT16 sNewGridNo, sStructGridNo;
INT32 sNewGridNo, sStructGridNo;
INT16 sNewIndex, sSubIndex;
UINT16 usObjectIndex, usTileIndex;
UINT8 ubNumberOfTiles, ubLoop;
@@ -584,7 +602,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
INT8 bDamageReturnVal;
BOOLEAN fContinue;
UINT32 uiTileType;
INT16 sBaseGridNo;
INT32 sBaseGridNo;
BOOLEAN fExplosive;
// ATE: Check for O3 statue for special damage..
@@ -810,7 +828,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
// Move WEST
sNewGridNo = NewGridNo( pBase->sGridNo, DirectionInc( WEST ) );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridno( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridNo( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
if ( pNewNode != NULL )
{
@@ -842,7 +860,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
// Move in EAST
sNewGridNo = NewGridNo( pBase->sGridNo, DirectionInc( EAST ) );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridno( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridNo( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
if ( pNewNode != NULL )
{
@@ -957,7 +975,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
// Move in NORTH
sNewGridNo = NewGridNo( pBase->sGridNo, DirectionInc( NORTH ) );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridno( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridNo( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
if ( pNewNode != NULL )
{
@@ -988,7 +1006,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
// Move in SOUTH
sNewGridNo = NewGridNo( pBase->sGridNo, DirectionInc( SOUTH ) );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridno( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
pNewNode = GetWallLevelNodeAndStructOfSameOrientationAtGridNo( sNewGridNo, pCurrent->ubWallOrientation, &pWallStruct );
if ( pNewNode != NULL )
{
@@ -1101,11 +1119,11 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
if ( !fInRoom )
{
// try to south
fInRoom = InARoom( (INT16)( sGridNo + DirectionInc( SOUTH ) ), &ubRoom );
fInRoom = InARoom( sGridNo + DirectionInc( SOUTH ) , &ubRoom );
if ( !fInRoom )
{
// try to east
fInRoom = InARoom( (INT16)( sGridNo + DirectionInc( EAST ) ), &ubRoom );
fInRoom = InARoom( sGridNo + DirectionInc( EAST ) , &ubRoom );
}
}
@@ -1214,19 +1232,27 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe
STRUCTURE *gStruct;
void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel )
{
STRUCTURE * pCurrent, *pNextCurrent, *pStructure;
STRUCTURE * pBaseStructure;
INT16 sDesiredLevel;
DB_STRUCTURE_TILE **ppTile;
UINT8 ubLoop, ubLoop2;
INT16 sNewGridNo, sNewGridNo2, sBaseGridNo;
BOOLEAN fToBreak = FALSE;
BOOLEAN fMultiStructure = FALSE;
UINT8 ubNumberOfTiles;
BOOLEAN fMultiStructSpecialFlag = FALSE;
BOOLEAN fExplodeDamageReturn = FALSE;
#ifdef JA2BETAVERSION
if (is_networked) {
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"ExplosiveDamageGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompileMoveCosts : %i , fOnlyWalls : %i , MultiStructSpecialFlag : %i ,fSubsequentMultiTilesTransDmg : %i , ubOwner : %i , bLevel : %i )\n",sGridNo, sWoundAmt , (int)*pfRecompileMovementCosts , (int)fOnlyWalls , bMultiStructSpecialFlag , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel );
MPDebugMsg(tmpMPDbgString);
}
#endif
STRUCTURE *pCurrent, *pNextCurrent, *pStructure;
STRUCTURE *pBaseStructure;
INT16 sDesiredLevel;
DB_STRUCTURE_TILE **ppTile = NULL;
UINT8 ubLoop, ubLoop2;
INT32 sNewGridNo, sNewGridNo2, sBaseGridNo = NOWHERE;
BOOLEAN fToBreak = FALSE;
BOOLEAN fMultiStructure = FALSE;
UINT8 ubNumberOfTiles = 0xff;
BOOLEAN fMultiStructSpecialFlag = FALSE;
BOOLEAN fExplodeDamageReturn = FALSE;
// Based on distance away, damage any struct at this gridno
// OK, loop through structures and damage!
@@ -1376,8 +1402,34 @@ void ExplosiveDamageGridNo( INT16 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE
}
BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent )
BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent , BOOL fFromRemoteClient )
{
// OJW - 20091028
if (is_networked && is_client)
{
SOLDIERTYPE* pSoldier = MercPtrs[ubPerson];
if (pSoldier != NULL)
{
// only the owner of a merc may send damage (as this takes into account equipped armor)
if (IsOurSoldier(pSoldier) || (pSoldier->bTeam == 1 && is_server) && !fFromRemoteClient)
{
// let this function proceed, we will send damage towards the end
}
else if (!fFromRemoteClient)
{
// skip executing locally because we want the random number generator to be aligned
// with the client that spawns set off the explosion/grenade/whatever
return FALSE;
}
}
#ifdef JA2BETAVERSION
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"DamageSoldierFromBlast ( ubPerson : %i , ubOwner : %i , sBombGridNo : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , usItem : %i , sSubs : %i , fFromRemoteClient : %i )\n",ubPerson, ubOwner , sBombGridNo , sWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent , fFromRemoteClient );
MPDebugMsg(tmpMPDbgString);
#endif
}
SOLDIERTYPE *pSoldier;
INT16 sNewWoundAmt = 0;
UINT8 ubDirection;
@@ -1400,7 +1452,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo
// Lesh: if flashbang
// check if soldier is outdoor and situated farther that half explosion radius and not underground
usHalfExplosionRadius = Explosive[Item[usItem].ubClassIndex].ubRadius / 2;
if ( fFlashbang && !gbWorldSectorZ && !fInBuilding && (UINT16)uiDist > usHalfExplosionRadius )
if ( fFlashbang && !gbWorldSectorZ && !fInBuilding && uiDist > usHalfExplosionRadius )
{
// HEADROCK HAM 3.3: Flashbang at half distance causes up to 6 suppression points. Roughly equivalent of being
// "lightly" shot at.
@@ -1432,7 +1484,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo
ubSpecial = DetermineFlashbangEffect( pSoldier, ubDirection, fInBuilding);
}
// HEADROCK HAM 3.3: Explosions cause suppression based on distance.
// HEADROCK HAM 3.3: Explosions cause suppression based on distance.
if (gGameExternalOptions.usExplosionSuppressionEffect > 0)
{
pSoldier->ubSuppressionPoints += ((__max(0,((Explosive[Item[usItem].ubClassIndex].ubRadius * 3) - uiDist)))* gGameExternalOptions.usExplosionSuppressionEffect) / 100;
@@ -1442,8 +1494,19 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo
}
}
pSoldier->EVENT_SoldierGotHit( usItem, sNewWoundAmt, sBreathAmt, ubDirection, (INT16)uiDist, ubOwner, ubSpecial, ANIM_CROUCH, sSubsequent, sBombGridNo );
if (is_networked && is_client)
{
if (IsOurSoldier(pSoldier) || (pSoldier->bTeam == 1 && is_server) && !fFromRemoteClient)
{
// if it gets here then we can let the other clients know our merc took damage
send_explosivedamage( ubPerson , ubOwner , sBombGridNo , sNewWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent );
}
}
// OJW - 20091028 - If from a remote client, use unadjusted damage amount
pSoldier->EVENT_SoldierGotHit( usItem, (fFromRemoteClient ? sWoundAmt : sNewWoundAmt) , sBreathAmt, ubDirection, (INT16)uiDist, ubOwner, ubSpecial, ANIM_CROUCH, sSubsequent, sBombGridNo );
pSoldier->ubMiscSoldierFlags |= SOLDIER_MISC_HURT_BY_EXPLOSION;
if ( ubOwner != NOBODY && MercPtrs[ ubOwner ]->bTeam == gbPlayerNum && pSoldier->bTeam != gbPlayerNum )
@@ -1454,8 +1517,29 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT16 sBombGridNo
return( TRUE );
}
BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner )
BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner , BOOL fFromRemoteClient )
{
// OJW - 20091028
if (is_networked && is_client)
{
// only the owner of a merc may send damage (as this takes into account equipped gas mask)
if (IsOurSoldier(pSoldier) || (pSoldier->bTeam == 1 && is_server) && !fFromRemoteClient)
{
// allow this function to proceed, we will send it later, when we are sure we take damage this turn and from this function call
}
else if (!fFromRemoteClient)
{
// skip executing locally because we want the random number generator to be aligned
// with the client that spawns set off the explosion/grenade/whatever
return FALSE;
}
#ifdef JA2BETAVERSION
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"DishOutGasDamage ( ubSoldierID : %i , ubExplosiveType : %i , sSubsequent : %i , recompileMoveCosts : %i , sWoundAmt : %i , sBreathAmt : %i , ubOwner : %i , fRemote : %i)\n", pSoldier->ubID , pExplosive->ubType , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , ubOwner , fFromRemoteClient );
MPDebugMsg(tmpMPDbgString);
#endif
}
INT8 bPosOfMask = NO_SLOT;
if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->stats.bLife || AM_A_ROBOT( pSoldier ) )
@@ -1513,8 +1597,16 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
}
}
else if(pExplosive->ubType == EXPLOSV_SMOKE)//dnl ch40 200909
{
// ignore whether subsequent or not if hit this turn
if(AM_A_ROBOT(pSoldier) || (pSoldier->flags.fHitByGasFlags & HIT_BY_SMOKEGAS))
return(fRecompileMovementCosts);
}
bPosOfMask = FindGasMask(pSoldier);
if(!DoesSoldierWearGasMask(pSoldier))//dnl ch40 200909
bPosOfMask = NO_SLOT;
if ( bPosOfMask == NO_SLOT || pSoldier->inv[ bPosOfMask ][0]->data.objectStatus < USABLE )
{
bPosOfMask = NO_SLOT;
@@ -1597,6 +1689,9 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
case EXPLOSV_BURNABLEGAS:
pSoldier->flags.fHitByGasFlags |= HIT_BY_BURNABLEGAS;
break;
case EXPLOSV_SMOKE://dnl ch40 200909
pSoldier->flags.fHitByGasFlags |= HIT_BY_SMOKEGAS;
break;
default:
break;
}
@@ -1606,6 +1701,17 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
// a gas effect, take damage directly...
pSoldier->SoldierTakeDamage( ANIM_STAND, sWoundAmt, sBreathAmt, TAKE_DAMAGE_GAS, NOBODY, NOWHERE, 0, TRUE );
if (is_networked && is_client)
{
// if it gets here we are supposed to send it.
// let all the other clients know that our merc got gassed
// and align them with our random number generator
if (IsOurSoldier(pSoldier) || (pSoldier->bTeam == 1 && is_server) && !fFromRemoteClient)
{
send_gasdamage( pSoldier , pExplosive->uiIndex , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , ubOwner );
}
}
if ( pSoldier->stats.bLife >= CONSCIOUSNESS )
{
pSoldier->DoMercBattleSound( (INT8)( BATTLE_SOUND_HIT1 + Random( 2 ) ) );
@@ -1619,8 +1725,16 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
return( fRecompileMovementCosts );
}
BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID )
BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID )
{
#ifdef JA2BETAVERSION
if (is_networked) {
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"ExpAffect ( sBombGridNo : %i , sGridNo : %i , uiDist : %i , usItem : %i , ubOwner : %i , sSubsequent : %i , fMercHit : %i , bLevel : %i , iSmokeEffectID : %i )\n",sBombGridNo, sGridNo , uiDist , usItem , ubOwner , sSubsequent , (int)*pfMercHit , bLevel , iSmokeEffectID );
MPDebugMsg(tmpMPDbgString);
}
#endif
INT16 sWoundAmt = 0,sBreathAmt = 0, /* sNewWoundAmt = 0, sNewBreathAmt = 0, */ sStructDmgAmt;
UINT8 ubPerson;
SOLDIERTYPE *pSoldier;
@@ -1632,7 +1746,7 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte
BOOLEAN fBlastEffect = TRUE;
BOOLEAN fBloodEffect = FALSE;
INT8 bSmokeEffectType = 0;
INT16 sNewGridNo;
INT32 sNewGridNo;
ITEM_POOL * pItemPool, * pItemPoolNext;
UINT32 uiRoll;
@@ -2041,7 +2155,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
INT8 Blocking, BlockingTemp;
BOOLEAN fTravelCostObs = FALSE;
UINT32 uiRangeReduce;
INT16 sNewGridNo;
INT32 sNewGridNo;
STRUCTURE * pBlockingStructure;
BOOLEAN fBlowWindowSouth = FALSE;
BOOLEAN fReduceRay = TRUE;
@@ -2068,7 +2182,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
}
Blocking = GetBlockingStructureInfo( (INT16)uiNewSpot, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
Blocking = GetBlockingStructureInfo( uiNewSpot, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );//dnl ch53 111009
if ( pBlockingStructure )
{
@@ -2094,7 +2208,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
STRUCTURE * pStructure;
// Check for roof here....
pStructure = FindStructure( (INT16)uiNewSpot, STRUCTURE_ROOF );
pStructure = FindStructure( uiNewSpot, STRUCTURE_ROOF );
if ( pStructure == NULL )
{
@@ -2119,9 +2233,9 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
{
// ATE: For windows, check to the west and north for a broken window, as movement costs
// will override there...
sNewGridNo = NewGridNo( (INT16)uiNewSpot, DirectionInc( WEST ) );
sNewGridNo = NewGridNo( uiNewSpot, DirectionInc( WEST ) );
BlockingTemp = GetBlockingStructureInfo( (INT16)sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
BlockingTemp = GetBlockingStructureInfo( sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
if ( BlockingTemp == BLOCKING_TOPRIGHT_OPEN_WINDOW || BlockingTemp == BLOCKING_TOPLEFT_OPEN_WINDOW )
{
// If open, fTravelCostObs set to false and reduce range....
@@ -2137,9 +2251,9 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
if ( fTravelCostObs )
{
sNewGridNo = NewGridNo( (INT16)uiNewSpot, DirectionInc( NORTH ) );
sNewGridNo = NewGridNo( uiNewSpot, DirectionInc( NORTH ) );
BlockingTemp = GetBlockingStructureInfo( (INT16)sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
BlockingTemp = GetBlockingStructureInfo( sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
if ( BlockingTemp == BLOCKING_TOPRIGHT_OPEN_WINDOW || BlockingTemp == BLOCKING_TOPLEFT_OPEN_WINDOW )
{
// If open, fTravelCostObs set to false and reduce range....
@@ -2169,15 +2283,15 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
if ( pBlockingStructure != NULL )
{
WindowHit( (INT16)uiNewSpot, pBlockingStructure->usStructureID, fBlowWindowSouth, TRUE );
WindowHit( uiNewSpot, pBlockingStructure->usStructureID, fBlowWindowSouth, TRUE );
}
}
// ATE: For windows, check to the west and north for a broken window, as movement costs
// will override there...
sNewGridNo = NewGridNo( (INT16)uiNewSpot, DirectionInc( WEST ) );
sNewGridNo = NewGridNo( uiNewSpot, DirectionInc( WEST ) );
BlockingTemp = GetBlockingStructureInfo( (INT16)sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure , TRUE );
BlockingTemp = GetBlockingStructureInfo( sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure , TRUE );
if ( pBlockingStructure && pBlockingStructure->pDBStructureRef->pDBStructure->ubDensity <= 15 )
{
fTravelCostObs = FALSE;
@@ -2191,8 +2305,8 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
}
}
sNewGridNo = NewGridNo( (INT16)uiNewSpot, DirectionInc( NORTH ) );
BlockingTemp = GetBlockingStructureInfo( (INT16)sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
sNewGridNo = NewGridNo( uiNewSpot, DirectionInc( NORTH ) );
BlockingTemp = GetBlockingStructureInfo( sNewGridNo, ubDir, 0, bLevel, &bStructHeight, &pBlockingStructure, TRUE );
if ( pBlockingStructure && pBlockingStructure->pDBStructureRef->pDBStructure->ubDensity <= 15 )
{
@@ -2274,8 +2388,39 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE
void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID )
void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID , BOOL fFromRemoteClient , BOOL fNewSmokeEffect )
{
if (is_networked && is_client)
{
SOLDIERTYPE* pAttacker = MercPtrs[ubOwner];
if (pAttacker != NULL)
{
if (IsOurSoldier(pAttacker) || (pAttacker->bTeam == 1 && is_server))
{
// dont send SpreadEffect if it was just called from NewSmokeEffect - as now we sync that seperately
if (!fNewSmokeEffect)
{
// let all the other clients know we are spawning this effect
// and align them with our random number generator
send_spreadeffect(sGridNo,ubRadius,usItem,ubOwner,fSubsequent,bLevel,iSmokeEffectID);
}
}
else if (!fFromRemoteClient)
{
// skip executing locally because we want the random number generator to be aligned
// with the client that spawns set off the explosion/grenade/whatever
return;
}
}
#ifdef JA2BETAVERSION
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"SpreadEffect ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , fFromRemote : %i , fNewSmoke : %i )\n",sGridNo, ubRadius , usItem , ubOwner , (int)fSubsequent , bLevel , iSmokeEffectID , fFromRemoteClient , fNewSmokeEffect );
MPDebugMsg(tmpMPDbgString);
gfMPDebugOutputRandoms = true;
#endif
}
INT32 uiNewSpot, uiTempSpot, uiBranchSpot, cnt, branchCnt;
INT32 uiTempRange, ubBranchRange;
UINT8 ubDir,ubBranchDir, ubKeepGoing;
@@ -2296,11 +2441,11 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner,
fSmokeEffect = TRUE;
break;
}
if(is_networked)
/*if(is_networked)
{
ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"explosives not coded in MP");
return;
}
}*/
// Set values for recompile region to optimize area we need to recompile for MPs
gsRecompileAreaTop = sGridNo / WORLD_COLS;
gsRecompileAreaLeft = sGridNo % WORLD_COLS;
@@ -2334,7 +2479,7 @@ if(is_networked)
while( cnt <= uiTempRange) // end of range loop
{
// move one tile in direction
uiNewSpot = NewGridNo( (INT16)uiTempSpot, DirectionInc( ubDir ) );
uiNewSpot = NewGridNo( uiTempSpot, DirectionInc( ubDir ) );
// see if this was a different spot & if we should be able to reach
// this spot
@@ -2354,7 +2499,7 @@ if(is_networked)
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Explosion affects %d", uiNewSpot) );
// ok, do what we do here...
if ( ExpAffect( sGridNo, (INT16)uiNewSpot, cnt / 2, usItem, ubOwner, fSubsequent, &fAnyMercHit, bLevel, iSmokeEffectID ) )
if ( ExpAffect( sGridNo, uiNewSpot, cnt / 2, usItem, ubOwner, fSubsequent, &fAnyMercHit, bLevel, iSmokeEffectID ) )
{
fRecompileMovement = TRUE;
}
@@ -2382,7 +2527,7 @@ if(is_networked)
while( branchCnt <= ubBranchRange) // end of range loop
{
ubKeepGoing = TRUE;
uiNewSpot = NewGridNo( (INT16)uiBranchSpot, DirectionInc(ubBranchDir));
uiNewSpot = NewGridNo( uiBranchSpot, DirectionInc(ubBranchDir));
if (uiNewSpot != uiBranchSpot)
{
@@ -2393,7 +2538,7 @@ if(is_networked)
{
// ok, do what we do here
//DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Explosion affects %d", uiNewSpot) );
if ( ExpAffect( sGridNo, (INT16)uiNewSpot, (INT16)((cnt + branchCnt) / 2), usItem, ubOwner, fSubsequent, &fAnyMercHit, bLevel, iSmokeEffectID ) )
if ( ExpAffect( sGridNo, uiNewSpot, (INT16)((cnt + branchCnt) / 2), usItem, ubOwner, fSubsequent, &fAnyMercHit, bLevel, iSmokeEffectID ) )
{
fRecompileMovement = TRUE;
}
@@ -2447,7 +2592,7 @@ if(is_networked)
INT16 sX, sY;
// DO wireframes as well
ConvertGridNoToXY( (INT16)sGridNo, &sX, &sY );
ConvertGridNoToXY( sGridNo, &sX, &sY );
SetRecalculateWireFrameFlagRadius( sX, sY, ubRadius );
CalculateWorldWireFrameTiles( FALSE );
@@ -2494,6 +2639,8 @@ if(is_networked)
MakeNoise( NOBODY, sGridNo, bLevel, gpWorldLevelData[sGridNo].ubTerrainID, (UINT8)Explosive[ Item [ usItem ].ubClassIndex ].ubVolume, NOISE_EXPLOSION );
}
gfMPDebugOutputRandoms = false;
}
void ToggleActionItemsByFrequency( INT8 bFrequency )
@@ -2527,7 +2674,7 @@ void ToggleActionItemsByFrequency( INT8 bFrequency )
}
}
void TogglePressureActionItemsInGridNo( INT16 sGridNo )
void TogglePressureActionItemsInGridNo( INT32 sGridNo )
{
UINT32 uiWorldBombIndex;
OBJECTTYPE * pObj;
@@ -2595,7 +2742,7 @@ BOOLEAN HookerInRoom( UINT8 ubRoom )
return( FALSE );
}
void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
void PerformItemAction( INT32 sGridNo, OBJECTTYPE * pObj )
{
STRUCTURE * pStructure;
@@ -2925,8 +3072,8 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
}
if ( sDoorSpot != NOWHERE && sTeleportSpot != NOWHERE )
if (!TileIsOutOfBounds(sDoorSpot) && !TileIsOutOfBounds(sTeleportSpot) )
{
// close the door...
DoorCloser[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR;
@@ -2990,13 +3137,54 @@ void PerformItemAction( INT16 sGridNo, OBJECTTYPE * pObj )
}
}
void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp )
void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemoteClient )
{
if (gubElementsOnExplosionQueue == MAX_BOMB_QUEUE)
{
return;
}
// 20091002 - OJW - MP Explosives
if (is_networked && is_client)
{
/*if (gWorldBombs[uiWorldBombIndex].bIsFromRemotePlayer && !fFromRemoteClient)
{
return;
}
else
{
// this is the world item index
UINT32 iWorldIndex = gWorldBombs[uiWorldBombIndex].iItemIndex;
WORLDITEM wi = gWorldItems[iWorldIndex];
if (wi.fExists)
{
INT8 soldierID = wi.soldierID;
if (soldierID == -1)
soldierID = wi.object[0]->data.misc.ubBombOwner - 2; // undo the hack
send_detonate_explosive(iWorldIndex,soldierID);
}
}*/
UINT32 iWorldIndex = gWorldBombs[uiWorldBombIndex].iItemIndex;
WORLDITEM wi = gWorldItems[iWorldIndex];
if (wi.fExists)
{
INT8 soldierID = wi.soldierID; // bomb's owner
if (soldierID == -1)
soldierID = wi.object[0]->data.misc.ubBombOwner - 2; // undo the hack
if (IsOurSoldier(gubPersonToSetOffExplosions) || IsOurSoldier(soldierID))
{
// we set off the bomb (could be failed disarm) or we own it, tell the other clients we are setting it off
send_detonate_explosive(iWorldIndex,gubPersonToSetOffExplosions);
}
else if (gWorldBombs[uiWorldBombIndex].bIsFromRemotePlayer && !fFromRemoteClient)
{
return; // dont explode bombs which arent originating from our client unless we were told to
}
}
}
gExplosionQueue[gubElementsOnExplosionQueue].uiWorldBombIndex = uiWorldBombIndex;
gExplosionQueue[gubElementsOnExplosionQueue].uiTimeStamp = uiTimeStamp;
gExplosionQueue[gubElementsOnExplosionQueue].fExists = TRUE;
@@ -3016,7 +3204,7 @@ void HandleExplosionQueue( void )
UINT32 uiIndex;
UINT32 uiWorldBombIndex;
UINT32 uiCurrentTime;
INT16 sGridNo;
INT32 sGridNo;
OBJECTTYPE * pObj;
UINT8 ubLevel;
@@ -3134,7 +3322,8 @@ void HandleExplosionQueue( void )
// unlock UI
//UnSetUIBusy( (UINT8)gusSelectedSoldier );
if ( !(gTacticalStatus.uiFlags & INCOMBAT) || gTacticalStatus.ubCurrentTeam == gbPlayerNum )
// OJW - 20091028 - fix explosion UI lock bug on unoriginating clients
if ( !(gTacticalStatus.uiFlags & INCOMBAT) || gTacticalStatus.ubCurrentTeam == gbPlayerNum || (is_networked && gTacticalStatus.ubCurrentTeam != 1) )
{
// don't end UI lock when it's a computer turn
guiPendingOverrideEvent = LU_ENDUILOCK;
@@ -3165,8 +3354,6 @@ void DecayBombTimers( void )
(*pObj)[0]->data.misc.bDelay--;
if ((*pObj)[0]->data.misc.bDelay == 0)
{
// put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp );
// ATE: CC black magic....
if ( (*pObj)[0]->data.misc.ubBombOwner > 1 )
{
@@ -3177,6 +3364,9 @@ void DecayBombTimers( void )
gubPersonToSetOffExplosions = NOBODY;
}
// put this bomb on the queue
AddBombToQueue( uiWorldBombIndex, uiTimeStamp );
if (pObj->usItem != ACTION_ITEM || (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP)
{
uiTimeStamp += BOMB_QUEUE_DELAY;
@@ -3224,10 +3414,10 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency )
void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger )
{
// need to turn off gridnos & flags in gTacticalStatus
gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] = NOWHERE;
if ( (gTacticalStatus.sPanicTriggerGridNo[0] == NOWHERE) &&
(gTacticalStatus.sPanicTriggerGridNo[1] == NOWHERE) &&
(gTacticalStatus.sPanicTriggerGridNo[2] == NOWHERE) )
gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] = NOWHERE;
if ( ( TileIsOutOfBounds(gTacticalStatus.sPanicTriggerGridNo[0])) &&
( TileIsOutOfBounds(gTacticalStatus.sPanicTriggerGridNo[1])) &&
( TileIsOutOfBounds(gTacticalStatus.sPanicTriggerGridNo[2])) )
{
gTacticalStatus.fPanicFlags &= ~(PANIC_TRIGGERS_HERE);
}
@@ -3259,7 +3449,7 @@ void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger )
}
}
BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 bLevel )
BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel )
{
UINT32 uiWorldBombIndex;
UINT32 uiTimeStamp;
@@ -3326,7 +3516,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8
return( fFoundMine );
}
void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo )
void ActivateSwitchInGridNo( UINT8 ubID, INT32 sGridNo )
{
UINT32 uiWorldBombIndex;
OBJECTTYPE * pObj;
@@ -3497,7 +3687,7 @@ BOOLEAN LoadExplosionTableFromSavedGameFile( HWFILE hFile )
BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT16 sGridNo )
BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT32 sGridNo )
{
INT32 cnt;
INT16 sSectorNo;
@@ -3527,7 +3717,7 @@ BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT16
}
void UpdateAndDamageSAMIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT16 sGridNo, UINT8 ubDamage )
void UpdateAndDamageSAMIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT32 sGridNo, UINT8 ubDamage )
{
INT16 sSectorNo;
@@ -3622,7 +3812,7 @@ void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
// loop through civ team and find
// anybody who is an NPC and
// see if they get angry
void HandleBuldingDestruction( INT16 sGridNo, UINT8 ubOwner )
void HandleBuldingDestruction( INT32 sGridNo, UINT8 ubOwner )
{
SOLDIERTYPE * pSoldier;
UINT8 cnt;
+11 -11
View File
@@ -23,7 +23,7 @@ typedef struct
INT16 sX; // World X ( optional )
INT16 sY; // World Y ( optional )
INT16 sZ; // World Z ( optional )
INT16 sGridNo; // World GridNo
INT32 sGridNo; // World GridNo
BOOLEAN fLocate;
INT8 bLevel; // World level
UINT8 ubUnsed[1];
@@ -98,26 +98,22 @@ extern EXPLOSIONTYPE gExplosionData[ NUM_EXPLOSION_SLOTS ];
extern UINT8 gubElementsOnExplosionQueue;
extern BOOLEAN gfExplosionQueueActive;
void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 sGridNo, UINT16 usItem, INT8 bLevel );
void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel );
void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel );
void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel );
void GenerateExplosion( EXPLOSION_PARAMS *pExpParams );
void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum );
void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp );
void DecayBombTimers( void );
void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency );
BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT16 sGridNo, BOOLEAN fAllBombs, INT8 bLevel );
void ActivateSwitchInGridNo( UINT8 ubID, INT16 sGridNo );
BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel );
void ActivateSwitchInGridNo( UINT8 ubID, INT32 sGridNo );
void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger );
void UpdateExplosionFrame( INT32 iIndex, INT16 sCurrentFrame );
void RemoveExplosionData( INT32 iIndex );
void UpdateAndDamageSAMIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT16 sGridNo, UINT8 ubDamage );
void UpdateAndDamageSAMIfFound( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT32 sGridNo, UINT8 ubDamage );
void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
@@ -131,6 +127,10 @@ void RemoveAllActiveTimedBombs( void );
#define GASMASK_MIN_STATUS 70
BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner );
// OJW - 20091028 - Explosion damage sync
BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent , BOOL fFromRemoteClient = FALSE );
BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner , BOOL fFromRemoteClient = FALSE );
void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum , BOOL fFromRemoteClient = FALSE , BOOL fNewSmokeEffect = FALSE );
void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemoteClient = FALSE );
#endif
+1 -1
View File
@@ -12,7 +12,7 @@
//When line of sight reaches a gridno, and there is a light there, it turns it on.
//This is only done in the cave levels.
void RemoveFogFromGridNo( UINT32 uiGridNo )
void RemoveFogFromGridNo( INT32 uiGridNo )
{
INT32 i;
INT32 x, y;
+1 -1
View File
@@ -7,6 +7,6 @@
void InitializeFogInWorld();
//Removes and smooths the adjacent tiles.
void RemoveFogFromGridNo( UINT32 uiGridNo );
void RemoveFogFromGridNo( INT32 uiGridNo );
#endif
+24 -24
View File
@@ -46,14 +46,14 @@
typedef struct
{
INT16 sGridNo;
INT32 sGridNo;
UINT8 ubFlags;
INT16 sTileIndex;
INT16 sMaxScreenY;
INT16 sHeighestScreenY;
BOOLEAN fFound;
LEVELNODE *pFoundNode;
INT16 sFoundGridNo;
INT32 sFoundGridNo;
UINT16 usStructureID;
BOOLEAN fStructure;
@@ -83,9 +83,9 @@ UINT16 gusINTOldMousePosX = 0;
UINT16 gusINTOldMousePosY = 0;
BOOLEAN RefinePointCollisionOnStruct( INT16 sGridNo, INT16 sTestX, INT16 sTestY, INT16 sSrcX, INT16 sSrcY, LEVELNODE *pNode );
BOOLEAN RefinePointCollisionOnStruct( INT32 sGridNo, INT16 sTestX, INT16 sTestY, INT16 sSrcX, INT16 sSrcY, LEVELNODE *pNode );
BOOLEAN CheckVideoObjectScreenCoordinateInData( HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iTextX, INT32 iTestY );
BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode );
BOOLEAN RefineLogicOnStruct( INT32 sGridNo, LEVELNODE *pNode );
BOOLEAN InitInteractiveTileManagement( )
@@ -97,12 +97,12 @@ void ShutdownInteractiveTileManagement( )
{
}
BOOLEAN AddInteractiveTile( INT16 sGridNo, LEVELNODE *pLevelNode, UINT32 uiFlags, UINT16 usType )
BOOLEAN AddInteractiveTile( INT32 sGridNo, LEVELNODE *pLevelNode, UINT32 uiFlags, UINT16 usType )
{
return( TRUE );
}
BOOLEAN StartInteractiveObject( INT16 sGridNo, UINT16 usStructureID, SOLDIERTYPE *pSoldier, UINT8 ubDirection )
BOOLEAN StartInteractiveObject( INT32 sGridNo, UINT16 usStructureID, SOLDIERTYPE *pSoldier, UINT8 ubDirection )
{
STRUCTURE * pStructure;
@@ -144,7 +144,7 @@ BOOLEAN StartInteractiveObject( INT16 sGridNo, UINT16 usStructureID, SOLDIERTYPE
}
BOOLEAN CalcInteractiveObjectAPs( INT16 sGridNo, STRUCTURE * pStructure, INT16 *psAPCost, INT16 *psBPCost )
BOOLEAN CalcInteractiveObjectAPs( INT32 sGridNo, STRUCTURE * pStructure, INT16 *psAPCost, INT16 *psBPCost )
{
if (pStructure == NULL)
{
@@ -199,7 +199,7 @@ BOOLEAN SoldierHandleInteractiveObject( SOLDIERTYPE *pSoldier )
{
STRUCTURE *pStructure;
UINT16 usStructureID;
INT16 sGridNo;
INT32 sGridNo;
sGridNo = pSoldier->aiData.sPendingActionData2;
@@ -216,7 +216,7 @@ BOOLEAN SoldierHandleInteractiveObject( SOLDIERTYPE *pSoldier )
return( HandleOpenableStruct( pSoldier, sGridNo, pStructure ) );
}
void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo )
void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo )
{
STRUCTURE *pStructure, *pNewStructure;
ITEM_POOL *pItemPool;
@@ -267,7 +267,7 @@ void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo )
// LOOK for item pool here...
if ( GetItemPool( (INT16)sGridNo, &pItemPool, pSoldier->pathing.bLevel ) )
if ( GetItemPool( sGridNo, &pItemPool, pSoldier->pathing.bLevel ) )
{
// Update visiblity....
if ( !( pStructure->fFlags & STRUCTURE_OPEN ) )
@@ -354,7 +354,7 @@ UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm )
{
LEVELNODE *pIntNode;
STRUCTURE *pStructure;
INT16 sGridNo;
INT32 sGridNo;
// OK, first see if we have an in tile...
pIntNode = GetCurInteractiveTileGridNoAndStructure( &sGridNo, &pStructure );
@@ -403,7 +403,7 @@ void SetActionModeDoorCursorText( )
{
LEVELNODE *pIntNode;
STRUCTURE *pStructure;
INT16 sGridNo;
INT32 sGridNo;
// If we are over a merc, don't
if ( gfUIFullTargetFound )
@@ -424,7 +424,7 @@ void SetActionModeDoorCursorText( )
}
void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT16 sYPos, INT16 sGridNo )
void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT16 sYPos, INT32 sGridNo )
{
INT16 sScreenX, sScreenY;
INT16 sOffsetX, sOffsetY;
@@ -511,7 +511,7 @@ void CompileInteractiveTiles( )
}
void LogMouseOverInteractiveTile( INT16 sGridNo )
void LogMouseOverInteractiveTile( INT32 sGridNo )
{
SGPRect aRect;
INT16 sXMapPos, sYMapPos, sScreenX, sScreenY;
@@ -649,7 +649,7 @@ LEVELNODE *GetCurInteractiveTile( )
}
LEVELNODE *GetCurInteractiveTileGridNo( INT16 *psGridNo )
LEVELNODE *GetCurInteractiveTileGridNo( INT32 *psGridNo )
{
LEVELNODE *pNode;
@@ -669,7 +669,7 @@ LEVELNODE *GetCurInteractiveTileGridNo( INT16 *psGridNo )
LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT16 *psGridNo, STRUCTURE **ppStructure, BOOLEAN fRejectOnTopItems )
LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT32 *psGridNo, STRUCTURE **ppStructure, BOOLEAN fRejectOnTopItems )
{
LEVELNODE *pNode;
STRUCTURE *pStructure;
@@ -708,7 +708,7 @@ LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT16 *psGridNo,
}
LEVELNODE *GetCurInteractiveTileGridNoAndStructure( INT16 *psGridNo, STRUCTURE **ppStructure )
LEVELNODE *GetCurInteractiveTileGridNoAndStructure( INT32 *psGridNo, STRUCTURE **ppStructure )
{
return( ConditionalGetCurInteractiveTileGridNoAndStructure( psGridNo, ppStructure, TRUE ) );
}
@@ -777,7 +777,7 @@ void EndCurInteractiveTileCheck( )
}
BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode )
BOOLEAN RefineLogicOnStruct( INT32 sGridNo, LEVELNODE *pNode )
{
TILE_ELEMENT *TileElem;
STRUCTURE *pStructure;
@@ -845,8 +845,8 @@ BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode )
// IF we are a switch, reject in another direction...
if ( pStructure->fFlags & STRUCTURE_SWITCH )
{
// Find a new gridno based on switch's orientation...
INT16 sNewGridNo = NOWHERE;
// Find a new gridno based on switch's orientation...
INT32 sNewGridNo = NOWHERE;
switch( pStructure->pDBStructureRef->pDBStructure->ubWallOrientation )
{
@@ -865,8 +865,8 @@ BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode )
break;
}
if ( sNewGridNo != NOWHERE )
if (!TileIsOutOfBounds(sNewGridNo))
{
// If we are hidden by a roof, reject it!
if ( !gfBasement && IsRoofVisible2( sNewGridNo ) && !( gTacticalStatus.uiFlags&SHOW_ALL_ITEMS ) )
@@ -900,7 +900,7 @@ BOOLEAN RefineLogicOnStruct( INT16 sGridNo, LEVELNODE *pNode )
}
BOOLEAN RefinePointCollisionOnStruct( INT16 sGridNo, INT16 sTestX, INT16 sTestY, INT16 sSrcX, INT16 sSrcY, LEVELNODE *pNode )
BOOLEAN RefinePointCollisionOnStruct( INT32 sGridNo, INT16 sTestX, INT16 sTestY, INT16 sSrcX, INT16 sSrcY, LEVELNODE *pNode )
{
TILE_ELEMENT *TileElem;
@@ -1102,7 +1102,7 @@ BOOLEAN ShouldCheckForMouseDetections( )
}
void CycleIntTileFindStack( INT16 sMapPos )
void CycleIntTileFindStack( INT32 usMapPos )
{
gfCycleIntTile = TRUE;
+10 -10
View File
@@ -14,34 +14,34 @@
extern BOOLEAN gfOverIntTile;
void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT16 sYPos, INT16 sGridNo );
void GetLevelNodeScreenRect( LEVELNODE *pNode, SGPRect *pRect, INT16 sXPos, INT16 sYPos, INT32 sGridNo );
BOOLEAN InitInteractiveTileManagement( );
void ShutdownInteractiveTileManagement( );
BOOLEAN AddInteractiveTile( INT16 sGridNo, LEVELNODE *pLevelNode, UINT32 uiFlags, UINT16 usType );
BOOLEAN StartInteractiveObject( INT16 sGridNo, UINT16 usStructureID, SOLDIERTYPE *pSoldier, UINT8 ubDirection );
BOOLEAN AddInteractiveTile( INT32 sGridNo, LEVELNODE *pLevelNode, UINT32 uiFlags, UINT16 usType );
BOOLEAN StartInteractiveObject( INT32 sGridNo, UINT16 usStructureID, SOLDIERTYPE *pSoldier, UINT8 ubDirection );
BOOLEAN StartInteractiveObjectFromMouse( SOLDIERTYPE *pSoldier, UINT8 ubDirection );
void CompileInteractiveTiles( );
UINT32 GetInteractiveTileCursor( UINT32 uiOldCursor, BOOLEAN fConfirm );
BOOLEAN InteractWithInteractiveObject( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, UINT8 ubDirection );
BOOLEAN SoldierHandleInteractiveObject( SOLDIERTYPE *pSoldier );
BOOLEAN CalcInteractiveObjectAPs( INT16 sGridNo, STRUCTURE * pStructure, INT16 *psAPCost, INT16 *psBPCost );
BOOLEAN CalcInteractiveObjectAPs( INT32 sGridNo, STRUCTURE * pStructure, INT16 *psAPCost, INT16 *psBPCost );
void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT16 sGridNo );
void HandleStructChangeFromGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo );
void BeginCurInteractiveTileCheck( UINT8 bCheckFlags );
void EndCurInteractiveTileCheck( );
void LogMouseOverInteractiveTile( INT16 sGridNo );
void LogMouseOverInteractiveTile( INT32 sGridNo );
BOOLEAN ShouldCheckForMouseDetections( );
void CycleIntTileFindStack( INT16 sMapPos );
void CycleIntTileFindStack( INT32 usMapPos );
void SetActionModeDoorCursorText( );
LEVELNODE *GetCurInteractiveTile( );
LEVELNODE *GetCurInteractiveTileGridNo( INT16 *psGridNo );
LEVELNODE *GetCurInteractiveTileGridNoAndStructure( INT16 *psGridNo, STRUCTURE **ppStructure );
LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT16 *psGridNo, STRUCTURE **ppStructure, BOOLEAN fRejectOnTopItems );
LEVELNODE *GetCurInteractiveTileGridNo( INT32 *psGridNo );
LEVELNODE *GetCurInteractiveTileGridNoAndStructure( INT32 *psGridNo, STRUCTURE **ppStructure );
LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT32 *psGridNo, STRUCTURE **ppStructure, BOOLEAN fRejectOnTopItems );
+101 -88
View File
@@ -24,17 +24,16 @@ UINT32 guiForceRefreshMousePositionCalculation = 0;
// GLOBALS
INT16 DirIncrementer[8] =
{
-MAPWIDTH, //N
1-MAPWIDTH, //NE
1, //E
1+MAPWIDTH, //SE
MAPWIDTH, //S
MAPWIDTH-1, //SW
-1, //W
-MAPWIDTH-1 //NW
};
{
-WORLD_COLS, //N
1-WORLD_COLS, //NE
1, //E
1+WORLD_COLS, //SE
WORLD_COLS, //S
WORLD_COLS-1, //SW
-1, //W
-WORLD_COLS-1 //NW
};
// Opposite directions
UINT8 gOppositeDirection[ NUM_WORLD_DIRECTIONS ] =
@@ -341,22 +340,22 @@ BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY )
// I did that (or actually uncasted a bunch of stuff and re-typed others to correct them), so
// no worries
// (jonathanl) to save me having to cast all the previous code
BOOLEAN GetMouseMapPos( INT16 *psMapPos )
BOOLEAN GetMouseMapPos( UINT32 *psMapPos )
{
return GetMouseMapPos( (INT16 *)psMapPos );
return GetMouseMapPos( (INT32 *)psMapPos );
}
#endif
BOOLEAN GetMouseMapPos( INT16 *pusMapPos )
BOOLEAN GetMouseMapPos( INT32 *psMapPos )
{
INT16 sWorldX, sWorldY;
static INT16 sSameCursorPos;
static INT32 sSameCursorPos;
static UINT32 uiOldFrameNumber = 99999;
// Check if this is the same frame as before, return already calculated value if so!
if ( uiOldFrameNumber == guiGameCycleCounter && !guiForceRefreshMousePositionCalculation )
{
( *pusMapPos ) = sSameCursorPos;
( *psMapPos ) = sSameCursorPos;
if ( sSameCursorPos == 0 )
{
@@ -371,14 +370,14 @@ BOOLEAN GetMouseMapPos( INT16 *pusMapPos )
if ( GetMouseXY( &sWorldX, &sWorldY ) )
{
*pusMapPos = MAPROWCOLTOPOS( sWorldY, sWorldX );
sSameCursorPos = (*pusMapPos);
*psMapPos = MAPROWCOLTOPOS( sWorldY, sWorldX );
sSameCursorPos = (*psMapPos);
return( TRUE );
}
else
{
*pusMapPos = 0;
sSameCursorPos = (*pusMapPos);
*psMapPos = 0;
sSameCursorPos = (*psMapPos);
return( FALSE );
}
@@ -386,14 +385,14 @@ BOOLEAN GetMouseMapPos( INT16 *pusMapPos )
BOOLEAN ConvertMapPosToWorldTileCenter( INT16 sMapPos, INT16 *psXPos, INT16 *psYPos )
BOOLEAN ConvertMapPosToWorldTileCenter( INT32 usMapPos, INT16 *psXPos, INT16 *psYPos )
{
INT16 sWorldX, sWorldY;
INT16 sCellX, sCellY;
// Get X, Y world GRID Coordinates
sWorldY = ( sMapPos / WORLD_COLS );
sWorldX = sMapPos - ( sWorldY * WORLD_COLS );
sWorldY = ( usMapPos / WORLD_COLS );
sWorldX = usMapPos - ( sWorldY * WORLD_COLS );
// Convert into cell coords
sCellY = sWorldY * CELL_Y_SIZE;
@@ -444,7 +443,7 @@ void GetScreenXYWorldCell( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldCellX,
}
void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT16 *psMapPos )
void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT32 *psMapPos )
{
INT16 sWorldX, sWorldY;
@@ -460,8 +459,8 @@ void GetWorldXYAbsoluteScreenXY( INT32 sWorldCellX, INT32 sWorldCellY, INT16 *ps
INT16 sDistToCenterY, sDistToCenterX;
// Find the diustance from render center to true world center
sDistToCenterX = (INT16) ( ( sWorldCellX * CELL_X_SIZE ) - gCenterWorldX);
sDistToCenterY = (INT16) ( ( sWorldCellY * CELL_Y_SIZE ) - gCenterWorldY);
sDistToCenterX = ( sWorldCellX * CELL_X_SIZE ) - gCenterWorldX;
sDistToCenterY = ( sWorldCellY * CELL_Y_SIZE ) - gCenterWorldY;
// From render center in world coords, convert to render center in "screen" coords
@@ -503,27 +502,27 @@ void GetFromAbsoluteScreenXYWorldXY( INT32 *psWorldCellX, INT32* psWorldCellY, I
// UTILITY FUNTIONS
INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno)
INT32 OutOfBounds(INT32 sGridNo, INT32 sProposedGridNo)
{
INT16 sMod,sPropMod;
INT32 sMod,sPropMod;
// get modulas of our origin
sMod = sGridno % MAXCOL;
sMod = sGridNo % MAXCOL;
if (sMod != 0) // if we're not on leftmost grid
if (sMod != RIGHTMOSTGRID) // if we're not on rightmost grid
if (sGridno < LASTROWSTART) // if we're above bottom row
if (sGridno > MAXCOL) // if we're below top row
if (sGridNo < LASTROWSTART) // if we're above bottom row
if (sGridNo > MAXCOL) // if we're below top row
// Everything's OK - we're not on the edge of the map
return(FALSE);
// if we've got this far, there's a potential problem - check it out!
if (sProposedGridno < 0)
if (sProposedGridNo < 0)
return(TRUE);
sPropMod = sProposedGridno % MAXCOL;
sPropMod = sProposedGridNo % MAXCOL;
if (sMod == 0 && sPropMod == RIGHTMOSTGRID)
return(TRUE);
@@ -531,24 +530,36 @@ INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno)
if (sMod == RIGHTMOSTGRID && sPropMod == 0)
return(TRUE);
else
if (sGridno >= LASTROWSTART && sProposedGridno >= GRIDSIZE)
if (sGridNo >= LASTROWSTART && sProposedGridNo >= GRIDSIZE)
return(TRUE);
else
return(FALSE);
}
INT16 NewGridNo(INT16 sGridno, INT16 sDirInc)
//Lalien: This function should be used to check if the tile is not inside map array,
// it will return FALSE if the tile index is NOWHERE (-1) too.
// If the tile index has some special meaning ("-1" = does not exist) the check for NOWHERE should be used
BOOLEAN TileIsOutOfBounds(INT32 sGridNo)
{
INT16 sProposedGridno = sGridno + sDirInc;
if( (sGridNo < 0) || (sGridNo >= MAX_MAP_POS) )
{
return TRUE;
}
return FALSE;
}
INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc)
{
INT32 sProposedGridNo = sGridNo + sDirInc;
// now check for out-of-bounds
if (OutOfBounds(sGridno,sProposedGridno))
if (OutOfBounds(sGridNo,sProposedGridNo))
// return ORIGINAL gridno to user
sProposedGridno = sGridno;
sProposedGridNo = sGridNo;
return(sProposedGridno);
return(sProposedGridNo);
}
@@ -586,13 +597,13 @@ INT16 sDeltaScreenX, sDeltaScreenY;
}
void ConvertGridNoToXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos )
void ConvertGridNoToXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
{
*sYPos = sGridNo / WORLD_COLS;
*sXPos = ( sGridNo - ( *sYPos * WORLD_COLS ) );
}
void ConvertGridNoToCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos )
void ConvertGridNoToCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
{
*sYPos = ( sGridNo / WORLD_COLS );
*sXPos = sGridNo - ( *sYPos * WORLD_COLS );
@@ -601,7 +612,7 @@ void ConvertGridNoToCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos )
*sXPos = ( *sXPos * CELL_X_SIZE );
}
void ConvertGridNoToCenterCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos )
void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos )
{
*sYPos = ( sGridNo / WORLD_COLS );
*sXPos = ( sGridNo - ( *sYPos * WORLD_COLS ) );
@@ -610,7 +621,7 @@ void ConvertGridNoToCenterCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos )
*sXPos = ( *sXPos * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 );
}
INT32 GetRangeFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 )
INT32 GetRangeFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 )
{
INT32 uiDist;
INT16 sXPos, sYPos, sXPos2, sYPos2;
@@ -621,12 +632,12 @@ INT32 GetRangeFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 )
// Convert our grid-not into an XY
ConvertGridNoToXY( sGridNo2, &sXPos2, &sYPos2 );
uiDist = (INT16)sqrt((double) ( sXPos2 - sXPos )*( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) );
uiDist = sqrt((double) ( sXPos2 - sXPos )*( sXPos2 - sXPos ) + ( sYPos2 - sYPos ) * ( sYPos2 - sYPos ) );
return( uiDist );
}
INT32 GetRangeInCellCoordsFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 )
INT32 GetRangeInCellCoordsFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 )
{
INT16 sXPos, sYPos, sXPos2, sYPos2;
@@ -656,7 +667,7 @@ BOOLEAN IsPointInScreenRectWithRelative( INT16 sXPos, INT16 sYPos, SGPRect *pRec
{
if ( (sXPos >= pRect->iLeft) && (sXPos <= pRect->iRight) && (sYPos >= pRect->iTop) && (sYPos <= pRect->iBottom) )
{
(*sXRel) = (INT16) pRect->iLeft - sXPos;
(*sXRel) = pRect->iLeft - sXPos;
(*sYRel) = sYPos - (INT16)pRect->iTop;
return( TRUE );
@@ -668,12 +679,12 @@ BOOLEAN IsPointInScreenRectWithRelative( INT16 sXPos, INT16 sYPos, SGPRect *pRec
}
INT16 PythSpacesAway(INT16 sOrigin, INT16 sDest)
INT16 PythSpacesAway(INT32 sOrigin, INT32 sDest)
{
INT16 sRows,sCols,sResult;
sRows = (INT16) abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
sCols = (INT16) abs((sOrigin % MAXROW) - (sDest % MAXROW));
sRows = abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
sCols = abs((sOrigin % MAXROW) - (sDest % MAXROW));
// apply Pythagoras's theorem for right-handed triangle:
@@ -684,23 +695,23 @@ INT16 PythSpacesAway(INT16 sOrigin, INT16 sDest)
}
INT16 SpacesAway(INT16 sOrigin, INT16 sDest)
INT16 SpacesAway(INT32 sOrigin, INT32 sDest)
{
INT16 sRows,sCols;
sRows = (INT16) abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
sCols = (INT16) abs((sOrigin % MAXROW) - (sDest % MAXROW));
sRows = abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
sCols = abs((sOrigin % MAXROW) - (sDest % MAXROW));
return( __max( sRows, sCols ) );
}
INT16 CardinalSpacesAway(INT16 sOrigin, INT16 sDest)
INT16 CardinalSpacesAway(INT32 sOrigin, INT32 sDest)
// distance away, ignoring diagonals!
{
INT16 sRows,sCols;
sRows = (INT16) abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
sCols = (INT16) abs((sOrigin % MAXROW) - (sDest % MAXROW));
sRows = abs((sOrigin / MAXCOL) - (sDest / MAXCOL));
sCols = abs((sOrigin % MAXROW) - (sDest % MAXROW));
return( (INT16)( sRows + sCols ) );
}
@@ -748,10 +759,10 @@ INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 )
}
BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection )
BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection )
{
INT32 cnt;
INT16 sNewGridNo;
INT32 sNewGridNo;
BOOLEAN fFound = FALSE;
UINT8 bMinNumTurns = 100;
INT8 bNumTurns;
@@ -767,7 +778,7 @@ BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDi
// LOOP THROUGH ALL 8 DIRECTIONS
for ( cnt = 0; cnt < 8; cnt+= 2 )
{
sNewGridNo = NewGridNo( (INT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, 1 ) )
{
@@ -797,10 +808,10 @@ BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDi
return( FALSE );
}
BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection )
BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection )
{
INT32 cnt;
INT16 sNewGridNo;
INT32 sNewGridNo;
BOOLEAN fFound = FALSE;
UINT8 bMinNumTurns = 100;
INT8 bNumTurns;
@@ -809,7 +820,7 @@ BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir,
// LOOP THROUGH ALL 8 DIRECTIONS
for ( cnt = 0; cnt < 8; cnt+= 2 )
{
sNewGridNo = NewGridNo( (INT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
// Make sure there is NOT a roof here...
// Check OK destination
@@ -907,9 +918,9 @@ INT16 ExtQuickestDirection(INT16 origin, INT16 dest)
// Returns the (center ) cell coordinates in X
INT16 CenterX( INT16 sGridNo )
INT16 CenterX( INT32 sGridNo )
{
INT16 sYPos, sXPos;
INT32 sYPos, sXPos;
sYPos = sGridNo / WORLD_COLS;
sXPos = ( sGridNo - ( sYPos * WORLD_COLS ) );
@@ -919,9 +930,9 @@ INT16 CenterX( INT16 sGridNo )
// Returns the (center ) cell coordinates in Y
INT16 CenterY( INT16 sGridNo )
INT16 CenterY( INT32 sGridNo )
{
INT16 sYPos, sXPos;
INT32 sYPos, sXPos;
sYPos = sGridNo / WORLD_COLS;
sXPos = ( sGridNo - ( sYPos * WORLD_COLS ) );
@@ -930,9 +941,9 @@ INT16 CenterY( INT16 sGridNo )
}
INT16 MapX( INT16 sGridNo )
INT16 MapX( INT32 sGridNo )
{
INT16 sYPos, sXPos;
INT32 sYPos, sXPos;
sYPos = sGridNo / WORLD_COLS;
sXPos = ( sGridNo - ( sYPos * WORLD_COLS ) );
@@ -941,9 +952,9 @@ INT16 MapX( INT16 sGridNo )
}
INT16 MapY( INT16 sGridNo )
INT16 MapY( INT32 sGridNo )
{
INT16 sYPos, sXPos;
INT32 sYPos, sXPos;
sYPos = sGridNo / WORLD_COLS;
sXPos = ( sGridNo - ( sYPos * WORLD_COLS ) );
@@ -953,7 +964,7 @@ INT16 MapY( INT16 sGridNo )
BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo )
BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo )
{
INT16 sWorldX;
INT16 sWorldY;
@@ -964,9 +975,11 @@ BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo )
// Get screen coordinates for current position of soldier
GetWorldXYAbsoluteScreenXY( sXMapPos, sYMapPos, &sWorldX, &sWorldY);
if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) &&
sWorldY > 20 && sWorldY < ( gsBLY - gsTLY - 20 ) )
#if 0//dnl ch53 151009
if ( sWorldX > 0 && sWorldX < ( gsTRX - gsTLX - 20 ) && sWorldY > 20 && sWorldY < ( gsBLY - gsTLY - 20 ) )
#else
if ( sWorldX >= 30 && sWorldX <= (gsTRX - gsTLX - 30) && sWorldY >= 20 && sWorldY <= (gsBLY - gsTLY - 10) )
#endif
{
return( TRUE );
}
@@ -974,11 +987,11 @@ BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo )
return( FALSE );
}
#if 0//dnl ch53 101009
// This function is used when we care about astetics with the top Y portion of the
// gma eplay area
// mostly due to UI bar that comes down....
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT16 sGridNo )
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT32 sGridNo )
{
INT16 sWorldX;
INT16 sWorldY;
@@ -998,9 +1011,9 @@ BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT16 sGridNo )
return( FALSE );
}
#endif
BOOLEAN GridNoOnEdgeOfMap( INT16 sGridNo, INT8 * pbDirection )
BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection )
{
INT8 bDir;
@@ -1019,17 +1032,17 @@ BOOLEAN GridNoOnEdgeOfMap( INT16 sGridNo, INT8 * pbDirection )
}
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection )
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection )
{
INT32 cnt;
INT16 sNewGridNo, sOtherSideOfFence;
INT32 sNewGridNo, sOtherSideOfFence;
BOOLEAN fFound = FALSE;
UINT8 bMinNumTurns = 100;
INT8 bNumTurns;
INT8 bMinDirection = 0;
// IF there is a fence in this gridno, return false!
if ( IsJumpableFencePresentAtGridno( sGridNo ) )
if ( IsJumpableFencePresentAtGridNo( sGridNo ) )
{
return( FALSE );
}
@@ -1038,8 +1051,8 @@ BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStar
for ( cnt = 0; cnt < 8; cnt+= 2 )
{
// go out *2* tiles
sNewGridNo = NewGridNo( (INT16)sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
sOtherSideOfFence = NewGridNo( (INT16)sNewGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
sOtherSideOfFence = NewGridNo( sNewGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
if ( NewOKDestination( pSoldier, sOtherSideOfFence, TRUE, 0 ) )
{
@@ -1047,7 +1060,7 @@ BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStar
// Check if we have a fence here
if ( IsJumpableFencePresentAtGridno( sNewGridNo ) )
if ( IsJumpableFencePresentAtGridNo( sNewGridNo ) )
{
fFound = TRUE;
@@ -1073,7 +1086,7 @@ BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStar
}
//Simply chooses a random gridno within valid boundaries (for dropping things in unloaded sectors)
INT16 RandomGridNo()
INT32 RandomGridNo()
{
INT32 iMapXPos, iMapYPos, iMapIndex;
do
@@ -1081,6 +1094,6 @@ INT16 RandomGridNo()
iMapXPos = Random( WORLD_COLS );
iMapYPos = Random( WORLD_ROWS );
iMapIndex = iMapYPos * WORLD_COLS + iMapXPos;
}while( !GridNoOnVisibleWorldTile( (INT16)iMapIndex ) );
return (INT16)iMapIndex;
}while( !GridNoOnVisibleWorldTile( iMapIndex ) );
return iMapIndex;
}
+41 -33
View File
@@ -9,11 +9,16 @@
#define GRIDSIZE (MAXCOL * MAXROW)
#define RIGHTMOSTGRID (MAXCOL - 1)
#define LASTROWSTART (GRIDSIZE - MAXCOL)
#define NOWHERE (GRIDSIZE + 1)
//#define NO_MAP_POS NOWHERE
#define MAPWIDTH (WORLD_COLS)
#define MAPHEIGHT (WORLD_ROWS)
#define MAPLENGTH (MAPHEIGHT*MAPWIDTH)
//SB: NOWHERE must be constant
//#define NOWHERE (GRIDSIZE + 1) //Lalien: old definition, replaced with -1
//#define NOWHERE MAXLONG
#define NOWHERE -1
//#define NO_MAP_POS NOWHERE //Lalien: replaced with NOWHERE
#define MAX_MAP_POS (GRIDSIZE) //MAX_MAP_POS will be used only to track the changes made for the big map project, should be replaced with GRIDSIZE later
//#define MAPWIDTH (WORLD_COLS) //Lalien: replaced with WORLD_COLS
//#define MAPHEIGHT (WORLD_ROWS) //Lalien: replaced with WORLD_ROWS
//#define MAPLENGTH (MAPHEIGHT*MAPWIDTH) //Lalien: replaced with WORLD_MAX
#define ADJUST_Y_FOR_HEIGHT( pos, y ) ( y -= gpWorldLevelData[ pos ].sHeight )
@@ -31,26 +36,27 @@ extern UINT8 gPurpendicularDirection[ NUM_WORLD_DIRECTIONS ][ NUM_WORLD_DIRECTIO
// |Check for map bounds------------------------------------------| |Invalid-| |Valid-------------------|
#define MAPROWCOLTOPOS( r, c ) ( ( (r < 0) || (r >= WORLD_ROWS) || (c < 0) || (c >= WORLD_COLS) ) ? ( 0xffff ) : ( (r) * WORLD_COLS + (c) ) )
#define MAPROWCOLTOPOS( r, c ) ( ( (r < 0) || (r >= WORLD_ROWS) || (c < 0) || (c >= WORLD_COLS) ) ? ( 0xFFFFFFFF ) : ( (INT32)(r) * WORLD_COLS + (c) ) )
#define GETWORLDINDEXFROMWORLDCOORDS( y, x ) ( (INT16) ( x / CELL_X_SIZE ) ) + WORLD_COLS * ( (INT16) ( y / CELL_Y_SIZE ) )
#define GETWORLDINDEXFROMWORLDCOORDS( y, x ) ( (INT32) ( x / CELL_X_SIZE ) ) + WORLD_COLS * ( (INT32) ( y / CELL_Y_SIZE ) )
void ConvertGridNoToXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
void ConvertGridNoToCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
void ConvertGridNoToCenterCellXY( INT16 sGridNo, INT16 *sXPos, INT16 *sYPos );
void ConvertGridNoToXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
void ConvertGridNoToCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
void ConvertGridNoToCenterCellXY( INT32 sGridNo, INT16 *sXPos, INT16 *sYPos );
// GRID NO MANIPULATION FUNCTIONS
INT16 NewGridNo(INT16 sGridno, INT16 sDirInc);
INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc);
INT16 DirectionInc(UINT8 ubDirection);
INT32 OutOfBounds(INT16 sGridno, INT16 sProposedGridno);
INT32 OutOfBounds(INT32 sGridNo, INT32 sProposedGridNo);
BOOLEAN TileIsOutOfBounds(INT32 sGridNo);
// Functions
BOOLEAN GetMouseCell( INT32 *piMouseMapPos );
BOOLEAN GetMouseXY( INT16 *psMouseX, INT16 *psMouseY );
BOOLEAN GetMouseWorldCoords( INT16 *psMouseX, INT16 *psMouseY );
BOOLEAN GetMouseMapPos( INT16 *psMapPos );
BOOLEAN GetMouseMapPos( INT32 *psMapPos );
BOOLEAN GetMouseWorldCoordsInCenter( INT16 *psMouseX, INT16 *psMouseY );
BOOLEAN GetMouseXYWithRemainder( INT16 *psMouseX, INT16 *psMouseY, INT16 *psCellX, INT16 *psCellY );
@@ -58,7 +64,7 @@ BOOLEAN GetMouseXYWithRemainder( INT16 *psMouseX, INT16 *psMouseY, INT16 *psCell
void GetScreenXYWorldCoords( INT16 sScreenX, INT16 sScreenY, INT16 *pWorldX, INT16 *psWorldY );
void GetScreenXYWorldCell( INT16 sScreenX, INT16 sScreenY, INT16 *psWorldCellX, INT16 *psWorldCellY );
void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT16 *psMapPos );
void GetScreenXYGridNo( INT16 sScreenX, INT16 sScreenY, INT32 *psMapPos );
void GetWorldXYAbsoluteScreenXY( INT32 sWorldCellX, INT32 sWorldCellY, INT16 *psWorldScreenX, INT16 *psWorldScreenY );
void GetFromAbsoluteScreenXYWorldXY( INT32 *psWorldCellX, INT32* psWorldCellY, INT16 sWorldScreenX, INT16 sWorldScreenY );
@@ -70,44 +76,44 @@ void FromScreenToCellCoordinates( INT16 sScreenX, INT16 sScreenY, INT16 *psCellX
void FloatFromCellToScreenCoordinates( FLOAT dCellX, FLOAT dCellY, FLOAT *pdScreenX, FLOAT *pdScreenY );
void FloatFromScreenToCellCoordinates( FLOAT dScreenX, FLOAT dScreenY, FLOAT *pdCellX, FLOAT *pdCellY );
BOOLEAN GridNoOnVisibleWorldTile( INT16 sGridNo );
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT16 sGridNo );
BOOLEAN GridNoOnEdgeOfMap( INT16 sGridNo, INT8 * pbDirection );
BOOLEAN GridNoOnVisibleWorldTile( INT32 sGridNo );
BOOLEAN GridNoOnVisibleWorldTileGivenYLimits( INT32 sGridNo );
BOOLEAN GridNoOnEdgeOfMap( INT32 sGridNo, INT8 * pbDirection );
BOOLEAN ConvertMapPosToWorldTileCenter( INT16 sMapPos, INT16 *psXPos, INT16 *psYPos );
BOOLEAN ConvertMapPosToWorldTileCenter( INT32 usMapPos, INT16 *psXPos, INT16 *psYPos );
BOOLEAN CellXYToScreenXY(INT16 sCellX, INT16 sCellY, INT16 *sScreenX, INT16 *sScreenY);
INT32 GetRangeFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 );
INT32 GetRangeInCellCoordsFromGridNoDiff( INT16 sGridNo1, INT16 sGridNo2 );
INT32 GetRangeFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 );
INT32 GetRangeInCellCoordsFromGridNoDiff( INT32 sGridNo1, INT32 sGridNo2 );
BOOLEAN IsPointInScreenRect( INT16 sXPos, INT16 sYPos, SGPRect *pRect );
BOOLEAN IsPointInScreenRectWithRelative( INT16 sXPos, INT16 sYPos, SGPRect *pRect, INT16 *sXRel, INT16 *sRelY );
INT16 PythSpacesAway(INT16 sOrigin, INT16 sDest);
INT16 SpacesAway(INT16 sOrigin, INT16 sDest);
INT16 CardinalSpacesAway(INT16 sOrigin, INT16 sDest);
INT16 PythSpacesAway(INT32 sOrigin, INT32 sDest);
INT16 SpacesAway(INT32 sOrigin, INT32 sDest);
INT16 CardinalSpacesAway(INT32 sOrigin, INT32 sDest);
INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 );
BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
BOOLEAN FindHeigherLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
INT16 QuickestDirection(INT16 origin, INT16 dest);
INT16 ExtQuickestDirection(INT16 origin, INT16 dest);
// Returns the (center ) cell coordinates in X
INT16 CenterX( INT16 sGridno );
INT16 CenterX( INT32 sGridNo );
// Returns the (center ) cell coordinates in Y
INT16 CenterY( INT16 sGridno );
INT16 CenterY( INT32 sGridNo );
INT16 MapX( INT16 sGridNo );
INT16 MapY( INT16 sGridNo );
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT16 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
INT16 MapX( INT32 sGridNo );
INT16 MapY( INT32 sGridNo );
BOOLEAN FindFenceJumpDirection( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, INT8 *pbDirection );
//Simply chooses a random gridno within valid boundaries (for dropping things in unloaded sectors)
INT16 RandomGridNo();
INT32 RandomGridNo();
extern UINT32 guiForceRefreshMousePositionCalculation;
@@ -123,13 +129,15 @@ extern UINT32 guiForceRefreshMousePositionCalculation;
class GridNode
{
public:
typedef GridNode MapXY_t[WORLD_MAX];
// WANNE - BMP: DONE!
//typedef GridNode MapXY_t[WORLD_MAX];
typedef GridNode MapXY_t[MAX_ALLOWED_WORLD_MAX];
static MapXY_t MapXY;
INT16 x;
INT16 y;
static MapXY_t *initGridNodes() { for (INT16 i=0; i<WORLD_MAX; i++){ConvertGridNoToXY(i, &MapXY[i].x, &MapXY[i].y); } return &MapXY; };
static MapXY_t *initGridNodes() { for (INT32 i=0; i<WORLD_MAX; i++){ConvertGridNoToXY(i, &MapXY[i].x, &MapXY[i].y); } return &MapXY; };
};
#endif
+3 -3
View File
@@ -107,7 +107,7 @@ void UpdateLightingSprite( LIGHTEFFECT *pLight )
}
INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius )
INT32 NewLightEffect( INT32 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius )
{
LIGHTEFFECT *pLight;
INT32 iLightIndex;
@@ -142,7 +142,7 @@ INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius )
void RemoveLightEffectFromTile( INT16 sGridNo )
void RemoveLightEffectFromTile( INT32 sGridNo )
{
LIGHTEFFECT *pLight;
UINT32 cnt;
@@ -170,7 +170,7 @@ void RemoveLightEffectFromTile( INT16 sGridNo )
}
BOOLEAN IsLightEffectAtTile( INT16 sGridNo )
BOOLEAN IsLightEffectAtTile( INT32 sGridNo )
{
LIGHTEFFECT *pLight;
UINT32 cnt;
+5 -5
View File
@@ -13,7 +13,7 @@ enum
typedef struct
{
INT16 sGridNo; // gridno at which the tear gas cloud is centered
INT32 sGridNo; // gridno at which the tear gas cloud is centered
UINT8 ubDuration; // the number of turns will remain effective
UINT8 bRadius; // the current radius
@@ -32,11 +32,11 @@ void DecayLightEffects( UINT32 uiTime );
// Add light to gridno
// ( Replacement algorithm uses distance away )
void AddLightEffectToTile( INT8 bType, INT16 sGridNo );
void AddLightEffectToTile( INT8 bType, INT32 sGridNo );
void RemoveLightEffectFromTile( INT16 sGridNo );
void RemoveLightEffectFromTile( INT32 sGridNo );
INT32 NewLightEffect( INT16 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius );
INT32 NewLightEffect( INT32 sGridNo, UINT8 ubDuration, UINT8 ubStartRadius );
BOOLEAN SaveLightEffectsToSaveGameFile( HWFILE hFile );
@@ -46,6 +46,6 @@ BOOLEAN SaveLightEffectsToMapTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
BOOLEAN LoadLightEffectsFromMapTempFile( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
void ResetLightEffects();
BOOLEAN IsLightEffectAtTile( INT16 sGridNo );
BOOLEAN IsLightEffectAtTile( INT32 sGridNo );
#endif
File diff suppressed because it is too large Load Diff
+21 -16
View File
@@ -10,21 +10,26 @@ typedef struct MAPEDGEPOINTINFO
{
UINT8 ubNumPoints;
UINT8 ubStrategicInsertionCode;
INT16 sGridNo[ LARGEST_NUMBER_IN_ANY_GROUP ];
INT32 sGridNo[ LARGEST_NUMBER_IN_ANY_GROUP ];
}MAPEDGEPOINTINFO;
UINT16 ChooseMapEdgepoint( UINT8 *ubStrategicInsertionCode, UINT8 lastValidICode );
INT32 ChooseMapEdgepoint( UINT8 *ubStrategicInsertionCode, UINT8 lastValidICode );
void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategicInsertionCode, UINT8 ubNumDesiredPoints );
void GenerateMapEdgepoints();
void SaveMapEdgepoints( HWFILE fp );
BOOLEAN LoadMapEdgepoints( INT8 **hBuffer );
void GenerateMapEdgepoints(BOOLEAN fValidate=FALSE);
void SaveMapEdgepoints(HWFILE fp, FLOAT dMajorMapVersion, UINT8 ubMinorMapVersion);//dnl ch33 240909
BOOLEAN LoadMapEdgepoints( INT8 **hBuffer, FLOAT dMajorMapVersion );
void TrashMapEdgepoints();
//dynamic arrays that contain the valid gridno's for each edge
extern INT16 *gps1stNorthEdgepointArray;
extern INT16 *gps1stEastEdgepointArray;
extern INT16 *gps1stSouthEdgepointArray;
extern INT16 *gps1stWestEdgepointArray;
extern INT32 *gps1stNorthEdgepointArray;
extern INT32 *gps1stEastEdgepointArray;
extern INT32 *gps1stSouthEdgepointArray;
extern INT32 *gps1stWestEdgepointArray;
// WANNE - MP: Center
extern INT32 *gps1stCenterEdgepointArray;
extern UINT16 gus1stCenterEdgepointArraySize;
//contains the size for each array
extern UINT16 gus1stNorthEdgepointArraySize;
extern UINT16 gus1stEastEdgepointArraySize;
@@ -39,10 +44,10 @@ extern UINT16 gus1stSouthEdgepointMiddleIndex;
extern UINT16 gus1stWestEdgepointMiddleIndex;
//dynamic arrays that contain the valid gridno's for each edge
extern INT16 *gps2ndNorthEdgepointArray;
extern INT16 *gps2ndEastEdgepointArray;
extern INT16 *gps2ndSouthEdgepointArray;
extern INT16 *gps2ndWestEdgepointArray;
extern INT32 *gps2ndNorthEdgepointArray;
extern INT32 *gps2ndEastEdgepointArray;
extern INT32 *gps2ndSouthEdgepointArray;
extern INT32 *gps2ndWestEdgepointArray;
//contains the size for each array
extern UINT16 gus2ndNorthEdgepointArraySize;
extern UINT16 gus2ndEastEdgepointArraySize;
@@ -64,8 +69,8 @@ extern UINT16 gus2ndWestEdgepointMiddleIndex;
//code shouldn't be used for enemies or anybody else.
void BeginMapEdgepointSearch();
void EndMapEdgepointSearch();
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode, UINT8 defaultICode = INSERTION_CODE_GRIDNO, UINT8 *storedICode = NULL );
INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode );
INT32 SearchForClosestPrimaryMapEdgepoint( INT32 sGridNo, UINT8 ubInsertionCode, UINT8 defaultICode = INSERTION_CODE_GRIDNO, UINT8 *storedICode = NULL );
INT32 SearchForClosestSecondaryMapEdgepoint( INT32 sGridNo, UINT8 ubInsertionCode );
//There are two classes of edgepoints.
//PRIMARY : The default list of edgepoints. This list includes edgepoints that are easily accessible from the
@@ -74,7 +79,7 @@ INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCod
// to these areas is possible. Examples would be isolated sections of Grumm or Alma, which you can't
// immediately
//
UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo );
UINT8 CalcMapEdgepointClassInsertionCode( INT32 sGridNo );
#ifdef JA2EDITOR
void ShowMapEdgepoints();
+22 -21
View File
@@ -24,13 +24,14 @@
#endif
// Room Information
UINT8 gubWorldRoomInfo[ WORLD_MAX ];
//UINT8 gubWorldRoomInfo[ WORLD_MAX ];
UINT8* gubWorldRoomInfo = NULL;
UINT8 gubWorldRoomHidden[ MAX_ROOMS ];
BOOLEAN InitRoomDatabase( )
{
memset( gubWorldRoomInfo, NO_ROOM, sizeof( gubWorldRoomInfo ) );
//memset( gubWorldRoomInfo, NO_ROOM, sizeof( gubWorldRoomInfo ) );
memset( gubWorldRoomHidden, TRUE, sizeof( gubWorldRoomHidden ) );
return( TRUE );
}
@@ -40,7 +41,7 @@ void ShutdownRoomDatabase( )
}
void SetTileRoomNum( INT16 sGridNo, UINT8 ubRoomNum )
void SetTileRoomNum( INT32 sGridNo, UINT8 ubRoomNum )
{
// Add to global room list
gubWorldRoomInfo[ sGridNo ] = ubRoomNum;
@@ -54,13 +55,13 @@ void SetTileRangeRoomNum( SGPRect *pSelectRegion, UINT8 ubRoomNum )
{
for ( cnt2 = pSelectRegion->iLeft; cnt2 <= pSelectRegion->iRight; cnt2++ )
{
gubWorldRoomInfo[ (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ) ] = ubRoomNum;
gubWorldRoomInfo[ MAPROWCOLTOPOS( cnt1, cnt2 ) ] = ubRoomNum;
}
}
}
BOOLEAN InARoom( INT16 sGridNo, UINT8 *pubRoomNo )
BOOLEAN InARoom( INT32 sGridNo, UINT8 *pubRoomNo )
{
if ( gubWorldRoomInfo[ sGridNo ] != NO_ROOM )
{
@@ -75,7 +76,7 @@ BOOLEAN InARoom( INT16 sGridNo, UINT8 *pubRoomNo )
}
BOOLEAN InAHiddenRoom( INT16 sGridNo, UINT8 *pubRoomNo )
BOOLEAN InAHiddenRoom( INT32 sGridNo, UINT8 *pubRoomNo )
{
if ( gubWorldRoomInfo[ sGridNo ] != NO_ROOM )
{
@@ -109,7 +110,7 @@ void SetRecalculateWireFrameFlagRadius(INT16 sX, INT16 sY, INT16 sRadius)
}
void SetGridNoRevealedFlag( INT16 sGridNo )
void SetGridNoRevealedFlag( INT32 sGridNo )
{
// UINT32 cnt;
// ITEM_POOL *pItemPool;
@@ -125,13 +126,13 @@ void SetGridNoRevealedFlag( INT16 sGridNo )
{
SetStructAframeFlags( sGridNo, LEVELNODE_HIDDEN );
// Find gridno one east as well...
if ( ( sGridNo + WORLD_COLS ) < NOWHERE )
if ( ( sGridNo + WORLD_COLS ) < MAX_MAP_POS )
{
SetStructAframeFlags( sGridNo + WORLD_COLS, LEVELNODE_HIDDEN );
}
if ( ( sGridNo + 1 ) < NOWHERE )
if ( ( sGridNo + 1 ) < MAX_MAP_POS )
{
SetStructAframeFlags( sGridNo + 1, LEVELNODE_HIDDEN );
}
@@ -146,7 +147,7 @@ void SetGridNoRevealedFlag( INT16 sGridNo )
// ATE: If there are any structs here, we can render them with the obscured flag!
// Look for anything but walls pn this gridno!
pStructure = gpWorldLevelData[ (INT16)sGridNo ].pStructureHead;
pStructure = gpWorldLevelData[ sGridNo ].pStructureHead;
while ( pStructure != NULL )
{
@@ -188,13 +189,13 @@ void SetGridNoRevealedFlag( INT16 sGridNo )
}
void ExamineGridNoForSlantRoofExtraGraphic( INT16 sCheckGridNo )
void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo )
{
LEVELNODE *pNode = NULL;
STRUCTURE *pStructure, *pBase;
UINT8 ubLoop;
DB_STRUCTURE_TILE ** ppTile;
INT16 sGridNo;
INT32 sGridNo;
UINT16 usIndex;
BOOLEAN fChanged = FALSE;
@@ -257,9 +258,9 @@ void ExamineGridNoForSlantRoofExtraGraphic( INT16 sCheckGridNo )
}
void RemoveRoomRoof( INT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier )
void RemoveRoomRoof( INT32 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier )
{
UINT32 cnt;
INT32 cnt;
ITEM_POOL *pItemPool;
INT16 sX, sY;
BOOLEAN fSaidItemSeenQuote = FALSE;
@@ -272,12 +273,12 @@ void RemoveRoomRoof( INT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier )
if ( gubWorldRoomInfo[ cnt ] == bRoomNum )
{
SetGridNoRevealedFlag( (INT16)cnt );
SetGridNoRevealedFlag( cnt );//dnl ch56 141009
RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL );
RemoveRoofIndexFlagsFromTypeRange( cnt, FIRSTROOF, SECONDSLANTROOF, LEVELNODE_REVEAL );
// Reveal any items if here!
if ( GetItemPoolFromGround( (INT16)cnt, &pItemPool ) )
if ( GetItemPoolFromGround( cnt, &pItemPool ) )
{
// Set visible! ( only if invisible... )
if ( SetItemPoolVisibilityOn( pItemPool, INVISIBLE, TRUE ) )
@@ -296,7 +297,7 @@ void RemoveRoomRoof( INT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier )
// OK, re-set writeframes ( in a radius )
// Get XY
ConvertGridNoToXY( (INT16)cnt, &sX, &sY );
ConvertGridNoToXY( cnt, &sX, &sY );
SetRecalculateWireFrameFlagRadius( sX, sY, 2 );
}
@@ -329,7 +330,7 @@ BOOLEAN AddSpecialTileRange( SGPRect *pSelectRegion )
{
for ( cnt2 = pSelectRegion->iLeft; cnt2 <= pSelectRegion->iRight; cnt2++ )
{
AddObjectToHead( (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT );
AddObjectToHead( MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT );
}
}
@@ -345,7 +346,7 @@ BOOLEAN RemoveSpecialTileRange( SGPRect *pSelectRegion )
{
for ( cnt2 = pSelectRegion->iLeft; cnt2 <= pSelectRegion->iRight; cnt2++ )
{
RemoveObject( (INT16)MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT );
RemoveObject( MAPROWCOLTOPOS( cnt1, cnt2 ), SPECIALTILE_MAPEXIT );
}
}
+7 -7
View File
@@ -9,22 +9,22 @@
extern UINT8 gubWorldRoomHidden[ MAX_ROOMS ];
extern UINT8 gubWorldRoomInfo[ WORLD_MAX ];
extern UINT8* gubWorldRoomInfo;
BOOLEAN InitRoomDatabase( );
void ShutdownRoomDatabase( );
void SetTileRoomNum( INT16 sGridNo, UINT8 ubRoomNum );
void SetTileRoomNum( INT32 sGridNo, UINT8 ubRoomNum );
void SetTileRangeRoomNum( SGPRect *pSelectRegion, UINT8 ubRoomNum );
void RemoveRoomRoof( INT16 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier );
BOOLEAN InARoom( INT16 sGridNo, UINT8 *pubRoomNo );
BOOLEAN InAHiddenRoom( INT16 sGridNo, UINT8 *pubRoomNo );
void RemoveRoomRoof( INT32 sGridNo, UINT8 bRoomNum, SOLDIERTYPE *pSoldier );
BOOLEAN InARoom( INT32 sGridNo, UINT8 *pubRoomNo );
BOOLEAN InAHiddenRoom( INT32 sGridNo, UINT8 *pubRoomNo );
void SetGridNoRevealedFlag( INT16 sGridNo );
void SetGridNoRevealedFlag( INT32 sGridNo );
void ExamineGridNoForSlantRoofExtraGraphic( INT16 sCheckGridNo );
void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo );
void SetRecalculateWireFrameFlagRadius(INT16 sX, INT16 sY, INT16 sRadius);
+71 -71
View File
@@ -21,8 +21,8 @@
#endif
#include "VFS/vfs.h"
#define NUM_REVEALED_BYTES 3200
//SB: make size of gpRevealedMap dependable from variable tactical map dimensions
#define NUM_REVEALED_BYTES (WORLD_MAX/8)
extern BOOLEAN gfLoadingExitGrids;
@@ -35,13 +35,13 @@ UINT8 *gpRevealedMap;
void RemoveSavedStructFromMap( UINT32 uiMapIndex, UINT16 usIndex );
void AddObjectFromMapTempFileToMap( UINT32 uiMapIndex, UINT16 usIndex );
void RemoveSavedStructFromMap( INT32 uiMapIndex, UINT16 usIndex );
void AddObjectFromMapTempFileToMap( INT32 uiMapIndex, UINT16 usIndex );
void AddBloodOrSmellFromMapTempFileToMap( MODIFY_MAP *pMap );
void SetSectorsRevealedBit( INT16 sMapIndex );
void SetSectorsRevealedBit( UINT32 usMapIndex );
void SetMapRevealedStatus();
void DamageStructsFromMapTempFile( MODIFY_MAP * pMap );
BOOLEAN ModifyWindowStatus( UINT32 uiMapIndex );
BOOLEAN ModifyWindowStatus( INT32 uiMapIndex );
//ppp
@@ -176,7 +176,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
case SLM_OBJECT:
GetTileIndexFromTypeSubIndex( pMap->usImageType, pMap->usSubImageIndex, &usIndex );
AddObjectFromMapTempFileToMap( pMap->sGridNo, usIndex );
AddObjectFromMapTempFileToMap( pMap->usGridNo, usIndex );
// Save this struct back to the temp file
SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
@@ -188,7 +188,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
case SLM_STRUCT:
GetTileIndexFromTypeSubIndex( pMap->usImageType, pMap->usSubImageIndex, &usIndex );
AddStructFromMapTempFileToMap( pMap->sGridNo, usIndex );
AddStructFromMapTempFileToMap( pMap->usGridNo, usIndex );
// Save this struct back to the temp file
SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
@@ -221,12 +221,12 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
if ( pMap->usImageType >= FIRSTDOOR && pMap->usImageType <= FOURTHDOOR )
{
// Remove ANY door...
RemoveAllStructsOfTypeRange( pMap->sGridNo, FIRSTDOOR, FOURTHDOOR );
RemoveAllStructsOfTypeRange( pMap->usGridNo, FIRSTDOOR, FOURTHDOOR );
}
else
{
GetTileIndexFromTypeSubIndex( pMap->usImageType, pMap->usSubImageIndex, &usIndex );
RemoveSavedStructFromMap( pMap->sGridNo, usIndex );
RemoveSavedStructFromMap( pMap->usGridNo, usIndex );
}
// Save this struct back to the temp file
@@ -259,12 +259,12 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
{
EXITGRID ExitGrid;
gfLoadingExitGrids = TRUE;
ExitGrid.sGridNo = pMap->usSubImageIndex;
ExitGrid.usGridNo = pMap->usSubImageIndex;
ExitGrid.ubGotoSectorX = (UINT8) pMap->usImageType;
ExitGrid.ubGotoSectorY = (UINT8) ( pMap->usImageType >> 8 ) ;
ExitGrid.ubGotoSectorZ = pMap->ubExtra;
AddExitGridToWorld( pMap->sGridNo, &ExitGrid );
AddExitGridToWorld( pMap->usGridNo, &ExitGrid );
gfLoadingExitGrids = FALSE;
// Save this struct back to the temp file
@@ -276,11 +276,11 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
break;
case SLM_OPENABLE_STRUCT:
SetOpenableStructStatusFromMapTempFile( pMap->sGridNo, (BOOLEAN)pMap->usImageType );
SetOpenableStructStatusFromMapTempFile( pMap->usGridNo, (BOOLEAN)pMap->usImageType );
break;
case SLM_WINDOW_HIT:
if ( ModifyWindowStatus( pMap->sGridNo ) )
if ( ModifyWindowStatus( pMap->usGridNo ) )
{
// Save this struct back to the temp file
SaveModifiedMapStructToMapTempFile( pMap, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
@@ -323,7 +323,7 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
void AddStructToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
void AddStructToMapTempFile( INT32 uiMapIndex, UINT16 usIndex )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -341,7 +341,7 @@ void AddStructToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -352,13 +352,13 @@ void AddStructToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
}
void AddStructFromMapTempFileToMap( UINT32 uiMapIndex, UINT16 usIndex )
void AddStructFromMapTempFileToMap( INT32 uiMapIndex, UINT16 usIndex )
{
AddStructToTailCommon( uiMapIndex, usIndex, TRUE );
}
void AddObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
void AddObjectToMapTempFile( INT32 uiMapIndex, UINT16 usIndex )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -375,7 +375,7 @@ void AddObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -386,12 +386,12 @@ void AddObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
}
void AddObjectFromMapTempFileToMap( UINT32 uiMapIndex, UINT16 usIndex )
void AddObjectFromMapTempFileToMap( INT32 uiMapIndex, UINT16 usIndex )
{
AddObjectToHead( uiMapIndex, usIndex );
}
void AddRemoveObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
void AddRemoveObjectToMapTempFile( INT32 uiMapIndex, UINT16 usIndex )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -408,7 +408,7 @@ void AddRemoveObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -419,7 +419,7 @@ void AddRemoveObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
}
void RemoveStructFromMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
void RemoveStructFromMapTempFile( INT32 uiMapIndex, UINT16 usIndex )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -436,7 +436,7 @@ void RemoveStructFromMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -448,7 +448,7 @@ void RemoveStructFromMapTempFile( UINT32 uiMapIndex, UINT16 usIndex )
}
void RemoveSavedStructFromMap( UINT32 uiMapIndex, UINT16 usIndex )
void RemoveSavedStructFromMap( INT32 uiMapIndex, UINT16 usIndex )
{
RemoveStruct( uiMapIndex, usIndex );
}
@@ -459,7 +459,7 @@ void RemoveSavedStructFromMap( UINT32 uiMapIndex, UINT16 usIndex )
void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
{
MODIFY_MAP Map;
UINT16 cnt;
INT32 cnt;
STRUCTURE * pStructure;
@@ -478,7 +478,7 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
// Save the BloodInfo in the bottom byte and the smell info in the upper byte
Map.sGridNo = (INT16)cnt;
Map.usGridNo = cnt;
// Map.usIndex = gpWorldLevelData[cnt].ubBloodInfo | ( gpWorldLevelData[cnt].ubSmellInfo << 8 );
Map.usImageType = gpWorldLevelData[cnt].ubBloodInfo;
Map.usSubImageIndex = gpWorldLevelData[cnt].ubSmellInfo;
@@ -521,7 +521,7 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
memset( &Map, 0, sizeof( MODIFY_MAP ) );
// Save the Damaged value
Map.sGridNo = (INT16)cnt;
Map.usGridNo = cnt;
// Map.usIndex = StructureFlagToType( pCurrent->fFlags ) | ( pCurrent->ubHitPoints << 8 );
Map.usImageType = StructureFlagToType( pCurrent->fFlags );
Map.usSubImageIndex = pCurrent->ubHitPoints;
@@ -560,19 +560,19 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
// The BloodInfo is saved in the bottom byte and the smell info in the upper byte
void AddBloodOrSmellFromMapTempFileToMap( MODIFY_MAP *pMap )
{
gpWorldLevelData[ pMap->sGridNo ].ubBloodInfo = (UINT8)pMap->usImageType;
gpWorldLevelData[ pMap->usGridNo ].ubBloodInfo = (UINT8)pMap->usImageType;
//if the blood and gore option IS set, add blood
if( gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] )
{
// Update graphics for both levels...
gpWorldLevelData[ pMap->sGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD;
UpdateBloodGraphics( pMap->sGridNo, 0 );
gpWorldLevelData[ pMap->sGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD;
UpdateBloodGraphics( pMap->sGridNo, 1 );
gpWorldLevelData[ pMap->usGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD;
UpdateBloodGraphics( pMap->usGridNo, 0 );
gpWorldLevelData[ pMap->usGridNo ].uiFlags |= MAPELEMENT_REEVALUATEBLOOD;
UpdateBloodGraphics( pMap->usGridNo, 1 );
}
gpWorldLevelData[ pMap->sGridNo ].ubSmellInfo = (UINT8)pMap->usSubImageIndex;
gpWorldLevelData[ pMap->usGridNo ].ubSmellInfo = (UINT8)pMap->usSubImageIndex;
}
@@ -686,13 +686,13 @@ BOOLEAN LoadRevealedStatusArrayFromRevealedTempFile()
return( TRUE );
}
void SetSectorsRevealedBit( INT16 sMapIndex )
void SetSectorsRevealedBit( UINT32 usMapIndex )
{
UINT16 usByteNumber;
UINT8 ubBitNumber;
usByteNumber = sMapIndex / 8;
ubBitNumber = sMapIndex % 8;
usByteNumber = usMapIndex / 8;
ubBitNumber = usMapIndex % 8;
gpRevealedMap[ usByteNumber ] |= 1 << ubBitNumber;
}
@@ -701,9 +701,9 @@ void SetSectorsRevealedBit( INT16 sMapIndex )
void SetMapRevealedStatus()
{
UINT16 usByteCnt;
UINT32 usByteCnt;
UINT8 ubBitCnt;
INT16 sMapIndex;
UINT32 usMapIndex;
if( gpRevealedMap == NULL )
AssertMsg( 0, "gpRevealedMap is NULL. DF 1" );
@@ -717,16 +717,16 @@ void SetMapRevealedStatus()
//loop through all the bits in the byte
for( ubBitCnt=0; ubBitCnt<8; ubBitCnt++)
{
sMapIndex = ( usByteCnt * 8 ) + ubBitCnt;
usMapIndex = ( usByteCnt * 8 ) + ubBitCnt;
if( gpRevealedMap[ usByteCnt ] & ( 1 << ubBitCnt ) )
{
gpWorldLevelData[ sMapIndex ].uiFlags |= MAPELEMENT_REVEALED;
SetGridNoRevealedFlag( sMapIndex );
gpWorldLevelData[ usMapIndex ].uiFlags |= MAPELEMENT_REVEALED;
SetGridNoRevealedFlag( usMapIndex );
}
else
{
gpWorldLevelData[ sMapIndex ].uiFlags &= (~MAPELEMENT_REVEALED );
gpWorldLevelData[ usMapIndex ].uiFlags &= (~MAPELEMENT_REVEALED );
}
}
}
@@ -748,7 +748,7 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap )
//Find the base structure
pCurrent = FindStructure( (INT16)pMap->sGridNo, STRUCTURE_BASE_TILE );
pCurrent = FindStructure( pMap->usGridNo, STRUCTURE_BASE_TILE );
if( pCurrent == NULL )
return;
@@ -759,7 +759,7 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap )
//Check to see if the desired strucure node is in this tile
pCurrent = FindStructureBySavedInfo( pMap->sGridNo, ubType, ubWallOrientation, bLevel );
pCurrent = FindStructureBySavedInfo( pMap->usGridNo, ubType, ubWallOrientation, bLevel );
if( pCurrent != NULL )
{
@@ -774,7 +774,7 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap )
//////////////
void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
void AddStructToUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -788,7 +788,7 @@ void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -799,7 +799,7 @@ void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS
SaveModifiedMapStructToMapTempFile( &Map, sSectorX, sSectorY, ubSectorZ );
}
void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
void AddObjectToUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -813,7 +813,7 @@ void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -824,7 +824,7 @@ void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sS
}
void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
void RemoveStructFromUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -838,7 +838,7 @@ void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -849,7 +849,7 @@ void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT
}
void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
void AddRemoveObjectToUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
{
MODIFY_MAP Map;
UINT32 uiType;
@@ -863,7 +863,7 @@ void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, IN
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
// Map.usIndex = usIndex;
Map.usImageType = (UINT16)uiType;
Map.usSubImageIndex = usSubIndex;
@@ -874,7 +874,7 @@ void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, IN
}
void AddExitGridToMapTempFile( INT16 sGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
void AddExitGridToMapTempFile( INT32 usGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
{
MODIFY_MAP Map;
@@ -889,11 +889,11 @@ void AddExitGridToMapTempFile( INT16 sGridNo, EXITGRID *pExitGrid, INT16 sSector
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = sGridNo;
Map.usGridNo = usGridNo;
// Map.usIndex = pExitGrid->ubGotoSectorX;
Map.usImageType = pExitGrid->ubGotoSectorX | ( pExitGrid->ubGotoSectorY << 8 );
Map.usSubImageIndex = pExitGrid->sGridNo;
Map.usSubImageIndex = pExitGrid->usGridNo;
Map.ubExtra = pExitGrid->ubGotoSectorZ;
Map.ubType = SLM_EXIT_GRIDS;
@@ -901,7 +901,7 @@ void AddExitGridToMapTempFile( INT16 sGridNo, EXITGRID *pExitGrid, INT16 sSector
SaveModifiedMapStructToMapTempFile( &Map, sSectorX, sSectorY, ubSectorZ );
}
BOOLEAN RemoveGraphicFromTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
BOOLEAN RemoveGraphicFromTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ )
{
CHAR8 zMapName[ 128 ];
HWFILE hFile;
@@ -977,7 +977,7 @@ BOOLEAN RemoveGraphicFromTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSec
pMap = &pTempArrayOfMaps[ cnt ];
//if this is the peice we are looking for
if( pMap->sGridNo == uiMapIndex && pMap->usImageType == uiType && pMap->usSubImageIndex == usSubIndex )
if( pMap->usGridNo == uiMapIndex && pMap->usImageType == uiType && pMap->usSubImageIndex == usSubIndex )
{
//Do nothin
fRetVal = TRUE;
@@ -994,13 +994,13 @@ BOOLEAN RemoveGraphicFromTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSec
void AddOpenableStructStatusToMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened )
void AddOpenableStructStatusToMapTempFile( INT32 uiMapIndex, BOOLEAN fOpened )
{
MODIFY_MAP Map;
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
Map.usImageType = fOpened;
Map.ubType = SLM_OPENABLE_STRUCT;
@@ -1008,41 +1008,41 @@ void AddOpenableStructStatusToMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened )
SaveModifiedMapStructToMapTempFile( &Map, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
}
void AddWindowHitToMapTempFile( UINT32 uiMapIndex )
void AddWindowHitToMapTempFile( INT32 uiMapIndex )
{
MODIFY_MAP Map;
memset( &Map, 0, sizeof( MODIFY_MAP ) );
Map.sGridNo = (INT16)uiMapIndex;
Map.usGridNo = uiMapIndex;
Map.ubType = SLM_WINDOW_HIT;
SaveModifiedMapStructToMapTempFile( &Map, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
}
BOOLEAN ModifyWindowStatus( UINT32 uiMapIndex )
BOOLEAN ModifyWindowStatus( INT32 uiMapIndex )
{
STRUCTURE * pStructure;
pStructure = FindStructure( (INT16) uiMapIndex, STRUCTURE_WALLNWINDOW );
pStructure = FindStructure( uiMapIndex, STRUCTURE_WALLNWINDOW );
if (pStructure)
{
SwapStructureForPartner( (INT16) uiMapIndex, pStructure );
SwapStructureForPartner( uiMapIndex, pStructure );
return( TRUE );
}
// else forget it, window could be destroyed
return( FALSE );
}
void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened )
void SetOpenableStructStatusFromMapTempFile( INT32 uiMapIndex, BOOLEAN fOpened )
{
STRUCTURE * pStructure;
STRUCTURE * pBase;
BOOLEAN fStatusOnTheMap;
ITEM_POOL *pItemPool;
INT16 sBaseGridNo = (INT16)uiMapIndex;
INT32 sBaseGridNo = uiMapIndex;
pStructure = FindStructure( (INT16)uiMapIndex, STRUCTURE_OPENABLE );
pStructure = FindStructure( uiMapIndex, STRUCTURE_OPENABLE );
if( pStructure == NULL )
{
@@ -1063,7 +1063,7 @@ void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened
sBaseGridNo = pBase->sGridNo;
}
if(SwapStructureForPartnerWithoutTriggeringSwitches( (INT16)uiMapIndex, pStructure ) == NULL )
if(SwapStructureForPartnerWithoutTriggeringSwitches( uiMapIndex, pStructure ) == NULL )
{
//an error occured
}
@@ -1093,7 +1093,7 @@ void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened
BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT16 sGridNo, BOOLEAN fChangeToOpen )
BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT32 usGridNo, BOOLEAN fChangeToOpen )
{
// STRUCTURE * pStructure;
// MODIFY_MAP Map;
@@ -1170,7 +1170,7 @@ BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 u
if( pMap->ubType == SLM_OPENABLE_STRUCT )
{
//if its on the same gridno
if( pMap->sGridNo == sGridNo )
if( pMap->usGridNo == usGridNo )
{
//Change to the desired settings
pMap->usImageType = fChangeToOpen;
+16 -16
View File
@@ -47,7 +47,7 @@ enum
typedef struct
{
UINT16 sGridNo; //The gridno the graphic will be applied to
INT32 usGridNo; //The gridno the graphic will be applied to
UINT16 usImageType; //graphic index
UINT16 usSubImageIndex; //
// UINT16 usIndex;
@@ -66,22 +66,22 @@ BOOLEAN SaveModifiedMapStructToMapTempFile( MODIFY_MAP *pMap, INT16 sSectorX, IN
//Applies a change TO THE MAP TEMP file
void AddStructToMapTempFile( UINT32 iMapIndex, UINT16 usIndex );
void AddStructToMapTempFile( INT32 iMapIndex, UINT16 usIndex );
//Applies a change TO THE MAP from the temp file
void AddStructFromMapTempFileToMap( UINT32 iMapIndex, UINT16 usIndex );
void AddStructFromMapTempFileToMap( INT32 iMapIndex, UINT16 usIndex );
void AddObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex );
void AddObjectToMapTempFile( INT32 uiMapIndex, UINT16 usIndex );
BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( );
void RemoveStructFromMapTempFile( UINT32 uiMapIndex, UINT16 usIndex );
void RemoveStructFromMapTempFile( INT32 uiMapIndex, UINT16 usIndex );
void AddRemoveObjectToMapTempFile( UINT32 uiMapIndex, UINT16 usIndex );
void AddRemoveObjectToMapTempFile( INT32 uiMapIndex, UINT16 usIndex );
void SaveBloodSmellAndRevealedStatesFromMapToTempFile();
@@ -91,25 +91,25 @@ BOOLEAN SaveRevealedStatusArrayToRevealedTempFile( INT16 sSectorX, INT16 sSector
BOOLEAN LoadRevealedStatusArrayFromRevealedTempFile();
void AddRemoveObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void RemoveStructFromUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void AddObjectToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void AddStructToUnLoadedMapTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void AddRemoveObjectToUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void RemoveStructFromUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void AddObjectToUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void AddStructToUnLoadedMapTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
//Adds the exit grid to
void AddExitGridToMapTempFile( INT16 sGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void AddExitGridToMapTempFile( INT32 usGridNo, EXITGRID *pExitGrid, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
//This function removes a struct with the same MapIndex and graphic index from the given sectors temp file
BOOLEAN RemoveGraphicFromTempFile( UINT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
BOOLEAN RemoveGraphicFromTempFile( INT32 uiMapIndex, UINT16 usIndex, INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ );
void SetOpenableStructStatusFromMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened );
void AddOpenableStructStatusToMapTempFile( UINT32 uiMapIndex, BOOLEAN fOpened );
void SetOpenableStructStatusFromMapTempFile( INT32 uiMapIndex, BOOLEAN fOpened );
void AddOpenableStructStatusToMapTempFile( INT32 uiMapIndex, BOOLEAN fOpened );
void AddWindowHitToMapTempFile( UINT32 uiMapIndex );
void AddWindowHitToMapTempFile( INT32 uiMapIndex );
BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT16 sGridNo, BOOLEAN fChangeToOpen );
BOOLEAN ChangeStatusOfOpenableStructInUnloadedSector( UINT16 usSectorX, UINT16 usSectorY, INT8 bSectorZ, INT32 usGridNo, BOOLEAN fChangeToOpen );
#endif
+12 -7
View File
@@ -13,6 +13,7 @@
#include "Map Information.h"
#include "Game Clock.h"
#include "Overhead.h"
#include "debug control.h"
#endif
/*
@@ -140,7 +141,7 @@ UINT8 ubBloodGraphicLUT [ ] = { 3, 3, 2, 2, 1, 1, 0, 0 };
(s) = BLOOD_ROOF_TYPE( ntr ) | (s & 0xFD); \
}
void RemoveBlood( INT16 sGridNo, INT8 bLevel )
void RemoveBlood( INT32 sGridNo, INT8 bLevel )
{
gpWorldLevelData[ sGridNo ].ubBloodInfo = 0;
@@ -152,7 +153,7 @@ void RemoveBlood( INT16 sGridNo, INT8 bLevel )
void DecaySmells( void )
{
UINT32 uiLoop;
INT32 uiLoop;
MAP_ELEMENT * pMapElement;
//return;
@@ -176,7 +177,7 @@ void DecaySmells( void )
void DecayBlood()
{
UINT32 uiLoop;
INT32 uiLoop;
MAP_ELEMENT * pMapElement;
for (uiLoop = 0, pMapElement = gpWorldLevelData; uiLoop < WORLD_MAX; uiLoop++, pMapElement++)
@@ -354,8 +355,12 @@ void DropSmell( SOLDIERTYPE * pSoldier )
}
void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStrength, INT8 bVisible )
void InternalDropBlood( INT32 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStrength, INT8 bVisible )
{
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"InternalDropBlood ( %i , %i , %i , %i , %i )\n",sGridNo, bLevel , ubType , ubStrength , bVisible );
MPDebugMsg(tmpMPDbgString);
MAP_ELEMENT * pMapElement;
UINT8 ubOldStrength=0;
UINT8 ubNewStrength=0;
@@ -373,8 +378,8 @@ void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStreng
return;
}
// ATE: Send warning if dropping blood nowhere....
if ( sGridNo == NOWHERE )
// ATE: Send warning if dropping blood nowhere....
if (TileIsOutOfBounds(sGridNo))
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Attempting to drop blood NOWHERE" );
@@ -499,7 +504,7 @@ void DropBlood( SOLDIERTYPE * pSoldier, UINT8 ubStrength, INT8 bVisible )
void UpdateBloodGraphics( INT16 sGridNo, INT8 bLevel )
void UpdateBloodGraphics( INT32 sGridNo, INT8 bLevel )
{
MAP_ELEMENT * pMapElement;
INT8 bValue;
+3 -3
View File
@@ -19,6 +19,6 @@ void DecaySmells( void );
void DecayBloodAndSmells( UINT32 uiTime );
void DropSmell( SOLDIERTYPE * pSoldier );
void DropBlood( SOLDIERTYPE * pSoldier, UINT8 ubStrength, INT8 bVisible );
void UpdateBloodGraphics( INT16 sGridNo, INT8 bLevel );
void RemoveBlood( INT16 sGridNo, INT8 bLevel );
void InternalDropBlood( INT16 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStrength, INT8 bVisible );
void UpdateBloodGraphics( INT32 sGridNo, INT8 bLevel );
void RemoveBlood( INT32 sGridNo, INT8 bLevel );
void InternalDropBlood( INT32 sGridNo, INT8 bLevel, UINT8 ubType, UINT8 ubStrength, INT8 bVisible );
+47 -8
View File
@@ -29,6 +29,9 @@
#endif
#include "SaveLoadGame.h"
#include "debug control.h"
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
@@ -41,9 +44,6 @@ UINT16 FromSmokeTypeToWorldFlags( INT8 bType );
#define NUM_SMOKE_EFFECT_SLOTS 25
// GLOBAL FOR SMOKE LISTING
SMOKEEFFECT gSmokeEffectData[ NUM_SMOKE_EFFECT_SLOTS ];
UINT32 guiNumSmokeEffects = 0;
@@ -88,7 +88,7 @@ void RecountSmokeEffects( void )
// Returns NO_SMOKE_EFFECT if none there...
INT8 GetSmokeEffectOnTile( INT16 sGridNo, INT8 bLevel )
INT8 GetSmokeEffectOnTile( INT32 sGridNo, INT8 bLevel )
{
UINT16 ubExtFlags;
@@ -171,7 +171,7 @@ UINT16 FromSmokeTypeToWorldFlags( INT8 bType )
INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner )
INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, BOOL fFromRemoteClient )
{
SMOKEEFFECT *pSmoke;
INT32 iSmokeIndex;
@@ -180,6 +180,33 @@ INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner )
if( ( iSmokeIndex = GetFreeSmokeEffect() )==(-1) )
return(-1);
// OJW - 20091027 - Syncronising smoke effect start for multiplayer
if (is_networked && is_client)
{
SOLDIERTYPE* pSoldier = MercPtrs[ubOwner];
if (pSoldier != NULL)
{
if (pSoldier->bTeam == 0 || (pSoldier->bTeam == 1 && is_server))
{
// let all the other clients know we are spawning this effect
// and align them with our random number generator
send_newsmokeeffect(sGridNo,usItem,ubOwner,bLevel,iSmokeIndex);
}
else if (!fFromRemoteClient)
{
// skip executing locally because we want the random number generator to be aligned
// with the client that spawns set off the smoke effect
return -1;
}
}
#ifdef JA2BETAVERSION
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"NewSmokeEffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i )\n",sGridNo, usItem , ubOwner , bLevel , iSmokeIndex );
MPDebugMsg(tmpMPDbgString);
gfMPDebugOutputRandoms = true;
#endif
}
memset( &gSmokeEffectData[ iSmokeIndex ], 0, sizeof( SMOKEEFFECT ) );
pSmoke = &gSmokeEffectData[ iSmokeIndex ];
@@ -257,7 +284,7 @@ INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner )
}
// ATE: FALSE into subsequent-- it's the first one!
SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, FALSE, bLevel, iSmokeIndex );
SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, FALSE, bLevel, iSmokeIndex , fFromRemoteClient , TRUE );
return( iSmokeIndex );
}
@@ -265,8 +292,14 @@ INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner )
// Add smoke to gridno
// ( Replacement algorithm uses distance away )
void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 bLevel )
void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT32 sGridNo, INT8 bLevel )
{
#ifdef JA2BETAVERSION
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"AddSmokeEffectToTile ( iSmokeEffectID : %i , bType : %i , sGridNo : %i , bLevel : %i )\n", iSmokeEffectID, bType , sGridNo , bLevel );
MPDebugMsg(tmpMPDbgString);
#endif
ANITILE_PARAMS AniParams;
ANITILE *pAniTile;
SMOKEEFFECT *pSmoke;
@@ -444,8 +477,14 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8
SetRenderFlags(RENDER_FLAG_FULL);
}
void RemoveSmokeEffectFromTile( INT16 sGridNo, INT8 bLevel )
void RemoveSmokeEffectFromTile( INT32 sGridNo, INT8 bLevel )
{
#ifdef JA2BETAVERSION
CHAR tmpMPDbgString[512];
sprintf(tmpMPDbgString,"RemoveSmokeEffectFromTile ( sGridNo : %i , bLevel : %i )\n", sGridNo, bLevel );
MPDebugMsg(tmpMPDbgString);
#endif
ANITILE *pAniTile;
UINT8 ubLevelID;
+10 -7
View File
@@ -17,10 +17,11 @@ enum
#define SMOKE_EFFECT_ON_ROOF 0x02
#define SMOKE_EFFECT_MARK_FOR_UPDATE 0x04
#define NUM_SMOKE_EFFECT_SLOTS 25 // OJW - 20091027 - moved here to allow global access
typedef struct TAG_SMOKE_EFFECT
{
INT16 sGridNo; // gridno at which the tear gas cloud is centered
INT32 sGridNo; // gridno at which the tear gas cloud is centered
UINT8 ubDuration; // the number of turns gas will remain effective
UINT8 ubRadius; // the current radius of the cloud in map tiles
@@ -32,24 +33,26 @@ typedef struct TAG_SMOKE_EFFECT
UINT8 ubOwner;
UINT8 ubPadding;
UINT32 uiTimeOfLastUpdate;
INT8 iMPTeamIndex;
INT32 iMPSmokeEffectID;
} SMOKEEFFECT;
extern SMOKEEFFECT gSmokeEffectData[ NUM_SMOKE_EFFECT_SLOTS ];
extern UINT32 guiNumSmokeEffects;
// Returns NO_SMOKE_EFFECT if none there...
INT8 GetSmokeEffectOnTile( INT16 sGridNo, INT8 bLevel );
INT8 GetSmokeEffectOnTile( INT32 sGridNo, INT8 bLevel );
// Decays all smoke effects...
void DecaySmokeEffects( UINT32 uiTime );
// Add smoke to gridno
// ( Replacement algorithm uses distance away )
void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT16 sGridNo, INT8 bLevel );
void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT32 sGridNo, INT8 bLevel );
void RemoveSmokeEffectFromTile( INT16 sGridNo, INT8 bLevel );
void RemoveSmokeEffectFromTile( INT32 sGridNo, INT8 bLevel );
INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner );
INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, BOOL fFromRemoteClient = 0 );
BOOLEAN SaveSmokeEffectsToSaveGameFile( HWFILE hFile );
+19 -21
View File
@@ -160,33 +160,31 @@ typedef struct TAG_DB_STRUCTURE_REF
DB_STRUCTURE_TILE ** ppTile; // dynamic array
} DB_STRUCTURE_REF; // 8 bytes
typedef struct TAG_STRUCTURE
//dnl ch46 031009
typedef struct TAG_STRUCTURE
{
struct TAG_STRUCTURE * pPrev;
struct TAG_STRUCTURE * pNext;
INT16 sGridNo;
UINT16 usStructureID;
DB_STRUCTURE_REF * pDBStructureRef;
struct TAG_STRUCTURE* pPrev;
struct TAG_STRUCTURE* pNext;
DB_STRUCTURE_REF* pDBStructureRef;
PROFILE* pShape;
UINT32 fFlags;// need to have something to indicate base tile/not
INT32 sGridNo;
union
{
struct
{
UINT8 ubHitPoints;
UINT8 ubLockStrength;
UINT8 ubHitPoints;
UINT8 ubLockStrength;
};
//struct
//{
INT16 sBaseGridNo;
//};
}; // 2 bytes
INT16 sCubeOffset;// height of bottom of object in profile "cubes"
UINT32 fFlags; // need to have something to indicate base tile/not
PROFILE * pShape;
UINT8 ubWallOrientation;
UINT8 ubVehicleHitLocation;
UINT8 ubStructureHeight; // if 0, then unset; otherwise stores height of structure when last calculated
UINT8 ubUnused[1];
} STRUCTURE; // 32 bytes
INT32 sBaseGridNo;
};
UINT16 usStructureID;
INT16 sCubeOffset;// height of bottom of object in profile "cubes"
UINT8 ubWallOrientation;
UINT8 ubVehicleHitLocation;
UINT8 ubStructureHeight;// if 0, then unset; otherwise stores height of structure when last calculated
UINT8 ubUnused;
}STRUCTURE;// 36 bytes
typedef struct TAG_STRUCTURE_FILE_REF
{
+218 -64
View File
@@ -48,7 +48,7 @@
#include "connect.h"
#include "saveloadscreen.h"
#include "Map Edgepoints.h"
#include "renderworld.h"//dnl ch45 051009
typedef struct MERCPLACEMENT
{
@@ -71,8 +71,12 @@ enum
};
UINT32 iTPButtons[ NUM_TP_BUTTONS ];
//dnl ch45 051009
#define PLACEMENT_OFFSET 150
extern INT32 giXA, giYA;
extern BOOLEAN gfOverheadMapDirty;
extern BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo );
extern BOOLEAN GetOverheadMouseGridNo( INT32 *psGridNo );
extern UINT16 iOffsetHorizontal;
extern UINT16 iOffsetVertical;
@@ -90,6 +94,13 @@ INT32 giPlacements = 0;
BOOLEAN gfTacticalPlacementGUIDirty = FALSE;
BOOLEAN gfValidLocationsChanged = FALSE;
SGPRect gTPClipRect = {0,0,0,0};
// WANNE - MP: Center
SGPRect gTPClipRectCenterLeft = {0,0,0,0};
SGPRect gTPClipRectCenterTop = {0,0,0,0};
SGPRect gTPClipRectCenterRight = {0,0,0,0};
SGPRect gTPClipRectCenterBottom = {0,0,0,0};
BOOLEAN gfValidCursor = FALSE;
BOOLEAN gfEveryonePlaced = FALSE;
@@ -104,6 +115,9 @@ SOLDIERTYPE *gpTacticalPlacementHilightedSoldier = NULL;
BOOLEAN gfNorth, gfEast, gfSouth, gfWest;
// WANNE - MP: Center
BOOLEAN gfCenter;
void DoneOverheadPlacementClickCallback( GUI_BUTTON *btn, INT32 reason );
void SpreadPlacementsCallback ( GUI_BUTTON *btn, INT32 reason );
void GroupPlacementsCallback( GUI_BUTTON *btn, INT32 reason );
@@ -150,7 +164,7 @@ void FindValidInsertionCode( UINT8 *pubStrategicInsertionCode )
iOffsetHorizontal + 30, iOffsetVertical + 160, 600, FONT10ARIALBOLD, FONT_YELLOW, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED );
RefreshScreen( NULL );
GenerateMapEdgepoints();
GenerateMapEdgepoints(TRUE);//dnl ch43 290909
switch( *pubStrategicInsertionCode )
{
case INSERTION_CODE_NORTH:
@@ -234,7 +248,9 @@ void InitTacticalPlacementGUI()
gfTacticalPlacementGUIDirty = TRUE;
gfValidLocationsChanged = TRUE;
gfTacticalPlacementFirstTime = TRUE;
gfNorth = gfEast = gfSouth = gfWest = FALSE;
// WANNE - MP: Center
gfNorth = gfEast = gfSouth = gfWest = gfCenter = FALSE;
#ifdef JA2BETAVERSION
gfNorthValid = gfEastValid = gfSouthValid = gfWestValid = FALSE;
gfChangedEntrySide = FALSE;
@@ -318,7 +334,6 @@ void InitTacticalPlacementGUI()
SpecifyButtonHilitedTextColors( iTPButtons[ GROUP_BUTTON ], FONT_WHITE, FONT_NEARBLACK );
SpecifyButtonHilitedTextColors( iTPButtons[ DONE_BUTTON ], FONT_WHITE, FONT_NEARBLACK );
//First pass: Count the number of mercs that are going to be placed by the player.
// This determines the size of the array we will allocate.
giPlacements = 0;
@@ -357,7 +372,6 @@ void InitTacticalPlacementGUI()
{
MercPtrs[ i ]->ubStrategicInsertionCode = GetValidInsertionDirectionForMP(MercPtrs[ i ]->ubStrategicInsertionCode);
}
// ATE: If we are in a vehicle - remove ourselves from it!
//if ( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) )
//{
@@ -372,7 +386,6 @@ void InitTacticalPlacementGUI()
gMercPlacement[ giPlacements ].pSoldier = MercPtrs[ i ];
gMercPlacement[ giPlacements ].ubStrategicInsertionCode = MercPtrs[ i ]->ubStrategicInsertionCode;
gMercPlacement[ giPlacements ].fPlaced = FALSE;
#ifdef JA2BETAVERSION
CheckForValidMapEdge( &MercPtrs[ i ]->ubStrategicInsertionCode );
#else
@@ -380,7 +393,6 @@ void InitTacticalPlacementGUI()
if (is_networked)
CheckForValidMapEdge( &MercPtrs[ i ]->ubStrategicInsertionCode );
#endif
switch( MercPtrs[ i ]->ubStrategicInsertionCode )
{
case INSERTION_CODE_NORTH:
@@ -396,6 +408,13 @@ void InitTacticalPlacementGUI()
gfWest = TRUE;
break;
}
// WANNE - MP: Center
if (is_networked && MercPtrs[ i ]->ubStrategicInsertionCode == INSERTION_CODE_CENTER)
{
gfCenter = TRUE;
}
giPlacements++;
}
}
@@ -497,7 +516,12 @@ UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint)
validInsertionDirection = INSERTION_CODE_WEST;
}
break;
}
// WANNE - MP: Center
case INSERTION_CODE_CENTER:
foundValidDirection = true;
validInsertionDirection = INSERTION_CODE_CENTER;
break;
}
// Find alternate insertion direction by looping through all directions (N, S, E, W)
if (!foundValidDirection)
@@ -560,7 +584,6 @@ UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint)
return validInsertionDirection;
}
void RenderTacticalPlacementGUI()
{
INT32 i, xp, yp, width, height;
@@ -681,12 +704,42 @@ void RenderTacticalPlacementGUI()
gfValidLocationsChanged--;
BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, iOffsetHorizontal, iOffsetVertical, 640, 320 );
InvalidateRegion( iOffsetHorizontal, iOffsetVertical, iOffsetHorizontal + 640, iOffsetVertical + 320 );
//dnl ch45 051009
gTPClipRect.iLeft = iOffsetHorizontal + 1;
gTPClipRect.iTop = iOffsetVertical + 1;
gTPClipRect.iBottom = iOffsetVertical + 318;
gTPClipRect.iRight = iOffsetHorizontal + 634;
if( gbCursorMercID == -1 )
{
gTPClipRect.iLeft = gfWest ? iOffsetHorizontal + 30 : iOffsetHorizontal;
gTPClipRect.iTop = gfNorth ? iOffsetVertical + 30 + 3 : iOffsetVertical + 3;
gTPClipRect.iRight = gfEast ? iOffsetHorizontal + 610 : iOffsetHorizontal + 634; // 636
gTPClipRect.iBottom = gfSouth ? iOffsetVertical + 290 : iOffsetVertical + 320;
// WANNE - MP: Center
if (is_networked && gfCenter)
{
// Left black border
gTPClipRectCenterLeft.iLeft = iOffsetHorizontal;
gTPClipRectCenterLeft.iTop = iOffsetVertical + 3;
gTPClipRectCenterLeft.iBottom = iOffsetVertical + 320;
gTPClipRectCenterLeft.iRight = iOffsetHorizontal + 250;
// Top black border
gTPClipRectCenterTop.iLeft = iOffsetHorizontal;
gTPClipRectCenterTop.iTop = iOffsetVertical + 3;
gTPClipRectCenterTop.iBottom = iOffsetVertical + 130;
gTPClipRectCenterTop.iRight = iOffsetHorizontal + 634;
// Right black border
gTPClipRectCenterRight.iLeft = iOffsetHorizontal + 634 - 250;
gTPClipRectCenterRight.iTop = iOffsetVertical + 3;
gTPClipRectCenterRight.iBottom = iOffsetVertical + 320;
gTPClipRectCenterRight.iRight = iOffsetHorizontal + 634;
// Bottom black border
gTPClipRectCenterBottom.iLeft = iOffsetHorizontal;
gTPClipRectCenterBottom.iTop = iOffsetVertical + 320 - 130;
gTPClipRectCenterBottom.iBottom = iOffsetVertical + 320;
gTPClipRectCenterBottom.iRight = iOffsetHorizontal + 634;
}
}
else
{
@@ -696,33 +749,101 @@ void RenderTacticalPlacementGUI()
gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode = GetValidInsertionDirectionForMP(gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode);
}
gTPClipRect.iLeft = iOffsetHorizontal;
gTPClipRect.iTop = iOffsetVertical + 3;
//gTPClipRect.iRight = iOffsetHorizontal + 640;
gTPClipRect.iRight = iOffsetHorizontal + 634; // 635
gTPClipRect.iBottom = iOffsetVertical + 320;
switch( gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode )
//dnl ch45 051009
INT16 sWorldScreenX, sX;
INT16 sWorldScreenY, sY;
sX = giXA;
sY = giYA;
GetWorldXYAbsoluteScreenXY(sX, sY, &sWorldScreenX, &sWorldScreenY);
sWorldScreenX += 20;// Correction from invisible area X
sWorldScreenY += 35;// Correction from invisible area Y
switch(gMercPlacement[gbCursorMercID].ubStrategicInsertionCode)
{
case INSERTION_CODE_NORTH:
gTPClipRect.iTop = iOffsetVertical + 30 + 3;
break;
case INSERTION_CODE_EAST:
gTPClipRect.iRight = iOffsetHorizontal + 610;
break;
case INSERTION_CODE_SOUTH:
gTPClipRect.iBottom = iOffsetVertical + 290;
break;
case INSERTION_CODE_WEST:
gTPClipRect.iLeft = iOffsetHorizontal + 30;
break;
case INSERTION_CODE_NORTH:
if(sWorldScreenY <= PLACEMENT_OFFSET)
{
sY = (PLACEMENT_OFFSET - sWorldScreenY) / 5;
gTPClipRect.iTop += sY;
}
break;
case INSERTION_CODE_EAST:
if((sWorldScreenX + NORMAL_MAP_SCREEN_WIDTH) >= (MAPWIDTH - PLACEMENT_OFFSET))
{
sX = ((sWorldScreenX + NORMAL_MAP_SCREEN_WIDTH) - (MAPWIDTH - PLACEMENT_OFFSET)) / 5;
gTPClipRect.iRight -= sX;
}
break;
case INSERTION_CODE_SOUTH:
if((sWorldScreenY + NORMAL_MAP_SCREEN_HEIGHT) >= (MAPHEIGHT - PLACEMENT_OFFSET))
{
sY = ((sWorldScreenY + NORMAL_MAP_SCREEN_HEIGHT) - (MAPHEIGHT - PLACEMENT_OFFSET)) / 5;
gTPClipRect.iBottom -= sY;
}
break;
case INSERTION_CODE_WEST:
if(sWorldScreenX <= PLACEMENT_OFFSET)
{
sX = (PLACEMENT_OFFSET - sWorldScreenX) / 5;
gTPClipRect.iLeft += sX;
}
break;
}
// WANNE - MP: Center
if (is_networked && gfCenter)
{
// Left black border
gTPClipRectCenterLeft.iLeft = iOffsetHorizontal;
gTPClipRectCenterLeft.iTop = iOffsetVertical + 3;
gTPClipRectCenterLeft.iBottom = iOffsetVertical + 320;
gTPClipRectCenterLeft.iRight = iOffsetHorizontal + 250;
// Top black border
gTPClipRectCenterTop.iLeft = iOffsetHorizontal;
gTPClipRectCenterTop.iTop = iOffsetVertical + 3;
gTPClipRectCenterTop.iBottom = iOffsetVertical + 130;
gTPClipRectCenterTop.iRight = iOffsetHorizontal + 634;
// Right black border
gTPClipRectCenterRight.iLeft = iOffsetHorizontal + 634 - 250;
gTPClipRectCenterRight.iTop = iOffsetVertical + 3;
gTPClipRectCenterRight.iBottom = iOffsetVertical + 320;
gTPClipRectCenterRight.iRight = iOffsetHorizontal + 634;
// Bottom black border
gTPClipRectCenterBottom.iLeft = iOffsetHorizontal;
gTPClipRectCenterBottom.iTop = iOffsetVertical + 320 - 130;
gTPClipRectCenterBottom.iBottom = iOffsetVertical + 320;
gTPClipRectCenterBottom.iRight = iOffsetHorizontal + 634;
}
}
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
Blt16BPPBufferLooseHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &gTPClipRect, usHatchColor );
if (!gfCenter)
Blt16BPPBufferLooseHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &gTPClipRect, usHatchColor );
// WANNE - MP: Center
else
{
Blt16BPPBufferLooseHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &gTPClipRectCenterLeft, usHatchColor );
Blt16BPPBufferLooseHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &gTPClipRectCenterTop, usHatchColor );
Blt16BPPBufferLooseHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &gTPClipRectCenterRight, usHatchColor );
Blt16BPPBufferLooseHatchRectWithColor( (UINT16*)pDestBuf, uiDestPitchBYTES, &gTPClipRectCenterBottom, usHatchColor );
}
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
RectangleDraw( TRUE, gTPClipRect.iLeft, gTPClipRect.iTop, gTPClipRect.iRight, gTPClipRect.iBottom, usHatchColor, pDestBuf );
if (!gfCenter)
RectangleDraw( TRUE, gTPClipRect.iLeft, gTPClipRect.iTop, gTPClipRect.iRight, gTPClipRect.iBottom, usHatchColor, pDestBuf );
else
{
RectangleDraw( TRUE, gTPClipRectCenterLeft.iLeft, gTPClipRectCenterLeft.iTop, gTPClipRectCenterLeft.iRight, gTPClipRectCenterLeft.iBottom, usHatchColor, pDestBuf );
RectangleDraw( TRUE, gTPClipRectCenterTop.iLeft, gTPClipRectCenterTop.iTop, gTPClipRectCenterTop.iRight, gTPClipRectCenterTop.iBottom, usHatchColor, pDestBuf );
RectangleDraw( TRUE, gTPClipRectCenterRight.iLeft, gTPClipRectCenterRight.iTop, gTPClipRectCenterRight.iRight, gTPClipRectCenterRight.iBottom, usHatchColor, pDestBuf );
RectangleDraw( TRUE, gTPClipRectCenterBottom.iLeft, gTPClipRectCenterBottom.iTop, gTPClipRectCenterBottom.iRight, gTPClipRectCenterBottom.iBottom, usHatchColor, pDestBuf );
}
UnLockVideoSurface( FRAME_BUFFER );
}
for( i = 0; i < giPlacements; i++ )
@@ -844,7 +965,7 @@ void TacticalPlacementHandle()
EnsureDoneButtonStatus();
RenderTacticalPlacementGUI();
if (is_networked)
lockui(0);//lockui before placement while clients loading //hayden
@@ -863,13 +984,14 @@ void TacticalPlacementHandle()
{
#ifdef JA2TESTVERSION
case ESC:
KillTacticalPlacementGUI();
//if (!is_networked)
KillTacticalPlacementGUI();
break;
#endif
case ENTER:
if( ButtonList[ iTPButtons[ DONE_BUTTON ] ]->uiFlags & BUTTON_ENABLED )
{
if(!is_client)KillTacticalPlacementGUI();
/*if(!is_client)KillTacticalPlacementGUI();*/
//if(is_client)send_donegui(0); only by mouse //hayden
}
break;
@@ -891,11 +1013,13 @@ void TacticalPlacementHandle()
case 'l'://hayden
if( InputEvent.usKeyState & ALT_DOWN )
{
/*
if (is_networked)
{
KillTacticalPlacementGUI();
DoQuickLoad();
}
*/
}
break;
case '7':
@@ -910,28 +1034,51 @@ void TacticalPlacementHandle()
}
gfValidCursor = FALSE;
if( gbSelectedMercID != -1 && gusMouseYPos < (iOffsetVertical + 320) && gusMouseYPos > iOffsetVertical
&& gusMouseXPos > iOffsetHorizontal && gusMouseXPos < (iOffsetHorizontal + 640))
if(gbSelectedMercID != -1 && gusMouseYPos < (iOffsetVertical + 320) && gusMouseYPos > iOffsetVertical && gusMouseXPos > iOffsetHorizontal && gusMouseXPos < (iOffsetHorizontal + 640))
{
switch( gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode )
//dnl ch45 051009
INT16 sWorldScreenX = (gusMouseXPos - iOffsetHorizontal) * 5;
INT16 sWorldScreenY = (gusMouseYPos - iOffsetVertical) * 5;
INT32 iCellX, iCellY;
GetFromAbsoluteScreenXYWorldXY(&iCellX, &iCellY, sWorldScreenX, sWorldScreenY);
iCellX = (iCellX / CELL_X_SIZE) + (giXA - 0);
iCellY = (iCellY / CELL_Y_SIZE) + (giYA - WORLD_ROWS/2);
GetWorldXYAbsoluteScreenXY(iCellX, iCellY, &sWorldScreenX, &sWorldScreenY);
switch(gMercPlacement[gbCursorMercID].ubStrategicInsertionCode)
{
case INSERTION_CODE_NORTH:
if( gusMouseYPos <= (iOffsetVertical + 30) ) // 40
gfValidCursor = TRUE;
break;
case INSERTION_CODE_EAST:
if( gusMouseXPos >= (iOffsetHorizontal + 610) ) // 600
gfValidCursor = TRUE;
break;
case INSERTION_CODE_SOUTH:
if( gusMouseYPos >= (iOffsetVertical + 290) ) // 280
gfValidCursor = TRUE;
break;
case INSERTION_CODE_WEST:
if( gusMouseXPos <= (iOffsetHorizontal + 30) ) // 40
gfValidCursor = TRUE;
break;
case INSERTION_CODE_NORTH:
if(sWorldScreenY <= PLACEMENT_OFFSET)
gfValidCursor = TRUE;
break;
case INSERTION_CODE_EAST:
if(sWorldScreenX >= (MAPWIDTH - PLACEMENT_OFFSET))
gfValidCursor = TRUE;
break;
case INSERTION_CODE_SOUTH:
if(sWorldScreenY >= (MAPHEIGHT - PLACEMENT_OFFSET))
gfValidCursor = TRUE;
break;
case INSERTION_CODE_WEST:
if(sWorldScreenX <= PLACEMENT_OFFSET)
gfValidCursor = TRUE;
break;
}
// WANNE - MP: Center
if (is_networked && gfCenter)
{
if (gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode == INSERTION_CODE_CENTER )
{
if (gusMouseYPos >= (iOffsetVertical + 130) && // N
gusMouseYPos <= (iOffsetVertical + 320 - 130) && // S
gusMouseXPos >= (iOffsetHorizontal + 250) && // W
gusMouseXPos <= (iOffsetHorizontal + 634 - 250)) // E
{
gfValidCursor = TRUE;
}
}
}
if( gubDefaultButton == GROUP_BUTTON )
{
if( gfValidCursor )
@@ -972,6 +1119,8 @@ void TacticalPlacementHandle()
{
gfKillTacticalGUI = 1;
}
ScrollOverheadMap();//dnl ch45 021009
}
void KillTacticalPlacementGUI()
@@ -1045,7 +1194,8 @@ void ChooseRandomEdgepoints()
if ( !( gMercPlacement[ i ].pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( &gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode );
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData != NOWHERE )
if( !TileIsOutOfBounds(gMercPlacement[ i ].pSoldier->usStrategicInsertionData))
{
gMercPlacement[ i ].pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
lastValidICode = gMercPlacement[ i ].ubStrategicInsertionCode;
@@ -1241,7 +1391,7 @@ void SelectNextUnplacedUnit()
void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason )
{
INT32 i;
INT16 sGridNo;
INT32 sGridNo;
BOOLEAN fInvalidArea = FALSE;
UINT8 lastValidICode = INSERTION_CODE_GRIDNO;
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
@@ -1263,7 +1413,8 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason
if( gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID )
{
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode, &gMercPlacement[ i ].ubStrategicInsertionCode );
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData == NOWHERE )
if(TileIsOutOfBounds(gMercPlacement[ i ].pSoldier->usStrategicInsertionData))
{
fInvalidArea = TRUE;
break;
@@ -1288,7 +1439,8 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason
else
{ //This is a single merc placement. If valid, then place him, else report error.
gMercPlacement[ gbSelectedMercID ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ gbSelectedMercID ].ubStrategicInsertionCode );
if( gMercPlacement[ gbSelectedMercID ].pSoldier->usStrategicInsertionData != NOWHERE )
if( !TileIsOutOfBounds(gMercPlacement[ gbSelectedMercID ].pSoldier->usStrategicInsertionData))
{
gMercPlacement[ gbSelectedMercID ].pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
PutDownMercPiece( gbSelectedMercID );
@@ -1355,7 +1507,8 @@ void SetCursorMerc( INT8 bPlacementID )
void PutDownMercPiece( INT32 iPlacement )
{
INT16 sGridNo, sCellX, sCellY;
INT32 sGridNo;
INT16 sCellX, sCellY;
UINT8 ubDirection;
SOLDIERTYPE *pSoldier;
@@ -1384,7 +1537,8 @@ void PutDownMercPiece( INT32 iPlacement )
if( gMercPlacement[ iPlacement ].fPlaced )
PickUpMercPiece( iPlacement );
sGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sInsertionGridNo, 4, &ubDirection );
if( sGridNo != NOWHERE )
if(!TileIsOutOfBounds(sGridNo))
{
ConvertGridNoToCellXY( sGridNo, &sCellX, &sCellY );
+1
View File
@@ -16,6 +16,7 @@ UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint);
extern BOOLEAN gfTacticalPlacementGUIActive;
extern BOOLEAN gfEnterTacticalPlacementGUI;
extern BOOLEAN gfTacticalPlacementGUIDirty;//dnl ch45 071009
extern SOLDIERTYPE *gpTacticalPlacementSelectedSoldier;
extern SOLDIERTYPE *gpTacticalPlacementHilightedSoldier;
+2 -2
View File
@@ -41,7 +41,7 @@ ANITILE *CreateAnimationTile( ANITILE_PARAMS *pAniParams )
ANITILE *pNewAniNode;
LEVELNODE *pNode;
INT32 iCachedTile=-1;
INT16 sGridNo;
INT32 sGridNo;
UINT8 ubLevel;
INT16 usTileType;
INT16 usTileIndex;
@@ -803,7 +803,7 @@ void SetAniTileFrame( ANITILE *pAniTile, INT16 sFrame )
}
ANITILE *GetCachedAniTileOfType( INT16 sGridNo, UINT8 ubLevelID, UINT32 uiFlags )
ANITILE *GetCachedAniTileOfType( INT32 sGridNo, UINT8 ubLevelID, UINT32 uiFlags )
{
LEVELNODE *pNode = NULL;
+3 -3
View File
@@ -55,7 +55,7 @@ typedef struct TAG_anitile
INT16 sRelativeX;
INT16 sRelativeY;
INT16 sRelativeZ;
INT16 sGridNo;
INT32 sGridNo;
UINT16 usTileIndex;
UINT16 usCachedTileSubIndex; // sub Index
@@ -87,7 +87,7 @@ typedef struct TAG_anitile_params
INT16 sX; // World X ( optional )
INT16 sY; // World Y ( optional )
INT16 sZ; // World Z ( optional )
INT16 sGridNo; // World GridNo
INT32 sGridNo; // World GridNo
LEVELNODE *pGivenLevelNode; // Levelnode for existing tile ( optional )
CHAR8 zCachedFile[ 100 ]; // Filename for cached tile name ( optional )
@@ -133,7 +133,7 @@ void DeleteAniTiles( );
void HideAniTile( ANITILE *pAniTile, BOOLEAN fHide );
void PauseAniTile( ANITILE *pAniTile, BOOLEAN fPause );
ANITILE *GetCachedAniTileOfType( INT16 sGridNo, UINT8 ubLevelID, UINT32 uiFlags );
ANITILE *GetCachedAniTileOfType( INT32 sGridNo, UINT8 ubLevelID, UINT32 uiFlags );
void PauseAllAniTilesOfType( UINT32 uiType, BOOLEAN fPause );
+1 -1
View File
@@ -314,7 +314,7 @@ STRUCTURE_FILE_REF *GetCachedTileStructureRefFromFilename( const STR8 cFilename
}
void CheckForAndAddTileCacheStructInfo( LEVELNODE *pNode, INT16 sGridNo, UINT16 usIndex, UINT16 usSubIndex )
void CheckForAndAddTileCacheStructInfo( LEVELNODE *pNode, INT32 sGridNo, UINT16 usIndex, UINT16 usSubIndex )
{
STRUCTURE_FILE_REF *pStructureFileRef;
+1 -1
View File
@@ -42,7 +42,7 @@ STRUCTURE_FILE_REF *GetCachedTileStructureRefFromFilename( const STR8 cFilename
HVOBJECT GetCachedTileVideoObject( INT32 iIndex );
STRUCTURE_FILE_REF *GetCachedTileStructureRef( INT32 iIndex );
void CheckForAndAddTileCacheStructInfo( LEVELNODE *pNode, INT16 sGridNo, UINT16 usIndex, UINT16 usSubIndex );
void CheckForAndAddTileCacheStructInfo( LEVELNODE *pNode, INT32 sGridNo, UINT16 usIndex, UINT16 usSubIndex );
void CheckForAndDeleteTileCacheStructInfo( LEVELNODE *pNode, UINT16 usIndex );
void GetRootName( STR8 pDestStr, const STR8 pSrcStr );
File diff suppressed because it is too large Load Diff
-510
View File
@@ -1,510 +0,0 @@
# Microsoft Developer Studio Project File - Name="TileEngine" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=TileEngine - Win32 Demo Bounds Checker
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "TileEngine.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "TileEngine.mak" CFG="TileEngine - Win32 Demo Bounds Checker"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "TileEngine - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Release with Debug Info" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Bounds Checker" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Debug Demo" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Release Demo" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Static Library")
!MESSAGE "TileEngine - Win32 Demo Bounds Checker" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA"
# PROP Scc_LocalPath "..\..\..\ja2\build"
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "TileEngine - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir "."
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"TileEngine All.h" /FD /O2b2 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir "."
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\Standard Gaming Platform" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"TileEngine All.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Release with Debug Info"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release with Debug Info"
# PROP BASE Intermediate_Dir "Release with Debug Info"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release with Debug"
# PROP Intermediate_Dir "Release with Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\tacticalai" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "NDEBUG" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /FR /YX /FD /O2b2 /c
# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"TileEngine All.h" /FD /O2b2 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Bounds Checker"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "TileEng0"
# PROP BASE Intermediate_Dir "TileEng0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Bounds Checker"
# PROP Intermediate_Dir "Bounds Checker"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "_DEBUG" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /FR /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR /YX"TileEngine All.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Debug Demo"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "TileEngi"
# PROP BASE Intermediate_Dir "TileEngi"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug Demo"
# PROP Intermediate_Dir "Debug Demo"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "_DEBUG" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /FR /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "_DEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"TileEngine All.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Release Demo"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "TileEng1"
# PROP BASE Intermediate_Dir "TileEng1"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release Demo"
# PROP Intermediate_Dir "Release Demo"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\tacticalai" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "NDEBUG" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "RELEASE_WITH_DEBUG_INFO" /FR /YX /FD /O2b2 /c
# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\tacticalai" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"TileEngine All.h" /FD /O2b2 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Demo Release with Debug Info"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "TileEng2"
# PROP BASE Intermediate_Dir "TileEng2"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Demo Release with Debug"
# PROP Intermediate_Dir "Demo Release with Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\tacticalai" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "NDEBUG" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "RELEASE_WITH_DEBUG_INFO" /FR /YX /FD /O2b2 /c
# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"TileEngine All.h" /FD /O2b2 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "TileEngine - Win32 Demo Bounds Checker"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "TileEng3"
# PROP BASE Intermediate_Dir "TileEng3"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Demo Bounds Checker"
# PROP Intermediate_Dir "Demo Bounds Checker"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "CALLBACKTIMER" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "BOUNDS_CHECKER" /FR /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\Tactical" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Editor" /I "\ja2\build\strategic" /I "\ja2\build\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"TileEngine All.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "TileEngine - Win32 Release"
# Name "TileEngine - Win32 Debug"
# Name "TileEngine - Win32 Release with Debug Info"
# Name "TileEngine - Win32 Bounds Checker"
# Name "TileEngine - Win32 Debug Demo"
# Name "TileEngine - Win32 Release Demo"
# Name "TileEngine - Win32 Demo Release with Debug Info"
# Name "TileEngine - Win32 Demo Bounds Checker"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=".\Ambient Control.cpp"
# End Source File
# Begin Source File
SOURCE=.\Buildings.cpp
# End Source File
# Begin Source File
SOURCE=.\environment.cpp
# End Source File
# Begin Source File
SOURCE=".\Exit Grids.cpp"
# End Source File
# Begin Source File
SOURCE=".\Explosion Control.cpp"
# End Source File
# Begin Source File
SOURCE=".\Fog Of War.cpp"
# End Source File
# Begin Source File
SOURCE=".\Interactive Tiles.cpp"
# End Source File
# Begin Source File
SOURCE=".\Isometric Utils.cpp"
# End Source File
# Begin Source File
SOURCE=.\LightEffects.cpp
# End Source File
# Begin Source File
SOURCE=.\lighting.cpp
# End Source File
# Begin Source File
SOURCE=".\Map Edgepoints.cpp"
# End Source File
# Begin Source File
SOURCE=".\overhead map.cpp"
# End Source File
# Begin Source File
SOURCE=".\phys math.cpp"
# End Source File
# Begin Source File
SOURCE=.\physics.cpp
# End Source File
# Begin Source File
SOURCE=.\pits.cpp
# End Source File
# Begin Source File
SOURCE=".\Radar Screen.cpp"
# End Source File
# Begin Source File
SOURCE=".\Render Dirty.cpp"
# End Source File
# Begin Source File
SOURCE=".\Render Fun.cpp"
# End Source File
# Begin Source File
SOURCE=.\renderworld.cpp
# End Source File
# Begin Source File
SOURCE=.\SaveLoadMap.cpp
# End Source File
# Begin Source File
SOURCE=".\Shade Table Util.cpp"
# End Source File
# Begin Source File
SOURCE=".\Simple Render Utils.cpp"
# End Source File
# Begin Source File
SOURCE=.\Smell.cpp
# End Source File
# Begin Source File
SOURCE=.\SmokeEffects.cpp
# End Source File
# Begin Source File
SOURCE=.\structure.cpp
# End Source File
# Begin Source File
SOURCE=.\sysutil.cpp
# End Source File
# Begin Source File
SOURCE=".\Tactical Placement GUI.cpp"
# End Source File
# Begin Source File
SOURCE=".\Tile Animation.cpp"
# End Source File
# Begin Source File
SOURCE=".\Tile Cache.cpp"
# End Source File
# Begin Source File
SOURCE=".\Tile Surface.cpp"
# End Source File
# Begin Source File
SOURCE=.\TileDat.cpp
# End Source File
# Begin Source File
SOURCE=.\tiledef.cpp
# End Source File
# Begin Source File
SOURCE=.\WorldDat.cpp
# End Source File
# Begin Source File
SOURCE=.\worlddef.cpp
# End Source File
# Begin Source File
SOURCE=.\worldman.cpp
# End Source File
# Begin Source File
SOURCE=.\XML_ExplosionData.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=".\Ambient Control.h"
# End Source File
# Begin Source File
SOURCE=".\Ambient Types.h"
# End Source File
# Begin Source File
SOURCE=.\Buildings.h
# End Source File
# Begin Source File
SOURCE=.\edit_sys.h
# End Source File
# Begin Source File
SOURCE=.\environment.h
# End Source File
# Begin Source File
SOURCE=".\Exit Grids.h"
# End Source File
# Begin Source File
SOURCE=".\Fog Of War.h"
# End Source File
# Begin Source File
SOURCE=".\Interactive Tiles.h"
# End Source File
# Begin Source File
SOURCE=".\Isometric Utils.h"
# End Source File
# Begin Source File
SOURCE=.\lighting.h
# End Source File
# Begin Source File
SOURCE=".\Map Edgepoints.h"
# End Source File
# Begin Source File
SOURCE=.\pits.h
# End Source File
# Begin Source File
SOURCE=".\Radar Screen.h"
# End Source File
# Begin Source File
SOURCE=".\render dirty.h"
# End Source File
# Begin Source File
SOURCE=".\Render Fun.h"
# End Source File
# Begin Source File
SOURCE=.\renderworld.h
# End Source File
# Begin Source File
SOURCE=.\SaveLoadMap.h
# End Source File
# Begin Source File
SOURCE=".\Shade Table Util.h"
# End Source File
# Begin Source File
SOURCE=".\Simple Render Utils.h"
# End Source File
# Begin Source File
SOURCE=.\Smell.h
# End Source File
# Begin Source File
SOURCE=".\Structure Internals.h"
# End Source File
# Begin Source File
SOURCE=.\structure.h
# End Source File
# Begin Source File
SOURCE=.\sysutil.h
# End Source File
# Begin Source File
SOURCE=".\Tile Animation.h"
# End Source File
# Begin Source File
SOURCE=.\TileDat.h
# End Source File
# Begin Source File
SOURCE=.\tiledef.h
# End Source File
# Begin Source File
SOURCE=".\TileEngine All.h"
# End Source File
# Begin Source File
SOURCE=.\WorldDat.h
# End Source File
# Begin Source File
SOURCE=.\worlddef.h
# End Source File
# Begin Source File
SOURCE=.\worldman.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+62
View File
@@ -267,6 +267,68 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release_WithDebugInfo|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_2005Express.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\utf8\source;..\VFS"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
+64
View File
@@ -268,6 +268,70 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release_WithDebugInfo|Win32"
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_VS2008.vsprops"
CharacterSet="0"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
+16 -17
View File
@@ -16,7 +16,6 @@
#include "VFS/vfs.h"
#include "XMLWriter.h"
// THIS FILE CONTAINS DEFINITIONS FOR TILESET FILES
void SetTilesetThreeTerrainValues();
@@ -48,7 +47,7 @@ void InitEngineTilesets( )
return;
}
xmlw.OpenNode("JA2SET");
xmlw.openNode("JA2SET");
// READ # TILESETS and compare
// fread( &gubNumSets, sizeof( gubNumSets ), 1, hfile );
@@ -60,7 +59,7 @@ void InitEngineTilesets( )
SET_ERROR( "Too many tilesets in the data file" );
return;
}
xmlw.AddAttributeToNextValue("numTilesets",(int)gubNumSets);
xmlw.addAttributeToNextValue("numTilesets",(int)gubNumSets);
// READ #files
// fread( &uiNumFiles, sizeof( uiNumFiles ), 1, hfile );
@@ -73,27 +72,27 @@ void InitEngineTilesets( )
SET_ERROR( "Number of tilesets slots in code does not match data file" );
return;
}
xmlw.AddAttributeToNextValue("numFiles",(int)uiNumFiles);
xmlw.OpenNode("tilesets");
xmlw.addAttributeToNextValue("numFiles",(int)uiNumFiles);
xmlw.openNode("tilesets");
// Loop through each tileset, load name then files
for ( cnt = 0; cnt < gubNumSets; cnt++ )
{
xmlw.AddAttributeToNextValue("index",(int)cnt);
xmlw.OpenNode("Tileset");
xmlw.addAttributeToNextValue("index",(int)cnt);
xmlw.openNode("Tileset");
//Read name
// fread( &zName, sizeof( zName ), 1, hfile );
FileRead( hfile, &zName, sizeof( zName ), &uiNumBytesRead );
xmlw.AddValue("Name",std::string(zName));
xmlw.addValue("Name",std::string(zName));
// Read ambience value
// fread( &(gTilesets[ cnt ].ubAmbientID), sizeof( UINT8), 1, hfile );
FileRead( hfile, &(gTilesets[ cnt ].ubAmbientID), sizeof( UINT8 ), &uiNumBytesRead );
xmlw.AddValue("AmbientID",(int)gTilesets[ cnt ].ubAmbientID);
xmlw.addValue("AmbientID",(int)gTilesets[ cnt ].ubAmbientID);
// Set into tileset
swprintf( gTilesets[ cnt ].zName, L"%S", zName );
xmlw.OpenNode("Files");
xmlw.openNode("Files");
// Loop for files
for ( cnt2 = 0; cnt2 < uiNumFiles; cnt2++ )
{
@@ -102,25 +101,25 @@ void InitEngineTilesets( )
FileRead( hfile, &zName, sizeof( zName ), &uiNumBytesRead );
if(!std::string(zName).empty())
{
xmlw.AddAttributeToNextValue("index",(int)cnt2);
xmlw.AddValue("file",std::string(zName));
xmlw.addAttributeToNextValue("index",(int)cnt2);
xmlw.addValue("file",std::string(zName));
}
// Set into database
strcpy( gTilesets[ cnt ].TileSurfaceFilenames[ cnt2 ], zName );
}
xmlw.CloseNode(); // Files
xmlw.CloseNode(); // tileset
xmlw.closeNode(); // Files
xmlw.closeNode(); // tileset
}
xmlw.CloseNode();
xmlw.closeNode();
// fclose( hfile );
FileClose( hfile );
xmlw.CloseNode();
xmlw.closeNode();
#ifdef USE_VFS
xmlw.WriteToFile("Ja2Set.dat.xml");
xmlw.writeToFile("Ja2Set.dat.xml");
#endif
// SET CALLBACK FUNTIONS!!!!!!!!!!!!!
gTilesets[ TLS_CAVES_1 ].MovementCostFnc = (TILESET_CALLBACK)SetTilesetTwoTerrainValues;
+13 -18
View File
@@ -495,12 +495,12 @@ UINT16 usTileNo, usSrcTileNo;
usTileNo=MAPROWCOLTOPOS(iY, iX);
usSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX);
if ( usTileNo >= NOWHERE )
if (TileIsOutOfBounds(usTileNo))
{
return( FALSE );
}
if ( usSrcTileNo >= NOWHERE )
if (TileIsOutOfBounds(usSrcTileNo))
{
return( FALSE );
}
@@ -553,18 +553,13 @@ UINT8 ubTravelCost;
{
return( FALSE );
}
//if ( usTileNo == 10125 || usTileNo == 10126 )
//{
// int i = 0;
//}
if ( usTileNo >= NOWHERE )
if ( TileIsOutOfBounds(usTileNo))
{
return( FALSE );
}
if ( usSrcTileNo >= NOWHERE )
if ( TileIsOutOfBounds(usSrcTileNo))
{
return( FALSE );
}
@@ -744,7 +739,7 @@ INT32 iDx, iDy;
Returns the light level at a particular level without fake lights
***************************************************************************************/
UINT8 LightTrueLevel( INT16 sGridNo, INT16 bLevel )
UINT8 LightTrueLevel( INT32 sGridNo, INT16 bLevel )
{
LEVELNODE * pNode;
INT32 iSum;
@@ -860,8 +855,8 @@ BOOLEAN fFake;
Assert(gpWorldLevelData!=NULL);
uiTile= MAPROWCOLTOPOS( iY, iX );
if ( uiTile >= NOWHERE )
if ( TileIsOutOfBounds( uiTile ) )
{
return( FALSE );
}
@@ -1002,8 +997,8 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE
Assert(gpWorldLevelData!=NULL);
uiTile= MAPROWCOLTOPOS( iY, iX );
if ( uiTile >= NOWHERE )
if ( TileIsOutOfBounds( uiTile ) )
{
return( FALSE );
}
@@ -1164,7 +1159,7 @@ UINT32 uiIndex;
uiIndex = MAPROWCOLTOPOS( iY, iX );
Assert(uiIndex!=0xffff);
Assert(uiIndex!=0xffffffff);
ubShade=__max(SHADE_MAX, ubShade);
ubShade=__min(SHADE_MIN, ubShade);
@@ -1253,7 +1248,7 @@ UINT32 uiTile;
uiTile = MAPROWCOLTOPOS( iY, iX );
CHECKF(uiTile!=0xffff);
CHECKF(uiTile!=0xffffffff);
pLand = gpWorldLevelData[uiTile].pLandHead;
@@ -2320,7 +2315,7 @@ BOOLEAN LightRevealWall(INT16 sX, INT16 sY, INT16 sSrcX, INT16 sSrcY)
fDoLeftWalls=FALSE;
// IF A FENCE, RETURN FALSE
if ( IsFencePresentAtGridno( (INT16)uiTile ) )
if ( IsFencePresentAtGridNo( uiTile ) )
{
return( FALSE );
}
+1 -1
View File
@@ -171,7 +171,7 @@ BOOLEAN CreateSoldierShadedPalette( SOLDIERTYPE *pSoldier, UINT32 uiBase, SGPPa
UINT16 CreateSoldierPaletteTables(SOLDIERTYPE *pSoldier, UINT32 uiType);
// returns the true light value at a tile (ignoring fake/merc lights)
UINT8 LightTrueLevel( INT16 sGridNo, INT16 bLevel );
UINT8 LightTrueLevel( INT32 sGridNo, INT16 bLevel );
// system variables
extern LIGHT_NODE *pLightList[MAX_LIGHT_TEMPLATES];
+270 -187
View File
@@ -49,18 +49,6 @@
extern SOLDIERINITNODE *gpSelected;
#endif
// OK, these are values that are calculated in InitRenderParams( ) with normal view settings.
// These would be different if we change ANYTHING about the game worlkd map sizes...
#define NORMAL_MAP_SCREEN_WIDTH 3160
#define NORMAL_MAP_SCREEN_HEIGHT 1540
#define NORMAL_MAP_SCREEN_X 1580
#define NORMAL_MAP_SCREEN_BY 2400
#define NORMAL_MAP_SCREEN_TY 860
#define FASTMAPROWCOLTOPOS( r, c ) ( (r) * WORLD_COLS + (c) )
typedef struct
{
@@ -91,17 +79,24 @@ BOOLEAN gfOverheadMapDirty = FALSE;
extern BOOLEAN gfRadarCurrentGuyFlash;
INT16 gsStartRestrictedX, gsStartRestrictedY;
BOOLEAN gfOverItemPool = FALSE;
INT16 gsOveritemPoolGridNo;
INT32 gsOveritemPoolGridNo;
UINT16 iOffsetHorizontal; // Horizontal start postion of the overview map
UINT16 iOffsetVertical; // Vertical start position of the overview map
//dnl ch45 021009 Current position of map displayed in overhead map, (A=TopLeft, B=BottomLeft, C=TopRight)
#define MAXSCROLL 4
INT32 giXA = 0, giYA = WORLD_ROWS/2;
INT32 giXB = (0 + OLD_WORLD_COLS/2), giYB = (WORLD_ROWS/2 + OLD_WORLD_ROWS/2);
INT32 giXC = (0 + OLD_WORLD_COLS/2), giYC = (WORLD_ROWS/2 - OLD_WORLD_ROWS/2);
extern BOOLEAN gfValidLocationsChanged;//dnl ch45 051009
void HandleOverheadUI( );
void ClickOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason);
void MoveOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason);
void DeleteOverheadDB( );
BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT16 *psGridNo );
BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT32 *psGridNo );
extern BOOLEAN AnyItemsVisibleOnLevel( ITEM_POOL *pItemPool, INT8 bZLevel );
@@ -109,8 +104,8 @@ extern void HandleAnyMercInSquadHasCompatibleStuff( UINT8 ubSquad, OBJECTTYPE *p
//Isometric utilities (for overhead stuff only)
BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo );
void GetOverheadScreenXYFromGridNo( INT16 sGridNo, INT16 *psScreenX, INT16 *psScreenY );
BOOLEAN GetOverheadMouseGridNo( INT32 *psGridNo );
BOOLEAN GetOverheadScreenXYFromGridNo(INT32 sGridNo, INT16* psScreenX, INT16* psScreenY);//dnl ch45 041009
void CopyOverheadDBShadetablesFromTileset( );
void RenderOverheadOverlays();
@@ -217,7 +212,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
INT16 sX1, sY1, sX2, sY2;
CalculateRestrictedMapCoords( NORTH, &sX1, &sY1, &sX2, &gsStartRestrictedY, iOffsetHorizontal + 640, iOffsetVertical + 320 );
CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &gsStartRestrictedX, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 );
CalculateRestrictedMapCoords( WEST, &sX1, &sY1, &gsStartRestrictedX, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 );//dnl ch49 061009
}
// Copy over shade tables from main tileset
@@ -237,12 +232,12 @@ void DeleteOverheadDB( )
}
BOOLEAN GetClosestItemPool( INT16 sSweetGridNo, ITEM_POOL **ppReturnedItemPool, UINT8 ubRadius, INT8 bLevel )
BOOLEAN GetClosestItemPool( INT32 sSweetGridNo, ITEM_POOL **ppReturnedItemPool, UINT8 ubRadius, INT8 bLevel )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sGridNo;
INT32 sGridNo;
INT32 uiRange, uiLowestRange = 999999;
INT32 leftmost;
BOOLEAN fFound = FALSE;
@@ -286,12 +281,12 @@ BOOLEAN GetClosestItemPool( INT16 sSweetGridNo, ITEM_POOL **ppReturnedItemPool,
return( fFound );
}
BOOLEAN GetClosestMercInOverheadMap( INT16 sSweetGridNo, SOLDIERTYPE **ppReturnedSoldier, UINT8 ubRadius )
BOOLEAN GetClosestMercInOverheadMap( INT32 sSweetGridNo, SOLDIERTYPE **ppReturnedSoldier, UINT8 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sGridNo;
INT32 sGridNo;
INT32 uiRange, uiLowestRange = 999999;
INT32 leftmost;
BOOLEAN fFound = FALSE;
@@ -335,46 +330,48 @@ BOOLEAN GetClosestMercInOverheadMap( INT16 sSweetGridNo, SOLDIERTYPE **ppReturne
return( fFound );
}
void DisplayMercNameInOverhead( SOLDIERTYPE *pSoldier )
//dnl ch45 041009
void DisplayMercNameInOverhead(SOLDIERTYPE* pSoldier)
{
INT16 sWorldScreenX, sX;
INT16 sWorldScreenY, sY;
INT16 sWorldScreenX, sX;
INT16 sWorldScreenY, sY;
// Get Screen position of guy.....
GetWorldXYAbsoluteScreenXY( ( pSoldier->sX / CELL_X_SIZE ), ( pSoldier->sY / CELL_Y_SIZE ), &sWorldScreenX, &sWorldScreenY );
sX = pSoldier->sX;
sY = pSoldier->sY;
sWorldScreenX = gsStartRestrictedX + ( sWorldScreenX / 5 ) + 5;
sWorldScreenY = gsStartRestrictedY + ( sWorldScreenY / 5 ) + ( pSoldier->sHeightAdjustment / 5 ) + (gpWorldLevelData[ pSoldier->sGridNo ].sHeight/5) - 8;
sX -= ((giXA - 0) * CELL_X_SIZE);
sY -= ((giYA - WORLD_ROWS/2) * CELL_Y_SIZE);
GetWorldXYAbsoluteScreenXY((sX/CELL_X_SIZE), (sY/CELL_Y_SIZE), &sWorldScreenX, &sWorldScreenY);
if(sWorldScreenX < 0 || sWorldScreenX > NORMAL_MAP_SCREEN_WIDTH || sWorldScreenY < 0 || sWorldScreenY > NORMAL_MAP_SCREEN_HEIGHT)
return;
sWorldScreenY += ( gsRenderHeight / 5 );
sWorldScreenX = gsStartRestrictedX + (sWorldScreenX/5) + 5;
sWorldScreenY = gsStartRestrictedY + (sWorldScreenY/5) + (pSoldier->sHeightAdjustment/5) + (gpWorldLevelData[pSoldier->sGridNo].sHeight/5) - 8;
sWorldScreenY += (gsRenderHeight/5);
// Display name
SetFont( TINYFONT1 );
SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_WHITE );
SetFont(TINYFONT1);
SetFontBackground(FONT_MCOLOR_BLACK);
SetFontForeground(FONT_MCOLOR_WHITE);
// Center here....
FindFontCenterCoordinates( sWorldScreenX, sWorldScreenY, (INT16)( 1 ), 1, pSoldier->name, TINYFONT1, &sX, &sY );
FindFontCenterCoordinates(sWorldScreenX, sWorldScreenY, (INT16)(1), 1, pSoldier->name, TINYFONT1, &sX, &sY);
// Full size maps
if (gsStartRestrictedX == 0)
{
if(gsStartRestrictedX == 0)
sX += iOffsetHorizontal;
}
// Full size maps
if (gsStartRestrictedY == 0)
{
if(gsStartRestrictedY == 0)
sY += iOffsetVertical;
}
// OK, selected guy is here...
gprintfdirty( sX, sY, pSoldier->name );
mprintf( sX, sY, pSoldier->name );
gprintfdirty(sX, sY, pSoldier->name);
mprintf(sX, sY, pSoldier->name);
}
void HandleOverheadMap( )
{
static BOOLEAN fFirst = TRUE;
@@ -417,8 +414,7 @@ void HandleOverheadMap( )
RestoreBackgroundRects( );
// Render the overhead map
RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal,
iOffsetVertical, 640 + iOffsetHorizontal, 320 + iOffsetVertical, FALSE );
RenderOverheadMap(giXA, giYA, iOffsetHorizontal, iOffsetVertical, 640+iOffsetHorizontal, 320+iOffsetVertical, FALSE);//dnl ch45 011009
HandleTalkingAutoFaces( );
@@ -456,22 +452,22 @@ void HandleOverheadMap( )
if( !gfEditMode && !gfTacticalPlacementGUIActive )
{
INT16 sMapPos;
INT32 usMapPos;
ITEM_POOL *pItemPool;
gfUIHandleSelectionAboveGuy = FALSE;
HandleAnyMercInSquadHasCompatibleStuff( (INT8) CurrentSquad( ), NULL, TRUE );
if ( GetOverheadMouseGridNo( &sMapPos ) )
if ( GetOverheadMouseGridNo( &usMapPos ) )
{
// ATE: Find the closest item pool within 5 tiles....
if ( GetClosestItemPool( sMapPos, &pItemPool, 1, 0 ) )
if ( GetClosestItemPool( usMapPos, &pItemPool, 1, 0 ) )
{
STRUCTURE *pStructure = NULL;
INT16 sIntTileGridNo;
INT32 sIntTileGridNo;
INT8 bZLevel = 0;
INT16 sActionGridNo = sMapPos;
INT32 sActionGridNo = usMapPos;
// Get interactive tile...
if ( ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ) )
@@ -483,43 +479,42 @@ void HandleOverheadMap( )
if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) )
{
DrawItemPoolList( pItemPool, sMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos );
DrawItemPoolList( pItemPool, usMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos );
gfOverItemPool = TRUE;
gsOveritemPoolGridNo = pItemPool->sGridNo;
}
}
if ( GetClosestItemPool( sMapPos, &pItemPool, 1, 1 ) )
if ( GetClosestItemPool( usMapPos, &pItemPool, 1, 1 ) )
{
INT8 bZLevel = 0;
if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) )
{
DrawItemPoolList( pItemPool, sMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, (UINT16)( gusMouseYPos - 5 ) );
DrawItemPoolList( pItemPool, usMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, (UINT16)( gusMouseYPos - 5 ) );
gfOverItemPool = TRUE;
gsOveritemPoolGridNo = pItemPool->sGridNo;
}
}
}
}
if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &sMapPos ) )
if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &usMapPos ) )
{
if ( GetClosestMercInOverheadMap( usMapPos, &pSoldier, 1 ) )
{
if ( GetClosestMercInOverheadMap( sMapPos, &pSoldier, 1 ) )
if ( pSoldier->bTeam == gbPlayerNum )
{
if ( pSoldier->bTeam == gbPlayerNum )
{
gfUIHandleSelectionAboveGuy = TRUE;
gsSelectedGuy = pSoldier->ubID;
}
DisplayMercNameInOverhead( pSoldier );
gfUIHandleSelectionAboveGuy = TRUE;
gsSelectedGuy = pSoldier->ubID;
}
DisplayMercNameInOverhead( pSoldier );
}
}
}
// Soldier dummy and items ...
RenderOverheadOverlays();
@@ -529,7 +524,7 @@ void HandleOverheadMap( )
{
pSoldier = MercPtrs[ gusSelectedSoldier ];
DisplayMercNameInOverhead( pSoldier );
DisplayMercNameInOverhead( pSoldier );
}
RenderButtons( );
@@ -559,6 +554,8 @@ void GoIntoOverheadMap( )
gfInOverheadMap = TRUE;
//dnl??? ch45 021009 Add here moving overhead map cords to your current position on big map
//RestoreExternBackgroundRect( INTERFACE_START_X, INTERFACE_START_Y, SCREEN_WIDTH, INTERFACE_HEIGHT );
// Overview map should be centered in the middle of the tactical screen.
@@ -636,50 +633,133 @@ void GoIntoOverheadMap( )
}
void HandleOverheadUI( )
//dnl ch45 021009
void HandleOverheadUI(void)
{
InputAtom InputEvent;
INT16 sMousePos=0;
UINT8 ubID;
INT32 sMousePos = 0;
InputAtom InputEvent;
UINT8 ubID;
// CHECK FOR MOUSE OVER REGIONS...
if ( GetOverheadMouseGridNo( &sMousePos ) )
if(GetOverheadMouseGridNo(&sMousePos))
{
// Look quickly for a soldier....
ubID = QuickFindSoldier( sMousePos );
if ( ubID != NOBODY )
ubID = QuickFindSoldier(sMousePos);
if(ubID != NOBODY)
{
// OK, selected guy is here...
// WANNE: Commented these lines out.
//gprintfdirty( gusMouseXPos, gusMouseYPos, MercPtrs[ ubID ]->name );
//mprintf( gusMouseXPos, gusMouseYPos, MercPtrs[ ubID ]->name );
}
}
while (DequeueEvent(&InputEvent) == TRUE)
ScrollOverheadMap();
while(DequeueEvent(&InputEvent) == TRUE)
{
if( ( InputEvent.usEvent == KEY_DOWN ) )
{
switch( InputEvent.usParam )
if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT)
{
INT32 i = 1;
switch(InputEvent.usParam)
{
case( ESC ):
case( INSERT ):
KillOverheadMap();
case ESC:
case INSERT:
KillOverheadMap();
break;
case( 'x' ):
if( ( InputEvent.usKeyState & ALT_DOWN ) )
{
HandleShortCutExitState( );
}
case 'x':
if(InputEvent.usKeyState & ALT_DOWN)
HandleShortCutExitState();
break;
}
}
}
}
void ScrollOverheadMap(void)
{
if(WORLD_MAX == OLD_WORLD_MAX)
return;
UINT32 uiFlags = 0;
INT32 i;
if(_KeyDown(UPARROW))
uiFlags |= SCROLL_UP;
if(_KeyDown(DNARROW))
uiFlags |= SCROLL_DOWN;
if(_KeyDown(RIGHTARROW))
uiFlags |= SCROLL_RIGHT;
if(_KeyDown(LEFTARROW))
uiFlags |= SCROLL_LEFT;
if(uiFlags)
{
gfOverheadMapDirty = TRUE;
gfValidLocationsChanged = TRUE;
gfTacticalPlacementGUIDirty = TRUE;
}
if(uiFlags & SCROLL_LEFT)// Scroll Left { Y = X + (3*WORLD_ROWS-WORLD_COLS)/4; --> p3 }
{
i = 1;
if(_KeyDown(SHIFT))
i = MAXSCROLL;
while(i--)
{
if(giYA == (giXA + (3*WORLD_ROWS-WORLD_COLS)/4))
break;
--giXA, ++giYA;
--giXB, ++giYB;
--giXC, ++giYC;
}
}
if(uiFlags & SCROLL_RIGHT)// Scroll Right { Y = X + (WORLD_ROWS-3*WORLD_COLS)/4; --> p3 }
{
i = 1;
if(_KeyDown(SHIFT))
i = MAXSCROLL;
while(i--)
{
if(giYC == (giXC + (WORLD_ROWS-3*WORLD_COLS)/4))
break;
++giXA, --giYA;
++giXB, --giYB;
++giXC, --giYC;
}
}
if(uiFlags & SCROLL_UP)// Scroll Up { Y = -X + (WORLD_ROWS+WORLD_COLS)/4; --> p4 }
{
i = 1;
if(_KeyDown(SHIFT))
i = MAXSCROLL;
while(i--)
{
if(giYA == (-giXA + (WORLD_ROWS+WORLD_COLS)/4))
break;
--giXA, --giYA;
--giXB, --giYB;
--giXC, --giYC;
}
}
if(uiFlags & SCROLL_DOWN)// Scroll Down { Y = -X + 3*(WORLD_ROWS+WORLD_COLS)/4; --> p2 }
{
i = 1;
if(_KeyDown(SHIFT))
i = MAXSCROLL;
while(i--)
{
if(giYB == (-giXB + 3*(WORLD_ROWS+WORLD_COLS)/4))
break;
++giXA, ++giYA;
++giXB, ++giYB;
++giXC, ++giYC;
}
}
}
void ResetScrollOverheadMap(void)
{
giXA = 0, giYA = WORLD_ROWS/2;
giXB = (0 + OLD_WORLD_COLS/2), giYB = (WORLD_ROWS/2 + OLD_WORLD_ROWS/2);
giXC = (0 + OLD_WORLD_COLS/2), giYC = (WORLD_ROWS/2 - OLD_WORLD_ROWS/2);
}
void KillOverheadMap()
@@ -736,7 +816,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
INT16 sTempPosX_M, sTempPosY_M;
INT16 sTempPosX_S, sTempPosY_S;
BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE;
UINT32 usTileIndex;
INT32 usTileIndex;
INT16 sX, sY;
UINT32 uiDestPitchBYTES;
UINT8 *pDestBuf;
@@ -760,10 +840,13 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
// Black color for the background!
//ColorFillVideoSurfaceArea( FRAME_BUFFER, sStartPointX_S, sStartPointY_S, sEndXS, sEndYS, 0 );
ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
if(gfTacticalPlacementGUIActive)//dnl ch45 021009 Skip overwrite buttons area which is not refresh during scroll
ColorFillVideoSurfaceArea(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-160, 0);
else
ColorFillVideoSurfaceArea(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-120, 0);
fInterfacePanelDirty = DIRTYLEVEL2;
InvalidateScreen( );
InvalidateScreen();
gfOverheadMapDirty = FALSE;
// Begin Render Loop
@@ -818,7 +901,6 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
//BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, gSmallTileDatabase[ gpWorldLevelData[ usTileIndex ].pLandHead->usIndex ], sX, sY, VO_BLT_SRCTRANSPARENCY, NULL );
//BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL );
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
pNode = pNode->pPrevNode;
}
@@ -1122,37 +1204,22 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
}
if ( !fFromMapUtility )
{
// Render border!
BltVideoObjectFromIndex( FRAME_BUFFER, uiOVERMAP, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL );
}
if(!fFromMapUtility)
BltVideoObjectFromIndex(FRAME_BUFFER, uiOVERMAP, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL);// Render border!
// Update the save buffer
{
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
UINT16 usWidth, usHeight;
UINT8 ubBitDepth;
// Update saved buffer - do for the viewport size ony!
GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth );
pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES);
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
if(gbPixelDepth==16)
{
// BLIT HERE
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0, 0, 0, 0, usWidth, usHeight );
}
UnLockVideoSurface(guiRENDERBUFFER);
UnLockVideoSurface(guiSAVEBUFFER);
}
// Update the save buffer
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
UINT16 usWidth, usHeight;
UINT8 ubBitDepth;
// Update saved buffer - do for the viewport size ony!
GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth );
pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES);
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
if(gbPixelDepth == 16)// BLIT HERE
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight );
UnLockVideoSurface(guiRENDERBUFFER);
UnLockVideoSurface(guiSAVEBUFFER);
}
}
@@ -1192,8 +1259,9 @@ void RenderOverheadOverlays()
continue;
//Soldier is here. Calculate his screen position based on his current gridno.
if(!GetOverheadScreenXYFromGridNo(pSoldier->sGridNo, &sX, &sY))//dnl ch45 041009
continue;
GetOverheadScreenXYFromGridNo( pSoldier->sGridNo, &sX, &sY );
//Now, draw his "doll"
//adjust for position.
@@ -1212,8 +1280,8 @@ void RenderOverheadOverlays()
continue;// ie dont render
}
}
if ( pSoldier->sGridNo == NOWHERE )
if (TileIsOutOfBounds(pSoldier->sGridNo))
{
continue;
}
@@ -1272,8 +1340,7 @@ void RenderOverheadOverlays()
else
#endif
if( !gfTacticalPlacementGUIActive )
{
//normal
{ //normal
if(is_networked)
{
if(pSoldier->bTeam!=0)
@@ -1301,15 +1368,12 @@ void RenderOverheadOverlays()
// Color depends on the bTeam
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
}
// Color depends on the bTeam
else
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
}
else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )
{
//vehicle
{ //vehicle
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 9 );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-6), (INT16)(sY), (INT16)(sX + 9), (INT16)(sY + 10));
}
@@ -1318,20 +1382,17 @@ void RenderOverheadOverlays()
// ubPassengers++;
//}
else if( gpTacticalPlacementSelectedSoldier == pSoldier )
{
//tactical placement selected merc
{ //tactical placement selected merc
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 7 );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
}
else if( gpTacticalPlacementHilightedSoldier == pSoldier && pSoldier->flags.uiStatusFlags )
{
//tactical placement hilighted merc
{ //tactical placement hilighted merc
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 8 );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
}
else
{
//normal
{ //normal
if(is_networked)
{
if(pSoldier->bTeam!=0)
@@ -1355,12 +1416,9 @@ void RenderOverheadOverlays()
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
}
else
// Color depends on the bTeam
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
}
if( ubPassengers )
{
SetFont( SMALLCOMPFONT );
@@ -1382,7 +1440,8 @@ void RenderOverheadOverlays()
continue;
}
GetOverheadScreenXYFromGridNo( pWorldItem->sGridNo, &sX, &sY );
if(!GetOverheadScreenXYFromGridNo(pWorldItem->sGridNo, &sX, &sY))//dnl ch45 041009
continue;
//adjust for position.
//sX += 2;
@@ -1677,6 +1736,10 @@ void ClickOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason)
// Get new proposed center location.
GetFromAbsoluteScreenXYWorldXY( (INT32 *)&uiCellX, (INT32 *)&uiCellY, sWorldScreenX, sWorldScreenY );
//dnl ch45 021009
uiCellX += ((giXA - 0) * CELL_X_SIZE);
uiCellY += ((giYA - WORLD_ROWS/2) * CELL_Y_SIZE);
SetRenderCenter( (INT16)uiCellX, (INT16)uiCellY );
KillOverheadMap();
@@ -1691,27 +1754,44 @@ void ClickOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason)
void MoveOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason)
{
;
}
void GetOverheadScreenXYFromGridNo( INT16 sGridNo, INT16 *psScreenX, INT16 *psScreenY )
//dnl ch45 041009
BOOLEAN GetOverheadScreenXYFromGridNo(INT32 sGridNo, INT16* psScreenX, INT16* psScreenY)
{
GetWorldXYAbsoluteScreenXY( (INT16)(CenterX( sGridNo ) / CELL_X_SIZE ), (INT16)( CenterY( sGridNo ) / CELL_Y_SIZE ), psScreenX, psScreenY );
INT16 sWorldScreenX, sX;
INT16 sWorldScreenY, sY;
ConvertGridNoToXY(sGridNo, &sX, &sY);
sX *= CELL_X_SIZE;
sY *= CELL_Y_SIZE;
sX -= ((giXA - 0) * CELL_X_SIZE);
sY -= ((giYA - WORLD_ROWS/2) * CELL_Y_SIZE);
GetWorldXYAbsoluteScreenXY((sX/CELL_X_SIZE), (sY/CELL_Y_SIZE), &sWorldScreenX, &sWorldScreenY);
if(sWorldScreenX < 0 || sWorldScreenX > NORMAL_MAP_SCREEN_WIDTH || sWorldScreenY < 0 || sWorldScreenY > NORMAL_MAP_SCREEN_HEIGHT)
return(FALSE);
*psScreenX = sWorldScreenX;
*psScreenY = sWorldScreenY;
*psScreenX /= 5;
*psScreenY /= 5;
*psScreenX += 5;
*psScreenY += 5;
//Subtract the height....
//*psScreenY -= gpWorldLevelData[ sGridNo ].sHeight / 5;
//*psScreenY -= gpWorldLevelData[sGridNo].sHeight / 5;
return(TRUE);
}
// WANNE: Fixed bug from sir tech, which occured on smaller maps ;-)
BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo )
BOOLEAN GetOverheadMouseGridNo( INT32 *psGridNo )
{
UINT32 uiCellX, uiCellY;
INT32 uiCellX, uiCellY;
INT16 sWorldScreenX, sWorldScreenY;
if ( ( OverheadRegion.uiFlags & MSYS_MOUSE_IN_AREA ) )
@@ -1743,16 +1823,19 @@ BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo )
GetFromAbsoluteScreenXYWorldXY( (INT32 *)&uiCellX, (INT32 *)&uiCellY, sWorldScreenX, sWorldScreenY );
// Get gridNo
(*psGridNo ) = (INT16)MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
(*psGridNo ) = MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
// Adjust for height.....
sWorldScreenY =sWorldScreenY + gpWorldLevelData[ (*psGridNo) ].sHeight;
sWorldScreenY = sWorldScreenY + gpWorldLevelData[ (*psGridNo) ].sHeight;
GetFromAbsoluteScreenXYWorldXY( (INT32 *)&uiCellX, (INT32 *)&uiCellY, sWorldScreenX, sWorldScreenY );
// Get gridNo
(*psGridNo ) = (INT16)MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
//dnl ch45 021009
uiCellX += ((giXA - 0) * CELL_X_SIZE);
uiCellY += ((giYA - WORLD_ROWS/2) * CELL_Y_SIZE);
// Get gridNo
(*psGridNo ) = MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
return( TRUE );
}
@@ -1764,9 +1847,9 @@ BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo )
// WANNE: Fixed bug from sir tech which occured on smaller maps ;-)
BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT16 *psGridNo )
BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT32 *psGridNo )
{
UINT32 uiCellX, uiCellY;
INT32 uiCellX, uiCellY;
INT16 sWorldScreenX, sWorldScreenY;
if ( ( OverheadRegion.uiFlags & MSYS_MOUSE_IN_AREA ) )
@@ -1798,16 +1881,19 @@ BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT16 *psGridNo )
GetFromAbsoluteScreenXYWorldXY( (INT32 *)&uiCellX, (INT32 *)&uiCellY, sWorldScreenX, sWorldScreenY );
// Get gridNo
(*psGridNo ) = (INT16)MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
(*psGridNo ) = MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
// Adjust for height.....
sWorldScreenY =sWorldScreenY + gpWorldLevelData[ (*psGridNo) ].sHeight;
sWorldScreenY = sWorldScreenY + gpWorldLevelData[ (*psGridNo) ].sHeight;
GetFromAbsoluteScreenXYWorldXY( (INT32 *)&uiCellX, (INT32 *)&uiCellY, sWorldScreenX, sWorldScreenY );
// Get gridNo
(*psGridNo ) = (INT16)MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
//dnl ch45 021009
uiCellX += ((giXA - 0) * CELL_X_SIZE);
uiCellY += ((giYA - WORLD_ROWS/2) * CELL_Y_SIZE);
// Get gridNo
(*psGridNo ) = MAPROWCOLTOPOS( ( uiCellY / CELL_Y_SIZE ), ( uiCellX / CELL_X_SIZE ) );
return( TRUE );
}
@@ -1820,37 +1906,34 @@ BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT16 *psGridNo )
// This method is used for smaller overhead maps, to calculate the non visible borders to make them black
// It is also used to get the starting (x and y coordinate)
void CalculateRestrictedMapCoords( INT8 bDirection, INT16 *psX1, INT16 *psY1, INT16 *psX2, INT16 *psY2, INT16 sEndXS, INT16 sEndYS )
void CalculateRestrictedMapCoords(INT8 bDirection, INT16 *psX1, INT16 *psY1, INT16 *psX2, INT16 *psY2, INT16 sEndXS, INT16 sEndYS)//dnl ch49 061009
{
switch( bDirection )
switch(bDirection)
{
case NORTH:
*psX1 = iOffsetHorizontal;
*psX2 = sEndXS;
*psY1 = iOffsetVertical;
*psY2 = ( abs( NORMAL_MAP_SCREEN_TY - gsTLY ) / 5) + iOffsetVertical;
break;
case EAST:
*psX1 = iOffsetHorizontal;
*psX2 = ( abs( -NORMAL_MAP_SCREEN_X - gsTLX ) / 5 ) + iOffsetHorizontal;
*psY1 = iOffsetVertical;
*psY2 = sEndYS;
break;
case SOUTH:
*psX1 = iOffsetHorizontal;
*psX2 = sEndXS;
*psY1 = ( NORMAL_MAP_SCREEN_HEIGHT - abs( NORMAL_MAP_SCREEN_BY - gsBLY )) / 5 + iOffsetVertical ;
*psY2 = sEndYS;
break;
case WEST:
*psX1 = ( NORMAL_MAP_SCREEN_WIDTH - abs( NORMAL_MAP_SCREEN_X - gsTRX )) / 5 + iOffsetHorizontal;
*psX2 = sEndXS;
*psY1 = iOffsetVertical;
*psY2 = sEndYS;
break;
case NORTH:
*psX1 = iOffsetHorizontal;
*psX2 = sEndXS;
*psY1 = iOffsetVertical;
*psY2 = (abs(NORMAL_MAP_SCREEN_TY - gsTLY) / 5) + iOffsetVertical;
break;
case WEST:
*psX1 = iOffsetHorizontal;
*psX2 = (abs(-NORMAL_MAP_SCREEN_X - gsTLX) / 5) + iOffsetHorizontal;
*psY1 = iOffsetVertical;
*psY2 = sEndYS;
break;
case SOUTH:
*psX1 = iOffsetHorizontal;
*psX2 = sEndXS;
*psY1 = ((NORMAL_MAP_SCREEN_HEIGHT - abs(NORMAL_MAP_SCREEN_BY - gsBLY)) / 5) + iOffsetVertical;
*psY2 = sEndYS;
break;
case EAST:
*psX1 = ((NORMAL_MAP_SCREEN_WIDTH - abs(NORMAL_MAP_SCREEN_X - gsTRX)) / 5) + iOffsetHorizontal;
*psX2 = sEndXS;
*psY1 = iOffsetVertical;
*psY2 = sEndYS;
break;
}
}
+14
View File
@@ -20,5 +20,19 @@ void CalculateRestrictedScaleFactors( INT16 *pScaleX, INT16 *pScaleY );
void TrashOverheadMap( );
//dnl ch45 031009
void ScrollOverheadMap(void);
void ResetScrollOverheadMap(void);
// WANNE - BMP: I THINK THIS NEEDS TO CHANGE FOR BIG MAPS!
// OK, these are values that are calculated in InitRenderParams( ) with normal view settings.
// These would be different if we change ANYTHING about the game worlkd map sizes...
#define NORMAL_MAP_SCREEN_WIDTH 3160
#define NORMAL_MAP_SCREEN_HEIGHT 1540
#define NORMAL_MAP_SCREEN_X 1580
#define NORMAL_MAP_SCREEN_BY 2400
#define NORMAL_MAP_SCREEN_TY 860
#define FASTMAPROWCOLTOPOS( r, c ) ( (r) * WORLD_COLS + (c) )
#endif
+75 -42
View File
@@ -37,6 +37,8 @@
#include "Campaign.h"
#include "SkillCheck.h"
#include "connect.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -107,16 +109,16 @@ void PhysicsDeleteObject( REAL_OBJECT *pObject );
BOOLEAN PhysicsHandleCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID, real DeltaTime );
FLOAT CalculateForceFromRange( INT16 sRange, FLOAT dDegrees );
INT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius );
INT32 RandomGridFromRadius( INT32 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius );
// Lesh: needed to fix item throwing through window
extern INT16 DirIncrementer[8];
void HandleArmedObjectImpact( REAL_OBJECT *pObject );
void ObjectHitWindow( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce );
FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT16 *psFinalGridNo );
vector_3 FindBestForceForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStartZ, INT16 sEndZ, real dzDegrees, OBJECTTYPE *pItem, INT16 *psGridNo, FLOAT *pzMagForce );
INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT16 *psFinalGridNo, INT8 *pbLevel, BOOLEAN fFromUI );
void ObjectHitWindow( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce );
FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT32 *psFinalGridNo );
vector_3 FindBestForceForTrajectory( INT32 sSrcGridNo, INT32 sGridNo,INT16 sStartZ, INT16 sEndZ, real dzDegrees, OBJECTTYPE *pItem, INT32 *psGridNo, FLOAT *pzMagForce );
INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT32 *psFinalGridNo, INT8 *pbLevel, BOOLEAN fFromUI );
FLOAT CalculateSoldierMaxForce( SOLDIERTYPE *pSoldier, FLOAT dDegrees, OBJECTTYPE *pObject, BOOLEAN fArmed );
BOOLEAN AttemptToCatchObject( REAL_OBJECT *pObject );
BOOLEAN CheckForCatchObject( REAL_OBJECT *pObject );
@@ -293,8 +295,8 @@ INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, r
pObject->pNode = NULL;
pObject->pShadow = NULL;
// If gridno not equal to NOWHERE, use sHeight of alnd....
if ( pObject->sGridNo != NOWHERE )
// If gridno not equal to NOWHERE, use sHeight of alnd....
if (!TileIsOutOfBounds(pObject->sGridNo))
{
pObject->Position.z += CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[ pObject->sGridNo ].sHeight );
pObject->EndedWithCollisionPosition.z += CONVERT_PIXELS_TO_HEIGHTUNITS( gpWorldLevelData[ pObject->sGridNo ].sHeight );
@@ -793,7 +795,7 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID )
FLOAT dElasity = 1;
UINT16 usStructureID = -1;
FLOAT dNormalX = 0.0, dNormalY = 0.0, dNormalZ = 1.0;
INT16 sGridNo = NOWHERE;
INT32 sGridNo = NOWHERE;
// Checkf for collisions
dX = pObject->Position.x;
@@ -1244,7 +1246,7 @@ void PhysicsResolveCollision( REAL_OBJECT *pObject, vector_3 *pVelocity, vector_
BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject )
{
LEVELNODE *pNode;
INT16 sNewGridNo, sTileIndex;
INT32 sNewGridNo, sTileIndex;
ETRLEObject *pTrav;
HVOBJECT hVObject;
@@ -1288,7 +1290,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject )
{
ANITILE_PARAMS AniParams;
AniParams.sGridNo = (INT16)sNewGridNo;
AniParams.sGridNo = sNewGridNo;
AniParams.ubLevelID = ANI_STRUCT_LEVEL;
AniParams.sDelay = (INT16)( 100 + PreRandom( 100 ) );
AniParams.sStartFrame = 0;
@@ -1411,7 +1413,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject )
#if 0
{
LEVELNODE *pNode;
INT16 sNewGridNo;
INT32 sNewGridNo;
//Determine new gridno
sNewGridNo = MAPROWCOLTOPOS( ( pObject->Position.y / CELL_Y_SIZE ), ( pObject->Position.x / CELL_X_SIZE ) );
@@ -1446,7 +1448,7 @@ BOOLEAN PhysicsMoveObject( REAL_OBJECT *pObject )
}
#endif
void ObjectHitWindow( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce )
void ObjectHitWindow( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce )
{
EV_S_WINDOWHIT SWindowHit;
SWindowHit.sGridNo = sGridNo;
@@ -1460,7 +1462,7 @@ void ObjectHitWindow( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSo
}
vector_3 FindBestForceForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStartZ, INT16 sEndZ, real dzDegrees, OBJECTTYPE *pItem, INT16 *psGridNo, real *pdMagForce )
vector_3 FindBestForceForTrajectory( INT32 sSrcGridNo, INT32 sGridNo,INT16 sStartZ, INT16 sEndZ, real dzDegrees, OBJECTTYPE *pItem, INT32 *psGridNo, real *pdMagForce )
{
vector_3 vDirNormal, vPosition, vForce;
INT16 sDestX, sDestY, sSrcX, sSrcY;
@@ -1554,12 +1556,12 @@ vector_3 FindBestForceForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStar
}
INT16 FindFinalGridNoGivenDirectionGridNoForceAngle( INT16 sSrcGridNo, INT16 sGridNo, INT16 sStartZ, INT16 sEndZ, real dForce, real dzDegrees, OBJECTTYPE *pItem )
INT32 FindFinalGridNoGivenDirectionGridNoForceAngle( INT32 sSrcGridNo, INT32 sGridNo, INT16 sStartZ, INT16 sEndZ, real dForce, real dzDegrees, OBJECTTYPE *pItem )
{
vector_3 vDirNormal, vPosition, vForce;
INT16 sDestX, sDestY, sSrcX, sSrcY;
real dRange;
INT16 sEndGridNo;
INT32 sEndGridNo;
// Get XY from gridno
@@ -1596,7 +1598,7 @@ INT16 FindFinalGridNoGivenDirectionGridNoForceAngle( INT16 sSrcGridNo, INT16 sGr
}
real FindBestAngleForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStartZ, INT16 sEndZ, real dForce, OBJECTTYPE *pItem, INT16 *psGridNo )
real FindBestAngleForTrajectory( INT32 sSrcGridNo, INT32 sGridNo,INT16 sStartZ, INT16 sEndZ, real dForce, OBJECTTYPE *pItem, INT32 *psGridNo )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"FindBestAngleForTrajectory");
@@ -1705,7 +1707,7 @@ real FindBestAngleForTrajectory( INT16 sSrcGridNo, INT16 sGridNo,INT16 sStartZ,
}
void FindTrajectory( INT16 sSrcGridNo, INT16 sGridNo, INT16 sStartZ, INT16 sEndZ, real dForce, real dzDegrees, OBJECTTYPE *pItem, INT16 *psGridNo )
void FindTrajectory( INT32 sSrcGridNo, INT32 sGridNo, INT16 sStartZ, INT16 sEndZ, real dForce, real dzDegrees, OBJECTTYPE *pItem, INT32 *psGridNo )
{
vector_3 vDirNormal, vPosition, vForce;
INT16 sDestX, sDestY, sSrcX, sSrcY;
@@ -1743,13 +1745,13 @@ void FindTrajectory( INT16 sSrcGridNo, INT16 sGridNo, INT16 sStartZ, INT16 sEndZ
// OK, this will, given a target Z, INVTYPE, source, target gridnos, initial force vector, will
// return range
FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT16 *psFinalGridNo )
FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT32 *psFinalGridNo )
{
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"CalculateObjectTrajectory");
INT32 iID;
REAL_OBJECT *pObject;
FLOAT dDiffX, dDiffY;
INT16 sGridNo;
INT32 sGridNo;
//int cnt=0;
if ( psFinalGridNo )
@@ -1805,7 +1807,7 @@ FLOAT CalculateObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vP
}
INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT16 *psNewGridNo, INT8 *pbLevel, BOOLEAN fFromUI )
INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vector_3 *vPosition, vector_3 *vForce, INT32 *psNewGridNo, INT8 *pbLevel, BOOLEAN fFromUI )
{
INT32 iID;
REAL_OBJECT *pObject;
@@ -1868,7 +1870,7 @@ INT32 ChanceToGetThroughObjectTrajectory( INT16 sTargetZ, OBJECTTYPE *pItem, vec
FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubHeight, real dForce, OBJECTTYPE *pItem, INT16 *psGridNo )
FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubHeight, real dForce, OBJECTTYPE *pItem, INT32 *psGridNo )
{
real dAngle;
INT16 sSrcX, sSrcY;
@@ -1883,9 +1885,9 @@ FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubHe
void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, FLOAT *pdMagForce, FLOAT *pdDegrees, INT16 *psFinalGridNo, BOOLEAN fArmed )
void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT32 sGridNo, UINT8 ubLevel, INT16 sEndZ, FLOAT *pdMagForce, FLOAT *pdDegrees, INT32 *psFinalGridNo, BOOLEAN fArmed )
{
INT16 sInterGridNo;
INT32 sInterGridNo = NOWHERE;
INT16 sStartZ;
FLOAT dMagForce, dMaxForce, dMinForce;
FLOAT dDegrees, dNewDegrees;
@@ -1944,7 +1946,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
fIndoors = TRUE;
}
if ( ( IsRoofPresentAtGridno( pSoldier->sGridNo ) ) && pSoldier->pathing.bLevel == 0 )
if ( ( IsRoofPresentAtGridNo( pSoldier->sGridNo ) ) && pSoldier->pathing.bLevel == 0 )
{
// Adjust angle....
dDegrees = INDOORS_START_ANGLE;
@@ -1952,7 +1954,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
}
// IS OUR TARGET INSIDE?
if ( IsRoofPresentAtGridno( sGridNo ) && ubLevel == 0 )
if ( IsRoofPresentAtGridNo( sGridNo ) && ubLevel == 0 )
{
// Adjust angle....
dDegrees = INDOORS_START_ANGLE;
@@ -1981,8 +1983,8 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
{
sInterGridNo = NOWHERE;
}
if ( sInterGridNo != NOWHERE )
if (!TileIsOutOfBounds(sInterGridNo))
{
// IF so, adjust target height, gridno....
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Through a window!" );
@@ -2067,7 +2069,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I
}
BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, INT16 *psFinalGridNo, BOOLEAN fArmed, INT8 *pbLevel, BOOLEAN fFromUI )
BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT32 sGridNo, UINT8 ubLevel, INT16 sEndZ, INT32 *psFinalGridNo, BOOLEAN fArmed, INT8 *pbLevel, BOOLEAN fFromUI )
{
FLOAT dForce, dDegrees;
INT16 sDestX, sDestY, sSrcX, sSrcY;
@@ -2132,8 +2134,8 @@ BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE
FLOAT CalculateForceFromRange( INT16 sRange, FLOAT dDegrees )
{
FLOAT dMagForce;
INT16 sSrcGridNo, sDestGridNo;
INT16 sFinalGridNo;
INT32 sSrcGridNo, sDestGridNo;
INT32 sFinalGridNo;
// OK, use a fake gridno, find the new gridno based on range, use height of merc, end height of ground,
// 45 degrees
@@ -2171,12 +2173,12 @@ FLOAT CalculateSoldierMaxForce( SOLDIERTYPE *pSoldier, FLOAT dDegrees , OBJECTTY
#define MIN_MISS_BY 1
#define MAX_MISS_RADIUS 5
void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, OBJECTTYPE *pItem, INT8 bMissBy, UINT8 ubActionCode, UINT32 uiActionData )
void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubLevel, INT16 sEndZ, OBJECTTYPE *pItem, INT8 bMissBy, UINT8 ubActionCode, UINT32 uiActionData )
{
FLOAT dForce, dDegrees;
INT16 sDestX, sDestY, sSrcX, sSrcY;
vector_3 vForce, vDirNormal;
INT16 sFinalGridNo;
INT32 sFinalGridNo;
BOOLEAN fArmed = FALSE;
UINT16 usLauncher;
INT16 sStartZ;
@@ -2507,11 +2509,20 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
INT16 sZ;
BOOLEAN fDoImpact = FALSE;
BOOLEAN fCheckForDuds = FALSE;
bool fIsDud = FALSE;
OBJECTTYPE *pObj;
INT32 iTrapped = 0;
UINT16 usFlags = 0;
INT8 bLevel = 0;
if (is_networked && is_client)
{
if (pObject->mpIsFromRemoteClient && !pObject->mpHaveClientResult)
{
return;
}
}
// Calculate pixel position of z
sZ = (INT16)CONVERT_HEIGHTUNITS_TO_PIXELS( (INT16)( pObject->Position.z ) ) - gpWorldLevelData[ pObject->sGridNo ].sHeight;
@@ -2541,16 +2552,31 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
if ( fCheckForDuds )
{
// If we landed on anything other than the floor, always! go off...
#ifdef TESTDUDEXPLOSIVES
if ( sZ != 0 || pObject->fInWater )
#else
if ( sZ != 0 || pObject->fInWater || ( (*pObj)[0]->data.objectStatus >= USABLE && ( PreRandom( 100 ) < (UINT32) (*pObj)[0]->data.objectStatus + PreRandom( 50 ) ) ) )
#endif
// OJW - 20021002 - MP Explosives
if (is_networked && is_client && pObject->mpIsFromRemoteClient && pObject->mpHaveClientResult)
{
fDoImpact = TRUE;
fIsDud = pObject->mpWasDud;
}
else // didn't go off!
else
{
// If we landed on anything other than the floor, always! go off...
#ifdef TESTDUDEXPLOSIVES
if ( sZ != 0 || pObject->fInWater )
#else
if ( sZ != 0 || pObject->fInWater || ( (*pObj)[0]->data.objectStatus >= USABLE && ( PreRandom( 100 ) < (UINT32) (*pObj)[0]->data.objectStatus + PreRandom( 50 ) ) ) )
#endif
{
fDoImpact = TRUE;
fIsDud = false;
}
else // didn't go off!
{
fIsDud = true;
}
}
if (fIsDud)
{
#ifdef TESTDUDEXPLOSIVES
if ( 1 )
@@ -2634,6 +2660,13 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject )
}
}
// OJW - 20021002 - MP Explosives
if (is_networked && is_client && !pObject->mpIsFromRemoteClient)
{
// send results to other clients
send_grenade_result( (INT16)pObject->Position.x, (INT16)pObject->Position.y, sZ , pObject->sGridNo , pObject->ubOwner, pObject->iID, fIsDud);
}
}
@@ -2717,10 +2750,10 @@ BOOLEAN LoadPhysicsTableFromSavedGameFile( HWFILE hFile )
}
INT16 RandomGridFromRadius( INT16 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius )
INT32 RandomGridFromRadius( INT32 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRadius )
{
INT16 sX, sY;
INT16 sGridNo = NOWHERE;
INT32 sGridNo = NOWHERE;
INT32 leftmost;
BOOLEAN fFound = FALSE;
UINT32 cnt = 0;
+17 -9
View File
@@ -39,7 +39,7 @@ public:
vector_3 CollisionVelocity;
real CollisionElasticity;
INT16 sGridNo;
INT32 sGridNo;
INT32 iID;
LEVELNODE *pNode;
LEVELNODE *pShadow;
@@ -52,7 +52,7 @@ public:
FLOAT dLifeSpan;
OLD_OBJECTTYPE_101 oldObj;
BOOLEAN fFirstTimeMoved;
INT16 sFirstGridNo;
INT32 sFirstGridNo;
UINT8 ubOwner;
UINT8 ubActionCode;
UINT32 uiActionData;
@@ -66,7 +66,7 @@ public:
vector_3 EndedWithCollisionPosition;
BOOLEAN fHaveHitGround;
BOOLEAN fPotentialForDebug;
INT16 sLevelNodeGridNo;
INT32 sLevelNodeGridNo;
INT32 iSoundID;
UINT8 ubLastTargetTakenDamage;
UINT8 ubPadding[1];
@@ -108,7 +108,7 @@ public:
vector_3 CollisionVelocity;
real CollisionElasticity;
INT16 sGridNo;
INT32 sGridNo;
INT32 iID;
LEVELNODE *pNode;
LEVELNODE *pShadow;
@@ -120,7 +120,7 @@ public:
FLOAT dLifeLength;
FLOAT dLifeSpan;
BOOLEAN fFirstTimeMoved;
INT16 sFirstGridNo;
INT32 sFirstGridNo;
UINT8 ubOwner;
UINT8 ubActionCode;
UINT32 uiActionData;
@@ -134,9 +134,15 @@ public:
vector_3 EndedWithCollisionPosition;
BOOLEAN fHaveHitGround;
BOOLEAN fPotentialForDebug;
INT16 sLevelNodeGridNo;
INT32 sLevelNodeGridNo;
INT32 iSoundID;
UINT8 ubLastTargetTakenDamage;
// OJW - 20091002 - mp explosives
UINT8 mpTeam; // the intiating clients team
INT32 mpRealObjectID; // ID from the initiating client
bool mpIsFromRemoteClient;
bool mpHaveClientResult;
bool mpWasDud;
char endOfPod;
OBJECTTYPE Obj;
@@ -153,13 +159,15 @@ extern REAL_OBJECT ObjectSlots[ NUM_OBJECT_SLOTS ];
INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject );
BOOLEAN RemoveObjectSlot( INT32 iObject );
void RemoveAllPhysicsObjects( );
// OJW - 20091002 - mp explosives
extern void HandleArmedObjectImpact( REAL_OBJECT *pObject );
FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubHeight, real dForce, OBJECTTYPE *pItem, INT16 *psGridNo );
FLOAT CalculateLaunchItemAngle( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubHeight, real dForce, OBJECTTYPE *pItem, INT32 *psGridNo );
BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT16 sGridNo, UINT8 ubLevel, INT16 sEndZ, INT16 *psFinalGridNo, BOOLEAN fArmed, INT8 *pbLevel, BOOLEAN fFromUI );
BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, INT32 sGridNo, UINT8 ubLevel, INT16 sEndZ, INT32 *psFinalGridNo, BOOLEAN fArmed, INT8 *pbLevel, BOOLEAN fFromUI );
void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubLevel, INT16 sZPos, OBJECTTYPE *pItem, INT8 bMissBy, UINT8 ubActionCode, UINT32 uiActionData );
void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubLevel, INT16 sZPos, OBJECTTYPE *pItem, INT8 bMissBy, UINT8 ubActionCode, UINT32 uiActionData );
+113 -112
View File
@@ -29,31 +29,32 @@ void Add3X3Pit( INT32 iMapIndex )
EXITGRID ExitGrid;
if( !gfEditMode )
ApplyMapChangesToMapTempFile( TRUE );
AddObjectToTail( iMapIndex + 159, REGWATERTEXTURE1 );
AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE2 );
AddObjectToTail( iMapIndex - 161, REGWATERTEXTURE3 );
AddObjectToTail( iMapIndex + 160, REGWATERTEXTURE4 );
AddObjectToTail( iMapIndex, REGWATERTEXTURE5 );
AddObjectToTail( iMapIndex - 160, REGWATERTEXTURE6 );
AddObjectToTail( iMapIndex + 161, REGWATERTEXTURE7 );
AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE8 );
AddObjectToTail( iMapIndex - 159, REGWATERTEXTURE9 );
AddObjectToTail( iMapIndex + WORLD_COLS-1, REGWATERTEXTURE1 );
AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE2 );
AddObjectToTail( iMapIndex - WORLD_COLS+1, REGWATERTEXTURE3 );
AddObjectToTail( iMapIndex + WORLD_COLS, REGWATERTEXTURE4 );
AddObjectToTail( iMapIndex, REGWATERTEXTURE5 );
AddObjectToTail( iMapIndex - WORLD_COLS, REGWATERTEXTURE6 );
AddObjectToTail( iMapIndex + WORLD_COLS+1, REGWATERTEXTURE7 );
AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE8 );
AddObjectToTail( iMapIndex - WORLD_COLS-1, REGWATERTEXTURE9 );
if( !gfEditMode )
{ //Add the exitgrids associated with the pit.
{
//Add the exitgrids associated with the pit.
ExitGrid.ubGotoSectorX = (UINT8)gWorldSectorX;
ExitGrid.ubGotoSectorY = (UINT8)gWorldSectorY;
ExitGrid.ubGotoSectorZ = (UINT8)(gbWorldSectorZ+1);
ExitGrid.sGridNo = (INT16)iMapIndex;
AddExitGridToWorld( iMapIndex + 159, &ExitGrid );
AddExitGridToWorld( iMapIndex - 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - 161, &ExitGrid );
AddExitGridToWorld( iMapIndex + 160, &ExitGrid );
AddExitGridToWorld( iMapIndex, &ExitGrid );
AddExitGridToWorld( iMapIndex - 160, &ExitGrid );
AddExitGridToWorld( iMapIndex + 161, &ExitGrid );
AddExitGridToWorld( iMapIndex + 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - 159, &ExitGrid );
RecompileLocalMovementCostsFromRadius( (INT16)iMapIndex, 2 );
ExitGrid.usGridNo = iMapIndex;
AddExitGridToWorld( iMapIndex + WORLD_COLS-1, &ExitGrid );
AddExitGridToWorld( iMapIndex - 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS+1, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS, &ExitGrid );
AddExitGridToWorld( iMapIndex, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS+1, &ExitGrid );
AddExitGridToWorld( iMapIndex + 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS-1, &ExitGrid );
RecompileLocalMovementCostsFromRadius( iMapIndex, 2 );
}
MarkWorldDirty();
@@ -66,63 +67,63 @@ void Add5X5Pit( INT32 iMapIndex )
EXITGRID ExitGrid;
if( !gfEditMode )
ApplyMapChangesToMapTempFile( TRUE );
AddObjectToTail( iMapIndex + 318, REGWATERTEXTURE10 );
AddObjectToTail( iMapIndex + 158, REGWATERTEXTURE11 );
AddObjectToTail( iMapIndex - 2, REGWATERTEXTURE12 );
AddObjectToTail( iMapIndex - 162, REGWATERTEXTURE13 );
AddObjectToTail( iMapIndex - 322, REGWATERTEXTURE14 );
AddObjectToTail( iMapIndex + 319, REGWATERTEXTURE15 );
AddObjectToTail( iMapIndex + 159, REGWATERTEXTURE16 );
AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE17 );
AddObjectToTail( iMapIndex - 161, REGWATERTEXTURE18 );
AddObjectToTail( iMapIndex - 321, REGWATERTEXTURE19 );
AddObjectToTail( iMapIndex + 320, REGWATERTEXTURE20 );
AddObjectToTail( iMapIndex + 160, REGWATERTEXTURE21 );
AddObjectToTail( iMapIndex, REGWATERTEXTURE22 );
AddObjectToTail( iMapIndex - 160, REGWATERTEXTURE23 );
AddObjectToTail( iMapIndex - 320, REGWATERTEXTURE24 );
AddObjectToTail( iMapIndex + 321, REGWATERTEXTURE25 );
AddObjectToTail( iMapIndex + 161, REGWATERTEXTURE26 );
AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE27 );
AddObjectToTail( iMapIndex - 159, REGWATERTEXTURE28 );
AddObjectToTail( iMapIndex - 319, REGWATERTEXTURE29 );
AddObjectToTail( iMapIndex + 322, REGWATERTEXTURE30 );
AddObjectToTail( iMapIndex + 162, REGWATERTEXTURE31 );
AddObjectToTail( iMapIndex + 2, REGWATERTEXTURE32 );
AddObjectToTail( iMapIndex - 158, REGWATERTEXTURE33 );
AddObjectToTail( iMapIndex - 318, REGWATERTEXTURE34 );
AddObjectToTail( iMapIndex + WORLD_COLS*2-2, REGWATERTEXTURE10 );
AddObjectToTail( iMapIndex + WORLD_COLS-2, REGWATERTEXTURE11 );
AddObjectToTail( iMapIndex - 2, REGWATERTEXTURE12 );
AddObjectToTail( iMapIndex - WORLD_COLS+2, REGWATERTEXTURE13 );
AddObjectToTail( iMapIndex - WORLD_COLS*2+2, REGWATERTEXTURE14 );
AddObjectToTail( iMapIndex + WORLD_COLS*2-1, REGWATERTEXTURE15 );
AddObjectToTail( iMapIndex + WORLD_COLS-1, REGWATERTEXTURE16 );
AddObjectToTail( iMapIndex - 1, REGWATERTEXTURE17 );
AddObjectToTail( iMapIndex - WORLD_COLS+1, REGWATERTEXTURE18 );
AddObjectToTail( iMapIndex - WORLD_COLS*2+1, REGWATERTEXTURE19 );
AddObjectToTail( iMapIndex + WORLD_COLS*2, REGWATERTEXTURE20 );
AddObjectToTail( iMapIndex + WORLD_COLS, REGWATERTEXTURE21 );
AddObjectToTail( iMapIndex, REGWATERTEXTURE22 );
AddObjectToTail( iMapIndex - WORLD_COLS, REGWATERTEXTURE23 );
AddObjectToTail( iMapIndex - WORLD_COLS*2, REGWATERTEXTURE24 );
AddObjectToTail( iMapIndex + WORLD_COLS*2+1, REGWATERTEXTURE25 );
AddObjectToTail( iMapIndex + WORLD_COLS+1, REGWATERTEXTURE26 );
AddObjectToTail( iMapIndex + 1, REGWATERTEXTURE27 );
AddObjectToTail( iMapIndex - WORLD_COLS-1, REGWATERTEXTURE28 );
AddObjectToTail( iMapIndex - WORLD_COLS*2-1, REGWATERTEXTURE29 );
AddObjectToTail( iMapIndex + WORLD_COLS*2+2, REGWATERTEXTURE30 );
AddObjectToTail( iMapIndex + WORLD_COLS+2, REGWATERTEXTURE31 );
AddObjectToTail( iMapIndex + 2, REGWATERTEXTURE32 );
AddObjectToTail( iMapIndex - WORLD_COLS-2, REGWATERTEXTURE33 );
AddObjectToTail( iMapIndex - WORLD_COLS*2-2, REGWATERTEXTURE34 );
if( !gfEditMode )
{ //Add the exitgrids associated with the pit.
ExitGrid.ubGotoSectorX = (UINT8)gWorldSectorX;
ExitGrid.ubGotoSectorY = (UINT8)gWorldSectorY;
ExitGrid.ubGotoSectorZ = (UINT8)(gbWorldSectorZ+1);
ExitGrid.sGridNo = (INT16)iMapIndex;
AddExitGridToWorld( iMapIndex + 318, &ExitGrid );
AddExitGridToWorld( iMapIndex + 158, &ExitGrid );
AddExitGridToWorld( iMapIndex - 2, &ExitGrid );
AddExitGridToWorld( iMapIndex - 162, &ExitGrid );
AddExitGridToWorld( iMapIndex - 322, &ExitGrid );
AddExitGridToWorld( iMapIndex + 319, &ExitGrid );
AddExitGridToWorld( iMapIndex + 159, &ExitGrid );
AddExitGridToWorld( iMapIndex - 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - 161, &ExitGrid );
AddExitGridToWorld( iMapIndex - 321, &ExitGrid );
AddExitGridToWorld( iMapIndex + 320, &ExitGrid );
AddExitGridToWorld( iMapIndex + 160, &ExitGrid );
AddExitGridToWorld( iMapIndex, &ExitGrid );
AddExitGridToWorld( iMapIndex - 160, &ExitGrid );
AddExitGridToWorld( iMapIndex - 320, &ExitGrid );
AddExitGridToWorld( iMapIndex + 321, &ExitGrid );
AddExitGridToWorld( iMapIndex + 161, &ExitGrid );
AddExitGridToWorld( iMapIndex + 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - 159, &ExitGrid );
AddExitGridToWorld( iMapIndex - 319, &ExitGrid );
AddExitGridToWorld( iMapIndex + 322, &ExitGrid );
AddExitGridToWorld( iMapIndex + 162, &ExitGrid );
AddExitGridToWorld( iMapIndex + 2, &ExitGrid );
AddExitGridToWorld( iMapIndex - 158, &ExitGrid );
AddExitGridToWorld( iMapIndex - 318, &ExitGrid );
RecompileLocalMovementCostsFromRadius( (INT16)iMapIndex, 3 );
ExitGrid.usGridNo = iMapIndex;
AddExitGridToWorld( iMapIndex + WORLD_COLS*2-2, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS-2, &ExitGrid );
AddExitGridToWorld( iMapIndex - 2, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS+2, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS*2+2, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS*2-1, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS-1, &ExitGrid );
AddExitGridToWorld( iMapIndex - 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS+1, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS*2+1, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS*2, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS, &ExitGrid );
AddExitGridToWorld( iMapIndex, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS*2, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS*2+1, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS+1, &ExitGrid );
AddExitGridToWorld( iMapIndex + 1, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS-1, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS*2-1, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS*2+2, &ExitGrid );
AddExitGridToWorld( iMapIndex + WORLD_COLS+2, &ExitGrid );
AddExitGridToWorld( iMapIndex + 2, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS-2, &ExitGrid );
AddExitGridToWorld( iMapIndex - WORLD_COLS*2-2, &ExitGrid );
RecompileLocalMovementCostsFromRadius( iMapIndex, 3 );
}
MarkWorldDirty();
if( !gfEditMode )
@@ -131,45 +132,45 @@ void Add5X5Pit( INT32 iMapIndex )
void Remove3X3Pit( INT32 iMapIndex )
{
RemoveAllObjectsOfTypeRange( iMapIndex + 159, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 161, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 160, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 160, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 161, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 159, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS-1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS+1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS+1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS-1, REGWATERTEXTURE, REGWATERTEXTURE );
MarkWorldDirty();
}
void Remove5X5Pit( INT32 iMapIndex )
{
RemoveAllObjectsOfTypeRange( iMapIndex + 318, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 158, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 162, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 322, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 319, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 159, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 161, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 321, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 320, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 160, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 160, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 320, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 321, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 161, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 159, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 319, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 322, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 162, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 158, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 318, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS*2-2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS-2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS+2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS*2+2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS*2-1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS-1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS+1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS*2+1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS*2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS*2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS*2+1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS+1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS-1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS*2-1, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS*2+2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + WORLD_COLS+2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex + 2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS-2, REGWATERTEXTURE, REGWATERTEXTURE );
RemoveAllObjectsOfTypeRange( iMapIndex - WORLD_COLS*2-2, REGWATERTEXTURE, REGWATERTEXTURE );
MarkWorldDirty();
}
@@ -203,9 +204,9 @@ void RemoveAllPits()
}
}
void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT16 sGridNo, INT16 sRadius )
void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 sRadius )
{
INT16 x, y, sNewGridNo;
INT32 x, y, sNewGridNo;
UINT8 ubID;
SOLDIERTYPE *pSoldier;
@@ -240,16 +241,16 @@ void HandleFallIntoPitFromAnimation( UINT8 ubID )
{
SOLDIERTYPE *pSoldier = MercPtrs[ ubID ];
EXITGRID ExitGrid;
INT16 sPitGridNo;
INT32 sPitGridNo;
// OK, get exit grid...
sPitGridNo = (INT16)pSoldier->aiData.uiPendingActionData4;
sPitGridNo = pSoldier->aiData.uiPendingActionData4;
GetExitGrid( sPitGridNo, &ExitGrid );
// Given exit grid, make buddy move to next sector....
pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
pSoldier->usStrategicInsertionData = ExitGrid.sGridNo;
pSoldier->usStrategicInsertionData = ExitGrid.usGridNo;
pSoldier->sSectorX = ExitGrid.ubGotoSectorX;
pSoldier->sSectorY = ExitGrid.ubGotoSectorY;
+1 -1
View File
@@ -6,7 +6,7 @@ void Add5X5Pit( INT32 iMapIndex );
void Remove3X3Pit( INT32 iMapIndex );
void Remove5X5Pit( INT32 iMapIndex );
void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT16 sGridNo, INT16 sRadius );
void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 sRadius );
void AddAllPits();
void RemoveAllPits();
+20 -17
View File
@@ -584,12 +584,15 @@ void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPoi
#ifdef _DEBUG
extern UINT8 gubFOVDebugInfoInfo[ WORLD_MAX ];
extern UINT8 gubGridNoMarkers[ WORLD_MAX ];
//extern UINT8 gubFOVDebugInfoInfo[ WORLD_MAX ];
//extern UINT8 gubGridNoMarkers[ WORLD_MAX ];
extern UINT8 * gubFOVDebugInfoInfo;
extern UINT8 * gubGridNoMarkers;
extern UINT8 gubGridNoValue;
extern BOOLEAN gfDisplayCoverValues;
extern BOOLEAN gfDisplayGridNoVisibleValues = 0;
extern INT16 gsCoverValue[ WORLD_MAX ];
//extern INT16 gsCoverValue[ WORLD_MAX ];
extern INT16 * gsCoverValue;
extern INT16 gsBestCover;
void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS );
@@ -710,7 +713,7 @@ TILE_ELEMENT *TileElem;
void ConcealAllWalls(void)
{
LEVELNODE *pStruct;
UINT32 uiCount;
INT32 uiCount;
for(uiCount=0; uiCount < WORLD_MAX; uiCount++)
{
@@ -790,7 +793,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
INT32 iTempPosX_S, iTempPosY_S;
FLOAT dOffsetX, dOffsetY;
FLOAT dTempX_S, dTempY_S;
UINT32 uiTileIndex;
INT32 uiTileIndex;
UINT16 usImageIndex, *pShadeTable, *pDirtyBackPtr;
UINT32 uiBrushWidth, uiBrushHeight, uiDirtyFlags;
INT16 sTileHeight, sXPos, sYPos, sZLevel;
@@ -821,7 +824,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
UINT16 usOutlineColor=0;
static INT32 iTileMapPos[ 500 ];
UINT32 uiMapPosIndex;
INT32 uiMapPosIndex;
UINT8 bBlitClipVal;
INT8 bItemCount, bVisibleItemCount;
//UINT16 us16BPPIndex;
@@ -953,8 +956,8 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
uiTileIndex = iTileMapPos[ uiMapPosIndex ];
uiMapPosIndex++;
//if ( 0 )
if ( uiTileIndex < GRIDSIZE )
//if ( 0 )
if (!TileIsOutOfBounds(uiTileIndex))
{
// OK, we're searching through this loop anyway, might as well check for mouse position
// over objects...
@@ -963,7 +966,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
{
if ( fCheckForMouseDetections && gpWorldLevelData[uiTileIndex].pStructHead != NULL )
{
LogMouseOverInteractiveTile( (INT16)uiTileIndex );
LogMouseOverInteractiveTile( uiTileIndex );
}
}
@@ -2556,8 +2559,8 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT
{
if(!(uiFlags&TILES_DIRTY))
UnLockVideoSurface( FRAME_BUFFER );
ColorFillVideoSurfaceArea( FRAME_BUFFER, iTempPosX_S, iTempPosY_S, (INT16)(iTempPosX_S + 40),
(INT16)( min( iTempPosY_S + 20, INTERFACE_START_Y )), Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
ColorFillVideoSurfaceArea( FRAME_BUFFER, iTempPosX_S, iTempPosY_S, (iTempPosX_S + 40),
( min( iTempPosY_S + 20, INTERFACE_START_Y )), Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
if(!(uiFlags&TILES_DIRTY))
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
}
@@ -3579,8 +3582,8 @@ void ScrollWorld( )
if ( gfIgnoreScrolling != 3 )
{
// Check for sliding
if ( gTacticalStatus.sSlideTarget != NOWHERE )
// Check for sliding
if (!TileIsOutOfBounds(gTacticalStatus.sSlideTarget))
{
// Ignore all input...
// Check if we have reached out dest!
@@ -4295,7 +4298,7 @@ BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOL
void ClearMarkedTiles(void)
{
UINT32 uiCount;
INT32 uiCount;
for(uiCount=0; uiCount < WORLD_MAX; uiCount++)
gpWorldLevelData[uiCount].uiFlags&=(~MAPELEMENT_REDRAW);
@@ -4325,7 +4328,7 @@ void InvalidateWorldRedundencyRadius(INT16 sX, INT16 sY, INT16 sRadius)
void InvalidateWorldRedundency( )
{
UINT32 uiCount;
INT32 uiCount;
SetRenderFlags( RENDER_FLAG_CHECKZ );
@@ -6434,8 +6437,8 @@ void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPoi
INT16 sTempPosX_M, sTempPosY_M;
INT16 sTempPosX_S, sTempPosY_S;
BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE;
UINT16 usTileIndex;
INT16 sX, sY;
INT32 usTileIndex;//dnl ch56 141009
UINT32 uiDestPitchBYTES;
UINT8 *pDestBuf;
@@ -6757,8 +6760,8 @@ void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, I
INT16 sTempPosX_M, sTempPosY_M;
INT16 sTempPosX_S, sTempPosY_S;
BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE;
UINT16 usTileIndex;
INT16 sX, sY;
INT32 usTileIndex;//dnl ch56 141009
UINT32 uiDestPitchBYTES;
UINT8 *pDestBuf;
+4
View File
@@ -150,6 +150,10 @@ extern BOOLEAN fLandLayerDirty;
extern BOOLEAN gfIgnoreScrollDueToCenterAdjust;
//dnl ch45 051009
#define MAPWIDTH (gsTRX - gsTLX)// World Screen Width
#define MAPHEIGHT (gsBRY - gsTRY)// World Screen Height
// FUNCTIONS
void ScrollWorld( );
+28 -26
View File
@@ -527,7 +527,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT
return( pStructure );
}
BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fIgnorePeople )
BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fIgnorePeople )
{
// Verifies whether a structure is blocked from being added to the map at a particular point
DB_STRUCTURE * pDBStructure;
@@ -535,8 +535,8 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
STRUCTURE * pExistingStructure;
STRUCTURE * pOtherExistingStructure;
INT8 bLoop, bLoop2;
INT16 sGridNo;
INT16 sOtherGridNo;
INT32 sGridNo;
INT32 sOtherGridNo;
ppTile = pDBStructureRef->ppTile;
sGridNo = sBaseGridNo + ppTile[ubTileIndex]->sPosRelToBase;
@@ -761,7 +761,7 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
return( TRUE );
}
BOOLEAN InternalOkayToAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fIgnorePeople )
BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fIgnorePeople )
{
UINT8 ubLoop;
INT16 sCubeOffset;
@@ -804,7 +804,7 @@ BOOLEAN InternalOkayToAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_ST
return( TRUE );
}
BOOLEAN OkayToAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID )
BOOLEAN OkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID )
{
return( InternalOkayToAddStructureToWorld( sBaseGridNo, bLevel, pDBStructureRef, sExclusionID, (BOOLEAN)(sExclusionID == IGNORE_PEOPLE_STRUCTURE_ID) ) );
}
@@ -836,10 +836,10 @@ BOOLEAN AddStructureToTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure, U
}
STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, LEVELNODE * pLevelNode )
STRUCTURE * InternalAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, LEVELNODE * pLevelNode )
{
// Adds a complete structure to the world at a location plus all other locations covered by the structure
INT16 sGridNo;
INT32 sGridNo;
STRUCTURE ** ppStructure;
STRUCTURE * pBaseStructure;
DB_STRUCTURE * pDBStructure;
@@ -1002,7 +1002,7 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU
return( pBaseStructure );
}
BOOLEAN AddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, PTR pLevelN )
BOOLEAN AddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, PTR pLevelN )
{
STRUCTURE * pStructure;
@@ -1068,12 +1068,12 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
STRUCTURE * pCurrent;
UINT8 ubLoop, ubLoop2;
UINT8 ubNumberOfTiles;
INT16 sBaseGridNo, sGridNo;
INT32 sBaseGridNo, sGridNo;
UINT16 usStructureID;
BOOLEAN fMultiStructure;
BOOLEAN fRecompileMPs;
BOOLEAN fRecompileExtraRadius; // for doors... yuck
INT16 sCheckGridNo;
INT32 sCheckGridNo;
CHECKF( pStructure );
@@ -1131,7 +1131,7 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
return( TRUE );
}
STRUCTURE * InternalSwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure, BOOLEAN fFlipSwitches, BOOLEAN fStoreInMap )
STRUCTURE * InternalSwapStructureForPartner( INT32 sGridNo, STRUCTURE * pStructure, BOOLEAN fFlipSwitches, BOOLEAN fStoreInMap )
{
// switch structure
LEVELNODE * pLevelNode;
@@ -1218,28 +1218,31 @@ STRUCTURE * InternalSwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructu
return( pNewBaseStructure );
}
STRUCTURE * SwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure )
STRUCTURE * SwapStructureForPartner( INT32 sGridNo, STRUCTURE * pStructure )
{
return( InternalSwapStructureForPartner( sGridNo, pStructure, TRUE, FALSE ) );
}
STRUCTURE * SwapStructureForPartnerWithoutTriggeringSwitches( INT16 sGridNo, STRUCTURE * pStructure )
STRUCTURE * SwapStructureForPartnerWithoutTriggeringSwitches( INT32 sGridNo, STRUCTURE * pStructure )
{
return( InternalSwapStructureForPartner( sGridNo, pStructure, FALSE, FALSE ) );
}
STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT16 sGridNo, STRUCTURE * pStructure )
STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT32 sGridNo, STRUCTURE * pStructure )
{
return( InternalSwapStructureForPartner( sGridNo, pStructure, TRUE, TRUE ) );
}
STRUCTURE * FindStructure( INT16 sGridNo, UINT32 fFlags )
STRUCTURE * FindStructure( INT32 sGridNo, UINT32 fFlags )
{
// finds a structure that matches any of the given flags
STRUCTURE * pCurrent;
if( sGridNo > WORLD_MAX-1 ) //bug fix for win98 crash when traveling between sectors
//bug fix for win98 crash when traveling between sectors
if ( TileIsOutOfBounds( sGridNo ) )
{
return( NULL );
}
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
while (pCurrent != NULL)
@@ -1270,7 +1273,7 @@ STRUCTURE * FindNextStructure( STRUCTURE * pStructure, UINT32 fFlags )
return( NULL );
}
STRUCTURE * FindStructureByID( INT16 sGridNo, UINT16 usStructureID )
STRUCTURE * FindStructureByID( INT32 sGridNo, UINT16 usStructureID )
{
// finds a structure that matches any of the given flags
STRUCTURE * pCurrent;
@@ -1298,7 +1301,7 @@ STRUCTURE * FindBaseStructure( STRUCTURE * pStructure )
return( FindStructureByID( pStructure->sBaseGridNo, pStructure->usStructureID ) );
}
STRUCTURE * FindNonBaseStructure( INT16 sGridNo, STRUCTURE * pStructure )
STRUCTURE * FindNonBaseStructure( INT32 sGridNo, STRUCTURE * pStructure )
{
// finds a non-base structure in a location
CHECKF( pStructure );
@@ -1376,7 +1379,7 @@ INT8 StructureHeight( STRUCTURE * pStructure )
return( bGreatestHeight + 1);
}
INT8 GetTallestStructureHeight( INT16 sGridNo, BOOLEAN fOnRoof )
INT8 GetTallestStructureHeight( INT32 sGridNo, BOOLEAN fOnRoof )
{
STRUCTURE * pCurrent;
INT8 iHeight;
@@ -1408,7 +1411,7 @@ INT8 GetTallestStructureHeight( INT16 sGridNo, BOOLEAN fOnRoof )
}
INT8 GetStructureTargetHeight( INT16 sGridNo, BOOLEAN fOnRoof )
INT8 GetStructureTargetHeight( INT32 sGridNo, BOOLEAN fOnRoof )
{
STRUCTURE * pCurrent;
INT8 iHeight;
@@ -1550,7 +1553,7 @@ BOOLEAN StructureDensity( STRUCTURE * pStructure, UINT8 * pubLevel0, UINT8 * pub
return( TRUE );
}
BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT16 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner )
BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner )
{
// do damage to a structure; returns TRUE if the structure should be removed
@@ -1673,8 +1676,7 @@ void DebugStructurePage1( void )
STRUCTURE * pStructure;
STRUCTURE * pBase;
//LEVELNODE * pLand;
INT16 sGridNo;
INT16 sDesiredLevel;
INT32 sGridNo, sDesiredLevel;
INT8 bHeight, bDens0, bDens1, bDens2, bDens3;
INT8 bStructures;
@@ -2179,7 +2181,7 @@ BOOLEAN FiniStructureDB( void )
}
INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock )
INT8 GetBlockingStructureInfo( INT32 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock )
{
STRUCTURE * pCurrent, *pStructure = 0;
INT16 sDesiredLevel;
@@ -2366,7 +2368,7 @@ UINT32 StructureTypeToFlag( UINT8 ubType )
return( uiFlag );
}
STRUCTURE * FindStructureBySavedInfo( INT16 sGridNo, UINT8 ubType, UINT8 ubWallOrientation, INT8 bLevel )
STRUCTURE * FindStructureBySavedInfo( INT32 sGridNo, UINT8 ubType, UINT8 ubWallOrientation, INT8 bLevel )
{
STRUCTURE * pCurrent;
UINT32 uiTypeFlag;
+14 -14
View File
@@ -35,38 +35,38 @@ BOOLEAN FreeStructureFile( STRUCTURE_FILE_REF * pStructureFile );
//
// functions at the structure instance level
//
BOOLEAN OkayToAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID );
BOOLEAN OkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID );
// for the PTR argument of AddStructureToWorld, pass in a LEVELNODE * please!
BOOLEAN AddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, PTR pLevelN );
BOOLEAN AddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, PTR pLevelN );
BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure );
//
// functions to find a structure in a location
//
STRUCTURE * FindStructure( INT16 sGridNo, UINT32 fFlags );
STRUCTURE * FindStructure( INT32 sGridNo, UINT32 fFlags );
STRUCTURE * FindNextStructure( STRUCTURE * pStructure, UINT32 fFlags );
STRUCTURE * FindStructureByID( INT16 sGridNo, UINT16 usStructureID );
STRUCTURE * FindStructureByID( INT32 sGridNo, UINT16 usStructureID );
STRUCTURE * FindBaseStructure( STRUCTURE * pStructure );
STRUCTURE * FindNonBaseStructure( INT16 sGridNo, STRUCTURE * pStructure );
STRUCTURE * FindNonBaseStructure( INT32 sGridNo, STRUCTURE * pStructure );
//
// functions related to interactive tiles
//
STRUCTURE * SwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure );
STRUCTURE * SwapStructureForPartnerWithoutTriggeringSwitches( INT16 sGridNo, STRUCTURE * pStructure );
STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT16 sGridNo, STRUCTURE * pStructure );
STRUCTURE * SwapStructureForPartner( INT32 sGridNo, STRUCTURE * pStructure );
STRUCTURE * SwapStructureForPartnerWithoutTriggeringSwitches( INT32 sGridNo, STRUCTURE * pStructure );
STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT32 sGridNo, STRUCTURE * pStructure );
//
// functions useful for AI that return info about heights
//
INT8 StructureHeight( STRUCTURE * pStructure );
INT8 StructureBottomLevel( STRUCTURE * pStructure );
INT8 GetTallestStructureHeight( INT16 sGridNo, BOOLEAN fOnRoof );
INT8 GetStructureTargetHeight( INT16 sGridNo, BOOLEAN fOnRoof );
INT8 GetTallestStructureHeight( INT32 sGridNo, BOOLEAN fOnRoof );
INT8 GetStructureTargetHeight( INT32 sGridNo, BOOLEAN fOnRoof );
BOOLEAN StructureDensity( STRUCTURE * pStructure, UINT8 * pubLevel0, UINT8 * pubLevel1, UINT8 * pubLevel2, UINT8 * pubLevel3 );
BOOLEAN FindAndSwapStructure( INT16 sGridNo );
BOOLEAN FindAndSwapStructure( INT32 sGridNo );
INT16 GetBaseTile( STRUCTURE * pStructure );
//
// functions to work with the editor undo code
@@ -77,9 +77,9 @@ void DebugStructurePage1( void );
BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructureFileRef, BOOLEAN fFromAnimation, INT16 sSTIStartIndex );
// FUNCTIONS FOR DETERMINING STUFF THAT BLOCKS VIEW FOR TILE_bASED LOS
INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock );
INT8 GetBlockingStructureInfo( INT32 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock );
BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT16 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner );
BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner );
// Material armour type enumeration
enum
@@ -118,7 +118,7 @@ enum
extern INT32 guiMaterialHitSound[ NUM_MATERIAL_TYPES ];
STRUCTURE *FindStructureBySavedInfo( INT16 sGridNo, UINT8 ubType, UINT8 ubWallOrientation, INT8 bLevel );
STRUCTURE *FindStructureBySavedInfo( INT32 sGridNo, UINT8 ubType, UINT8 ubWallOrientation, INT8 bLevel );
UINT32 StructureTypeToFlag( UINT8 ubType );
UINT8 StructureFlagToType( UINT32 uiFlag );
+1191 -1199
View File
File diff suppressed because it is too large Load Diff
+92 -36
View File
@@ -9,36 +9,59 @@
#define WORLD_TILE_X 40
#define WORLD_TILE_Y 20
#define WORLD_COLS 160
#define WORLD_ROWS 160
#define WORLD_COORD_COLS 1600
#define WORLD_COORD_ROWS 1600
#define WORLD_MAX 25600
//#define WORLD_COLS 160
//#define WORLD_ROWS 160
//#define WORLD_COORD_COLS 1600
//#define WORLD_COORD_ROWS 1600
//#define WORLD_MAX 25600
#define CELL_X_SIZE 10
#define CELL_Y_SIZE 10
//<SB> variable map size
extern INT32 guiWorldCols;
extern INT32 guiWorldRows;
#define OLD_WORLD_COLS 160
#define OLD_WORLD_ROWS 160
#define OLD_WORLD_COORD_COLS 1600
#define OLD_WORLD_COORD_ROWS 1600
#define OLD_WORLD_MAX 25600
#define WORLD_COLS guiWorldCols
#define WORLD_ROWS guiWorldRows
#define WORLD_COORD_COLS (WORLD_COLS*CELL_X_SIZE)
#define WORLD_COORD_ROWS (WORLD_ROWS*CELL_Y_SIZE)
#define WORLD_MAX (WORLD_COLS*WORLD_ROWS)
// WANNE - BMP: The maximum value WORLD_MAX can have. DONE!
#define MAX_ALLOWED_WORLD_MAX 4000000 // (1000 cols x 1000 rows)
//</SB>
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
//Don't mess with this value, unless you want to force update all maps in the game!
// Lesh: fix the sad situation with the different major map versions
//#ifdef RUSSIAN
//#define MAJOR_MAP_VERSION 6.00
//#else
#define MAJOR_MAP_VERSION 6.00
//#endif
// SB: new map version, with map dimensions added
#define MAJOR_MAP_VERSION 7.0
//Current minor map version updater.
#define MINOR_MAP_VERSION 27
//dnl ch33 230909
#define VANILLA_MAJOR_MAP_VERSION 5.00
#define VANILLA_MINOR_MAP_VERSION 25
#define WORLD_BASE_HEIGHT 0
#define WORLD_CLIFF_HEIGHT 80
//A macro that actually memcpy's over data and increments the pointer automatically
//based on the size. Works like a FileRead except with a buffer instead of a file pointer.
//based on the size. Works like a FileRead except with a buffer instead of a file pointer.
//Used by LoadWorld() and child functions.
#include <memory.h>
#define LOADDATA( dst, src, size ) memcpy( dst, src, size ); src += size
//SB: fix macro syntax flaw
//#define LOADDATA( dst, src, size ) memcpy( dst, src, size ); src += size
#define LOADDATA( dst, src, size ) { memcpy( dst, src, size ); src += size; }
#define LANDHEAD 0
@@ -119,6 +142,7 @@ class SOLDIERTYPE;
#define ANY_SMOKE_EFFECT ( MAPELEMENT_EXT_CREATUREGAS | MAPELEMENT_EXT_SMOKE | MAPELEMENT_EXT_TEARGAS | MAPELEMENT_EXT_MUSTARDGAS | MAPELEMENT_EXT_BURNABLEGAS )
// WDS - Clean up inventory handling
struct LEVELNODE
{
struct LEVELNODE *pNext;
@@ -133,7 +157,9 @@ struct LEVELNODE
STRUCTURE *pStructureData; // STRUCTURE DATA
INT32 iPhysicsObjectID; // ID FOR PHYSICS ITEM
INT32 uiAPCost; // FOR AP DISPLAY
INT32 iExitGridInfo;
//SB: change packed exitgrid for EXITGRID *
// INT32 iExitGridInfo;
void * pExitGridInfo;
}; // ( 4 byte union )
union
@@ -237,12 +263,12 @@ typedef struct
LEVELNODE *pLevelNodes[ 9 ];
//};
STRUCTURE *pStructureHead;
STRUCTURE *pStructureTail;
STRUCTURE *pStructureHead;
STRUCTURE *pStructureTail;
UINT16 uiFlags;
UINT16 uiFlags;
UINT16 ubExtFlags[2];
UINT16 sSumRealLights[1];
UINT16 sSumRealLights[1];
UINT8 sHeight;
UINT8 ubAdjacentSoldierCnt;
UINT8 ubTerrainID;
@@ -257,14 +283,43 @@ typedef struct
extern MAP_ELEMENT *gpWorldLevelData;
// World Movement Costs
extern UINT8 gubWorldMovementCosts[ WORLD_MAX ][MAXDIR][2];
//UINT8 gubWorldMovementCosts[ WORLD_MAX ][MAXDIR][2];
extern UINT8 (*gubWorldMovementCosts)[MAXDIR][2];//dnl ch43 260909
//dnl ch44 290909 Translation routine
class MAPTRANSLATION
{
private:
BOOLEAN fTrn;
INT32 iTrnFromRows;
INT32 iTrnFromCols;
INT32 iTrnToRows;
INT32 iTrnToCols;
INT32 iResizeTrnFromRows;
INT32 iResizeTrnFromCols;
INT32 iResizeTrnToRows;
INT32 iResizeTrnToCols;
public:
MAPTRANSLATION();
~MAPTRANSLATION();
void DisableTrn(void){ fTrn = FALSE; }
void GetTrnCnt(INT32& cnt);
void GetTrnXY(INT16& x, INT16& y);
BOOLEAN IsTrn(void){ return(fTrn); }
BOOLEAN SetTrnPar(INT32 iFromRows, INT32 iFromCols, INT32 iToRows, INT32 iToCols);
//dnl ch45 011009
void ResizeTrnCfg(INT32 iFromRows, INT32 iFromCols, INT32 iToRows, INT32 iToCols);
void ResizeTrnCnt(INT32& cnt);
};
extern MAPTRANSLATION gMapTrn;
extern UINT8 gubCurrentLevel;
extern INT32 giCurrentTilesetID;
extern HVOBJECT hRenderVObject;
extern UINT32 gSurfaceMemUsage;
extern HVOBJECT hRenderVObject;
extern UINT32 gSurfaceMemUsage;
extern CHAR8 gzLastLoadedFile[ 260 ];
@@ -282,15 +337,15 @@ void DestroyTileShadeTables( );
void TrashWorld(void);
void TrashMapTile(INT16 MapTile);
BOOLEAN NewWorld( void );
void TrashMapTile(INT32 MapTile);
BOOLEAN NewWorld( INT32 nMapRows, INT32 nMapCols );
BOOLEAN SaveWorld( const STR8 puiFilename );
BOOLEAN LoadWorld( const STR8 puiFilename, float* pMajorMapVersion = NULL, UINT8* pMinorMapVersion = NULL );
BOOLEAN SaveWorld(const STR8 puiFilename, FLOAT dMajorMapVersion=MAJOR_MAP_VERSION, UINT8 ubMinorMapVersion=MINOR_MAP_VERSION);//dnl ch33 150909
BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion=NULL, UINT8* pMinorMapVersion=NULL);//dnl ch44 290909
void CompileWorldMovementCosts( );
void RecompileLocalMovementCosts( INT16 sCentreGridNo );
void RecompileLocalMovementCostsFromRadius( INT16 sCentreGridNo, INT8 bRadius );
void CompileWorldMovementCosts(void);//dnl ch56 151009
void RecompileLocalMovementCosts( INT32 sCentreGridNo );
void RecompileLocalMovementCostsFromRadius( INT32 sCentreGridNo, INT8 bRadius );
BOOLEAN LoadMapTileset( INT32 iTilesetID );
@@ -300,22 +355,23 @@ void SetLoadOverrideParams( BOOLEAN fForceLoad, BOOLEAN fForceFile, CHAR8 *zLoad
void CalculateWorldWireFrameTiles( BOOLEAN fForce );
void RemoveWorldWireFrameTiles( );
void RemoveWireFrameTiles( INT16 sGridNo );
void RemoveWireFrameTiles( INT32 sGridNo );
LEVELNODE *GetAnimProfileFlags( INT16 sGridNo, UINT16 *usFlags, SOLDIERTYPE **ppTargSoldier, LEVELNODE *pGivenNode );
LEVELNODE *GetAnimProfileFlags( INT32 sGridNo, UINT16 *usFlags, SOLDIERTYPE **ppTargSoldier, LEVELNODE *pGivenNode );
void ReloadTileset( UINT8 ubID );
BOOLEAN FloorAtGridNo( UINT32 iMapIndex );
BOOLEAN DoorAtGridNo( UINT32 iMapIndex );
BOOLEAN GridNoIndoors( UINT32 iMapIndex );
BOOLEAN FloorAtGridNo( INT32 iMapIndex );
BOOLEAN DoorAtGridNo( INT32 iMapIndex );
BOOLEAN GridNoIndoors( INT32 iMapIndex );
BOOLEAN OpenableAtGridNo( UINT32 iMapIndex );
BOOLEAN OpenableAtGridNo( INT32 iMapIndex );
void RecompileLocalMovementCostsInAreaWithFlags( void );
void AddTileToRecompileArea( INT16 sGridNo );
void AddTileToRecompileArea( INT32 sGridNo );
void SetWorldSize(INT32 nWorldRows, INT32 nWorldCols);
#endif
+160 -154
View File
File diff suppressed because it is too large Load Diff
+100 -100
View File
@@ -6,139 +6,139 @@ void CountLevelNodes( void );
// Object manipulation functions
BOOLEAN RemoveObject( UINT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddObjectToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddObjectToHead( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusObjectIndex );
BOOLEAN RemoveAllObjectsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
void SetAllObjectShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllObjectShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff );
BOOLEAN TypeRangeExistsInObjectLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusObjectIndex );
BOOLEAN RemoveObject( INT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddObjectToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddObjectToHead( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInObjectLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusObjectIndex );
BOOLEAN RemoveAllObjectsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
void SetAllObjectShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllObjectShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );
BOOLEAN TypeRangeExistsInObjectLayer( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusObjectIndex );
// Roof manipulation functions
BOOLEAN RemoveRoof( UINT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddRoofToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddRoofToHead( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusRoofIndex );
BOOLEAN RemoveAllRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
void SetAllRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff );
void RemoveRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
void SetRoofIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
BOOLEAN TypeRangeExistsInRoofLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusRoofIndex );
void SetWallLevelnodeFlags( INT16 sGridNo, UINT32 uiFlags );
void RemoveWallLevelnodeFlags( INT16 sGridNo, UINT32 uiFlags );
BOOLEAN IndexExistsInRoofLayer( INT16 sGridNo, UINT16 usIndex );
BOOLEAN RemoveRoof( INT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddRoofToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddRoofToHead( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInRoofLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusRoofIndex );
BOOLEAN RemoveAllRoofsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
void SetAllRoofShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllRoofShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );
void RemoveRoofIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
void SetRoofIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
BOOLEAN TypeRangeExistsInRoofLayer( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusRoofIndex );
void SetWallLevelnodeFlags( INT32 sGridNo, UINT32 uiFlags );
void RemoveWallLevelnodeFlags( INT32 sGridNo, UINT32 uiFlags );
BOOLEAN IndexExistsInRoofLayer( INT32 sGridNo, UINT16 usIndex );
// OnRoof manipulation functions
BOOLEAN RemoveOnRoof( UINT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddOnRoofToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddOnRoofToHead( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInOnRoofLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusOnRoofIndex );
BOOLEAN RemoveAllOnRoofsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
void SetAllOnRoofShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllOnRoofShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff );
BOOLEAN RemoveOnRoofFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode );
BOOLEAN RemoveOnRoof( INT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddOnRoofToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddOnRoofToHead( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInOnRoofLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusOnRoofIndex );
BOOLEAN RemoveAllOnRoofsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
void SetAllOnRoofShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllOnRoofShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );
BOOLEAN RemoveOnRoofFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode );
// Land manipulation functions
BOOLEAN RemoveLand( UINT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddLandToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddLandToHead( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInLandLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusLandIndex );
BOOLEAN RemoveAllLandsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN TypeRangeExistsInLandLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusLandIndex );
BOOLEAN TypeRangeExistsInLandHead( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusLandIndex );
BOOLEAN ReplaceLandIndex( UINT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex );
BOOLEAN DeleteAllLandLayers( UINT32 iMapIndex );
BOOLEAN InsertLandIndexAtLevel( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel );
BOOLEAN RemoveHigherLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT32 **puiHigherTypes, UINT8 *pubNumHigherTypes );
BOOLEAN SetLowerLandLevels( UINT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex );
BOOLEAN AdjustForFullTile( UINT32 iMapIndex );
void SetAllLandShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllLandShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff );
void AdjustAllLandDirtyCount( UINT32 iMapIndex, INT8 bDirtyDiff );
UINT8 GetTerrainType( INT16 sGridNo );
BOOLEAN Water( INT16 sGridNo );
BOOLEAN DeepWater( INT16 sGridNo );
BOOLEAN WaterTooDeepForAttacks( INT16 sGridNo );
BOOLEAN RemoveLand( INT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddLandToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddLandToHead( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInLandLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusLandIndex );
BOOLEAN RemoveAllLandsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN TypeRangeExistsInLandLayer( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusLandIndex );
BOOLEAN TypeRangeExistsInLandHead( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusLandIndex );
BOOLEAN ReplaceLandIndex( INT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex );
BOOLEAN DeleteAllLandLayers( INT32 iMapIndex );
BOOLEAN InsertLandIndexAtLevel( INT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel );
BOOLEAN RemoveHigherLandLevels( INT32 iMapIndex, UINT32 fSrcType, UINT32 **puiHigherTypes, UINT8 *pubNumHigherTypes );
BOOLEAN SetLowerLandLevels( INT32 iMapIndex, UINT32 fSrcType, UINT16 usIndex );
BOOLEAN AdjustForFullTile( INT32 iMapIndex );
void SetAllLandShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllLandShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );
void AdjustAllLandDirtyCount( INT32 iMapIndex, INT8 bDirtyDiff );
UINT8 GetTerrainType( INT32 sGridNo );
BOOLEAN Water( INT32 sGridNo );
BOOLEAN DeepWater( INT32 sGridNo );
BOOLEAN WaterTooDeepForAttacks( INT32 sGridNo );
// Structure manipulation routines
BOOLEAN RemoveStruct( UINT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddStructToTail( UINT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddStructToTailCommon( UINT32 iMapIndex, UINT16 usIndex, BOOLEAN fAddStructDBInfo );
LEVELNODE *ForceStructToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN RemoveStruct( INT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddStructToTail( INT32 iMapIndex, UINT16 usIndex );
LEVELNODE *AddStructToTailCommon( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fAddStructDBInfo );
LEVELNODE *ForceStructToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddStructToHead( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInStructLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusStructIndex );
BOOLEAN RemoveAllStructsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN AddStructToHead( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInStructLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusStructIndex );
BOOLEAN RemoveAllStructsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN AddWallToStructLayer( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fReplace );
BOOLEAN ReplaceStructIndex( UINT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex );
BOOLEAN HideStructOfGivenType( UINT32 iMapIndex, UINT32 fType, BOOLEAN fHide );
BOOLEAN InsertStructIndex( UINT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel );
void SetAllStructShadeLevels( UINT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllStructShadeLevels( UINT32 iMapIndex, INT8 bShadeDiff );
void SetStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
void RemoveStructIndexFlagsFromTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
void SetStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags );
void RemoveStructAframeFlags( UINT32 iMapIndex, UINT32 uiFlags );
BOOLEAN RemoveStructFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode );
BOOLEAN ReplaceStructIndex( INT32 iMapIndex, UINT16 usOldIndex, UINT16 usNewIndex );
BOOLEAN HideStructOfGivenType( INT32 iMapIndex, UINT32 fType, BOOLEAN fHide );
BOOLEAN InsertStructIndex( INT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel );
void SetAllStructShadeLevels( INT32 iMapIndex, UINT8 ubShadeLevel );
void AdjustAllStructShadeLevels( INT32 iMapIndex, INT8 bShadeDiff );
void SetStructIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
void RemoveStructIndexFlagsFromTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT32 uiFlags );
void SetStructAframeFlags( INT32 iMapIndex, UINT32 uiFlags );
void RemoveStructAframeFlags( INT32 iMapIndex, UINT32 uiFlags );
BOOLEAN RemoveStructFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode );
BOOLEAN RemoveStructFromTail( UINT32 iMapIndex );
BOOLEAN RemoveStructFromTailCommon( UINT32 iMapIndex, BOOLEAN fRemoveStructDBInfo );
BOOLEAN ForceRemoveStructFromTail( UINT32 iMapIndex );
BOOLEAN RemoveStructFromTail( INT32 iMapIndex );
BOOLEAN RemoveStructFromTailCommon( INT32 iMapIndex, BOOLEAN fRemoveStructDBInfo );
BOOLEAN ForceRemoveStructFromTail( INT32 iMapIndex );
BOOLEAN TypeRangeExistsInStructLayer( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusStructIndex );
BOOLEAN TypeRangeExistsInStructLayer( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType, UINT16 *pusStructIndex );
// Shadow manipulation routines
BOOLEAN RemoveShadow( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddShadowToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddShadowToHead( UINT32 iMapIndex, UINT16 usIndex );
void AddExclusiveShadow( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInShadowLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusShadowIndex );
BOOLEAN RemoveAllShadowsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN RemoveAllShadows( UINT32 iMapIndex );
BOOLEAN RemoveShadowFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode );
BOOLEAN RemoveShadow( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddShadowToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddShadowToHead( INT32 iMapIndex, UINT16 usIndex );
void AddExclusiveShadow( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInShadowLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusShadowIndex );
BOOLEAN RemoveAllShadowsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN RemoveAllShadows( INT32 iMapIndex );
BOOLEAN RemoveShadowFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode );
// Merc manipulation routines
// #################################################################
BOOLEAN AddMercToHead( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStructInfo );
BOOLEAN RemoveMerc( UINT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder );
UINT8 WhoIsThere2( INT16 sGridNo, INT8 bLevel );
BOOLEAN AddMercStructureInfo( INT16 sGridNo, SOLDIERTYPE *pSoldier );
BOOLEAN AddMercStructureInfoFromAnimSurface( INT16 sGridNo, SOLDIERTYPE *pSoldier, UINT16 usAnimSurface, UINT16 usAnimState );
BOOLEAN AddMercToHead( INT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStructInfo );
BOOLEAN RemoveMerc( INT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder );
UINT8 WhoIsThere2( INT32 sGridNo, INT8 bLevel );
BOOLEAN AddMercStructureInfo( INT32 sGridNo, SOLDIERTYPE *pSoldier );
BOOLEAN AddMercStructureInfoFromAnimSurface( INT32 sGridNo, SOLDIERTYPE *pSoldier, UINT16 usAnimSurface, UINT16 usAnimState );
BOOLEAN UpdateMercStructureInfo( SOLDIERTYPE *pSoldier );
BOOLEAN OKToAddMercToWorld( SOLDIERTYPE *pSoldier, INT8 bDirection );
// TOPMOST manipulation functions
LEVELNODE *AddTopmostToTail( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddTopmostToHead( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN RemoveTopmost( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInTopmostLayer( UINT32 iMapIndex, UINT32 fType, UINT16 *pusTopmostIndex );
BOOLEAN RemoveAllTopmostsOfTypeRange( UINT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN SetMapElementShadeLevel( UINT32 uiMapIndex, UINT8 ubShadeLevel );
void SetTopmostFlags( UINT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex );
void RemoveTopmostFlags( UINT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex );
BOOLEAN AddUIElem( UINT32 iMapIndex, UINT16 usIndex, INT8 sRelativeX, INT8 sRelativeY, LEVELNODE **ppNewNode );
void RemoveUIElem( UINT32 iMapIndex, UINT16 usIndex );
BOOLEAN RemoveTopmostFromLevelNode( UINT32 iMapIndex, LEVELNODE *pNode );
LEVELNODE *AddTopmostToTail( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN AddTopmostToHead( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN RemoveTopmost( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN TypeExistsInTopmostLayer( INT32 iMapIndex, UINT32 fType, UINT16 *pusTopmostIndex );
BOOLEAN RemoveAllTopmostsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32 fEndType );
BOOLEAN SetMapElementShadeLevel( INT32 uiMapIndex, UINT8 ubShadeLevel );
void SetTopmostFlags( INT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex );
void RemoveTopmostFlags( INT32 iMapIndex, UINT32 uiFlags, UINT16 usIndex );
BOOLEAN AddUIElem( INT32 iMapIndex, UINT16 usIndex, INT8 sRelativeX, INT8 sRelativeY, LEVELNODE **ppNewNode );
void RemoveUIElem( INT32 iMapIndex, UINT16 usIndex );
BOOLEAN RemoveTopmostFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode );
BOOLEAN IsLowerLevel( INT16 sGridNo );
BOOLEAN IsHeigherLevel( INT16 sGridNo );
BOOLEAN IsRoofVisible( INT16 sMapPos );
BOOLEAN IsRoofVisible2( INT16 sMapPos );
BOOLEAN IsLowerLevel( INT32 sGridNo );
BOOLEAN IsHeigherLevel( INT32 sGridNo );
BOOLEAN IsRoofVisible( INT32 sMapPos );
BOOLEAN IsRoofVisible2( INT32 sMapPos );
LEVELNODE * FindLevelNodeBasedOnStructure( INT16 sGridNo, STRUCTURE * pStructure );
LEVELNODE * FindShadow( INT16 sGridNo, UINT16 usStructIndex );
LEVELNODE * FindLevelNodeBasedOnStructure( INT32 sGridNo, STRUCTURE * pStructure );
LEVELNODE * FindShadow( INT32 sGridNo, UINT16 usStructIndex );
void WorldHideTrees( );
void WorldShowTrees( );