Browse Source

🐛 Fix render assertions on Big Endian systems

pull/1128/head
Anders Jenbo 5 years ago
parent
commit
f97adef2dd
  1. 12
      Source/scrollrt.cpp

12
Source/scrollrt.cpp

@ -634,9 +634,9 @@ static void DrawItem(CelOutputBuffer out, int x, int y, int sx, int sy, BOOL pre
} }
nCel = pItem->_iAnimFrame; nCel = pItem->_iAnimFrame;
pFrameTable = (DWORD *)pCelBuff; int frames = SDL_SwapLE32(*(DWORD *)pCelBuff);
if (nCel < 1 || pFrameTable[0] > 50 || nCel > (int)pFrameTable[0]) { if (nCel < 1 || frames > 50 || nCel > frames) {
SDL_Log("Draw \"%s\" Item 1: frame %d of %d, item type==%d", pItem->_iIName, nCel, pFrameTable[0], pItem->_itype); SDL_Log("Draw \"%s\" Item 1: frame %d of %d, item type==%d", pItem->_iIName, nCel, frames, pItem->_itype);
return; return;
} }
@ -779,10 +779,10 @@ static void scrollrt_draw_dungeon(CelOutputBuffer out, int sx, int sy, int dx, i
assert(pCelBuff != NULL); assert(pCelBuff != NULL);
if (pCelBuff == NULL) if (pCelBuff == NULL)
break; break;
pFrameTable = (DWORD *)pCelBuff; frames = SDL_SwapLE32(*(DWORD *)pCelBuff);
nCel = pDeadGuy->_deadFrame; nCel = pDeadGuy->_deadFrame;
if (nCel < 1 || pFrameTable[0] > 50 || nCel > (int)pFrameTable[0]) { if (nCel < 1 || frames > 50 || nCel > frames) {
SDL_Log("Unclipped dead: frame %d of %d, deadnum==%d", nCel, pFrameTable[0], (bDead & 0x1F) - 1); SDL_Log("Unclipped dead: frame %d of %d, deadnum==%d", nCel, frames, (bDead & 0x1F) - 1);
break; break;
} }
if (pDeadGuy->_deadtrans != 0) { if (pDeadGuy->_deadtrans != 0) {

Loading…
Cancel
Save