From 4541487c3b12dc61fe93ec538c8baf2f86723372 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 19 Jan 2014 14:12:04 +0000 Subject: [PATCH] Fix: Opening up sector map could cause crashes. Note: I am not really sure at what causes the error here, this is probably due to some recent changes in overheadmap. For the time, this fixes that, though someone with better knowledge should fix the real problem eventually. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6775 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- TileEngine/overhead map.cpp | 101 ++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 44 deletions(-) diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index c0bc55654..a5f797a21 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1063,24 +1063,28 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart { pTile = &( gSmTileDB[ pNode->usIndex ] ); - sX = sTempPosX_S; - sY = sTempPosY_S; - - if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT ) + // Flugente: uninformed hack + if ( pTile && pTile->vo ) { - sY -= sModifiedHeight; + sX = sTempPosX_S; + sY = sTempPosY_S; + + if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT ) + { + sY -= sModifiedHeight; + } + else + { + sY -= sHeight; + } + + sY += ( gsRenderHeight / 5 ); + + pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; + + // RENDER! + Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); } - else - { - sY -= sHeight; - } - - sY += ( gsRenderHeight / 5 ); - - pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; - - // RENDER! - Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); } } pNode = pNode->pNext; @@ -1092,21 +1096,26 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart if(usTileIndex >= 0 && usTileIndex < GRIDSIZE)//dnl ch82 081213 { pTile = &( gSmTileDB[ pNode->usIndex ] ); - sX = sTempPosX_S; - sY = sTempPosY_S - sHeight; - //dnl ch82 081213 - sY = sTempPosY_S; - if(gTileDatabase[pNode->usIndex].uiFlags & IGNORE_WORLD_HEIGHT) - sY -= sModifiedHeight; - else - sY -= sHeight; - sY += ( gsRenderHeight / 5 ); + // Flugente: uninformed hack + if ( pTile && pTile->vo ) + { + sX = sTempPosX_S; + sY = sTempPosY_S - sHeight; + //dnl ch82 081213 + sY = sTempPosY_S; + if(gTileDatabase[pNode->usIndex].uiFlags & IGNORE_WORLD_HEIGHT) + sY -= sModifiedHeight; + else + sY -= sHeight; - pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; + sY += ( gsRenderHeight / 5 ); - // RENDER! - Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); + pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; + + // RENDER! + Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); + } } pNode = pNode->pNext; } @@ -1121,24 +1130,28 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart { pTile = &( gSmTileDB[ pNode->usIndex ] ); - sX = sTempPosX_S; - sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5); - - if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT ) + // Flugente: uninformed hack + if ( pTile && pTile->vo ) { - sY -= sModifiedHeight; + sX = sTempPosX_S; + sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5); + + if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT ) + { + sY -= sModifiedHeight; + } + else + { + sY -= sHeight; + } + + sY += ( gsRenderHeight / 5 ); + + pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; + + // RENDER! + Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); } - else - { - sY -= sHeight; - } - - sY += ( gsRenderHeight / 5 ); - - pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel]; - - // RENDER! - Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex ); } } pNode = pNode->pNext;