From d2b1f0cfc8b2b1d52a084945f2bd8a3e05778a5a Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 30 Sep 2019 11:50:18 +0200 Subject: [PATCH] Apply the Cel helper functions in a few more places --- Source/control.cpp | 6 +----- Source/minitext.cpp | 8 +++----- Source/monster.cpp | 2 +- Source/player.cpp | 2 +- Source/towners.cpp | 2 +- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index e8a1538f9..cd372e4f1 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -174,12 +174,8 @@ void DrawSpellCel(int xp, int yp, BYTE *pCelBuff, int nCel, int nWidth) { int nDataSize; BYTE *pRLEBytes; - DWORD *pFrameTable; - - pFrameTable = (DWORD *)pCelBuff; - pRLEBytes = &pCelBuff[pFrameTable[nCel]]; - nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel]; + pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize); CelDecDatLightOnly(&gpBuffer[xp + PitchTbl[yp]], pRLEBytes, nDataSize, nWidth, SplTransTbl); } diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 2ce9bf91b..9e574677e 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -87,14 +87,12 @@ void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel) pStart = &gpBuffer[PitchTbl[209]]; pEnd = &gpBuffer[PitchTbl[469]]; - int i; + int i, nDataSize; BYTE width; BYTE *src; - DWORD *pFrameTable; - pFrameTable = (DWORD *)&pCelBuff[4 * nCel]; - src = &pCelBuff[pFrameTable[0]]; - end = &src[pFrameTable[1] - pFrameTable[0]]; + src = CelGetFrame(pCelBuff,nCel, &nDataSize); + end = &src[nDataSize]; for (; src != end; dst -= BUFFER_WIDTH + 22) { for (i = 22; i;) { diff --git a/Source/monster.cpp b/Source/monster.cpp index 1d19db969..4aae30792 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -294,7 +294,7 @@ void InitMonsterGFX(int monst) if (Monsters[monst].mtype != MT_GOLEM || (animletter[anim] != 's' && animletter[anim] != 'd')) { for (i = 0; i < 8; i++) { - Monsters[monst].Anims[anim].Data[i] = &celBuf[((int *)celBuf)[i]]; + Monsters[monst].Anims[anim].Data[i] = CelGetFrameStart(celBuf, i); } } else { for (i = 0; i < 8; i++) { diff --git a/Source/player.cpp b/Source/player.cpp index 953f3b6bc..c0dec3da4 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -127,7 +127,7 @@ void SetPlayerGPtrs(BYTE *pData, BYTE **pAnim) int i; for (i = 0; i < 8; i++) { - pAnim[i] = pData + ((DWORD *)pData)[i]; + pAnim[i] = CelGetFrameStart(pData, i); } } diff --git a/Source/towners.cpp b/Source/towners.cpp index 2ecc55f94..fcd67be7c 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -130,7 +130,7 @@ void SetTownerGPtrs(BYTE *pData, BYTE **pAnim) pFrameTable = (DWORD *)pData; for (i = 0; i < 8; i++) { - pAnim[i] = &pData[pFrameTable[i]]; + pAnim[i] = CelGetFrameStart(pData, i); } }