Brief: //dnl ch83

- Fix BigMaps cliff-prone problem.
Details:
- Bug which prevent merc to go prone and crawl in big maps with cliffs was reported by Buggler who already find source of problem which lies in DB_STRUCTURE_TILE struct variable sPosRelToBase. This variable contains relative position to base tile which and cannot simply be change to INT32 as data from JSD files are loaded into it. However reason for problem is because sPosRelToBase is not updated for quite bunch of structures when map size is changed so add macro which in real time perform conversion and update sPosRelToBase value.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6740 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2014-01-08 21:16:35 +00:00
parent 49de642d7d
commit a3a9b29ead
6 changed files with 47 additions and 4 deletions
+17
View File
@@ -636,7 +636,11 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
INT32 sOtherGridNo;
ppTile = pDBStructureRef->ppTile;
#if 0//dnl ch83 080114
sGridNo = sBaseGridNo + ppTile[ubTileIndex]->sPosRelToBase;
#else
sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubTileIndex]);
#endif
if (sGridNo < 0 || sGridNo > WORLD_MAX)
{
return( FALSE );
@@ -742,11 +746,16 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC
}
for (bLoop2 = 0; bLoop2 < pDBStructure->ubNumberOfTiles; bLoop2++)
{
#if 0//dnl ch83 080114
if ( sBaseGridNo + ppTile[bLoop2]->sPosRelToBase == sOtherGridNo)
{
// obstacle will straddle wall!
return( FALSE );
}
#else
if(AddPosRelToBase(sBaseGridNo, ppTile[bLoop2]) == sOtherGridNo)
return(FALSE);// obstacle will straddle wall!
#endif
}
}
}
@@ -988,7 +997,11 @@ STRUCTURE * InternalAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRU
MemFree( ppStructure );
return( NULL );
}
#if 0//dnl ch83 080114
ppStructure[ubLoop]->sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
#else
ppStructure[ubLoop]->sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]);
#endif
if (ubLoop != BASE_TILE)
{
#ifdef JA2EDITOR
@@ -1196,7 +1209,11 @@ BOOLEAN DeleteStructureFromWorld( STRUCTURE * pStructure )
// Free all the tiles
for (ubLoop = BASE_TILE; ubLoop < ubNumberOfTiles; ubLoop++)
{
#if 0//dnl ch83 080114
sGridNo = sBaseGridNo + ppTile[ubLoop]->sPosRelToBase;
#else
sGridNo = AddPosRelToBase(sBaseGridNo, ppTile[ubLoop]);
#endif
// there might be two structures in this tile, one on each level, but we just want to
// delete one on each pass
pCurrent = FindStructureByID( sGridNo, usStructureID );