mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
New feature: additional decals adds blood spatters and structural wear on walls
Requires GameDir >= r2595 to work git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9113 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+52
-20
@@ -48,6 +48,7 @@ void RemoveMineFlagFromMap( INT32 usGridNo );
|
||||
void SetSectorsRevealedBit( UINT32 usMapIndex );
|
||||
void SetMapRevealedStatus();
|
||||
void DamageStructsFromMapTempFile( MODIFY_MAP * pMap );
|
||||
void AddDecalToStructsFromMapTempFile( MODIFY_MAP * pMap );
|
||||
BOOLEAN ModifyWindowStatus( INT32 uiMapIndex );
|
||||
//ppp
|
||||
|
||||
@@ -544,6 +545,10 @@ BOOLEAN LoadAllMapChangesFromMapTempFileAndApplyThem( )
|
||||
RemoveMineFlagFromMap( pMap->usGridNo );
|
||||
break;
|
||||
|
||||
case SLM_DECAL:
|
||||
AddDecalToStructsFromMapTempFile( pMap );
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertMsg( 0, "ERROR! Map Type not in switch when loading map changes from temp file");
|
||||
break;
|
||||
@@ -836,11 +841,7 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
|
||||
//if there is a structure that is damaged
|
||||
if( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_STRUCTURE_DAMAGED )
|
||||
{
|
||||
STRUCTURE * pCurrent;
|
||||
|
||||
pCurrent = gpWorldLevelData[cnt].pStructureHead;
|
||||
|
||||
pCurrent = FindStructure( cnt, STRUCTURE_BASE_TILE );
|
||||
STRUCTURE* pCurrent = FindStructure( cnt, STRUCTURE_BASE_TILE );
|
||||
|
||||
//loop through all the structures and add all that are damaged
|
||||
while( pCurrent )
|
||||
@@ -848,11 +849,10 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
|
||||
//if the structure has been damaged
|
||||
if( pCurrent->ubHitPoints < pCurrent->pDBStructureRef->pDBStructure->ubHitPoints )
|
||||
{
|
||||
UINT8 ubBitToSet = 0x80;
|
||||
UINT8 ubLevel=0;
|
||||
|
||||
if( pCurrent->sCubeOffset != 0 )
|
||||
ubLevel |= ubBitToSet;
|
||||
ubLevel |= STRUCTURE_SAVEGAMELEVELFLAG;
|
||||
|
||||
memset( &Map, 0, sizeof( MODIFY_MAP ) );
|
||||
|
||||
@@ -870,6 +870,23 @@ void SaveBloodSmellAndRevealedStatesFromMapToTempFile()
|
||||
SaveModifiedMapStructToMapTempFile( &Map, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
}
|
||||
|
||||
if ( pCurrent->ubDecalFlag )
|
||||
{
|
||||
UINT8 ubLevel = 0;
|
||||
if ( pCurrent->sCubeOffset != 0 )
|
||||
ubLevel |= STRUCTURE_SAVEGAMELEVELFLAG;
|
||||
|
||||
memset( &Map, 0, sizeof( MODIFY_MAP ) );
|
||||
|
||||
Map.usGridNo = cnt;
|
||||
Map.usImageType = StructureFlagToType( pCurrent->fFlags );
|
||||
Map.ubType = SLM_DECAL;
|
||||
Map.ubExtra = pCurrent->ubWallOrientation | ubLevel | STRUCTURE_DECALFLAG_BLOOD;
|
||||
|
||||
//Save the change to the map file
|
||||
SaveModifiedMapStructToMapTempFile( &Map, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
|
||||
}
|
||||
|
||||
pCurrent = FindNextStructure( pCurrent, STRUCTURE_BASE_TILE );
|
||||
}
|
||||
}
|
||||
@@ -1086,23 +1103,15 @@ void SetMapRevealedStatus()
|
||||
|
||||
void DamageStructsFromMapTempFile( MODIFY_MAP * pMap )
|
||||
{
|
||||
STRUCTURE *pCurrent=NULL;
|
||||
INT8 bLevel;
|
||||
UINT8 ubWallOrientation;
|
||||
UINT8 ubBitToSet = 0x80;
|
||||
UINT8 ubType=0;
|
||||
|
||||
|
||||
//Find the base structure
|
||||
pCurrent = FindStructure( pMap->usGridNo, STRUCTURE_BASE_TILE );
|
||||
STRUCTURE* pCurrent = FindStructure( pMap->usGridNo, STRUCTURE_BASE_TILE );
|
||||
|
||||
if( pCurrent == NULL )
|
||||
if ( pCurrent == NULL )
|
||||
return;
|
||||
|
||||
bLevel = pMap->ubExtra & ubBitToSet;
|
||||
ubWallOrientation = pMap->ubExtra & ~ubBitToSet;
|
||||
ubType = (UINT8) pMap->usImageType;
|
||||
|
||||
INT8 bLevel = ( pMap->ubExtra & STRUCTURE_SAVEGAMELEVELFLAG ) ? 1 : 0;
|
||||
UINT8 ubWallOrientation = pMap->ubExtra & STRUCTURE_SAVEGAMELEVELFLAG_BLK;
|
||||
UINT8 ubType = (UINT8)pMap->usImageType;
|
||||
|
||||
//Check to see if the desired strucure node is in this tile
|
||||
pCurrent = FindStructureBySavedInfo( pMap->usGridNo, ubType, ubWallOrientation, bLevel );
|
||||
@@ -1116,6 +1125,29 @@ void DamageStructsFromMapTempFile( MODIFY_MAP * pMap )
|
||||
}
|
||||
}
|
||||
|
||||
void AddDecalToStructsFromMapTempFile( MODIFY_MAP * pMap )
|
||||
{
|
||||
//Find the base structure
|
||||
STRUCTURE* pCurrent = FindStructure( pMap->usGridNo, STRUCTURE_BASE_TILE );
|
||||
|
||||
if ( pCurrent == NULL )
|
||||
return;
|
||||
|
||||
INT8 bLevel = ( pMap->ubExtra & STRUCTURE_SAVEGAMELEVELFLAG ) ? 1 : 0;
|
||||
UINT8 ubWallOrientation = pMap->ubExtra & STRUCTURE_SAVEGAMELEVELFLAG_BLK;
|
||||
UINT8 ubType = (UINT8)pMap->usImageType;
|
||||
|
||||
//Check to see if the desired strucure node is in this tile
|
||||
pCurrent = FindStructureBySavedInfo( pMap->usGridNo, ubType, ubWallOrientation, bLevel );
|
||||
|
||||
if ( pCurrent != NULL )
|
||||
{
|
||||
pCurrent->ubDecalFlag |= STRUCTURE_DECALFLAG_BLOOD;
|
||||
|
||||
gpWorldLevelData[pCurrent->sGridNo].uiFlags |= MAPELEMENT_STRUCTURE_DAMAGED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user