mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Merged New Inventory Project into main branch
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+191
-173
@@ -33,7 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include "explosion control.h"
|
||||
#include "sound control.h"
|
||||
#include "Sound Control.h"
|
||||
|
||||
#include "Buildings.h"
|
||||
|
||||
@@ -51,13 +51,13 @@
|
||||
|
||||
void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure );
|
||||
/*
|
||||
* NB: STRUCTURE_SPECIAL
|
||||
* NB: STRUCTURE_SPECIAL
|
||||
*
|
||||
* Means different things depending on the context.
|
||||
*
|
||||
*
|
||||
* WALLNWINDOW SPECIAL - opaque to sight
|
||||
* MULTI SPECIAL - second level (damaged) MULTI structure, should only be deleted if
|
||||
* starting with the deletion of a MULTI SPECIAL structure
|
||||
* MULTI SPECIAL - second level (damaged) MULTI structure, should only be deleted if
|
||||
* starting with the deletion of a MULTI SPECIAL structure
|
||||
*/
|
||||
|
||||
UINT8 AtHeight[PROFILE_Z_SIZE] = { 0x01, 0x02, 0x04, 0x08 };
|
||||
@@ -106,7 +106,7 @@ INT32 guiMaterialHitSound[ NUM_MATERIAL_TYPES ] =
|
||||
|
||||
UINT8 gubMaterialArmour[] =
|
||||
/*
|
||||
index 1-10, organics
|
||||
index 1-10, organics
|
||||
index 11-20, rocks and concretes
|
||||
index 21-30, metals
|
||||
|
||||
@@ -125,11 +125,11 @@ index 25, indestructable metal
|
||||
*/
|
||||
|
||||
{ // note: must increase; r.c. should block *AP* 7.62mm rounds
|
||||
0, // nothing
|
||||
0, // nothing
|
||||
25, // dry timber; wood wall +1/2
|
||||
20, // furniture wood (thin!) or plywood wall +1/2
|
||||
30, // wood (live); 1.5x timber
|
||||
3, // light vegetation
|
||||
3, // light vegetation
|
||||
10, // upholstered furniture
|
||||
47, // porcelain
|
||||
10, // cactus, hay, bamboo
|
||||
@@ -138,9 +138,9 @@ index 25, indestructable metal
|
||||
0,
|
||||
55, // stone masonry; 3x timber
|
||||
63, // non-reinforced concrete; 4x timber???
|
||||
70, // reinforced concrete; 6x timber
|
||||
85, // rock? - number invented
|
||||
9, // rubber - tires
|
||||
70, // reinforced concrete; 6x timber
|
||||
85, // rock? - number invented
|
||||
9, // rubber - tires
|
||||
40, // sand
|
||||
1, // cloth
|
||||
40, // sandbag
|
||||
@@ -148,7 +148,7 @@ index 25, indestructable metal
|
||||
0,
|
||||
37, // light metal (furniture; NB thin!)
|
||||
57, // thicker metal (dumpster)
|
||||
85, // heavy metal (vault doors) - block everything
|
||||
85, // heavy metal (vault doors) - block everything
|
||||
// note that vehicle armour will probably end up in here
|
||||
127, // rock indestructable
|
||||
127, // indestructable
|
||||
@@ -185,8 +185,9 @@ UINT8 FilledTilePositions( DB_STRUCTURE_TILE * pTile )
|
||||
//
|
||||
|
||||
void FreeStructureFileRef( STRUCTURE_FILE_REF * pFileRef )
|
||||
{ // Frees all of the memory associated with a file reference, including
|
||||
// the file reference structure itself
|
||||
{
|
||||
// Frees all of the memory associated with a file reference, including
|
||||
// the file reference structure itself
|
||||
|
||||
UINT16 usLoop;
|
||||
|
||||
@@ -218,7 +219,8 @@ void FreeStructureFileRef( STRUCTURE_FILE_REF * pFileRef )
|
||||
}
|
||||
|
||||
void FreeAllStructureFiles( void )
|
||||
{ // Frees all of the structure database!
|
||||
{
|
||||
// Frees all of the structure database!
|
||||
STRUCTURE_FILE_REF * pFileRef;
|
||||
STRUCTURE_FILE_REF * pNextRef;
|
||||
|
||||
@@ -261,14 +263,15 @@ BOOLEAN FreeStructureFile( STRUCTURE_FILE_REF * pStructureFile )
|
||||
|
||||
BOOLEAN LoadStructureData( STR szFileName, STRUCTURE_FILE_REF * pFileRef, UINT32 * puiStructureDataSize )
|
||||
//UINT8 **ppubStructureData, UINT32 * puiDataSize, STRUCTURE_FILE_HEADER * pHeader )
|
||||
{ // Loads a structure file's data as a honking chunk o' memory
|
||||
{
|
||||
// Loads a structure file's data as a honking chunk o' memory
|
||||
HWFILE hInput;
|
||||
STRUCTURE_FILE_HEADER Header;
|
||||
STRUCTURE_FILE_HEADER Header;
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiDataSize;
|
||||
BOOLEAN fOk;
|
||||
|
||||
CHECKF( szFileName );
|
||||
CHECKF( szFileName );
|
||||
CHECKF( pFileRef );
|
||||
hInput = FileOpen( szFileName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
|
||||
if (hInput == 0)
|
||||
@@ -359,8 +362,9 @@ BOOLEAN LoadStructureData( STR szFileName, STRUCTURE_FILE_REF * pFileRef, UINT32
|
||||
}
|
||||
|
||||
BOOLEAN CreateFileStructureArrays( STRUCTURE_FILE_REF * pFileRef, UINT32 uiDataSize )
|
||||
{ // Based on a file chunk, creates all the dynamic arrays for the
|
||||
// structure definitions contained within
|
||||
{
|
||||
// Based on a file chunk, creates all the dynamic arrays for the
|
||||
// structure definitions contained within
|
||||
|
||||
UINT8 * pCurrent;
|
||||
DB_STRUCTURE_REF * pDBStructureRef;
|
||||
@@ -406,7 +410,7 @@ BOOLEAN CreateFileStructureArrays( STRUCTURE_FILE_REF * pFileRef, UINT32 uiDataS
|
||||
ppTileArray[usTileLoop] = (DB_STRUCTURE_TILE *) pCurrent;
|
||||
// set the single-value relative position between this tile and the base tile
|
||||
ppTileArray[usTileLoop]->sPosRelToBase = ppTileArray[usTileLoop]->bXPosRelToBase + ppTileArray[usTileLoop]->bYPosRelToBase * WORLD_COLS;
|
||||
uiHitPoints += FilledTilePositions( ppTileArray[usTileLoop] );
|
||||
uiHitPoints += FilledTilePositions( ppTileArray[usTileLoop] );
|
||||
pCurrent += sizeof( DB_STRUCTURE_TILE );
|
||||
}
|
||||
// scale hit points down to something reasonable...
|
||||
@@ -429,7 +433,8 @@ BOOLEAN CreateFileStructureArrays( STRUCTURE_FILE_REF * pFileRef, UINT32 uiDataS
|
||||
}
|
||||
|
||||
STRUCTURE_FILE_REF * LoadStructureFile( STR szFileName )
|
||||
{ // NB should be passed in expected number of structures so we can check equality
|
||||
{
|
||||
// NB should be passed in expected number of structures so we can check equality
|
||||
UINT32 uiDataSize = 0;
|
||||
BOOLEAN fOk;
|
||||
STRUCTURE_FILE_REF * pFileRef;
|
||||
@@ -455,7 +460,7 @@ STRUCTURE_FILE_REF * LoadStructureFile( STR szFileName )
|
||||
return( NULL );
|
||||
}
|
||||
}
|
||||
// Add the file reference to the master list, at the head for convenience
|
||||
// Add the file reference to the master list, at the head for convenience
|
||||
if (gpStructureFileRefs != NULL)
|
||||
{
|
||||
gpStructureFileRefs->pPrev = pFileRef;
|
||||
@@ -472,7 +477,8 @@ STRUCTURE_FILE_REF * LoadStructureFile( STR szFileName )
|
||||
|
||||
|
||||
STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileNum )
|
||||
{ // Creates a STRUCTURE struct for one tile of a structure
|
||||
{
|
||||
// Creates a STRUCTURE struct for one tile of a structure
|
||||
STRUCTURE * pStructure;
|
||||
DB_STRUCTURE * pDBStructure;
|
||||
DB_STRUCTURE_TILE * pTile;
|
||||
@@ -484,7 +490,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT
|
||||
CHECKN( pDBStructureRef->ppTile );
|
||||
pTile = pDBStructureRef->ppTile[ubTileNum];
|
||||
CHECKN( pTile );
|
||||
|
||||
|
||||
// allocate memory...
|
||||
pStructure = (STRUCTURE *) MemAlloc( sizeof( STRUCTURE ) );
|
||||
CHECKN( pStructure );
|
||||
@@ -506,7 +512,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT
|
||||
{
|
||||
// for multi-tile walls, which are only the special corner pieces,
|
||||
// the non-base tile gets no orientation value because this copy
|
||||
// will be skipped
|
||||
// will be skipped
|
||||
if (pStructure->fFlags & STRUCTURE_BASE_TILE)
|
||||
{
|
||||
pStructure->ubWallOrientation = pDBStructure->ubWallOrientation;
|
||||
@@ -522,7 +528,8 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT
|
||||
}
|
||||
|
||||
BOOLEAN OkayToAddStructureToTile( INT16 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
|
||||
{
|
||||
// Verifies whether a structure is blocked from being added to the map at a particular point
|
||||
DB_STRUCTURE * pDBStructure;
|
||||
DB_STRUCTURE_TILE ** ppTile;
|
||||
STRUCTURE * pExistingStructure;
|
||||
@@ -562,15 +569,15 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
|
||||
// CJC:
|
||||
// If adding a mobile structure, allow addition if existing structure is passable
|
||||
if ( (pDBStructure->fFlags & STRUCTURE_MOBILE) && (pExistingStructure->fFlags & STRUCTURE_PASSABLE) )
|
||||
{
|
||||
if ( (pDBStructure->fFlags & STRUCTURE_MOBILE) && (pExistingStructure->fFlags & STRUCTURE_PASSABLE) )
|
||||
{
|
||||
// Skip!
|
||||
pExistingStructure = pExistingStructure->pNext;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (pDBStructure->fFlags & STRUCTURE_OBSTACLE)
|
||||
if (pDBStructure->fFlags & STRUCTURE_OBSTACLE)
|
||||
{
|
||||
|
||||
// CJC: NB these next two if states are probably COMPLETELY OBSOLETE but I'm leaving
|
||||
@@ -598,14 +605,14 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// two obstacle structures aren't allowed in the same tile at the same height
|
||||
// ATE: There is more sophisticated logic for mobiles, so postpone this check if mobile....
|
||||
if ( ( pExistingStructure->fFlags & STRUCTURE_OBSTACLE ) && !( pDBStructure->fFlags & STRUCTURE_MOBILE ) )
|
||||
{
|
||||
if ( pExistingStructure->fFlags & STRUCTURE_PASSABLE && !(pExistingStructure->fFlags & STRUCTURE_MOBILE) )
|
||||
{
|
||||
// no mobiles, existing structure is passable
|
||||
// no mobiles, existing structure is passable
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -687,8 +694,8 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( pDBStructure->fFlags & STRUCTURE_MOBILE )
|
||||
|
||||
if ( pDBStructure->fFlags & STRUCTURE_MOBILE )
|
||||
{
|
||||
// ATE:
|
||||
// ignore this one if it has the same ID num as exclusion
|
||||
@@ -720,13 +727,13 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// ATE: Another rule: allow PASSABLE *IF* the PASSABLE is *NOT* MOBILE!
|
||||
// ATE: Another rule: allow PASSABLE *IF* the PASSABLE is *NOT* MOBILE!
|
||||
if ( !( pExistingStructure->fFlags & STRUCTURE_MOBILE ) && (pExistingStructure->fFlags & STRUCTURE_PASSABLE) )
|
||||
{
|
||||
// Skip!
|
||||
pExistingStructure = pExistingStructure->pNext;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// ATE: Added here - UNLESS this part is PASSABLE....
|
||||
// two obstacle structures aren't allowed in the same tile at the same height
|
||||
@@ -735,7 +742,7 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((pDBStructure->fFlags & STRUCTURE_OPENABLE))
|
||||
{
|
||||
if (pExistingStructure->fFlags & STRUCTURE_OPENABLE)
|
||||
@@ -749,7 +756,7 @@ BOOLEAN OkayToAddStructureToTile( INT16 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
|
||||
|
||||
pExistingStructure = pExistingStructure->pNext;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -803,7 +810,8 @@ BOOLEAN OkayToAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_
|
||||
}
|
||||
|
||||
BOOLEAN AddStructureToTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure, UINT16 usStructureID )
|
||||
{ // adds a STRUCTURE to a MAP_ELEMENT (adds part of a structure to a location on the map)
|
||||
{
|
||||
// adds a STRUCTURE to a MAP_ELEMENT (adds part of a structure to a location on the map)
|
||||
STRUCTURE * pStructureTail;
|
||||
|
||||
CHECKF( pMapElement );
|
||||
@@ -829,7 +837,8 @@ BOOLEAN AddStructureToTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure, U
|
||||
|
||||
|
||||
STRUCTURE * InternalAddStructureToWorld( INT16 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
|
||||
{
|
||||
// Adds a complete structure to the world at a location plus all other locations covered by the structure
|
||||
INT16 sGridNo;
|
||||
STRUCTURE ** ppStructure;
|
||||
STRUCTURE * pBaseStructure;
|
||||
@@ -859,9 +868,9 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU
|
||||
|
||||
// We go through a definition stage here and a later stage of
|
||||
// adding everything to the world so that we don't have to untangle
|
||||
// things if we run out of memory. First we create an array of
|
||||
// things if we run out of memory. First we create an array of
|
||||
// pointers to point to all of the STRUCTURE elements created in
|
||||
// the first stage. This array gets given to the base tile so
|
||||
// the first stage. This array gets given to the base tile so
|
||||
// there is an easy way to remove an entire object from the world quickly
|
||||
|
||||
// NB we add 1 because the 0th element is in fact the reference count!
|
||||
@@ -886,9 +895,9 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU
|
||||
if (ubLoop != BASE_TILE)
|
||||
{
|
||||
#ifdef JA2EDITOR
|
||||
//Kris:
|
||||
//Kris:
|
||||
//Added this undo code if in the editor.
|
||||
//It is important to save tiles effected by multitiles. If the structure placement
|
||||
//It is important to save tiles effected by multitiles. If the structure placement
|
||||
//fails below, it doesn't matter, because it won't hurt the undo code.
|
||||
if( gfEditMode )
|
||||
AddToUndoList( ppStructure[ ubLoop ]->sGridNo );
|
||||
@@ -938,7 +947,7 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU
|
||||
}
|
||||
else if (pLevelNode->uiFlags & LEVELNODE_ROTTINGCORPSE)
|
||||
{
|
||||
// ATE: Offset IDs so they don't collide with soldiers
|
||||
// ATE: Offset IDs so they don't collide with soldiers
|
||||
usStructureID = (UINT16)( TOTAL_SOLDIERS + pLevelNode->pAniTile->uiUserData );
|
||||
}
|
||||
else
|
||||
@@ -956,7 +965,7 @@ STRUCTURE * InternalAddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRU
|
||||
{
|
||||
sGridNo = ppStructure[ubLoop]->sGridNo;
|
||||
if (ubLoop == BASE_TILE)
|
||||
{
|
||||
{
|
||||
sBaseTileHeight = gpWorldLevelData[sGridNo].sHeight;
|
||||
}
|
||||
else
|
||||
@@ -1010,7 +1019,8 @@ BOOLEAN AddStructureToWorld( INT16 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF *
|
||||
//
|
||||
|
||||
void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure )
|
||||
{ // removes a STRUCTURE element at a particular location from the world
|
||||
{
|
||||
// removes a STRUCTURE element at a particular location from the world
|
||||
// put location pointer in tile
|
||||
if (pMapElement->pStructureHead == pStructure)
|
||||
{
|
||||
@@ -1034,7 +1044,7 @@ void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure
|
||||
}
|
||||
else
|
||||
{
|
||||
// second or later element in the list; it's guaranteed that there is a
|
||||
// second or later element in the list; it's guaranteed that there is a
|
||||
// previous element but not necessary a next
|
||||
pStructure->pPrev->pNext = pStructure->pNext;
|
||||
if (pStructure->pNext != NULL)
|
||||
@@ -1050,7 +1060,8 @@ void DeleteStructureFromTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure
|
||||
}
|
||||
|
||||
BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
|
||||
{ // removes all of the STRUCTURE elements for a structure from the world
|
||||
{
|
||||
// removes all of the STRUCTURE elements for a structure from the world
|
||||
MAP_ELEMENT * pBaseMapElement;
|
||||
STRUCTURE * pBaseStructure;
|
||||
DB_STRUCTURE_TILE ** ppTile;
|
||||
@@ -1067,7 +1078,7 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
|
||||
CHECKF( pStructure );
|
||||
|
||||
pBaseStructure = FindBaseStructure( pStructure );
|
||||
CHECKF( pBaseStructure );
|
||||
CHECKF( pBaseStructure );
|
||||
|
||||
usStructureID = pBaseStructure->usStructureID;
|
||||
fMultiStructure = ( ( pBaseStructure->fFlags & STRUCTURE_MULTI ) != 0 );
|
||||
@@ -1116,12 +1127,13 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return( TRUE );
|
||||
}
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
STRUCTURE * InternalSwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure, BOOLEAN fFlipSwitches, BOOLEAN fStoreInMap )
|
||||
{ // switch structure
|
||||
{
|
||||
// switch structure
|
||||
LEVELNODE * pLevelNode;
|
||||
LEVELNODE * pShadowNode;
|
||||
STRUCTURE * pBaseStructure;
|
||||
@@ -1207,7 +1219,7 @@ STRUCTURE * InternalSwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructu
|
||||
}
|
||||
|
||||
STRUCTURE * SwapStructureForPartner( INT16 sGridNo, STRUCTURE * pStructure )
|
||||
{
|
||||
{
|
||||
return( InternalSwapStructureForPartner( sGridNo, pStructure, TRUE, FALSE ) );
|
||||
}
|
||||
|
||||
@@ -1222,13 +1234,14 @@ STRUCTURE * SwapStructureForPartnerAndStoreChangeInMap( INT16 sGridNo, STRUCTURE
|
||||
}
|
||||
|
||||
STRUCTURE * FindStructure( INT16 sGridNo, UINT32 fFlags )
|
||||
{ // finds a structure that matches any of the given flags
|
||||
{
|
||||
// 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
|
||||
return( NULL );
|
||||
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
while (pCurrent != NULL)
|
||||
{
|
||||
if ((pCurrent->fFlags & fFlags) != 0)
|
||||
@@ -1258,10 +1271,11 @@ STRUCTURE * FindNextStructure( STRUCTURE * pStructure, UINT32 fFlags )
|
||||
}
|
||||
|
||||
STRUCTURE * FindStructureByID( INT16 sGridNo, UINT16 usStructureID )
|
||||
{ // finds a structure that matches any of the given flags
|
||||
{
|
||||
// finds a structure that matches any of the given flags
|
||||
STRUCTURE * pCurrent;
|
||||
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
while (pCurrent != NULL)
|
||||
{
|
||||
if (pCurrent->usStructureID == usStructureID)
|
||||
@@ -1274,7 +1288,8 @@ STRUCTURE * FindStructureByID( INT16 sGridNo, UINT16 usStructureID )
|
||||
}
|
||||
|
||||
STRUCTURE * FindBaseStructure( STRUCTURE * pStructure )
|
||||
{ // finds the base structure for any structure
|
||||
{
|
||||
// finds the base structure for any structure
|
||||
CHECKF( pStructure );
|
||||
if (pStructure->fFlags & STRUCTURE_BASE_TILE)
|
||||
{
|
||||
@@ -1284,7 +1299,8 @@ STRUCTURE * FindBaseStructure( STRUCTURE * pStructure )
|
||||
}
|
||||
|
||||
STRUCTURE * FindNonBaseStructure( INT16 sGridNo, STRUCTURE * pStructure )
|
||||
{ // finds a non-base structure in a location
|
||||
{
|
||||
// finds a non-base structure in a location
|
||||
CHECKF( pStructure );
|
||||
if (!(pStructure->fFlags & STRUCTURE_BASE_TILE))
|
||||
{ // error!
|
||||
@@ -1311,7 +1327,8 @@ INT16 GetBaseTile( STRUCTURE * pStructure )
|
||||
}
|
||||
|
||||
INT8 StructureHeight( STRUCTURE * pStructure )
|
||||
{ // return the height of an object from 1-4
|
||||
{
|
||||
// return the height of an object from 1-4
|
||||
UINT8 ubLoopX, ubLoopY;
|
||||
PROFILE * pShape;
|
||||
UINT8 ubShapeValue;
|
||||
@@ -1350,7 +1367,7 @@ INT8 StructureHeight( STRUCTURE * pStructure )
|
||||
return( bGreatestHeight + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1443,7 +1460,8 @@ INT8 GetStructureTargetHeight( INT16 sGridNo, BOOLEAN fOnRoof )
|
||||
|
||||
|
||||
INT8 StructureBottomLevel( STRUCTURE * pStructure )
|
||||
{ // return the bottom level of an object, from 1-4
|
||||
{
|
||||
// return the bottom level of an object, from 1-4
|
||||
UINT8 ubLoopX, ubLoopY;
|
||||
PROFILE * pShape;
|
||||
UINT8 ubShapeValue;
|
||||
@@ -1474,7 +1492,7 @@ INT8 StructureBottomLevel( STRUCTURE * pStructure )
|
||||
return( 1 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1533,7 +1551,8 @@ BOOLEAN StructureDensity( STRUCTURE * pStructure, UINT8 * pubLevel0, UINT8 * pub
|
||||
}
|
||||
|
||||
BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT16 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner )
|
||||
{ // do damage to a structure; returns TRUE if the structure should be removed
|
||||
{
|
||||
// do damage to a structure; returns TRUE if the structure should be removed
|
||||
|
||||
STRUCTURE *pBase;
|
||||
UINT8 ubArmour;
|
||||
@@ -1588,7 +1607,7 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason,
|
||||
{
|
||||
// Remove struct!
|
||||
pBase = FindBaseStructure( pStructure );
|
||||
|
||||
|
||||
// ATE: Set hit points to zero....
|
||||
pBase->ubHitPoints = 0;
|
||||
|
||||
@@ -1610,17 +1629,17 @@ BOOLEAN DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason,
|
||||
}
|
||||
|
||||
// Make hit sound....
|
||||
if ( pStructure->fFlags & STRUCTURE_CAVEWALL )
|
||||
{
|
||||
PlayJA2Sample( S_VEG_IMPACT1, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] != -1 )
|
||||
{
|
||||
PlayJA2Sample( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ], RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||
}
|
||||
}
|
||||
if ( pStructure->fFlags & STRUCTURE_CAVEWALL )
|
||||
{
|
||||
PlayJA2Sample( S_VEG_IMPACT1, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ] != -1 )
|
||||
{
|
||||
PlayJA2Sample( guiMaterialHitSound[ pStructure->pDBStructureRef->pDBStructure->ubArmour ], RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) );
|
||||
}
|
||||
}
|
||||
// Don't update damage HPs....
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -1654,7 +1673,7 @@ void DebugStructurePage1( void )
|
||||
STRUCTURE * pStructure;
|
||||
STRUCTURE * pBase;
|
||||
//LEVELNODE * pLand;
|
||||
UINT16 usGridNo;
|
||||
INT16 sGridNo;
|
||||
INT16 sDesiredLevel;
|
||||
INT8 bHeight, bDens0, bDens1, bDens2, bDens3;
|
||||
INT8 bStructures;
|
||||
@@ -1670,7 +1689,7 @@ void DebugStructurePage1( void )
|
||||
|
||||
SetFont( LARGEFONT1 );
|
||||
gprintf( 0, 0, L"DEBUG STRUCTURES PAGE 1 OF 1" );
|
||||
if (GetMouseMapPos( &usGridNo ) == FALSE)
|
||||
if (GetMouseMapPos( &sGridNo ) == FALSE)
|
||||
{
|
||||
return;
|
||||
//gprintf( 0, LINE_HEIGHT * 1, L"No structure selected" );
|
||||
@@ -1685,14 +1704,14 @@ void DebugStructurePage1( void )
|
||||
sDesiredLevel = STRUCTURE_ON_ROOF;
|
||||
}
|
||||
|
||||
gprintf( 320, 0, L"Building %d", gubBuildingInfo[ usGridNo ] );
|
||||
gprintf( 320, 0, L"Building %d", gubBuildingInfo[ sGridNo ] );
|
||||
/*
|
||||
pLand = gpWorldLevelData[usGridNo].pLandHead;
|
||||
pLand = gpWorldLevelData[sGridNo].pLandHead;
|
||||
gprintf( 320, 0, L"Fake light %d", pLand->ubFakeShadeLevel );
|
||||
gprintf( 320, LINE_HEIGHT, L"Real light: ground %d roof %d", LightTrueLevel( usGridNo, 0 ), LightTrueLevel( usGridNo, 1 ) );
|
||||
gprintf( 320, LINE_HEIGHT, L"Real light: ground %d roof %d", LightTrueLevel( sGridNo, 0 ), LightTrueLevel( sGridNo, 1 ) );
|
||||
*/
|
||||
|
||||
pStructure = gpWorldLevelData[usGridNo].pStructureHead;
|
||||
pStructure = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
while (pStructure != NULL)
|
||||
{
|
||||
if (pStructure->sCubeOffset == sDesiredLevel)
|
||||
@@ -1738,7 +1757,7 @@ void DebugStructurePage1( void )
|
||||
}
|
||||
else if (pStructure->fFlags & STRUCTURE_SLIDINGDOOR)
|
||||
{
|
||||
gprintf( 0, LINE_HEIGHT * 1, L"%s sliding door with orientation %s",
|
||||
gprintf( 0, LINE_HEIGHT * 1, L"%s sliding door with orientation %s",
|
||||
(pStructure->fFlags & STRUCTURE_OPEN) ? L"Open" : L"Closed",
|
||||
WallOrientationString[pStructure->ubWallOrientation] );
|
||||
}
|
||||
@@ -1755,7 +1774,7 @@ void DebugStructurePage1( void )
|
||||
gprintf( 0, LINE_HEIGHT * 1, L"UNKNOWN STRUCTURE! (%x)", pStructure->fFlags );
|
||||
}
|
||||
bHeight = StructureHeight( pStructure );
|
||||
pBase = FindBaseStructure( pStructure );
|
||||
pBase = FindBaseStructure( pStructure );
|
||||
gprintf( 0, LINE_HEIGHT * 2, L"Structure height %d, cube offset %d, armour %d, HP %d", bHeight, pStructure->sCubeOffset, gubMaterialArmour[pStructure->pDBStructureRef->pDBStructure->ubArmour], pBase->ubHitPoints );
|
||||
if (StructureDensity( pStructure, (UINT8 *)&bDens0, (UINT8 *)&bDens1, (UINT8 *)&bDens2, (UINT8 *)&bDens3 ) == TRUE)
|
||||
{
|
||||
@@ -1767,7 +1786,7 @@ void DebugStructurePage1( void )
|
||||
gprintf( 0, LINE_HEIGHT * 4, L"Structure ID %d", pStructure->usStructureID );
|
||||
#endif
|
||||
|
||||
pStructure = gpWorldLevelData[usGridNo].pStructureHead;
|
||||
pStructure = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
for ( bStructures = 0; pStructure != NULL; pStructure = pStructure->pNext)
|
||||
{
|
||||
bStructures++;
|
||||
@@ -1802,23 +1821,23 @@ void DebugStructurePage1( void )
|
||||
}
|
||||
#endif
|
||||
gprintf( 0, LINE_HEIGHT * 13, L"N %d NE %d E %d SE %d",
|
||||
gubWorldMovementCosts[ usGridNo ][ NORTH ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ usGridNo ][ NORTHEAST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ usGridNo ][ EAST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ usGridNo ][ SOUTHEAST ][ gsInterfaceLevel ] );
|
||||
gubWorldMovementCosts[ sGridNo ][ NORTH ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ sGridNo ][ NORTHEAST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ sGridNo ][ EAST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ sGridNo ][ SOUTHEAST ][ gsInterfaceLevel ] );
|
||||
gprintf( 0, LINE_HEIGHT * 14, L"S %d SW %d W %d NW %d",
|
||||
gubWorldMovementCosts[ usGridNo ][ SOUTH ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ usGridNo ][ SOUTHWEST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ usGridNo ][ WEST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ usGridNo ][ NORTHWEST ][ gsInterfaceLevel ] );
|
||||
gubWorldMovementCosts[ sGridNo ][ SOUTH ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ sGridNo ][ SOUTHWEST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ sGridNo ][ WEST ][ gsInterfaceLevel ],
|
||||
gubWorldMovementCosts[ sGridNo ][ NORTHWEST ][ gsInterfaceLevel ] );
|
||||
gprintf( 0, LINE_HEIGHT * 15, L"Ground smell %d strength %d",
|
||||
SMELL_TYPE( gpWorldLevelData[ usGridNo ].ubSmellInfo ),
|
||||
SMELL_STRENGTH( gpWorldLevelData[ usGridNo ].ubSmellInfo ) );
|
||||
SMELL_TYPE( gpWorldLevelData[ sGridNo ].ubSmellInfo ),
|
||||
SMELL_STRENGTH( gpWorldLevelData[ sGridNo ].ubSmellInfo ) );
|
||||
|
||||
#ifdef COUNT_PATHS
|
||||
if (guiTotalPathChecks > 0)
|
||||
{
|
||||
gprintf( 0, LINE_HEIGHT * 16,
|
||||
gprintf( 0, LINE_HEIGHT * 16,
|
||||
L"Total %ld, %%succ %3ld | %%failed %3ld | %%unsucc %3ld",
|
||||
guiTotalPathChecks,
|
||||
100 * guiSuccessfulPathChecks / guiTotalPathChecks,
|
||||
@@ -1827,8 +1846,8 @@ void DebugStructurePage1( void )
|
||||
|
||||
}
|
||||
#else
|
||||
gprintf( 0, LINE_HEIGHT * 16,
|
||||
L"Adj soldiers %d", gpWorldLevelData[usGridNo].ubAdjacentSoldierCnt );
|
||||
gprintf( 0, LINE_HEIGHT * 16,
|
||||
L"Adj soldiers %d", gpWorldLevelData[sGridNo].ubAdjacentSoldierCnt );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1874,7 +1893,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
{
|
||||
// spans multiple tiles! (could be two levels high in one tile)
|
||||
fFound = TRUE;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1919,8 +1938,8 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
}
|
||||
|
||||
sStructIndex = 0;
|
||||
sNext = sSTIStartIndex + sSTIStep;
|
||||
fFirstTime = TRUE;
|
||||
sNext = sSTIStartIndex + sSTIStep;
|
||||
fFirstTime = TRUE;
|
||||
|
||||
for (uiLoop = (UINT8)sSTIStartIndex; uiLoop < hVObject->usNumberOfObjects; uiLoop++ )
|
||||
{
|
||||
@@ -1967,7 +1986,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
hVObject->ppZStripInfo[ uiDestVoIndex ] = (ZStripInfo *) MemAlloc( sizeof( ZStripInfo ) );
|
||||
if (hVObject->ppZStripInfo[ uiDestVoIndex ] == NULL)
|
||||
{
|
||||
// augh!! out of memory! free everything allocated and abort
|
||||
// augh!! out of memory! free everything allocated and abort
|
||||
for (ubLoop2 = 0; ubLoop2 < uiLoop; ubLoop2++)
|
||||
{
|
||||
if (hVObject->ppZStripInfo[ubLoop2] != NULL)
|
||||
@@ -1993,16 +2012,15 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
usWidth = hVObject->pETRLEObject[uiLoop].usWidth;
|
||||
usHeight = hVObject->pETRLEObject[uiLoop].usHeight;
|
||||
if (pDBStructure->fFlags & (STRUCTURE_MOBILE | STRUCTURE_CORPSE) )
|
||||
{
|
||||
UINT32 i = 0;
|
||||
// adjust for the difference between the animation and structure base tile
|
||||
|
||||
{
|
||||
// adjust for the difference between the animation and structure base tile
|
||||
|
||||
//if (pDBStructure->fFlags & (STRUCTURE_MOBILE ) )
|
||||
{
|
||||
sOffsetX = sOffsetX + (WORLD_TILE_X / 2);
|
||||
sOffsetY = sOffsetY + (WORLD_TILE_Y / 2);
|
||||
}
|
||||
// adjust for the tile offset
|
||||
// adjust for the tile offset
|
||||
sOffsetX = sOffsetX - pDBStructure->bZTileOffsetX * (WORLD_TILE_X / 2) + pDBStructure->bZTileOffsetY * (WORLD_TILE_X / 2);
|
||||
sOffsetY = sOffsetY - pDBStructure->bZTileOffsetY * (WORLD_TILE_Y / 2);
|
||||
}
|
||||
@@ -2016,7 +2034,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
sRightHalfWidth = usWidth + sOffsetX - (WORLD_TILE_X / 2);
|
||||
|
||||
if (sRightHalfWidth >= 0)
|
||||
{
|
||||
{
|
||||
// Case 1: negative image offset, image straddles bottom corner
|
||||
|
||||
// negative of a negative is positive
|
||||
@@ -2055,7 +2073,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
else
|
||||
{
|
||||
// Case 5: positive offset, image all on right side
|
||||
// should never happen either
|
||||
// should never happen either
|
||||
sLeftHalfWidth = 0;
|
||||
sRightHalfWidth = usWidth;
|
||||
}
|
||||
@@ -2064,7 +2082,7 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
{
|
||||
ubNumIncreasing = sLeftHalfWidth / (WORLD_TILE_X / 2);
|
||||
}
|
||||
if (sRightHalfWidth > 0)
|
||||
if (sRightHalfWidth > 0)
|
||||
{
|
||||
ubNumStable = 1;
|
||||
if (sRightHalfWidth > (WORLD_TILE_X / 2))
|
||||
@@ -2118,12 +2136,12 @@ BOOLEAN AddZStripInfoToVObject( HVOBJECT hVObject, STRUCTURE_FILE_REF * pStructu
|
||||
}
|
||||
for (ubLoop2 = 0; ubLoop2 < ubNumIncreasing; ubLoop2++)
|
||||
{
|
||||
pCurr->pbZChange[ubLoop2] = 1;
|
||||
}
|
||||
pCurr->pbZChange[ubLoop2] = 1;
|
||||
}
|
||||
for (; ubLoop2 < ubNumIncreasing + ubNumStable; ubLoop2++)
|
||||
{
|
||||
pCurr->pbZChange[ubLoop2] = 0;
|
||||
}
|
||||
}
|
||||
for (; ubLoop2 < pCurr->ubNumberOfZChanges; ubLoop2++)
|
||||
{
|
||||
pCurr->pbZChange[ubLoop2] = -1;
|
||||
@@ -2163,7 +2181,7 @@ BOOLEAN FiniStructureDB( void )
|
||||
|
||||
INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock )
|
||||
{
|
||||
STRUCTURE * pCurrent, *pStructure = NULL;
|
||||
STRUCTURE * pCurrent, *pStructure = 0;
|
||||
INT16 sDesiredLevel;
|
||||
BOOLEAN fOKStructOnLevel = FALSE;
|
||||
BOOLEAN fMinimumBlockingFound = FALSE;
|
||||
@@ -2177,12 +2195,12 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
sDesiredLevel = STRUCTURE_ON_ROOF;
|
||||
}
|
||||
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
|
||||
// If no struct, return
|
||||
if ( pCurrent == NULL )
|
||||
{
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*ppTallestStructure) = NULL;
|
||||
return( NOTHING_BLOCKING );
|
||||
}
|
||||
@@ -2193,16 +2211,16 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
if (pCurrent->sCubeOffset == sDesiredLevel )
|
||||
{
|
||||
fOKStructOnLevel = TRUE;
|
||||
pStructure = pCurrent;
|
||||
pStructure = pCurrent;
|
||||
|
||||
// Turn off if we are on upper level!
|
||||
if ( pCurrent->fFlags & STRUCTURE_ROOF && bLevel == 1 )
|
||||
if ( pCurrent->fFlags & STRUCTURE_ROOF && bLevel == 1 )
|
||||
{
|
||||
fOKStructOnLevel = FALSE;
|
||||
}
|
||||
|
||||
// Don't stop FOV for people
|
||||
if ( pCurrent->fFlags & ( STRUCTURE_CORPSE | STRUCTURE_PERSON ) )
|
||||
if ( pCurrent->fFlags & ( STRUCTURE_CORPSE | STRUCTURE_PERSON ) )
|
||||
{
|
||||
fOKStructOnLevel = FALSE;
|
||||
}
|
||||
@@ -2220,7 +2238,7 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
// OK! This will be handled by movement costs......!
|
||||
fOKStructOnLevel = FALSE;
|
||||
}
|
||||
|
||||
|
||||
// CHECK FOR WINDOW
|
||||
if ( pCurrent->fFlags & STRUCTURE_WALLNWINDOW )
|
||||
{
|
||||
@@ -2228,34 +2246,34 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
{
|
||||
case OUTSIDE_TOP_LEFT:
|
||||
case INSIDE_TOP_LEFT:
|
||||
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*ppTallestStructure) = pCurrent;
|
||||
|
||||
if ( pCurrent->fFlags & STRUCTURE_OPEN )
|
||||
{
|
||||
return( BLOCKING_TOPLEFT_OPEN_WINDOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( BLOCKING_TOPLEFT_WINDOW );
|
||||
}
|
||||
if ( pCurrent->fFlags & STRUCTURE_OPEN )
|
||||
{
|
||||
return( BLOCKING_TOPLEFT_OPEN_WINDOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( BLOCKING_TOPLEFT_WINDOW );
|
||||
}
|
||||
break;
|
||||
|
||||
case OUTSIDE_TOP_RIGHT:
|
||||
case INSIDE_TOP_RIGHT:
|
||||
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*ppTallestStructure) = pCurrent;
|
||||
|
||||
if ( pCurrent->fFlags & STRUCTURE_OPEN )
|
||||
{
|
||||
return( BLOCKING_TOPRIGHT_OPEN_WINDOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( BLOCKING_TOPRIGHT_WINDOW );
|
||||
}
|
||||
if ( pCurrent->fFlags & STRUCTURE_OPEN )
|
||||
{
|
||||
return( BLOCKING_TOPRIGHT_OPEN_WINDOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( BLOCKING_TOPRIGHT_WINDOW );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2266,10 +2284,10 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
// If we are not opem, we are full blocking!
|
||||
if ( !(pCurrent->fFlags & STRUCTURE_OPEN ) )
|
||||
{
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*ppTallestStructure) = pCurrent;
|
||||
return( FULL_BLOCKING );
|
||||
break;
|
||||
return( FULL_BLOCKING );
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2278,17 +2296,17 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
case OUTSIDE_TOP_LEFT:
|
||||
case INSIDE_TOP_LEFT:
|
||||
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*ppTallestStructure) = pCurrent;
|
||||
return( BLOCKING_TOPLEFT_DOOR );
|
||||
return( BLOCKING_TOPLEFT_DOOR );
|
||||
break;
|
||||
|
||||
case OUTSIDE_TOP_RIGHT:
|
||||
case INSIDE_TOP_RIGHT:
|
||||
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*pStructHeight) = StructureHeight( pCurrent );
|
||||
(*ppTallestStructure) = pCurrent;
|
||||
return( BLOCKING_TOPRIGHT_DOOR );
|
||||
return( BLOCKING_TOPRIGHT_DOOR );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2302,20 +2320,20 @@ INT8 GetBlockingStructureInfo( INT16 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLe
|
||||
{
|
||||
if ( fMinimumBlockingFound )
|
||||
{
|
||||
(*pStructHeight) = StructureHeight( pStructure );
|
||||
(*pStructHeight) = StructureHeight( pStructure );
|
||||
(*ppTallestStructure) = pStructure;
|
||||
return( BLOCKING_REDUCE_RANGE );
|
||||
}
|
||||
else
|
||||
{
|
||||
(*pStructHeight) = StructureHeight( pStructure );
|
||||
(*pStructHeight) = StructureHeight( pStructure );
|
||||
(*ppTallestStructure) = pStructure;
|
||||
return( BLOCKING_NEXT_TILE );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*pStructHeight) = 0;
|
||||
(*pStructHeight) = 0;
|
||||
(*ppTallestStructure) = NULL;
|
||||
return( NOTHING_BLOCKING );
|
||||
}
|
||||
@@ -2343,7 +2361,7 @@ UINT8 StructureFlagToType( UINT32 uiFlag )
|
||||
UINT32 StructureTypeToFlag( UINT8 ubType )
|
||||
{
|
||||
UINT32 uiFlag = 0x1;
|
||||
|
||||
|
||||
uiFlag = uiFlag << ubType;
|
||||
return( uiFlag );
|
||||
}
|
||||
@@ -2355,9 +2373,9 @@ STRUCTURE * FindStructureBySavedInfo( INT16 sGridNo, UINT8 ubType, UINT8 ubWallO
|
||||
|
||||
uiTypeFlag = StructureTypeToFlag( ubType );
|
||||
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
pCurrent = gpWorldLevelData[sGridNo].pStructureHead;
|
||||
while (pCurrent != NULL)
|
||||
{
|
||||
{
|
||||
if (pCurrent->fFlags & uiTypeFlag && pCurrent->ubWallOrientation == ubWallOrientation &&
|
||||
( (bLevel == 0 && pCurrent->sCubeOffset == 0) || (bLevel > 0 && pCurrent->sCubeOffset > 0) ) )
|
||||
{
|
||||
@@ -2371,31 +2389,31 @@ STRUCTURE * FindStructureBySavedInfo( INT16 sGridNo, UINT8 ubType, UINT8 ubWallO
|
||||
|
||||
UINT32 GetStructureOpenSound( STRUCTURE * pStructure, BOOLEAN fClose )
|
||||
{
|
||||
UINT32 uiSoundID;
|
||||
UINT32 uiSoundID;
|
||||
|
||||
switch( pStructure->pDBStructureRef->pDBStructure->ubArmour )
|
||||
{
|
||||
case MATERIAL_LIGHT_METAL:
|
||||
case MATERIAL_THICKER_METAL:
|
||||
switch( pStructure->pDBStructureRef->pDBStructure->ubArmour )
|
||||
{
|
||||
case MATERIAL_LIGHT_METAL:
|
||||
case MATERIAL_THICKER_METAL:
|
||||
|
||||
uiSoundID = OPEN_LOCKER;
|
||||
break;
|
||||
uiSoundID = OPEN_LOCKER;
|
||||
break;
|
||||
|
||||
case MATERIAL_WOOD_WALL:
|
||||
case MATERIAL_PLYWOOD_WALL:
|
||||
case MATERIAL_FURNITURE:
|
||||
case MATERIAL_WOOD_WALL:
|
||||
case MATERIAL_PLYWOOD_WALL:
|
||||
case MATERIAL_FURNITURE:
|
||||
|
||||
uiSoundID = OPEN_WOODEN_BOX;
|
||||
break;
|
||||
uiSoundID = OPEN_WOODEN_BOX;
|
||||
break;
|
||||
|
||||
default:
|
||||
uiSoundID = OPEN_DEFAULT_OPENABLE;
|
||||
}
|
||||
default:
|
||||
uiSoundID = OPEN_DEFAULT_OPENABLE;
|
||||
}
|
||||
|
||||
if ( fClose )
|
||||
{
|
||||
uiSoundID++;
|
||||
}
|
||||
if ( fClose )
|
||||
{
|
||||
uiSoundID++;
|
||||
}
|
||||
|
||||
return( uiSoundID );
|
||||
return( uiSoundID );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user