Browse Source

Enable assertions

pull/389/head
Anders Jenbo 6 years ago
parent
commit
0e578ffb11
  1. 196
      Source/engine.cpp
  2. 24
      Source/missiles.cpp
  3. 2
      Source/monster.cpp
  4. 4
      Source/objects.cpp
  5. 2
      Source/palette.cpp
  6. 9
      Source/pfile.cpp
  7. 48
      Source/scrollrt.cpp
  8. 2
      SourceX/sound.cpp

196
Source/engine.cpp

@ -25,12 +25,8 @@ void CelBlitFrame(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth)
int nDataSize;
BYTE *pRLEBytes;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(pBuff != NULL);
if (!pBuff)
return;
assert(pCelBuff != NULL);
assert(pBuff != NULL);
pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize);
CelBlitSafe(pBuff, pRLEBytes, nDataSize, nWidth);
@ -41,12 +37,8 @@ void CelClippedDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
BYTE *pRLEBytes;
int nDataSize;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(gpBuffer);
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
@ -62,12 +54,8 @@ void CelDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tb
int nDataSize;
BYTE *pDecodeTo, *pRLEBytes;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(gpBuffer);
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize);
pDecodeTo = &gpBuffer[sx + BUFFER_WIDTH * sy];
@ -83,15 +71,10 @@ void CelClippedDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
int nDataSize;
BYTE *pRLEBytes, *pDecodeTo;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(gpBuffer);
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
pDecodeTo = &gpBuffer[sx + BUFFER_WIDTH * sy];
if (light_table_index)
@ -105,15 +88,10 @@ void CelDrawLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char
int nDataSize, w, idx;
BYTE *pRLEBytes, *dst, *tbl;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(gpBuffer);
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
dst = &gpBuffer[sx + BUFFER_WIDTH * sy];
idx = light4flag ? 1024 : 4096;
@ -153,22 +131,14 @@ void CelDrawLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char
*/
void CelBlitSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
{
int w;
/// ASSERT: assert(pDecodeTo != NULL);
if (!pDecodeTo)
return;
/// ASSERT: assert(pRLEBytes != NULL);
if (!pRLEBytes)
return;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
int i;
int i, w;
BYTE width;
BYTE *src, *dst;
assert(pDecodeTo != NULL);
assert(pRLEBytes != NULL);
assert(gpBuffer);
src = pRLEBytes;
dst = pDecodeTo;
w = nWidth;
@ -197,12 +167,8 @@ void CelClippedDrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
BYTE *pRLEBytes;
int nDataSize;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(gpBuffer);
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
@ -218,22 +184,14 @@ void CelClippedDrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
*/
void CelBlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth, BYTE *tbl)
{
int w;
/// ASSERT: assert(pDecodeTo != NULL);
if (!pDecodeTo)
return;
/// ASSERT: assert(pRLEBytes != NULL);
if (!pRLEBytes)
return;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
int i;
int i, w;
BYTE width;
BYTE *src, *dst;
assert(pDecodeTo != NULL);
assert(pRLEBytes != NULL);
assert(gpBuffer);
src = pRLEBytes;
dst = pDecodeTo;
if (tbl == NULL)
@ -289,15 +247,9 @@ void CelBlitLightTransSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int
BOOL shift;
BYTE *tbl;
/// ASSERT: assert(pDecodeTo != NULL);
if (!pDecodeTo)
return;
/// ASSERT: assert(pRLEBytes != NULL);
if (!pRLEBytes)
return;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
assert(pDecodeTo != NULL);
assert(pRLEBytes != NULL);
assert(gpBuffer);
int i;
BYTE width;
@ -377,9 +329,7 @@ void CelClippedBlitLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth)
int nDataSize;
BYTE *pRLEBytes;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
@ -396,15 +346,10 @@ void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, c
int nDataSize, w, idx;
BYTE *pRLEBytes, *dst, *tbl;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
assert(gpBuffer);
assert(pCelBuff != NULL);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
dst = &gpBuffer[sx + BUFFER_WIDTH * sy];
idx = light4flag ? 1024 : 4096;
@ -452,12 +397,8 @@ void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel,
{
BYTE *pRLEBytes, *dst, *end;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(pBuff != NULL);
if (!pBuff)
return;
assert(pCelBuff != NULL);
assert(pBuff != NULL);
int i, nDataSize;
BYTE width;
@ -489,17 +430,10 @@ void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid
BYTE *src, *dst, *end;
BYTE width;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(gpBuffer);
if (!gpBuffer)
return;
assert(pCelBuff != NULL);
assert(gpBuffer);
src = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
if (src == NULL)
return;
end = &src[nDataSize];
dst = &gpBuffer[sx + BUFFER_WIDTH * sy];
@ -548,7 +482,7 @@ void ENG_set_pixel(int sx, int sy, BYTE col)
{
BYTE *dst;
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
if (sy < 0 || sy >= SCREEN_HEIGHT + SCREEN_Y || sx < SCREEN_X || sx >= SCREEN_WIDTH + SCREEN_X)
return;
@ -563,7 +497,7 @@ void engine_draw_pixel(int sx, int sy)
{
BYTE *dst;
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
if (gbRotateMap) {
if (gbNotInView && (sx < 0 || sx >= SCREEN_HEIGHT + SCREEN_Y || sy < SCREEN_X || sy >= SCREEN_WIDTH + SCREEN_X))
@ -906,7 +840,7 @@ DWORD LoadFileWithMem(const char *pszName, void *p)
DWORD dwFileLen;
HANDLE hsFile;
/// ASSERT: assert(pszName);
assert(pszName);
if (p == NULL) {
app_fatal("LoadFileWithMem(NULL):\n%s", pszName);
}
@ -933,8 +867,8 @@ void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel)
char width;
BYTE *dst;
/// ASSERT: assert(p != NULL);
/// ASSERT: assert(ttbl != NULL);
assert(p != NULL);
assert(ttbl != NULL);
for (i = 1; i <= nCel; i++) {
dst = CelGetFrame(p, i, &nDataSize) + 10;
@ -942,17 +876,17 @@ void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel)
while (nDataSize) {
width = *dst++;
nDataSize--;
/// ASSERT: assert(nDataSize >= 0);
assert(nDataSize >= 0);
if (width < 0) {
width = -width;
if (width > 65) {
nDataSize--;
/// ASSERT: assert(nDataSize >= 0);
assert(nDataSize >= 0);
*dst = ttbl[*dst];
dst++;
} else {
nDataSize -= width;
/// ASSERT: assert(nDataSize >= 0);
assert(nDataSize >= 0);
while (width) {
*dst = ttbl[*dst];
dst++;
@ -969,15 +903,9 @@ void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
BYTE *pRLEBytes;
int nDataSize;
/// ASSERT: assert(gpBuffer != NULL);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(nCel > 0);
if (nCel <= 0)
return;
assert(gpBuffer != NULL);
assert(pCelBuff != NULL);
assert(nCel > 0);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
@ -1064,15 +992,9 @@ void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid
int nDataSize;
BYTE *pRLEBytes;
/// ASSERT: assert(gpBuffer != NULL);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(nCel > 0);
if (nCel <= 0)
return;
assert(gpBuffer != NULL);
assert(pCelBuff != NULL);
assert(nCel > 0);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
@ -1167,18 +1089,11 @@ void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char
int nDataSize, idx;
BYTE *pRLEBytes, *pDecodeTo;
/// ASSERT: assert(gpBuffer != NULL);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(nCel > 0);
if (nCel <= 0)
return;
assert(gpBuffer != NULL);
assert(pCelBuff != NULL);
assert(nCel > 0);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
pDecodeTo = &gpBuffer[sx + BUFFER_WIDTH * sy];
idx = light4flag ? 1024 : 4096;
@ -1272,18 +1187,11 @@ void Cl2DrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
int nDataSize;
BYTE *pRLEBytes, *pDecodeTo;
/// ASSERT: assert(gpBuffer != NULL);
if (!gpBuffer)
return;
/// ASSERT: assert(pCelBuff != NULL);
if (!pCelBuff)
return;
/// ASSERT: assert(nCel > 0);
if (nCel <= 0)
return;
assert(gpBuffer != NULL);
assert(pCelBuff != NULL);
assert(nCel > 0);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
pDecodeTo = &gpBuffer[sx + BUFFER_WIDTH * sy];
if (light_table_index)

24
Source/missiles.cpp

@ -18,8 +18,8 @@ void GetDamageAmt(int i, int *mind, int *maxd)
{
int k, sl;
/// ASSERT: assert((DWORD)myplr < MAX_PLRS);
/// ASSERT: assert((DWORD)i < 64);
assert((DWORD)myplr < MAX_PLRS);
assert((DWORD)i < 64);
sl = plr[myplr]._pSplLvl[i] + plr[myplr]._pISplLvlAdd;
switch (i) {
@ -2277,7 +2277,7 @@ void AddFlamec(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy,
void AddCbolt(int mi, int sx, int sy, int dx, int dy, int midir, char micaster, int id, int dam)
{
/// ASSERT: assert((DWORD)mi < MAXMISSILES);
assert((DWORD)mi < MAXMISSILES);
if (micaster == 0) {
if (id == myplr) {
@ -2902,7 +2902,7 @@ void MI_Lightctrl(int i)
{
int pn, dam, p, mx, my;
/// ASSERT: assert((DWORD)i < MAXMISSILES);
assert((DWORD)i < MAXMISSILES);
missile[i]._mirange--;
p = missile[i]._misource;
@ -2922,10 +2922,10 @@ void MI_Lightctrl(int i)
mx = missile[i]._mix;
my = missile[i]._miy;
/// ASSERT: assert((DWORD)mx < MAXDUNX);
/// ASSERT: assert((DWORD)my < MAXDUNY);
assert((DWORD)mx < MAXDUNX);
assert((DWORD)my < MAXDUNY);
pn = dPiece[mx][my];
/// ASSERT: assert((DWORD)pn <= MAXTILES);
assert((DWORD)pn <= MAXTILES);
if (missile[i]._misource == -1) {
if ((mx != missile[i]._misx || my != missile[i]._misy) && nMissileTable[pn]) {
@ -3232,7 +3232,7 @@ void MI_Guardian(int i)
{
int j, k, sx, sy, sx1, sy1, ex;
/// ASSERT: assert((DWORD)i < MAXMISSILES);
assert((DWORD)i < MAXMISSILES);
sx1 = 0;
sy1 = 0;
@ -3649,7 +3649,7 @@ void MI_Wave(int i)
f1 = FALSE;
f2 = FALSE;
/// ASSERT: assert((DWORD)i < MAXMISSILES);
assert((DWORD)i < MAXMISSILES);
id = missile[i]._misource;
sx = missile[i]._mix;
@ -3662,7 +3662,7 @@ void MI_Wave(int i)
nxa = sx + XDirAdd[sd];
nya = sy + YDirAdd[sd];
pn = dPiece[nxa][nya];
/// ASSERT: assert((DWORD)pn <= MAXTILES);
assert((DWORD)pn <= MAXTILES);
if (!nMissileTable[pn]) {
AddMissile(nxa, nya, nxa + XDirAdd[sd], nya + YDirAdd[sd], plr[id]._pdir, MIS_FIREMOVE, 0, id, 0, missile[i]._mispllvl);
nxa += XDirAdd[dira];
@ -3671,7 +3671,7 @@ void MI_Wave(int i)
nyb = sy + YDirAdd[sd] + YDirAdd[dirb];
for (j = 0; j < (missile[i]._mispllvl >> 1) + 2; j++) {
pn = dPiece[nxa][nya]; // BUGFIX: dPiece is accessed before check against dungeon size and 0
/// ASSERT: assert((DWORD)pn <= MAXTILES);
assert((DWORD)pn <= MAXTILES);
if (nMissileTable[pn] || f1 || nxa <= 0 || nxa >= MAXDUNX || nya <= 0 || nya >= MAXDUNY) {
f1 = TRUE;
} else {
@ -3680,7 +3680,7 @@ void MI_Wave(int i)
nya += YDirAdd[dira];
}
pn = dPiece[nxb][nyb]; // BUGFIX: dPiece is accessed before check against dungeon size and 0
/// ASSERT: assert((DWORD)pn <= MAXTILES);
assert((DWORD)pn <= MAXTILES);
if (nMissileTable[pn] || f2 || nxb <= 0 || nxb >= MAXDUNX || nyb <= 0 || nyb >= MAXDUNY) {
f2 = TRUE;
} else {

2
Source/monster.cpp

@ -4516,7 +4516,7 @@ void ProcessMonsters()
DeleteMonsterList();
/// ASSERT: assert((DWORD)nummonsters <= MAXMONSTERS);
assert((DWORD)nummonsters <= MAXMONSTERS);
for (i = 0; i < nummonsters; i++) {
mi = monstactive[i];
Monst = &monster[mi];

4
Source/objects.cpp

@ -2833,7 +2833,7 @@ void OperateShrine(int pnum, int i, int sType)
dropGoldValue = 0;
}
/// ASSERT: assert((DWORD)i < MAXOBJECTS);
assert((DWORD)i < MAXOBJECTS);
if (object[i]._oSelFlag == 0)
return;
@ -3083,7 +3083,7 @@ void OperateShrine(int pnum, int i, int sType)
case SHRINE_THAUMATURGIC:
for (j = 0; j < nobjects; j++) {
v1 = objectactive[j];
/// ASSERT: assert((DWORD)v1 < MAXOBJECTS);
assert((DWORD)v1 < MAXOBJECTS);
if ((object[v1]._otype == OBJ_CHEST1
|| object[v1]._otype == OBJ_CHEST2
|| object[v1]._otype == OBJ_CHEST3)

2
Source/palette.cpp

@ -53,7 +53,7 @@ void LoadPalette(char *pszFileName)
void *pBuf;
BYTE PalData[256][3];
/// ASSERT: assert(pszFileName);
assert(pszFileName);
WOpenFile(pszFileName, &pBuf, 0);
WReadFile(pBuf, (char *)PalData, sizeof(PalData), pszFileName);

9
Source/pfile.cpp

@ -477,15 +477,15 @@ void pfile_rename_temp_to_perm()
char szPerm[MAX_PATH];
dwChar = pfile_get_save_num_from_name(plr[myplr]._pName);
/// ASSERT: assert(dwChar < MAX_CHARACTERS);
/// ASSERT: assert(gbMaxPlayers == 1);
assert(dwChar < MAX_CHARACTERS);
assert(gbMaxPlayers == 1);
if (!pfile_open_archive(FALSE, dwChar))
app_fatal("Unable to write to save file archive");
dwIndex = 0;
while (GetTempSaveNames(dwIndex, szTemp)) {
bResult = GetPermSaveNames(dwIndex, szPerm);
/// ASSERT: assert(bResult);
assert(bResult);
dwIndex++;
if (mpqapi_has_file(szTemp)) {
if (mpqapi_has_file(szPerm))
@ -493,8 +493,7 @@ void pfile_rename_temp_to_perm()
mpqapi_rename(szTemp, szPerm);
}
}
/// ASSERT: assert(! GetPermSaveNames(dwIndex,szPerm));
GetPermSaveNames(dwIndex, szPerm); // BUGFIX: function call has no purpose
assert(! GetPermSaveNames(dwIndex,szPerm));
pfile_flush(TRUE, dwChar);
}

48
Source/scrollrt.cpp

@ -74,7 +74,7 @@ static void scrollrt_draw_cursor_back_buffer()
return;
}
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
src = sgSaveBack;
dst = &gpBuffer[SCREENXY(sgdwCursX, sgdwCursY)];
@ -94,7 +94,7 @@ static void scrollrt_draw_cursor_item()
int i, mx, my, col;
BYTE *src, *dst;
/// ASSERT: assert(! sgdwCursWdt);
assert(! sgdwCursWdt);
if (pcurs <= 0 || cursW == 0 || cursH == 0) {
return;
@ -131,8 +131,8 @@ static void scrollrt_draw_cursor_item()
sgdwCursHgt -= sgdwCursY;
sgdwCursHgt++;
/// ASSERT: assert(sgdwCursWdt * sgdwCursHgt < sizeof sgSaveBack);
/// ASSERT: assert(gpBuffer);
assert(sgdwCursWdt * sgdwCursHgt < sizeof sgSaveBack);
assert(gpBuffer);
dst = sgSaveBack;
src = &gpBuffer[SCREENXY(sgdwCursX, sgdwCursY)];
@ -207,9 +207,7 @@ void DrawMissile(int x, int y, int sx, int sy, BOOL pre)
}
for (i = 0; i < nummissiles; i++) {
/// ASSERT: assert(missileactive[i] < MAXMISSILES);
if (missileactive[i] >= MAXMISSILES)
break;
assert(missileactive[i] < MAXMISSILES);
m = &missile[missileactive[i]];
if (m->_mix != x || m->_miy != y)
continue;
@ -390,9 +388,7 @@ static void DrawObject(int x, int y, int ox, int oy, BOOL pre)
sy = oy + (yy << 4) + (xx << 4);
}
/// ASSERT: assert((unsigned char)bv < MAXOBJECTS);
if ((BYTE)bv >= MAXOBJECTS)
return;
assert((unsigned char)bv < MAXOBJECTS);
pCelBuff = object[bv]._oAnimData;
if (!pCelBuff) {
@ -412,9 +408,7 @@ static void DrawObject(int x, int y, int ox, int oy, BOOL pre)
if (object[bv]._oLight) {
CelClippedDrawLight(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
} else {
/// ASSERT: assert(object[bv]._oAnimData);
if (object[bv]._oAnimData) // BUGFIX: _oAnimData was already checked, this is redundant
CelClippedDraw(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
CelClippedDraw(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
}
}
@ -480,7 +474,7 @@ static void DrawItem(int x, int y, int sx, int sy, BOOL pre)
if (pItem->_iPostDraw == pre)
return;
/// ASSERT: assert((unsigned char)bItem <= MAXITEMS);
assert((unsigned char)bItem <= MAXITEMS);
int px = sx - pItem->_iAnimWidth2;
if (bItem - 1 == pcursitem) {
CelBlitOutline(181, px, sy, pItem->_iAnimData, pItem->_iAnimFrame, pItem->_iAnimWidth);
@ -504,7 +498,7 @@ static void DrawMonsterHelper(int x, int y, int oy, int sx, int sy, int eflag)
if (mi == pcursmonst) {
CelBlitOutline(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth);
}
/// ASSERT: assert(towner[mi]._tAnimData);
assert(towner[mi]._tAnimData);
CelClippedDraw(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth);
return;
}
@ -557,8 +551,8 @@ static void scrollrt_draw_dungeon(int sx, int sy, int dx, int dy, int eflag)
DeadStruct *pDeadGuy;
BYTE *pCelBuff;
/// ASSERT: assert((DWORD)sx < MAXDUNX);
/// ASSERT: assert((DWORD)sy < MAXDUNY);
assert((DWORD)sx < MAXDUNX);
assert((DWORD)sy < MAXDUNY);
bFlag = dFlags[sx][sy];
bDead = dDead[sx][sy];
bArch = dArch[sx][sy];
@ -579,7 +573,7 @@ static void scrollrt_draw_dungeon(int sx, int sy, int dx, int dy, int eflag)
dd = (bDead >> 5) & 7;
px = dx - pDeadGuy->_deadWidth2;
pCelBuff = pDeadGuy->_deadData[dd];
/// ASSERT: assert(pDeadGuy->_deadData[dd] != NULL);
assert(pDeadGuy->_deadData[dd] != NULL);
if (pCelBuff != NULL) {
if (pDeadGuy->_deadtrans != 0) {
Cl2DrawLightTbl(px, dy, pCelBuff, pDeadGuy->_deadFrame, pDeadGuy->_deadWidth, pDeadGuy->_deadtrans);
@ -591,7 +585,7 @@ static void scrollrt_draw_dungeon(int sx, int sy, int dx, int dy, int eflag)
DrawObject(sx, sy, dx, dy, 1);
DrawItem(sx, sy, dx, dy, 1);
if (bFlag & BFLAG_PLAYERLR) {
/// ASSERT: assert((DWORD)(sy-1) < MAXDUNY);
assert((DWORD)(sy-1) < MAXDUNY);
DrawPlayerHelper(sx, sy, -1, dx, dy, eflag);
}
if (bFlag & BFLAG_MONSTLR && negMon < 0) {
@ -624,7 +618,7 @@ static void scrollrt_draw_dungeon(int sx, int sy, int dx, int dy, int eflag)
static void scrollrt_draw(int x, int y, int sx, int sy, int chunks, int dPieceRow)
{
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
if (dPieceRow & 1) {
x--;
@ -743,7 +737,7 @@ static void DrawGame(int x, int y)
break;
}
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
for (i = 0; i < (blocks << 1); i++) {
scrollrt_draw(x, y, sx, sy, chunks, i);
sy += 16;
@ -773,7 +767,7 @@ static void DrawGame(int x, int y)
}
}
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
int hgt;
BYTE *src, *dst1, *dst2;
@ -852,7 +846,7 @@ void ClearScreenBuffer()
{
lock_buf(3);
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
int i;
BYTE *dst;
@ -978,14 +972,14 @@ static void DoBlitScreen(DWORD dwX, DWORD dwY, DWORD dwWdt, DWORD dwHgt)
{
RECT SrcRect;
/// ASSERT: assert(! (dwX & 3));
/// ASSERT: assert(! (dwWdt & 3));
assert(! (dwX & 3));
assert(! (dwWdt & 3));
SrcRect.left = dwX + SCREEN_X;
SrcRect.top = dwY + SCREEN_Y;
SrcRect.right = SrcRect.left + dwWdt - 1;
SrcRect.bottom = SrcRect.top + dwHgt - 1;
/// ASSERT: assert(! gpBuffer);
BltFast(dwX, dwY, &SrcRect);
}
@ -1001,7 +995,7 @@ static void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BO
return;
}
/// ASSERT: assert(ysize >= 0 && ysize <= 480); // SCREEN_HEIGHT
assert(ysize >= 0 && ysize <= SCREEN_HEIGHT);
if (ysize > 0) {
DoBlitScreen(0, 0, SCREEN_WIDTH, ysize);

2
SourceX/sound.cpp

@ -191,7 +191,7 @@ void music_start(int nTrack)
{
BOOL success;
/// ASSERT: assert((DWORD) nTrack < NUM_MUSIC);
assert((DWORD) nTrack < NUM_MUSIC);
music_stop();
if (gbMusicOn) {
success = SFileOpenFile(sgszMusicTracks[nTrack], &sgpMusicTrack);

Loading…
Cancel
Save