1. PItems are now variable, from 3-20 and can be set in JA2Options.ini via NUM_P_ITEMS

2. USE_XML_TILESETS moved from JA2.ini to JA2Options.ini
3. New Feature - Ctrl+Click on an item with an item in hand to auto-attach/merge them.  Attach works with stacks.  Merge only works on single items, for now at least.
4. New Feature - To accompany Quiet Training, there are now Quiet Repairing and Quiet Doctoring options.
5. Bugfix - inseparable attachments of attachments were getting lost again when using ctrl+f/the map screen button to remove attachments
6. Bugfix - INT8 overflow error causing vehicle repair to actually lower its status
7. GasMask tag in items.xml can now be applied to helmets as well as face items.
8. Bugfix - AI code was referencing hard coded GASMASK item number instead of looking for the tag
9. Bugfix - "break;" was removed in Explosion Control.cpp, thereby causing mustard gas to deal out fire damage. (Not sure if this was deliberate?  But the new implementation differs from the JA2 standard, so it should be added to JA2Options.ini at least)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5320 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2012-05-30 10:19:53 +00:00
parent 67fee5f14f
commit 49a590ed34
37 changed files with 427 additions and 208 deletions
+1
View File
@@ -1994,6 +1994,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN
break;
case EXPLOSV_MUSTGAS:
pSoldier->flags.fHitByGasFlags |= HIT_BY_MUSTARDGAS;
break;
case EXPLOSV_BURNABLEGAS:
pSoldier->flags.fHitByGasFlags |= HIT_BY_BURNABLEGAS;
break;
+21 -7
View File
@@ -5,6 +5,11 @@
#include "worlddef.h"
#endif
#include "GameSettings.h"
INT32 giNumberOfTiles; //Madd: new global variables to allow for a variable number of Pitems
INT32 giNumberOfTileTypes;
INT16 gOpenDoorList[20] =
{
FIRSTDOOR1,
@@ -588,13 +593,14 @@ UINT16 gNumTilesPerType[ NUMBEROFTILETYPES ] =
THIRDMISS14 - THIRDMISS1 + 1,
WIREFRAMES15 - WIREFRAMES1 + 1,
////MM: New item tileslots start here
// P4ITEM5000 - P4ITEM1 + 1,
// P5ITEM5000 - P5ITEM1 + 1,
// P6ITEM5000 - P6ITEM1 + 1,
// P7ITEM5000 - P7ITEM1 + 1,
// P8ITEM5000 - P8ITEM1 + 1,
// P9ITEM5000 - P9ITEM1 + 1
//MM: New item tileslots start here
P4ITEM5000 - P4ITEM1 + 1,
P5ITEM5000 - P5ITEM1 + 1,
P6ITEM5000 - P6ITEM1 + 1,
P7ITEM5000 - P7ITEM1 + 1,
P8ITEM5000 - P8ITEM1 + 1,
P9ITEM5000 - P9ITEM1 + 1,
P10ITEM5000 - P10ITEM1 + 1
};
@@ -946,3 +952,11 @@ void SetSpecificDatabaseValues( UINT16 usType, UINT16 uiDatabaseElem, TILE_ELEME
}
// Madd: sets the giNumberOfTiles variable
void SetNumberOfTiles()
{
giNumberOfTiles = P4ITEM1 + ((gGameExternalOptions.ubNumPItems - 3) * 5000);
giNumberOfTileTypes = P4ITEMS + (gGameExternalOptions.ubNumPItems - 3);
}
+221 -74
View File
@@ -3014,82 +3014,216 @@ enum TileDefines
WIREFRAMES14,
WIREFRAMES15,
////MM: New item tileslots start here
//P4ITEM1,
//P4ITEM2,
//P4ITEM3,
//P4ITEM4,
//P4ITEM5,
//P4ITEM6,
//P4ITEM7,
//P4ITEM8,
//P4ITEM9,
//P4ITEM10,
//P4ITEM5000 = P4ITEM10 + 4990,
//MM: New item tileslots start here
P4ITEM1,
P4ITEM2,
P4ITEM3,
P4ITEM4,
P4ITEM5,
P4ITEM6,
P4ITEM7,
P4ITEM8,
P4ITEM9,
P4ITEM10,
P4ITEM5000 = P4ITEM10 + 4990,
//P5ITEM1,
//P5ITEM2,
//P5ITEM3,
//P5ITEM4,
//P5ITEM5,
//P5ITEM6,
//P5ITEM7,
//P5ITEM8,
//P5ITEM9,
//P5ITEM10,
//P5ITEM5000 = P5ITEM10 + 4990,
P5ITEM1,
P5ITEM2,
P5ITEM3,
P5ITEM4,
P5ITEM5,
P5ITEM6,
P5ITEM7,
P5ITEM8,
P5ITEM9,
P5ITEM10,
P5ITEM5000 = P5ITEM10 + 4990,
//P6ITEM1,
//P6ITEM2,
//P6ITEM3,
//P6ITEM4,
//P6ITEM5,
//P6ITEM6,
//P6ITEM7,
//P6ITEM8,
//P6ITEM9,
//P6ITEM10,
//P6ITEM5000 = P6ITEM10 + 4990,
P6ITEM1,
P6ITEM2,
P6ITEM3,
P6ITEM4,
P6ITEM5,
P6ITEM6,
P6ITEM7,
P6ITEM8,
P6ITEM9,
P6ITEM10,
P6ITEM5000 = P6ITEM10 + 4990,
//P7ITEM1,
//P7ITEM2,
//P7ITEM3,
//P7ITEM4,
//P7ITEM5,
//P7ITEM6,
//P7ITEM7,
//P7ITEM8,
//P7ITEM9,
//P7ITEM10,
//P7ITEM5000 = P7ITEM10 + 4990,
P7ITEM1,
P7ITEM2,
P7ITEM3,
P7ITEM4,
P7ITEM5,
P7ITEM6,
P7ITEM7,
P7ITEM8,
P7ITEM9,
P7ITEM10,
P7ITEM5000 = P7ITEM10 + 4990,
//P8ITEM1,
//P8ITEM2,
//P8ITEM3,
//P8ITEM4,
//P8ITEM5,
//P8ITEM6,
//P8ITEM7,
//P8ITEM8,
//P8ITEM9,
//P8ITEM10,
//P8ITEM5000 = P8ITEM10 + 4990,
P8ITEM1,
P8ITEM2,
P8ITEM3,
P8ITEM4,
P8ITEM5,
P8ITEM6,
P8ITEM7,
P8ITEM8,
P8ITEM9,
P8ITEM10,
P8ITEM5000 = P8ITEM10 + 4990,
//P9ITEM1,
//P9ITEM2,
//P9ITEM3,
//P9ITEM4,
//P9ITEM5,
//P9ITEM6,
//P9ITEM7,
//P9ITEM8,
//P9ITEM9,
//P9ITEM10,
//P9ITEM5000 = P9ITEM10 + 4990,
P9ITEM1,
P9ITEM2,
P9ITEM3,
P9ITEM4,
P9ITEM5,
P9ITEM6,
P9ITEM7,
P9ITEM8,
P9ITEM9,
P9ITEM10,
P9ITEM5000 = P9ITEM10 + 4990,
P10ITEM1,
P10ITEM2,
P10ITEM3,
P10ITEM4,
P10ITEM5,
P10ITEM6,
P10ITEM7,
P10ITEM8,
P10ITEM9,
P10ITEM10,
P10ITEM5000 = P10ITEM10 + 4990,
P11ITEM1,
P11ITEM2,
P11ITEM3,
P11ITEM4,
P11ITEM5,
P11ITEM6,
P11ITEM7,
P11ITEM8,
P11ITEM9,
P11ITEM10,
P11ITEM5000 = P11ITEM10 + 4990,
P12ITEM1,
P12ITEM2,
P12ITEM3,
P12ITEM4,
P12ITEM5,
P12ITEM6,
P12ITEM7,
P12ITEM8,
P12ITEM9,
P12ITEM10,
P12ITEM5000 = P12ITEM10 + 4990,
P13ITEM1,
P13ITEM2,
P13ITEM3,
P13ITEM4,
P13ITEM5,
P13ITEM6,
P13ITEM7,
P13ITEM8,
P13ITEM9,
P13ITEM10,
P13ITEM5000 = P13ITEM10 + 4990,
P14ITEM1,
P14ITEM2,
P14ITEM3,
P14ITEM4,
P14ITEM5,
P14ITEM6,
P14ITEM7,
P14ITEM8,
P14ITEM9,
P14ITEM10,
P14ITEM5000 = P14ITEM10 + 4990,
P15ITEM1,
P15ITEM2,
P15ITEM3,
P15ITEM4,
P15ITEM5,
P15ITEM6,
P15ITEM7,
P15ITEM8,
P15ITEM9,
P15ITEM10,
P15ITEM5000 = P15ITEM10 + 4990,
P16ITEM1,
P16ITEM2,
P16ITEM3,
P16ITEM4,
P16ITEM5,
P16ITEM6,
P16ITEM7,
P16ITEM8,
P16ITEM9,
P16ITEM10,
P16ITEM5000 = P16ITEM10 + 4990,
P17ITEM1,
P17ITEM2,
P17ITEM3,
P17ITEM4,
P17ITEM5,
P17ITEM6,
P17ITEM7,
P17ITEM8,
P17ITEM9,
P17ITEM10,
P17ITEM5000 = P17ITEM10 + 4990,
P18ITEM1,
P18ITEM2,
P18ITEM3,
P18ITEM4,
P18ITEM5,
P18ITEM6,
P18ITEM7,
P18ITEM8,
P18ITEM9,
P18ITEM10,
P18ITEM5000 = P18ITEM10 + 4990,
P19ITEM1,
P19ITEM2,
P19ITEM3,
P19ITEM4,
P19ITEM5,
P19ITEM6,
P19ITEM7,
P19ITEM8,
P19ITEM9,
P19ITEM10,
P19ITEM5000 = P19ITEM10 + 4990,
P20ITEM1,
P20ITEM2,
P20ITEM3,
P20ITEM4,
P20ITEM5,
P20ITEM6,
P20ITEM7,
P20ITEM8,
P20ITEM9,
P20ITEM10,
P20ITEM5000 = P20ITEM10 + 4990,
NUMBEROFTILES
};
extern INT32 giNumberOfTiles; //Madd: new global variable to allow for a variable number of Pitems
#define BLUEFLAG_GRAPHIC FIRSTSWITCHES21
// Defines for tile type identification
@@ -3290,17 +3424,29 @@ enum TileTypeDefines
WIREFRAMES,
////MM: New item tileslots start here
//P4ITEMS,
//P5ITEMS,
//P6ITEMS,
//P7ITEMS,
//P8ITEMS,
//P9ITEMS,
//MM: New item tileslots start here
P4ITEMS,
P5ITEMS,
P6ITEMS,
P7ITEMS,
P8ITEMS,
P9ITEMS,
P10ITEMS,
P11ITEMS,
P12ITEMS,
P13ITEMS,
P14ITEMS,
P15ITEMS,
P16ITEMS,
P17ITEMS,
P18ITEMS,
P19ITEMS,
P20ITEMS,
NUMBEROFTILETYPES
};
extern INT32 giNumberOfTileTypes; //Madd: for variable number of PItems
//==========================================================================
// Quick defines for finding last type entry in tile types
@@ -3345,5 +3491,6 @@ extern INT16 gOpenDoorShadowList[20];
extern INT16 gClosedDoorList[20];
extern INT16 gClosedDoorShadowList[20];
void SetNumberOfTiles(); // Madd: sets the giNumberOfTiles variable
#endif
+5 -4
View File
@@ -19,6 +19,7 @@
#include <vfs/Core/vfs_file_raii.h>
#include "XML_TileSet.hpp"
#include "XMLWriter.h"
#include "GameSettings.h"
void ExportTilesets(vfs::Path const& filename);
@@ -34,10 +35,10 @@ UINT8 gubNumSets = MAX_TILESETS;
TILESET gTilesets[ MAX_TILESETS ];
extern bool g_bUseXML_Tilesets;
//extern bool g_bUseXML_Tilesets;
void InitEngineTilesets( )
{
if(g_bUseXML_Tilesets)
if(gGameExternalOptions.fUseXmlTileSets)
{
const vfs::Path tileset_filename(L"Ja2Set.dat.xml");
if(!getVFS()->fileExists(tileset_filename))
@@ -84,7 +85,7 @@ void InitEngineTilesets( )
FileRead( hfile, &uiNumFiles, sizeof( uiNumFiles ), &uiNumBytesRead );
// COMPARE
if ( uiNumFiles != NUMBEROFTILETYPES )
if ( uiNumFiles != giNumberOfTileTypes )
{
// Report error
SET_ERROR( "Number of tilesets slots in code does not match data file" );
@@ -174,7 +175,7 @@ void ExportTilesets(vfs::Path const& filename)
FileRead( hfile, &numFiles, sizeof( numFiles ), &uiNumBytesRead );
// COMPARE
SGP_THROW_IFFALSE( numFiles == NUMBEROFTILETYPES,
SGP_THROW_IFFALSE( numFiles == giNumberOfTileTypes,
L"Number of tilesets slots in code does not match data file" );
xmlw.addAttributeToNextValue("numFiles",(int)numFiles);
+1 -1
View File
@@ -95,7 +95,7 @@ public:
TRANSITION_ENTER{
long lindex;
if(atts.getLong("index", lindex)){
SGP_THROW_IFFALSE(lindex < NUMBEROFTILETYPES,
SGP_THROW_IFFALSE(lindex < giNumberOfTileTypes,
_BS(L"tileset file index is too large : ") << lindex << _BS::wget );
T_DATA.index = lindex;
}
+12 -12
View File
@@ -596,7 +596,7 @@ UINT8 ubTravelCost;
pStruct = gpWorldLevelData[ usTileNo ].pStructHead;
while ( pStruct != NULL )
{
if ( pStruct->usIndex < NUMBEROFTILES )
if ( pStruct->usIndex < giNumberOfTiles )
{
GetTileType( pStruct->usIndex, &uiType );
@@ -886,7 +886,7 @@ BOOLEAN fFake;
pStruct = gpWorldLevelData[uiTile].pStructHead;
while(pStruct!=NULL)
{
if ( pStruct->usIndex < NUMBEROFTILES )
if ( pStruct->usIndex < giNumberOfTiles )
{
if((gTileDatabase[ pStruct->usIndex ].fType != FIRSTCLIFFHANG) || (uiFlags&LIGHT_EVERYTHING))
{
@@ -938,7 +938,7 @@ BOOLEAN fFake;
pObject = gpWorldLevelData[uiTile].pObjectHead;
while(pObject!=NULL)
{
if ( pObject->usIndex < NUMBEROFTILES )
if ( pObject->usIndex < giNumberOfTiles )
{
LightAddTileNode(pObject, uiLightType, ubShadeAdd, FALSE);
}
@@ -962,7 +962,7 @@ BOOLEAN fFake;
pRoof = gpWorldLevelData[uiTile].pRoofHead;
while(pRoof!=NULL)
{
if ( pRoof->usIndex < NUMBEROFTILES )
if ( pRoof->usIndex < giNumberOfTiles )
{
LightAddTileNode(pRoof, uiLightType, ubShadeAdd, fFake);
}
@@ -1029,7 +1029,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE
pStruct = gpWorldLevelData[uiTile].pStructHead;
while(pStruct!=NULL)
{
if ( pStruct->usIndex < NUMBEROFTILES )
if ( pStruct->usIndex < giNumberOfTiles )
{
if((gTileDatabase[ pStruct->usIndex ].fType != FIRSTCLIFFHANG) || (uiFlags&LIGHT_EVERYTHING))
{
@@ -1081,7 +1081,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE
pObject = gpWorldLevelData[uiTile].pObjectHead;
while(pObject!=NULL)
{
if ( pObject->usIndex < NUMBEROFTILES )
if ( pObject->usIndex < giNumberOfTiles )
{
LightSubtractTileNode(pObject, uiLightType, ubShadeSubtract, FALSE);
}
@@ -1105,7 +1105,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE
pRoof = gpWorldLevelData[uiTile].pRoofHead;
while(pRoof!=NULL)
{
if ( pRoof->usIndex < NUMBEROFTILES )
if ( pRoof->usIndex < giNumberOfTiles )
{
LightSubtractTileNode(pRoof, uiLightType, ubShadeSubtract, fFake);
}
@@ -1115,7 +1115,7 @@ BOOLEAN fFake; // only passed in to land and roof layers; others get fed FALSE
pOnRoof = gpWorldLevelData[uiTile].pOnRoofHead;
while(pOnRoof!=NULL)
{
if ( pOnRoof->usIndex < NUMBEROFTILES )
if ( pOnRoof->usIndex < giNumberOfTiles )
{
LightSubtractTileNode(pOnRoof, uiLightType, ubShadeSubtract, FALSE);
}
@@ -2323,7 +2323,7 @@ BOOLEAN LightRevealWall(INT16 sX, INT16 sY, INT16 sSrcX, INT16 sSrcY)
pStruct=gpWorldLevelData[uiTile].pStructHead;
//while(pStruct!=NULL)
while(pStruct!=NULL && pStruct->usIndex<NUMBEROFTILES) //lal bugfix
while(pStruct!=NULL && pStruct->usIndex<giNumberOfTiles) //lal bugfix
{
TileElem = &(gTileDatabase[pStruct->usIndex]);
switch(TileElem->usWallOrientation)
@@ -2346,7 +2346,7 @@ BOOLEAN LightRevealWall(INT16 sX, INT16 sY, INT16 sSrcX, INT16 sSrcY)
pStruct=gpWorldLevelData[uiTile].pStructHead;
//while(pStruct!=NULL)
while(pStruct!=NULL && pStruct->usIndex<NUMBEROFTILES) //lal bugfix
while(pStruct!=NULL && pStruct->usIndex<giNumberOfTiles) //lal bugfix
{
TileElem = &(gTileDatabase[pStruct->usIndex]);
switch(TileElem->usWallOrientation)
@@ -2403,7 +2403,7 @@ TILE_ELEMENT *TileElem;
pStruct=gpWorldLevelData[uiTile].pStructHead;
//while(pStruct!=NULL)
while(pStruct!=NULL && pStruct->usIndex<NUMBEROFTILES) // lal bugfix
while(pStruct!=NULL && pStruct->usIndex<giNumberOfTiles) // lal bugfix
{
TileElem = &(gTileDatabase[pStruct->usIndex]);
switch(TileElem->usWallOrientation)
@@ -2426,7 +2426,7 @@ TILE_ELEMENT *TileElem;
pStruct=gpWorldLevelData[uiTile].pStructHead;
//while(pStruct!=NULL)
while(pStruct!=NULL && pStruct->usIndex<NUMBEROFTILES) //lal bugfix
while(pStruct!=NULL && pStruct->usIndex<giNumberOfTiles) //lal bugfix
{
TileElem = &(gTileDatabase[pStruct->usIndex]);
switch(TileElem->usWallOrientation)
+8 -8
View File
@@ -123,7 +123,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
UINT32 dbSize = 0;
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
{
// Create video object
@@ -181,7 +181,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
}
// NOW LOOP THROUGH AND CREATE DATABASE
for( cnt1 = 0; cnt1 < NUMBEROFTILETYPES; cnt1++ )
for( cnt1 = 0; cnt1 < giNumberOfTileTypes; cnt1++ )
{
// Get number of regions
s = gSmTileSurf[ cnt1 ];
@@ -241,7 +241,7 @@ void DeleteOverheadDB( )
{
INT32 cnt;
for( cnt = 0; cnt < NUMBEROFTILETYPES; cnt++ )
for( cnt = 0; cnt < giNumberOfTileTypes; cnt++ )
{
DeleteVideoObject( gSmTileSurf[ cnt ].vo );
}
@@ -991,7 +991,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
while( pNode != NULL )
{
if ( pNode->usIndex < NUMBEROFTILES )
if ( pNode->usIndex < giNumberOfTiles )
{
// Don't render itempools!
if ( !( pNode->uiFlags & LEVELNODE_ITEM ) )
@@ -1026,7 +1026,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
pNode = gpWorldLevelData[ usTileIndex ].pShadowHead;
while( pNode != NULL )
{
if ( pNode->usIndex < NUMBEROFTILES )
if ( pNode->usIndex < giNumberOfTiles )
{
pTile = &( gSmTileDB[ pNode->usIndex ] );
sX = sTempPosX_S;
@@ -1047,7 +1047,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
while( pNode != NULL )
{
if ( pNode->usIndex < NUMBEROFTILES )
if ( pNode->usIndex < giNumberOfTiles )
{
// Don't render itempools!
if ( !( pNode->uiFlags & LEVELNODE_ITEM ) )
@@ -1147,7 +1147,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
pNode = gpWorldLevelData[ usTileIndex ].pRoofHead;
while( pNode != NULL )
{
if ( pNode->usIndex < NUMBEROFTILES )
if ( pNode->usIndex < giNumberOfTiles )
{
if ( !( pNode->uiFlags & LEVELNODE_HIDDEN ) )
{
@@ -1951,7 +1951,7 @@ void CopyOverheadDBShadetablesFromTileset( )
// Loop through tileset
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
{
pTileSurf = ( gTileSurfaceArray[ uiLoop ] );
+9 -9
View File
@@ -648,7 +648,7 @@ void CreateTileDatabase( )
TILE_ELEMENT TileElement;
// Loop through all surfaces and tiles and build database
for( cnt1 = 0; cnt1 < NUMBEROFTILETYPES; cnt1++ )
for( cnt1 = 0; cnt1 < giNumberOfTileTypes; cnt1++ )
{
// Get number of regions
TileSurf = gTileSurfaceArray[ cnt1 ];
@@ -657,7 +657,7 @@ void CreateTileDatabase( )
{
// Build start index list
gTileTypeStartIndex[ cnt1 ] = (UINT16)gTileDatabaseSize;
gTileTypeStartIndex[ cnt1 ] = (UINT16)gTileDatabaseSize;
NumRegions = TileSurf->vo->usNumberOfObjects;
@@ -809,7 +809,7 @@ void DeallocateTileDatabase( )
{
INT32 cnt;
for( cnt = 0; cnt < NUMBEROFTILES; cnt++ )
for( cnt = 0; cnt < giNumberOfTiles; cnt++ )
{
// Check if an existing set of animated tiles are in place, remove if found
if ( gTileDatabase[ cnt ].pAnimData != NULL )
@@ -1013,7 +1013,7 @@ BOOLEAN GetTypeSubIndexFromTileIndex( UINT32 uiCheckType, UINT16 usIndex, UINT16
*pusSubIndex = 0xffff;
CHECKF ( uiCheckType < NUMBEROFTILETYPES );
CHECKF ( uiCheckType < giNumberOfTileTypes );
*pusSubIndex = usIndex - gTileTypeStartIndex[ uiCheckType ] + 1;
@@ -1026,7 +1026,7 @@ BOOLEAN GetTypeSubIndexFromTileIndexChar( UINT32 uiCheckType, UINT16 usIndex, UI
// Tile database is zero-based, Type indecies are 1-based!
CHECKF ( uiCheckType < NUMBEROFTILETYPES );
CHECKF ( uiCheckType < giNumberOfTileTypes );
*pubSubIndex = (UINT8)(usIndex - gTileTypeStartIndex[ uiCheckType ] + 1);
@@ -1039,7 +1039,7 @@ BOOLEAN GetTileIndexFromTypeSubIndex( UINT32 uiCheckType, UINT16 usSubIndex, UIN
*pusTileIndex = 0xffff;
CHECKF ( uiCheckType < NUMBEROFTILETYPES );
CHECKF ( uiCheckType < giNumberOfTileTypes );
*pusTileIndex = usSubIndex + gTileTypeStartIndex[ uiCheckType ] - 1;
@@ -1069,7 +1069,7 @@ BOOLEAN GetTileType( UINT16 usIndex, UINT32 *puiType )
*puiType = 0xffffffff;
CHECKF( usIndex != NO_TILE );
CHECKF( usIndex < NUMBEROFTILES ); //lal bugfix
CHECKF( usIndex < giNumberOfTiles ); //lal bugfix
// Get tile element
TileElem = gTileDatabase[ usIndex ];
@@ -1086,7 +1086,7 @@ BOOLEAN GetTileFlags( UINT16 usIndex, UINT32 *puiFlags )
*puiFlags = 0;
CHECKF( usIndex != NO_TILE );
CHECKF( usIndex < NUMBEROFTILES );
CHECKF( usIndex < giNumberOfTiles );
// Get tile element
TileElem = gTileDatabase[ usIndex ];
@@ -1225,7 +1225,7 @@ BOOLEAN GetWallOrientation( UINT16 usIndex, UINT16 *pusWallOrientation )
*pusWallOrientation = 0xffff;
CHECKF( usIndex != NO_TILE );
CHECKF( usIndex < NUMBEROFTILES ); //lal bugfix
CHECKF( usIndex < giNumberOfTiles ); //lal bugfix
// Get tile element
TileElem = gTileDatabase[ usIndex ];
+12 -10
View File
@@ -292,6 +292,8 @@ BOOLEAN InitializeWorld( )
giOldTilesetUsed = -1;
#endif
SetNumberOfTiles();
// DB Adds the _8 to the names if we're in 8 bit mode.
//ProcessTilesetNamesForBPP();
@@ -399,7 +401,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID )
}
else
{
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
strcpy( TileSurfaceFilenames[uiLoop], ppTileSurfaceFilenames[uiLoop] );//(ppTileSurfaceFilenames + (65 * uiLoop)) );
}
@@ -413,7 +415,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID )
//uiFillColor = Get16BPPColor(FROMRGB( 100, 0, 0 ));
// load the tile surfaces
SetRelativeStartAndEndPercentage( 0, 1, 35, L"Tile Surfaces" );
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
{
@@ -431,7 +433,7 @@ BOOLEAN LoadTileSurfaces( char ppTileSurfaceFilenames[][32], UINT8 ubTilesetID )
gbDefaultSurfaceUsed[ uiLoop ] = FALSE;
}
#endif
uiPercentage = (uiLoop * 100) / (NUMBEROFTILETYPES-1);
uiPercentage = (uiLoop * 100) / (giNumberOfTileTypes-1);
RenderProgressBar( 0, uiPercentage );
//uiFillColor = Get16BPPColor(FROMRGB( 100 + uiPercentage , 0, 0 ));
@@ -672,7 +674,7 @@ void BuildTileShadeTables( )
memset( gbNewTileSurfaceLoaded, 1, sizeof( gbNewTileSurfaceLoaded ) );
}
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
{
if ( gTileSurfaceArray[ uiLoop ] != NULL )
{
@@ -695,7 +697,7 @@ void BuildTileShadeTables( )
#ifdef JA2TESTVERSION
uiNumImagesReloaded++;
#endif
RenderProgressBar( 0, uiLoop * 100 / NUMBEROFTILETYPES );
RenderProgressBar( 0, uiLoop * 100 / giNumberOfTileTypes );
CreateTilePaletteTables( gTileSurfaceArray[ uiLoop ]->vo, uiLoop, fForceRebuildForSlot );
}
}
@@ -718,7 +720,7 @@ void DestroyTileShadeTables( )
{
UINT32 uiLoop;
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
{
if ( gTileSurfaceArray[ uiLoop ] != NULL )
{
@@ -742,7 +744,7 @@ void DestroyTileSurfaces( )
{
UINT32 uiLoop;
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
for (uiLoop = 0; uiLoop < giNumberOfTileTypes; uiLoop++)
{
if ( gTileSurfaceArray[ uiLoop ] != NULL )
{
@@ -786,7 +788,7 @@ void CompileWorldTerrainIDs( void )
}
}
if (pNode == NULL || pNode->usIndex >= NUMBEROFTILES || gTileDatabase[ pNode->usIndex ].ubTerrainID == NO_TERRAIN)
if (pNode == NULL || pNode->usIndex >= giNumberOfTiles || gTileDatabase[ pNode->usIndex ].ubTerrainID == NO_TERRAIN)
{ // Try terrain instead!
pNode = gpWorldLevelData[ sGridNo ].pLandHead;
}
@@ -3618,7 +3620,7 @@ BOOLEAN SaveMapTileset( INT32 iTilesetID )
}
// Save current tile set in map file.
for ( cnt = 0; cnt < NUMBEROFTILETYPES; cnt++ )
for ( cnt = 0; cnt < giNumberOfTileTypes; cnt++ )
FileWrite( hTSet, TileSurfaceFilenames[cnt], 65, &uiBytesWritten );
FileClose( hTSet );
@@ -3953,7 +3955,7 @@ void RemoveWireFrameTiles( INT32 sGridNo )
{
pNewTopmost = pTopmost->pNext;
if ( pTopmost->usIndex < NUMBEROFTILES )
if ( pTopmost->usIndex < giNumberOfTiles )
{
pTileElement = &(gTileDatabase[ pTopmost->usIndex ]);
+22 -22
View File
@@ -130,7 +130,7 @@ BOOLEAN TypeExistsInLevel( LEVELNODE *pStartNode, UINT32 fType, UINT16 *pusIndex
while( pStartNode != NULL )
{
if ( pStartNode->usIndex != NO_TILE && pStartNode->usIndex < NUMBEROFTILES )
if ( pStartNode->usIndex != NO_TILE && pStartNode->usIndex < giNumberOfTiles )
{
GetTileType( pStartNode->usIndex, &fTileType );
@@ -369,7 +369,7 @@ BOOLEAN TypeRangeExistsInObjectLayer( INT32 iMapIndex, UINT32 fStartType, UINT32
pOldObject = pObject;
pObject = pObject->pNext;
if ( pOldObject->usIndex != NO_TILE && pOldObject->usIndex < NUMBEROFTILES )
if ( pOldObject->usIndex != NO_TILE && pOldObject->usIndex < giNumberOfTiles )
{
GetTileType( pOldObject->usIndex, &fTileType );
@@ -442,7 +442,7 @@ BOOLEAN RemoveAllObjectsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32
pOldObject = pObject;
pObject = pObject->pNext;
if ( pOldObject->usIndex != NO_TILE && pOldObject->usIndex < NUMBEROFTILES )
if ( pOldObject->usIndex != NO_TILE && pOldObject->usIndex < giNumberOfTiles )
{
GetTileType( pOldObject->usIndex, &fTileType );
@@ -525,7 +525,7 @@ BOOLEAN AddLandToHead( INT32 iMapIndex, UINT16 usIndex )
pNextLand->usIndex = usIndex;
pNextLand->ubShadeLevel = LightGetAmbient();
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
// Get tile element
TileElem = gTileDatabase[ usIndex ];
@@ -629,7 +629,7 @@ BOOLEAN AdjustForFullTile( INT32 iMapIndex )
while( pLand != NULL )
{
if ( pLand->usIndex < NUMBEROFTILES )
if ( pLand->usIndex < giNumberOfTiles )
{
// If this is a full tile, set new full tile
TileElem = gTileDatabase[ pLand->usIndex ];
@@ -1101,7 +1101,7 @@ LEVELNODE *AddStructToTailCommon( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fAddS
if ( fAddStructDBInfo )
{
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -1138,7 +1138,7 @@ LEVELNODE *AddStructToTailCommon( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fAddS
if ( fAddStructDBInfo )
{
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
@@ -1163,7 +1163,7 @@ LEVELNODE *AddStructToTailCommon( INT32 iMapIndex, UINT16 usIndex, BOOLEAN fAddS
}
// Check flags for tiledat and set a shadow if we have a buddy
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if ( !GridNoIndoors( iMapIndex ) && gTileDatabase[ usIndex ].uiFlags & HAS_SHADOW_BUDDY && gTileDatabase[ usIndex ].sBuddyNum != -1 )
{
@@ -1210,7 +1210,7 @@ BOOLEAN AddStructToHead( INT32 iMapIndex, UINT16 usIndex )
CHECKF( CreateLevelNode( &pNextStruct ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -1231,7 +1231,7 @@ BOOLEAN AddStructToHead( INT32 iMapIndex, UINT16 usIndex )
SetWorldFlagsFromNewNode( iMapIndex, pNextStruct->usIndex );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
// Check flags for tiledat and set a shadow if we have a buddy
if ( !GridNoIndoors( iMapIndex ) && gTileDatabase[ usIndex ].uiFlags & HAS_SHADOW_BUDDY && gTileDatabase[ usIndex ].sBuddyNum != -1 )
@@ -1311,7 +1311,7 @@ BOOLEAN InsertStructIndex( INT32 iMapIndex, UINT16 usIndex, UINT8 ubLevel )
return( FALSE );
}
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -1391,7 +1391,7 @@ BOOLEAN RemoveStructFromTailCommon( INT32 iMapIndex, BOOLEAN fRemoveStructDBInfo
MemFree( pStruct );
guiLevelNodes--;
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
// Check flags for tiledat and set a shadow if we have a buddy
if ( !GridNoIndoors( iMapIndex ) && gTileDatabase[ usIndex ].uiFlags & HAS_SHADOW_BUDDY && gTileDatabase[ usIndex ].sBuddyNum != -1 )
@@ -1454,7 +1454,7 @@ BOOLEAN RemoveStruct( INT32 iMapIndex, UINT16 usIndex )
//If we have to, make sure to remove this node when we reload the map from a saved game
RemoveStructFromMapTempFile( iMapIndex, usIndex );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
// Check flags for tiledat and set a shadow if we have a buddy
if ( !GridNoIndoors( iMapIndex ) && gTileDatabase[ usIndex ].uiFlags & HAS_SHADOW_BUDDY && gTileDatabase[ usIndex ].sBuddyNum != -1 )
@@ -1515,7 +1515,7 @@ BOOLEAN RemoveStructFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode )
//If we have to, make sure to remove this node when we reload the map from a saved game
RemoveStructFromMapTempFile( iMapIndex, usIndex );
if ( pNode->usIndex < NUMBEROFTILES )
if ( pNode->usIndex < giNumberOfTiles )
{
// Check flags for tiledat and set a shadow if we have a buddy
if ( !GridNoIndoors( iMapIndex ) && gTileDatabase[ usIndex ].uiFlags & HAS_SHADOW_BUDDY && gTileDatabase[ usIndex ].sBuddyNum != -1 )
@@ -1571,7 +1571,7 @@ BOOLEAN RemoveAllStructsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32
usIndex = pOldStruct->usIndex;
// Remove Item
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
RemoveStruct( iMapIndex, pOldStruct->usIndex );
fRetVal = TRUE;
@@ -2411,7 +2411,7 @@ LEVELNODE *AddRoofToTail( INT32 iMapIndex, UINT16 usIndex )
{
CHECKF( CreateLevelNode( &pRoof ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -2438,7 +2438,7 @@ LEVELNODE *AddRoofToTail( INT32 iMapIndex, UINT16 usIndex )
{
CHECKF( CreateLevelNode( &pNextRoof ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -2481,7 +2481,7 @@ BOOLEAN AddRoofToHead( INT32 iMapIndex, UINT16 usIndex )
CHECKF( CreateLevelNode( &pNextRoof ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -2769,7 +2769,7 @@ LEVELNODE *AddOnRoofToTail( INT32 iMapIndex, UINT16 usIndex )
{
CHECKF( CreateLevelNode( &pOnRoof ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -2798,7 +2798,7 @@ LEVELNODE *AddOnRoofToTail( INT32 iMapIndex, UINT16 usIndex )
{
CHECKF( CreateLevelNode( &pNextOnRoof ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -2838,7 +2838,7 @@ BOOLEAN AddOnRoofToHead( INT32 iMapIndex, UINT16 usIndex )
pOnRoof = gpWorldLevelData[ iMapIndex ].pOnRoofHead;
CHECKF( CreateLevelNode( &pNextOnRoof ) != FALSE );
if ( usIndex < NUMBEROFTILES )
if ( usIndex < giNumberOfTiles )
{
if (gTileDatabase[usIndex].pDBStructureRef != NULL)
{
@@ -3226,7 +3226,7 @@ BOOLEAN RemoveAllTopmostsOfTypeRange( INT32 iMapIndex, UINT32 fStartType, UINT32
pOldTopmost = pTopmost;
pTopmost = pTopmost->pNext;
if ( pOldTopmost->usIndex != NO_TILE && pOldTopmost->usIndex < NUMBEROFTILES )
if ( pOldTopmost->usIndex != NO_TILE && pOldTopmost->usIndex < giNumberOfTiles )
{
GetTileType( pOldTopmost->usIndex, &fTileType );