mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Improved feature: structures can be dragged. Which ones is defined in a new xml.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=360672&#msg_360672 Requires GameDir >= r2558 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8870 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -65,60 +65,60 @@ extern UINT8 AtHeight[PROFILE_Z_SIZE];
|
||||
// how to handle explodable structures
|
||||
|
||||
// NOT used in DB structures!
|
||||
#define STRUCTURE_BASE_TILE 0x00000001
|
||||
#define STRUCTURE_BASE_TILE 0x00000001
|
||||
#define STRUCTURE_OPEN 0x00000002
|
||||
#define STRUCTURE_OPENABLE 0x00000004
|
||||
#define STRUCTURE_OPENABLE 0x00000004
|
||||
// synonyms for STRUCTURE_OPENABLE
|
||||
#define STRUCTURE_CLOSEABLE 0x00000004
|
||||
#define STRUCTURE_SEARCHABLE 0x00000004
|
||||
#define STRUCTURE_CLOSEABLE 0x00000004
|
||||
#define STRUCTURE_SEARCHABLE 0x00000004
|
||||
#define STRUCTURE_HIDDEN 0x00000008
|
||||
|
||||
#define STRUCTURE_MOBILE 0x00000010
|
||||
// STRUCTURE_PASSABLE is set for each structure instance where
|
||||
// the tile flag TILE_PASSABLE is set
|
||||
#define STRUCTURE_PASSABLE 0x00000020
|
||||
#define STRUCTURE_EXPLOSIVE 0x00000040
|
||||
#define STRUCTURE_TRANSPARENT 0x00000080
|
||||
#define STRUCTURE_PASSABLE 0x00000020
|
||||
#define STRUCTURE_EXPLOSIVE 0x00000040
|
||||
#define STRUCTURE_TRANSPARENT 0x00000080
|
||||
|
||||
#define STRUCTURE_GENERIC 0x00000100
|
||||
#define STRUCTURE_TREE 0x00000200
|
||||
#define STRUCTURE_FENCE 0x00000400
|
||||
#define STRUCTURE_WIREFENCE 0x00000800
|
||||
#define STRUCTURE_WIREFENCE 0x00000800
|
||||
|
||||
#define STRUCTURE_HASITEMONTOP 0x00001000 // ATE: HASITEM: struct has item on top of it
|
||||
#define STRUCTURE_HASITEMONTOP 0x00001000 // ATE: HASITEM: struct has item on top of it
|
||||
#define STRUCTURE_SPECIAL 0x00002000
|
||||
#define STRUCTURE_LIGHTSOURCE 0x00004000
|
||||
#define STRUCTURE_LIGHTSOURCE 0x00004000
|
||||
#define STRUCTURE_VEHICLE 0x00008000
|
||||
|
||||
#define STRUCTURE_WALL 0x00010000
|
||||
#define STRUCTURE_WALLNWINDOW 0x00020000
|
||||
#define STRUCTURE_SLIDINGDOOR 0x00040000
|
||||
#define STRUCTURE_WALLNWINDOW 0x00020000
|
||||
#define STRUCTURE_SLIDINGDOOR 0x00040000
|
||||
#define STRUCTURE_DOOR 0x00080000
|
||||
|
||||
// a "multi" structure (as opposed to multitiled) is composed of multiple graphics & structures
|
||||
#define STRUCTURE_MULTI 0x00100000
|
||||
#define STRUCTURE_CAVEWALL 0x00200000
|
||||
#define STRUCTURE_DDOOR_LEFT 0x00400000
|
||||
#define STRUCTURE_DDOOR_RIGHT 0x00800000
|
||||
#define STRUCTURE_CAVEWALL 0x00200000
|
||||
#define STRUCTURE_DDOOR_LEFT 0x00400000
|
||||
#define STRUCTURE_DDOOR_RIGHT 0x00800000
|
||||
|
||||
#define STRUCTURE_NORMAL_ROOF 0x01000000
|
||||
#define STRUCTURE_SLANTED_ROOF 0x02000000
|
||||
#define STRUCTURE_TALL_ROOF 0x04000000
|
||||
#define STRUCTURE_NORMAL_ROOF 0x01000000
|
||||
#define STRUCTURE_SLANTED_ROOF 0x02000000
|
||||
#define STRUCTURE_TALL_ROOF 0x04000000
|
||||
#define STRUCTURE_SWITCH 0x08000000
|
||||
|
||||
#define STRUCTURE_ON_LEFT_WALL 0x10000000
|
||||
#define STRUCTURE_ON_RIGHT_WALL 0x20000000
|
||||
#define STRUCTURE_ON_LEFT_WALL 0x10000000
|
||||
#define STRUCTURE_ON_RIGHT_WALL 0x20000000
|
||||
#define STRUCTURE_CORPSE 0x40000000
|
||||
#define STRUCTURE_PERSON 0x80000000
|
||||
|
||||
// COMBINATION FLAGS
|
||||
#define STRUCTURE_ANYFENCE 0x00000C00
|
||||
#define STRUCTURE_ANYFENCE 0x00000C00
|
||||
#define STRUCTURE_ANYDOOR 0x00CC0000
|
||||
#define STRUCTURE_OBSTACLE 0x00008F00
|
||||
#define STRUCTURE_WALLSTUFF 0x00CF0000
|
||||
#define STRUCTURE_BLOCKSMOVES 0x00208F00
|
||||
#define STRUCTURE_TYPE_DEFINED 0x8FEF8F00
|
||||
#define STRUCTURE_ROOF 0x07000000
|
||||
#define STRUCTURE_OBSTACLE 0x00008F00
|
||||
#define STRUCTURE_WALLSTUFF 0x00CF0000
|
||||
#define STRUCTURE_BLOCKSMOVES 0x00208F00
|
||||
#define STRUCTURE_TYPE_DEFINED 0x8FEF8F00
|
||||
#define STRUCTURE_ROOF 0x07000000
|
||||
|
||||
#define TILE_ON_ROOF 0x01
|
||||
#define TILE_PASSABLE 0x02
|
||||
|
||||
@@ -633,6 +633,8 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT
|
||||
return( pStructure );
|
||||
}
|
||||
|
||||
extern UINT16 gusTempDragBuildSoldierID;
|
||||
|
||||
BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fAddingForReal = FALSE, INT16 sSoldierID = NOBODY )
|
||||
{
|
||||
// Verifies whether a structure is blocked from being added to the map at a particular point
|
||||
@@ -953,7 +955,9 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
|
||||
if ((pDBStructure->fFlags & STRUCTURE_OPENABLE))
|
||||
{
|
||||
if (pExistingStructure->fFlags & STRUCTURE_OPENABLE)
|
||||
// Flugente: we allow this if this structure is being dragged by a soldier, otherwise we can't move containers our of rooms (and are likely to unintenionally bar rooms)
|
||||
if (pExistingStructure->fFlags & STRUCTURE_OPENABLE
|
||||
&& !( gusTempDragBuildSoldierID != NOBODY && MercPtrs[gusTempDragBuildSoldierID]->sDragGridNo ) )
|
||||
{
|
||||
// don't allow two openable structures in the same tile or things will screw
|
||||
// up on an interface level
|
||||
@@ -2502,7 +2506,6 @@ BOOLEAN FiniStructureDB( void )
|
||||
|
||||
STRUCTURE* GetTallestStructureOnGridno( INT32 sGridNo, INT8 bLevel )
|
||||
{
|
||||
STRUCTURE* pCurrent = NULL;
|
||||
STRUCTURE* pStruct = NULL;
|
||||
INT8 bestheight = -1;
|
||||
INT16 sDesiredLevel = STRUCTURE_ON_GROUND;
|
||||
@@ -2510,7 +2513,7 @@ STRUCTURE* GetTallestStructureOnGridno( INT32 sGridNo, INT8 bLevel )
|
||||
if ( bLevel )
|
||||
sDesiredLevel = STRUCTURE_ON_ROOF;
|
||||
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
STRUCTURE* pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
|
||||
while ( pCurrent != NULL )
|
||||
{
|
||||
@@ -2538,6 +2541,42 @@ STRUCTURE* GetTallestStructureOnGridno( INT32 sGridNo, INT8 bLevel )
|
||||
return pStruct;
|
||||
}
|
||||
|
||||
STRUCTURE* GetTallestStructureOnGridnoDrag( INT32 sGridNo, INT8 bLevel )
|
||||
{
|
||||
STRUCTURE* pStruct = NULL;
|
||||
INT8 bestheight = -1;
|
||||
INT16 sDesiredLevel = STRUCTURE_ON_GROUND;
|
||||
|
||||
if ( bLevel )
|
||||
sDesiredLevel = STRUCTURE_ON_ROOF;
|
||||
|
||||
STRUCTURE* pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
|
||||
while ( pCurrent != NULL )
|
||||
{
|
||||
// Check level!
|
||||
if ( pCurrent->sCubeOffset == sDesiredLevel )
|
||||
{
|
||||
if ( pCurrent->fFlags & ( STRUCTURE_CORPSE | STRUCTURE_PERSON | STRUCTURE_ROOF | STRUCTURE_SWITCH | STRUCTURE_WALLSTUFF | STRUCTURE_MULTI | STRUCTURE_CAVEWALL | STRUCTURE_LIGHTSOURCE | STRUCTURE_VEHICLE | STRUCTURE_ANYFENCE | STRUCTURE_TREE ) )
|
||||
{
|
||||
pCurrent = pCurrent->pNext;
|
||||
continue;
|
||||
}
|
||||
|
||||
INT8 height = StructureHeight( pCurrent );
|
||||
if ( height > bestheight )
|
||||
{
|
||||
bestheight = height;
|
||||
pStruct = pCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
pCurrent = pCurrent->pNext;
|
||||
}
|
||||
|
||||
return pStruct;
|
||||
}
|
||||
|
||||
|
||||
INT8 GetBlockingStructureInfo( INT32 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock )
|
||||
{
|
||||
|
||||
@@ -85,6 +85,9 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
// Flugente: return the highest structure (no person, roof or corpse) on a gridno and level
|
||||
STRUCTURE* GetTallestStructureOnGridno( INT32 sGridNo, INT8 bLevel );
|
||||
|
||||
// Flugente: return the highest structure (no person, roof or corpse) on a gridno and level that we could possibly drag
|
||||
STRUCTURE* GetTallestStructureOnGridnoDrag( INT32 sGridNo, INT8 bLevel );
|
||||
|
||||
// FUNCTIONS FOR DETERMINING STUFF THAT BLOCKS VIEW FOR TILE_bASED LOS
|
||||
INT8 GetBlockingStructureInfo( INT32 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user