diff --git a/Source/appfat.cpp b/Source/appfat.cpp index d84fe01b8..4b8195fb8 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -33,14 +33,14 @@ void TriggerBreak() #ifdef _DEBUG LONG __stdcall BreakFilter(PEXCEPTION_POINTERS pExc) { - if(pExc->ExceptionRecord == NULL) { + if (pExc->ExceptionRecord == NULL) { return 0; } - if(pExc->ExceptionRecord->ExceptionCode != EXCEPTION_BREAKPOINT) { + if (pExc->ExceptionRecord->ExceptionCode != EXCEPTION_BREAKPOINT) { return 0; } - if(((BYTE *)pExc->ContextRecord->Eip)[0] == 0xCC) { // int 3 + if (((BYTE *)pExc->ContextRecord->Eip)[0] == 0xCC) { // int 3 pExc->ContextRecord->Eip++; } diff --git a/Source/capture.cpp b/Source/capture.cpp index f4d34014d..34b1e758d 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -68,9 +68,9 @@ BOOL CapturePal(HANDLE hFile, PALETTEENTRY *palette) pcx_palette[0] = 12; for (i = 0; i < 256; i++) { - pcx_palette[1 + 3*i + 0] = palette[i].peRed; - pcx_palette[1 + 3*i + 1] = palette[i].peGreen; - pcx_palette[1 + 3*i + 2] = palette[i].peBlue; + pcx_palette[1 + 3 * i + 0] = palette[i].peRed; + pcx_palette[1 + 3 * i + 1] = palette[i].peGreen; + pcx_palette[1 + 3 * i + 2] = palette[i].peBlue; } return WriteFile(hFile, pcx_palette, 769, &NumberOfBytesWritten, 0) && NumberOfBytesWritten == 769; diff --git a/Source/codec.cpp b/Source/codec.cpp index 1f85e20db..748fa2925 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -1,7 +1,6 @@ #include "diablo.h" -struct CodecSignature -{ +struct CodecSignature { DWORD checksum; BYTE error; BYTE last_chunk_size; @@ -94,7 +93,7 @@ DWORD codec_get_encoded_len(DWORD dwSrcBytes) return dwSrcBytes + 8; } -void codec_encode(BYTE* pbSrcDst, DWORD size, int size_64, char *pszPassword) +void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, char *pszPassword) { char buf[128]; char tmp[SHA1HashSize]; @@ -126,7 +125,7 @@ void codec_encode(BYTE* pbSrcDst, DWORD size, int size_64, char *pszPassword) } memset(buf, 0, sizeof(buf)); SHA1Result(0, tmp); - sig = (CodecSignature*) pbSrcDst; + sig = (CodecSignature *)pbSrcDst; sig->error = 0; sig->unused = 0; sig->checksum = *(DWORD *)tmp; diff --git a/Source/control.cpp b/Source/control.cpp index a6ca23ceb..119a952a4 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1730,7 +1730,7 @@ void DrawChr() mindam += plr[myplr]._pDamageMod; } maxdam = plr[myplr]._pIMaxDam; - maxdam += plr[myplr]._pIBonusDam * maxdam / 100; + maxdam += plr[myplr]._pIBonusDam * maxdam / 100; maxdam += plr[myplr]._pIBonusDamMod; if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._itype == ITYPE_BOW) { if (plr[myplr]._pClass == PC_ROGUE) diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 7f072aa16..de38cc0ae 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -17,7 +17,7 @@ char pcursplr; // weak int cursmx; int cursmy; int pcurstemp; // weak -int pcurs; // idb +int pcurs; // idb /* rdata */ const int InvItemWidth[180] = { @@ -177,23 +177,23 @@ void CheckCursMove() sx = MouseX; sy = MouseY; - if(chrflag || questlog) { - if(sx >= 160) { + if (chrflag || questlog) { + if (sx >= 160) { sx -= 160; } else { sx = 0; } - } else if(invflag || sbookflag) { - if(sx <= 320) { + } else if (invflag || sbookflag) { + if (sx <= 320) { sx += 160; } else { sx = 0; } } - if(sy > VIEWPORT_HEIGHT - 1 && track_isscrolling()) { + if (sy > VIEWPORT_HEIGHT - 1 && track_isscrolling()) { sy = VIEWPORT_HEIGHT - 1; } - if(!zoomflag) { + if (!zoomflag) { sx >>= 1; sy >>= 1; } @@ -201,21 +201,21 @@ void CheckCursMove() sx -= ScrollInfo._sxoff; sy -= ScrollInfo._syoff; - if(ScrollInfo._sdir != 0) { + if (ScrollInfo._sdir != 0) { sx += ((plr[myplr]._pVar6 + plr[myplr]._pxvel) >> 8) - (plr[myplr]._pVar6 >> 8); sy += ((plr[myplr]._pVar7 + plr[myplr]._pyvel) >> 8) - (plr[myplr]._pVar7 >> 8); } - if(sx < 0) { + if (sx < 0) { sx = 0; } - if(sx >= 640) { + if (sx >= 640) { sx = 640; } - if(sy < 0) { + if (sy < 0) { sy = 0; } - if(sy >= 480) { + if (sy >= 480) { sy = 480; } @@ -226,25 +226,25 @@ void CheckCursMove() mx = ViewX + tx + ty - (zoomflag ? 10 : 5); my = ViewY + ty - tx; - flipy = py < px >> 1; - if(flipy) { + flipy = py> 1; + if (flipy) { my--; } flipx = py >= 32 - (px >> 1); - if(flipx) { + if (flipx) { mx++; } - if(mx < 0) { + if (mx < 0) { mx = 0; } - if(mx >= MAXDUNX) { + if (mx >= MAXDUNX) { mx = MAXDUNX - 1; } - if(my < 0) { + if (my < 0) { my = 0; } - if(my >= MAXDUNY) { + if (my >= MAXDUNY) { my = MAXDUNY - 1; } @@ -254,7 +254,7 @@ void CheckCursMove() pcursmonst = -1; pcursobj = -1; pcursitem = -1; - if(pcursinvitem != -1) { + if (pcursinvitem != -1) { drawsbarflag = TRUE; } pcursinvitem = -1; @@ -263,232 +263,232 @@ void CheckCursMove() panelflag = 0; trigflag = FALSE; - if(plr[myplr]._pInvincible) { + if (plr[myplr]._pInvincible) { return; } - if(pcurs >= CURSOR_FIRSTITEM || spselflag) { + if (pcurs >= CURSOR_FIRSTITEM || spselflag) { cursmx = mx; cursmy = my; return; } - if(MouseY > VIEWPORT_HEIGHT) { + if (MouseY > VIEWPORT_HEIGHT) { CheckPanelInfo(); return; } - if(doomflag) { + if (doomflag) { return; } - if(invflag && MouseX > 320) { + if (invflag && MouseX > 320) { pcursinvitem = CheckInvHLight(); return; } - if(sbookflag && MouseX > 320) { + if (sbookflag && MouseX > 320) { return; } - if((chrflag || questlog) && MouseX < 320) { + if ((chrflag || questlog) && MouseX < 320) { return; } - if(leveltype != DTYPE_TOWN) { - if(pcurstemp != -1) { - if(!flipflag && dMonster[mx + 2][my + 1] != 0 && dFlags[mx + 2][my + 1] & BFLAG_LIT) { + if (leveltype != DTYPE_TOWN) { + if (pcurstemp != -1) { + if (!flipflag && dMonster[mx + 2][my + 1] != 0 && dFlags[mx + 2][my + 1] & BFLAG_LIT) { mi = dMonster[mx + 2][my + 1] > 0 ? dMonster[mx + 2][my + 1] - 1 : -(dMonster[mx + 2][my + 1] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 1; /// BUGFIX: 'mx + 2' cursmy = my + 2; /// BUGFIX: 'my + 1' pcursmonst = mi; } } - if(flipflag && dMonster[mx + 1][my + 2] != 0 && dFlags[mx + 1][my + 2] & BFLAG_LIT) { + if (flipflag && dMonster[mx + 1][my + 2] != 0 && dFlags[mx + 1][my + 2] & BFLAG_LIT) { mi = dMonster[mx + 1][my + 2] > 0 ? dMonster[mx + 1][my + 2] - 1 : -(dMonster[mx + 1][my + 2] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 1; cursmy = my + 2; pcursmonst = mi; } } - if(dMonster[mx + 2][my + 2] != 0 && dFlags[mx + 2][my + 2] & BFLAG_LIT) { + if (dMonster[mx + 2][my + 2] != 0 && dFlags[mx + 2][my + 2] & BFLAG_LIT) { mi = dMonster[mx + 2][my + 2] > 0 ? dMonster[mx + 2][my + 2] - 1 : -(dMonster[mx + 2][my + 2] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 2; cursmy = my + 2; pcursmonst = mi; } } - if(!flipflag && dMonster[mx + 1][my] != 0 && dFlags[mx + 1][my] & BFLAG_LIT) { + if (!flipflag && dMonster[mx + 1][my] != 0 && dFlags[mx + 1][my] & BFLAG_LIT) { mi = dMonster[mx + 1][my] > 0 ? dMonster[mx + 1][my] - 1 : -(dMonster[mx + 1][my] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { cursmx = mx + 1; cursmy = my; pcursmonst = mi; } } - if(flipflag && dMonster[mx][my + 1] != 0 && dFlags[mx][my + 1] & BFLAG_LIT) { + if (flipflag && dMonster[mx][my + 1] != 0 && dFlags[mx][my + 1] & BFLAG_LIT) { mi = dMonster[mx][my + 1] > 0 ? dMonster[mx][my + 1] - 1 : -(dMonster[mx][my + 1] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { cursmx = mx; cursmy = my + 1; pcursmonst = mi; } } - if(dMonster[mx][my] != 0 && dFlags[mx][my] & BFLAG_LIT) { + if (dMonster[mx][my] != 0 && dFlags[mx][my] & BFLAG_LIT) { mi = dMonster[mx][my] > 0 ? dMonster[mx][my] - 1 : -(dMonster[mx][my] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 1) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 1) { cursmx = mx; cursmy = my; pcursmonst = mi; } } - if(dMonster[mx + 1][my + 1] != 0 && dFlags[mx + 1][my + 1] & BFLAG_LIT) { + if (dMonster[mx + 1][my + 1] != 0 && dFlags[mx + 1][my + 1] & BFLAG_LIT) { mi = dMonster[mx + 1][my + 1] > 0 ? dMonster[mx + 1][my + 1] - 1 : -(dMonster[mx + 1][my + 1] + 1); - if(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { + if (mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { cursmx = mx + 1; cursmy = my + 1; pcursmonst = mi; } } - if(pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_HIDDEN) { + if (pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_HIDDEN) { pcursmonst = -1; cursmx = mx; cursmy = my; } - if(pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_GOLEM) { + if (pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_GOLEM) { pcursmonst = -1; } - if(pcursmonst != -1) { + if (pcursmonst != -1) { return; } } - if(!flipflag && dMonster[mx + 2][my + 1] != 0 && dFlags[mx + 2][my + 1] & BFLAG_LIT) { + if (!flipflag && dMonster[mx + 2][my + 1] != 0 && dFlags[mx + 2][my + 1] & BFLAG_LIT) { mi = dMonster[mx + 2][my + 1] > 0 ? dMonster[mx + 2][my + 1] - 1 : -(dMonster[mx + 2][my + 1] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 2; cursmy = my + 1; pcursmonst = mi; } } - if(flipflag && dMonster[mx + 1][my + 2] != 0 && dFlags[mx + 1][my + 2] & BFLAG_LIT) { + if (flipflag && dMonster[mx + 1][my + 2] != 0 && dFlags[mx + 1][my + 2] & BFLAG_LIT) { mi = dMonster[mx + 1][my + 2] > 0 ? dMonster[mx + 1][my + 2] - 1 : -(dMonster[mx + 1][my + 2] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 1; cursmy = my + 2; pcursmonst = mi; } } - if(dMonster[mx + 2][my + 2] != 0 && dFlags[mx + 2][my + 2] & BFLAG_LIT) { + if (dMonster[mx + 2][my + 2] != 0 && dFlags[mx + 2][my + 2] & BFLAG_LIT) { mi = dMonster[mx + 2][my + 2] > 0 ? dMonster[mx + 2][my + 2] - 1 : -(dMonster[mx + 2][my + 2] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 2; cursmy = my + 2; pcursmonst = mi; } } - if(!flipflag && dMonster[mx + 1][my] != 0 && dFlags[mx + 1][my] & BFLAG_LIT) { + if (!flipflag && dMonster[mx + 1][my] != 0 && dFlags[mx + 1][my] & BFLAG_LIT) { mi = dMonster[mx + 1][my] > 0 ? dMonster[mx + 1][my] - 1 : -(dMonster[mx + 1][my] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { cursmx = mx + 1; cursmy = my; pcursmonst = mi; } } - if(flipflag && dMonster[mx][my + 1] != 0 && dFlags[mx][my + 1] & BFLAG_LIT) { + if (flipflag && dMonster[mx][my + 1] != 0 && dFlags[mx][my + 1] & BFLAG_LIT) { mi = dMonster[mx][my + 1] > 0 ? dMonster[mx][my + 1] - 1 : -(dMonster[mx][my + 1] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { cursmx = mx; cursmy = my + 1; pcursmonst = mi; } } - if(dMonster[mx][my] != 0 && dFlags[mx][my] & BFLAG_LIT) { + if (dMonster[mx][my] != 0 && dFlags[mx][my] & BFLAG_LIT) { mi = dMonster[mx][my] > 0 ? dMonster[mx][my] - 1 : -(dMonster[mx][my] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 1) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 1) { cursmx = mx; cursmy = my; pcursmonst = mi; } } - if(dMonster[mx + 1][my + 1] != 0 && dFlags[mx + 1][my + 1] & BFLAG_LIT) { + if (dMonster[mx + 1][my + 1] != 0 && dFlags[mx + 1][my + 1] & BFLAG_LIT) { mi = dMonster[mx + 1][my + 1] > 0 ? dMonster[mx + 1][my + 1] - 1 : -(dMonster[mx + 1][my + 1] + 1); - if(monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { + if (monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 2) { cursmx = mx + 1; cursmy = my + 1; pcursmonst = mi; } } - if(pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_HIDDEN) { + if (pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_HIDDEN) { pcursmonst = -1; cursmx = mx; cursmy = my; } - if(pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_GOLEM) { + if (pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_GOLEM) { pcursmonst = -1; } } else { - if(!flipflag && dMonster[mx + 1][my] > 0) { + if (!flipflag && dMonster[mx + 1][my] > 0) { pcursmonst = dMonster[mx + 1][my] - 1; cursmx = mx + 1; cursmy = my; } - if(flipflag && dMonster[mx][my + 1] > 0) { + if (flipflag && dMonster[mx][my + 1] > 0) { pcursmonst = dMonster[mx][my + 1] - 1; cursmx = mx; cursmy = my + 1; } - if(dMonster[mx][my] > 0) { + if (dMonster[mx][my] > 0) { pcursmonst = dMonster[mx][my] - 1; cursmx = mx; cursmy = my; } - if(dMonster[mx + 1][my + 1] > 0) { + if (dMonster[mx + 1][my + 1] > 0) { pcursmonst = dMonster[mx + 1][my + 1] - 1; cursmx = mx + 1; cursmy = my + 1; } - if(!towner[pcursmonst]._tSelFlag) { /// BUGFIX: Add check 'pcursmonst != -1' + if (!towner[pcursmonst]._tSelFlag) { /// BUGFIX: Add check 'pcursmonst != -1' pcursmonst = -1; } } - if(pcursmonst == -1) { - if(!flipflag && dPlayer[mx + 1][my] != 0) { + if (pcursmonst == -1) { + if (!flipflag && dPlayer[mx + 1][my] != 0) { bv = dPlayer[mx + 1][my] > 0 ? dPlayer[mx + 1][my] - 1 : -(dPlayer[mx + 1][my] + 1); - if(bv != myplr && plr[bv]._pHitPoints != 0) { + if (bv != myplr && plr[bv]._pHitPoints != 0) { cursmx = mx + 1; cursmy = my; pcursplr = bv; } } - if(flipflag && dPlayer[mx][my + 1] != 0) { + if (flipflag && dPlayer[mx][my + 1] != 0) { bv = dPlayer[mx][my + 1] > 0 ? dPlayer[mx][my + 1] - 1 : -(dPlayer[mx][my + 1] + 1); - if(bv != myplr && plr[bv]._pHitPoints != 0) { + if (bv != myplr && plr[bv]._pHitPoints != 0) { cursmx = mx; cursmy = my + 1; pcursplr = bv; } } - if(dPlayer[mx][my] != 0) { + if (dPlayer[mx][my] != 0) { bv = dPlayer[mx][my] > 0 ? dPlayer[mx][my] - 1 : -(dPlayer[mx][my] + 1); - if(bv != myplr) { + if (bv != myplr) { cursmx = mx; cursmy = my; pcursplr = bv; } } - if(dFlags[mx][my] & BFLAG_DEAD_PLAYER) { - for(i = 0; i < MAX_PLRS; i++) { - if(plr[i].WorldX == mx && plr[i].WorldY == my && i != myplr) { + if (dFlags[mx][my] & BFLAG_DEAD_PLAYER) { + for (i = 0; i < MAX_PLRS; i++) { + if (plr[i].WorldX == mx && plr[i].WorldY == my && i != myplr) { cursmx = mx; cursmy = my; pcursplr = i; } } } - if(pcurs == CURSOR_RESURRECT) { - for(xx = -1; xx < 2; xx++) { - for(yy = -1; yy < 2; yy++) { - if(dFlags[mx + xx][my + yy] & BFLAG_DEAD_PLAYER) { - for(i = 0; i < MAX_PLRS; i++) { - if(plr[i].WorldX == mx + xx && plr[i].WorldY == my + yy && i != myplr) { + if (pcurs == CURSOR_RESURRECT) { + for (xx = -1; xx < 2; xx++) { + for (yy = -1; yy < 2; yy++) { + if (dFlags[mx + xx][my + yy] & BFLAG_DEAD_PLAYER) { + for (i = 0; i < MAX_PLRS; i++) { + if (plr[i].WorldX == mx + xx && plr[i].WorldY == my + yy && i != myplr) { cursmx = mx + xx; cursmy = my + yy; pcursplr = i; @@ -498,83 +498,83 @@ void CheckCursMove() } } } - if(dPlayer[mx + 1][my + 1] != 0) { + if (dPlayer[mx + 1][my + 1] != 0) { bv = dPlayer[mx + 1][my + 1] > 0 ? dPlayer[mx + 1][my + 1] - 1 : -(dPlayer[mx + 1][my + 1] + 1); - if(bv != myplr && plr[bv]._pHitPoints != 0) { + if (bv != myplr && plr[bv]._pHitPoints != 0) { cursmx = mx + 1; cursmy = my + 1; pcursplr = bv; } } } - if(pcursmonst == -1 && pcursplr == -1) { - if(!flipflag && dObject[mx + 1][my] != 0) { + if (pcursmonst == -1 && pcursplr == -1) { + if (!flipflag && dObject[mx + 1][my] != 0) { bv = dObject[mx + 1][my] > 0 ? dObject[mx + 1][my] - 1 : -(dObject[mx + 1][my] + 1); - if(object[bv]._oSelFlag >= 2) { + if (object[bv]._oSelFlag >= 2) { cursmx = mx + 1; cursmy = my; pcursobj = bv; } } - if(flipflag && dObject[mx][my + 1] != 0) { + if (flipflag && dObject[mx][my + 1] != 0) { bv = dObject[mx][my + 1] > 0 ? dObject[mx][my + 1] - 1 : -(dObject[mx][my + 1] + 1); - if(object[bv]._oSelFlag >= 2) { + if (object[bv]._oSelFlag >= 2) { cursmx = mx; cursmy = my + 1; pcursobj = bv; } } - if(dObject[mx][my] != 0) { + if (dObject[mx][my] != 0) { bv = dObject[mx][my] > 0 ? dObject[mx][my] - 1 : -(dObject[mx][my] + 1); - if(object[bv]._oSelFlag == 1 || object[bv]._oSelFlag == 3) { + if (object[bv]._oSelFlag == 1 || object[bv]._oSelFlag == 3) { cursmx = mx; cursmy = my; pcursobj = bv; } } - if(dObject[mx + 1][my + 1] != 0) { + if (dObject[mx + 1][my + 1] != 0) { bv = dObject[mx + 1][my + 1] > 0 ? dObject[mx + 1][my + 1] - 1 : -(dObject[mx + 1][my + 1] + 1); - if(object[bv]._oSelFlag >= 2) { + if (object[bv]._oSelFlag >= 2) { cursmx = mx + 1; cursmy = my + 1; pcursobj = bv; } } } - if(pcursplr == -1 && pcursobj == -1 && pcursmonst == -1) { - if(!flipflag && dItem[mx + 1][my] > 0) { + if (pcursplr == -1 && pcursobj == -1 && pcursmonst == -1) { + if (!flipflag && dItem[mx + 1][my] > 0) { bv = dItem[mx + 1][my] - 1; - if(item[bv]._iSelFlag >= 2) { + if (item[bv]._iSelFlag >= 2) { cursmx = mx + 1; cursmy = my; pcursitem = bv; } } - if(flipflag && dItem[mx][my + 1] > 0) { + if (flipflag && dItem[mx][my + 1] > 0) { bv = dItem[mx][my + 1] - 1; - if(item[bv]._iSelFlag >= 2) { + if (item[bv]._iSelFlag >= 2) { cursmx = mx; cursmy = my + 1; pcursitem = bv; } } - if(dItem[mx][my] > 0) { + if (dItem[mx][my] > 0) { bv = dItem[mx][my] - 1; - if(item[bv]._iSelFlag == 1 || item[bv]._iSelFlag == 3) { + if (item[bv]._iSelFlag == 1 || item[bv]._iSelFlag == 3) { cursmx = mx; cursmy = my; pcursitem = bv; } } - if(dItem[mx + 1][my + 1] > 0) { + if (dItem[mx + 1][my + 1] > 0) { bv = dItem[mx + 1][my + 1] - 1; - if(item[bv]._iSelFlag >= 2) { + if (item[bv]._iSelFlag >= 2) { cursmx = mx + 1; cursmy = my + 1; pcursitem = bv; } } - if(pcursitem == -1) { + if (pcursitem == -1) { cursmx = mx; cursmy = my; CheckTrigForce(); @@ -583,14 +583,14 @@ void CheckCursMove() } } - if(pcurs == CURSOR_IDENTIFY) { + if (pcurs == CURSOR_IDENTIFY) { pcursobj = -1; pcursmonst = -1; pcursitem = -1; cursmx = mx; cursmy = my; } - if(pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_GOLEM) { + if (pcursmonst != -1 && monster[pcursmonst]._mFlags & MFLAG_GOLEM) { pcursmonst = -1; } } diff --git a/Source/debug.cpp b/Source/debug.cpp index 0b1e75e5d..344bf275f 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -28,20 +28,20 @@ void init_seed_desync() { int i; - for(i = 0; i < 4096; i++) { + for (i = 0; i < 4096; i++) { seed_table[i] = -1; } seed_index = 0; - for(i = 0; i < NUMLEVELS; i++) { + for (i = 0; i < NUMLEVELS; i++) { level_seeds[i] = 0; } } void seed_desync_index_get() { - if(currlevel == 0) { + if (currlevel == 0) { return; } @@ -51,7 +51,7 @@ void seed_desync_index_get() void seed_desync_index_set() { - if(currlevel == 0) { + if (currlevel == 0) { return; } @@ -61,13 +61,13 @@ void seed_desync_index_set() void seed_desync_check(int seed) { - if(!update_seed_check || seed_index == 4096 || currlevel == 0) { + if (!update_seed_check || seed_index == 4096 || currlevel == 0) { return; } - if(seed_table[seed_index] == -1) { + if (seed_table[seed_index] == -1) { seed_table[seed_index] = seed; - } else if(seed != seed_table[seed_index]) { + } else if (seed != seed_table[seed_index]) { app_fatal("Seeds desynced"); } @@ -220,7 +220,7 @@ void PrintDebugQuest() sprintf(dstr, "Quest %i : Active = %i, Var1 = %i", dbgqst, quests[dbgqst]._qactive, quests[dbgqst]._qvar1); NetSendCmdString(1 << myplr, dstr); - + dbgqst++; if (dbgqst == MAXQUESTS) dbgqst = 0; @@ -229,8 +229,8 @@ void PrintDebugQuest() void PrintDebugMonster(int m) { BOOL bActive; - int i; - char dstr[128]; + int i; + char dstr[128]; sprintf(dstr, "Monster %i = %s", m, monster[m].mName); NetSendCmdString(1 << myplr, dstr); diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 3c3fa6912..f46584f87 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -142,12 +142,12 @@ void run_game_loop(unsigned int uMsg) gbGameLoopStartup = TRUE; nthread_ignore_mutex(FALSE); - while(gbRunGame) { + while (gbRunGame) { diablo_color_cyc_logic(); - if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { + if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); - while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if(msg.message == WM_QUIT) { + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + if (msg.message == WM_QUIT) { gbRunGameResult = FALSE; gbRunGame = FALSE; break; @@ -157,10 +157,10 @@ void run_game_loop(unsigned int uMsg) } bLoop = gbRunGame && nthread_has_500ms_passed(FALSE); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); - if(!bLoop) { + if (!bLoop) { continue; } - } else if(!nthread_has_500ms_passed(FALSE)) { + } else if (!nthread_has_500ms_passed(FALSE)) { #ifdef SLEEPFIX Sleep(1); #endif @@ -173,7 +173,7 @@ void run_game_loop(unsigned int uMsg) DrawAndBlit(); } - if(gbMaxPlayers > 1) { + if (gbMaxPlayers > 1) { pfile_write_hero(); } @@ -187,7 +187,7 @@ void run_game_loop(unsigned int uMsg) /// ASSERT: assert(saveProc == GM_Game); free_game(); - if(cineflag) { + if (cineflag) { cineflag = FALSE; DoEnding(); } @@ -323,24 +323,24 @@ void diablo_parse_flags(char *args) int i; #endif - while(*args != '\0') { - while(isspace(*args)) { + while (*args != '\0') { + while (isspace(*args)) { args++; } - if(_strnicmp("dd_emulate", args, strlen("dd_emulate")) == 0) { + if (_strnicmp("dd_emulate", args, strlen("dd_emulate")) == 0) { gbEmulate = 1; args += strlen("dd_emulate"); - } else if(_strnicmp("dd_backbuf", args, strlen("dd_backbuf")) == 0) { + } else if (_strnicmp("dd_backbuf", args, strlen("dd_backbuf")) == 0) { gbBackBuf = 1; args += strlen("dd_backbuf"); - } else if(_strnicmp("ds_noduplicates", args, strlen("ds_noduplicates")) == 0) { + } else if (_strnicmp("ds_noduplicates", args, strlen("ds_noduplicates")) == 0) { gbDupSounds = 0; args += strlen("ds_noduplicates"); } else { c = tolower(*args); args++; #ifdef _DEBUG - switch(c) { + switch (c) { case '^': debug_mode_key_inverted_v = 1; break; @@ -348,7 +348,7 @@ void diablo_parse_flags(char *args) debug_mode_dollar_sign = 1; break; case 'b': - /* + /* debug_mode_key_b = 1; */ break; @@ -363,7 +363,7 @@ void diablo_parse_flags(char *args) debug_mode_key_i = 1; break; case 'j': - /* + /* while(isspace(*args)) { args++; } @@ -378,20 +378,20 @@ void diablo_parse_flags(char *args) case 'l': setlevel = 0; leveldebug = 1; - while(isspace(*args)) { + while (isspace(*args)) { args++; } i = 0; - while(isdigit(*args)) { + while (isdigit(*args)) { i = *args + 10 * i - '0'; args++; } leveltype = i; - while(isspace(*args)) { + while (isspace(*args)) { args++; } i = 0; - while(isdigit(*args)) { + while (isdigit(*args)) { i = *args + 10 * i - '0'; args++; } @@ -400,11 +400,11 @@ void diablo_parse_flags(char *args) break; case 'm': monstdebug = 1; - while(isspace(*args)) { + while (isspace(*args)) { args++; } i = 0; - while(isdigit(*args)) { + while (isdigit(*args)) { i = *args + 10 * i - '0'; args++; } @@ -414,22 +414,22 @@ void diablo_parse_flags(char *args) showintrodebug = 0; break; case 'q': - while(isspace(*args)) { + while (isspace(*args)) { args++; } i = 0; - while(isdigit(*args)) { + while (isdigit(*args)) { i = *args + 10 * i - '0'; args++; } questdebug = i; break; case 'r': - while(isspace(*args)) { + while (isspace(*args)) { args++; } i = 0; - while(isdigit(*args)) { + while (isdigit(*args)) { i = *args + 10 * i - '0'; args++; } @@ -441,11 +441,11 @@ void diablo_parse_flags(char *args) case 't': leveldebug = 1; setlevel = 1; - while(isspace(*args)) { + while (isspace(*args)) { args++; } i = 0; - while(isdigit(*args)) { + while (isdigit(*args)) { i = *args + 10 * i - '0'; args++; } @@ -525,29 +525,29 @@ void diablo_reload_process(HINSTANCE hInstance) GetModuleFileName(hInstance, szFileName, sizeof(szFileName)); wsprintf(szReload, "Reload-%s", szFileName); - for(s = szReload; *s != '\0'; s++) { - if(*s == '\\') { + for (s = szReload; *s != '\0'; s++) { + if (*s == '\\') { *s = '/'; } } GetSystemInfo(&sinf); dwSize = sinf.dwPageSize; - if(dwSize < 4096) { + if (dwSize < 4096) { dwSize = 4096; } hMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, SEC_COMMIT | PAGE_READWRITE, 0, dwSize, szReload); bNoExist = GetLastError() != ERROR_ALREADY_EXISTS; - if(hMap == NULL) { + if (hMap == NULL) { return; } plMap = (long *)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, dwSize); - if(plMap == NULL) { + if (plMap == NULL) { return; } - if(bNoExist) { + if (bNoExist) { plMap[0] = -1; plMap[1] = 0; memset(&si, 0, sizeof(si)); @@ -556,7 +556,7 @@ void diablo_reload_process(HINSTANCE hInstance) WaitForInputIdle(pi.hProcess, INFINITE); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); - while(plMap[0] < 0) { + while (plMap[0] < 0) { Sleep(1000); } UnmapViewOfFile(plMap); @@ -564,26 +564,26 @@ void diablo_reload_process(HINSTANCE hInstance) ExitProcess(0); } - if(InterlockedIncrement(plMap) == 0) { + if (InterlockedIncrement(plMap) == 0) { plMap[1] = GetCurrentProcessId(); } else { hPrev = GetForegroundWindow(); hWnd = hPrev; - while(1) { + while (1) { hPrev = GetWindow(hPrev, GW_HWNDPREV); - if(hPrev == NULL) { + if (hPrev == NULL) { break; } hWnd = hPrev; } - while(1) { + while (1) { GetWindowThreadProcessId(hWnd, &dwProcessId); - if(dwProcessId == plMap[1]) { + if (dwProcessId == plMap[1]) { SetForegroundWindow(hWnd); break; } hWnd = GetWindow(hWnd, GW_HWNDNEXT); - if(hWnd == NULL) { + if (hWnd == NULL) { break; } } @@ -829,7 +829,7 @@ BOOL LeftMouseDown(int wParam) } } else { if (!talkflag && !dropGoldFlag && !gmenu_exception()) - CheckInvScrn(); + CheckInvScrn(); DoPanBtn(); if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) SetCursor_(CURSOR_HAND); @@ -897,47 +897,47 @@ BOOL LeftMouseCmd(BOOL bShift) BOOL TryIconCurs() { - if(pcurs == CURSOR_RESURRECT) { + if (pcurs == CURSOR_RESURRECT) { NetSendCmdParam1(TRUE, CMD_RESURRECT, pcursplr); return TRUE; - } else if(pcurs == CURSOR_HEALOTHER) { + } else if (pcurs == CURSOR_HEALOTHER) { NetSendCmdParam1(TRUE, CMD_HEALOTHER, pcursplr); return TRUE; - } else if(pcurs == CURSOR_TELEKINESIS) { + } else if (pcurs == CURSOR_TELEKINESIS) { DoTelekinesis(); return TRUE; - } else if(pcurs == CURSOR_IDENTIFY) { - if(pcursinvitem != -1) { + } else if (pcurs == CURSOR_IDENTIFY) { + if (pcursinvitem != -1) { CheckIdentify(myplr, pcursinvitem); } else { SetCursor_(CURSOR_HAND); } return TRUE; - } else if(pcurs == CURSOR_REPAIR) { - if(pcursinvitem != -1) { + } else if (pcurs == CURSOR_REPAIR) { + if (pcursinvitem != -1) { DoRepair(myplr, pcursinvitem); } else { SetCursor_(CURSOR_HAND); } return TRUE; - } else if(pcurs == CURSOR_RECHARGE) { - if(pcursinvitem != -1) { + } else if (pcurs == CURSOR_RECHARGE) { + if (pcursinvitem != -1) { DoRecharge(myplr, pcursinvitem); } else { SetCursor_(CURSOR_HAND); } return TRUE; - } else if(pcurs == CURSOR_TELEPORT) { - if(pcursmonst != -1) { + } else if (pcurs == CURSOR_TELEPORT) { + if (pcursmonst != -1) { NetSendCmdParam3(TRUE, CMD_TSPELLID, pcursmonst, plr[myplr]._pTSpell, GetSpellLevel(myplr, plr[myplr]._pTSpell)); - } else if(pcursplr != -1) { + } else if (pcursplr != -1) { NetSendCmdParam3(TRUE, CMD_TSPELLPID, pcursplr, plr[myplr]._pTSpell, GetSpellLevel(myplr, plr[myplr]._pTSpell)); } else { NetSendCmdLocParam2(TRUE, CMD_TSPELLXY, cursmx, cursmy, plr[myplr]._pTSpell, GetSpellLevel(myplr, plr[myplr]._pTSpell)); } SetCursor_(CURSOR_HAND); return TRUE; - } else if(pcurs == CURSOR_DISARM && pcursobj == -1) { + } else if (pcurs == CURSOR_DISARM && pcursobj == -1) { SetCursor_(CURSOR_HAND); return TRUE; } @@ -1007,15 +1007,15 @@ void diablo_hotkey_msg(DWORD dwMsg) char szFileName[MAX_PATH]; char szMsg[MAX_SEND_STR_LEN]; - if(gbMaxPlayers == 1) { + if (gbMaxPlayers == 1) { return; } - if(GetModuleFileName(ghInst, szFileName, sizeof(szFileName)) == 0) { + if (GetModuleFileName(ghInst, szFileName, sizeof(szFileName)) == 0) { app_fatal("Can't get program name"); } s = strrchr(szFileName, '\\'); - if(s != NULL) { + if (s != NULL) { *s = '\0'; } @@ -1036,64 +1036,64 @@ void ReleaseKey(int vkey) void PressKey(int vkey) { - if(gmenu_presskeys(vkey) || control_presskeys(vkey)) { + if (gmenu_presskeys(vkey) || control_presskeys(vkey)) { return; } - if(deathflag) { - if(sgnTimeoutCurs != 0) { + if (deathflag) { + if (sgnTimeoutCurs != 0) { return; } - if(vkey == VK_F9) { + if (vkey == VK_F9) { diablo_hotkey_msg(0); } - if(vkey == VK_F10) { + if (vkey == VK_F10) { diablo_hotkey_msg(1); } - if(vkey == VK_F11) { + if (vkey == VK_F11) { diablo_hotkey_msg(2); } - if(vkey == VK_F12) { + if (vkey == VK_F12) { diablo_hotkey_msg(3); } - if(vkey == VK_RETURN) { + if (vkey == VK_RETURN) { control_type_message(); } - if(vkey != VK_ESCAPE) { + if (vkey != VK_ESCAPE) { return; } } - if(vkey == VK_ESCAPE) { - if(!PressEscKey()) { + if (vkey == VK_ESCAPE) { + if (!PressEscKey()) { track_repeat_walk(0); gamemenu_previous(); } return; } - if(sgnTimeoutCurs != 0 || dropGoldFlag) { + if (sgnTimeoutCurs != 0 || dropGoldFlag) { return; } - if(vkey == VK_PAUSE) { + if (vkey == VK_PAUSE) { diablo_pause_game(); return; } - if(PauseMode == 2) { + if (PauseMode == 2) { return; } - if(vkey == VK_RETURN) { - if(stextflag) { + if (vkey == VK_RETURN) { + if (stextflag) { STextEnter(); - } else if(questlog) { + } else if (questlog) { QuestlogEnter(); } else { control_type_message(); } - } else if(vkey == VK_F1) { - if(helpflag) { + } else if (vkey == VK_F1) { + if (helpflag) { helpflag = 0; - } else if(stextflag) { + } else if (stextflag) { ClearPanel(); AddPanelString("No help available", TRUE); /// BUGFIX: message isn't displayed AddPanelString("while in stores", TRUE); @@ -1103,7 +1103,7 @@ void PressKey(int vkey) chrflag = 0; sbookflag = 0; spselflag = 0; - if(qtextflag && leveltype == DTYPE_TOWN) { + if (qtextflag && leveltype == DTYPE_TOWN) { qtextflag = 0; sfx_stop(); } @@ -1116,18 +1116,18 @@ void PressKey(int vkey) } } #ifdef _DEBUG - else if(vkey == VK_F2) { + else if (vkey == VK_F2) { } #endif #ifdef _DEBUG - else if(vkey == VK_F3) { - if(pcursitem != -1) { + else if (vkey == VK_F3) { + if (pcursitem != -1) { sprintf( - tempstr, - "IDX = %i : Seed = %i : CF = %i", - item[pcursitem].IDidx, - item[pcursitem]._iSeed, - item[pcursitem]._iCreateInfo); + tempstr, + "IDX = %i : Seed = %i : CF = %i", + item[pcursitem].IDidx, + item[pcursitem]._iSeed, + item[pcursitem]._iCreateInfo); NetSendCmdString(1 << myplr, tempstr); } sprintf(tempstr, "Numitems : %i", numitems); @@ -1135,85 +1135,85 @@ void PressKey(int vkey) } #endif #ifdef _DEBUG - else if(vkey == VK_F4) { + else if (vkey == VK_F4) { PrintDebugQuest(); } #endif - else if(vkey == VK_F5) { - if(spselflag) { + else if (vkey == VK_F5) { + if (spselflag) { SetSpeedSpell(0); } else { ToggleSpell(0); } - } else if(vkey == VK_F6) { - if(spselflag) { + } else if (vkey == VK_F6) { + if (spselflag) { SetSpeedSpell(1); } else { ToggleSpell(1); } - } else if(vkey == VK_F7) { - if(spselflag) { + } else if (vkey == VK_F7) { + if (spselflag) { SetSpeedSpell(2); } else { ToggleSpell(2); } - } else if(vkey == VK_F8) { - if(spselflag) { + } else if (vkey == VK_F8) { + if (spselflag) { SetSpeedSpell(3); } else { ToggleSpell(3); } - } else if(vkey == VK_F9) { + } else if (vkey == VK_F9) { diablo_hotkey_msg(0); - } else if(vkey == VK_F10) { + } else if (vkey == VK_F10) { diablo_hotkey_msg(1); - } else if(vkey == VK_F11) { + } else if (vkey == VK_F11) { diablo_hotkey_msg(2); - } else if(vkey == VK_F12) { + } else if (vkey == VK_F12) { diablo_hotkey_msg(3); - } else if(vkey == VK_UP) { - if(stextflag) { + } else if (vkey == VK_UP) { + if (stextflag) { STextUp(); - } else if(questlog) { + } else if (questlog) { QuestlogUp(); - } else if(helpflag) { + } else if (helpflag) { HelpScrollUp(); - } else if(automapflag) { + } else if (automapflag) { AutomapUp(); } - } else if(vkey == VK_DOWN) { - if(stextflag) { + } else if (vkey == VK_DOWN) { + if (stextflag) { STextDown(); - } else if(questlog) { + } else if (questlog) { QuestlogDown(); - } else if(helpflag) { + } else if (helpflag) { HelpScrollDown(); - } else if(automapflag) { + } else if (automapflag) { AutomapDown(); } - } else if(vkey == VK_PRIOR) { - if(stextflag) { + } else if (vkey == VK_PRIOR) { + if (stextflag) { STextPrior(); } - } else if(vkey == VK_NEXT) { - if(stextflag) { + } else if (vkey == VK_NEXT) { + if (stextflag) { STextNext(); } - } else if(vkey == VK_LEFT) { - if(automapflag && !talkflag) { + } else if (vkey == VK_LEFT) { + if (automapflag && !talkflag) { AutomapLeft(); } - } else if(vkey == VK_RIGHT) { - if(automapflag && !talkflag) { + } else if (vkey == VK_RIGHT) { + if (automapflag && !talkflag) { AutomapRight(); } - } else if(vkey == VK_TAB) { + } else if (vkey == VK_TAB) { DoAutoMap(); - } else if(vkey == VK_SPACE) { - if(!chrflag && invflag && MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { + } else if (vkey == VK_SPACE) { + if (!chrflag && invflag && MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX + 160, MouseY); } - if(!invflag && chrflag && MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { + if (!invflag && chrflag && MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX - 160, MouseY); } helpflag = 0; @@ -1221,7 +1221,7 @@ void PressKey(int vkey) chrflag = 0; sbookflag = 0; spselflag = 0; - if(qtextflag && leveltype == DTYPE_TOWN) { + if (qtextflag && leveltype == DTYPE_TOWN) { qtextflag = 0; sfx_stop(); } @@ -1260,26 +1260,26 @@ void diablo_pause_game() /* NOTE: `return` must be used instead of `break` to be bin exact as C++ */ void PressChar(int vkey) { - if(gmenu_exception() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) { + if (gmenu_exception() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) { return; } - if((char)vkey == 'p' || (char)vkey == 'P') { + if ((char)vkey == 'p' || (char)vkey == 'P') { diablo_pause_game(); return; } - if(PauseMode == 2) { + if (PauseMode == 2) { return; } - if(doomflag) { + if (doomflag) { doom_close(); return; } - if(dropGoldFlag) { + if (dropGoldFlag) { control_drop_gold(vkey); return; } - switch(vkey) { + switch (vkey) { case 'G': case 'g': DecreaseGamma(); @@ -1290,15 +1290,15 @@ void PressChar(int vkey) return; case 'I': case 'i': - if(!stextflag) { + if (!stextflag) { sbookflag = 0; invflag = invflag == 0; - if(!invflag || chrflag) { - if(MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { + if (!invflag || chrflag) { + if (MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX + 160, MouseY); } } else { - if(MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { + if (MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX - 160, MouseY); } } @@ -1306,15 +1306,15 @@ void PressChar(int vkey) return; case 'C': case 'c': - if(!stextflag) { + if (!stextflag) { questlog = FALSE; chrflag = chrflag == 0; - if(!chrflag || invflag) { - if(MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { + if (!chrflag || invflag) { + if (MouseX > 160 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX - 160, MouseY); } } else { - if(MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { + if (MouseX < 480 && MouseY < VIEWPORT_HEIGHT) { SetCursorPos(MouseX + 160, MouseY); } } @@ -1322,9 +1322,9 @@ void PressChar(int vkey) return; case 'Q': case 'q': - if(!stextflag) { + if (!stextflag) { chrflag = 0; - if(!questlog) { + if (!questlog) { StartQuestlog(); } else { questlog = FALSE; @@ -1337,9 +1337,9 @@ void PressChar(int vkey) return; case 'S': case 's': - if(!stextflag) { + if (!stextflag) { invflag = 0; - if(!spselflag) { + if (!spselflag) { DoSpeedBook(); } else { spselflag = 0; @@ -1349,20 +1349,20 @@ void PressChar(int vkey) return; case 'B': case 'b': - if(!stextflag) { + if (!stextflag) { invflag = 0; sbookflag = sbookflag == 0; } return; case '+': case '=': - if(automapflag) { + if (automapflag) { AutomapZoomIn(); } return; case '-': case '_': - if(automapflag) { + if (automapflag) { AutomapZoomOut(); } return; @@ -1374,95 +1374,95 @@ void PressChar(int vkey) return; case '!': case '1': - if(plr[myplr].SpdList[0]._itype != -1 && plr[myplr].SpdList[0]._itype != 11) { + if (plr[myplr].SpdList[0]._itype != -1 && plr[myplr].SpdList[0]._itype != 11) { UseInvItem(myplr, 47); } return; case '@': case '2': - if(plr[myplr].SpdList[1]._itype != -1 && plr[myplr].SpdList[1]._itype != 11) { + if (plr[myplr].SpdList[1]._itype != -1 && plr[myplr].SpdList[1]._itype != 11) { UseInvItem(myplr, 48); } return; case '#': case '3': - if(plr[myplr].SpdList[2]._itype != -1 && plr[myplr].SpdList[2]._itype != 11) { + if (plr[myplr].SpdList[2]._itype != -1 && plr[myplr].SpdList[2]._itype != 11) { UseInvItem(myplr, 49); } return; case '$': case '4': - if(plr[myplr].SpdList[3]._itype != -1 && plr[myplr].SpdList[3]._itype != 11) { + if (plr[myplr].SpdList[3]._itype != -1 && plr[myplr].SpdList[3]._itype != 11) { UseInvItem(myplr, 50); } return; case '%': case '5': - if(plr[myplr].SpdList[4]._itype != -1 && plr[myplr].SpdList[4]._itype != 11) { + if (plr[myplr].SpdList[4]._itype != -1 && plr[myplr].SpdList[4]._itype != 11) { UseInvItem(myplr, 51); } return; case '^': case '6': - if(plr[myplr].SpdList[5]._itype != -1 && plr[myplr].SpdList[5]._itype != 11) { + if (plr[myplr].SpdList[5]._itype != -1 && plr[myplr].SpdList[5]._itype != 11) { UseInvItem(myplr, 52); } return; case '&': case '7': - if(plr[myplr].SpdList[6]._itype != -1 && plr[myplr].SpdList[6]._itype != 11) { + if (plr[myplr].SpdList[6]._itype != -1 && plr[myplr].SpdList[6]._itype != 11) { UseInvItem(myplr, 53); } return; case '*': case '8': #ifdef _DEBUG - if(debug_mode_key_inverted_v || debug_mode_key_w) { + if (debug_mode_key_inverted_v || debug_mode_key_w) { NetSendCmd(TRUE, CMD_CHEAT_EXPERIENCE); return; } #endif - if(plr[myplr].SpdList[7]._itype != -1 && plr[myplr].SpdList[7]._itype != 11) { + if (plr[myplr].SpdList[7]._itype != -1 && plr[myplr].SpdList[7]._itype != 11) { UseInvItem(myplr, 54); } return; #ifdef _DEBUG case ')': case '0': - if(debug_mode_key_inverted_v) { - if(arrowdebug > 2) { + if (debug_mode_key_inverted_v) { + if (arrowdebug > 2) { arrowdebug = 0; } - if(arrowdebug == 0) { + if (arrowdebug == 0) { plr[myplr]._pIFlags &= ~ISPL_FIRE_ARROWS; plr[myplr]._pIFlags &= ~ISPL_LIGHT_ARROWS; } - if(arrowdebug == 1) { + if (arrowdebug == 1) { plr[myplr]._pIFlags |= ISPL_FIRE_ARROWS; } - if(arrowdebug == 2) { + if (arrowdebug == 2) { plr[myplr]._pIFlags |= ISPL_LIGHT_ARROWS; } arrowdebug++; } return; case ':': - if(currlevel == 0 && debug_mode_key_w) { + if (currlevel == 0 && debug_mode_key_w) { SetAllSpellsCheat(); } return; case '[': - if(currlevel == 0 && debug_mode_key_w) { + if (currlevel == 0 && debug_mode_key_w) { TakeGoldCheat(); } return; case ']': - if(currlevel == 0 && debug_mode_key_w) { + if (currlevel == 0 && debug_mode_key_w) { MaxSpellsCheat(); } return; case 'a': - if(debug_mode_key_inverted_v) { + if (debug_mode_key_inverted_v) { spelldata[SPL_TELEPORT].sTownSpell = 1; plr[myplr]._pSplLvl[plr[myplr]._pSpell]++; } @@ -1474,14 +1474,14 @@ void PressChar(int vkey) PrintDebugPlayer(FALSE); return; case 'e': - if(debug_mode_key_d) { + if (debug_mode_key_d) { sprintf(tempstr, "EFlag = %i", plr[myplr]._peflag); NetSendCmdString(1 << myplr, tempstr); } return; case 'L': case 'l': - if(debug_mode_key_inverted_v) { + if (debug_mode_key_inverted_v) { ToggleLighting(); } return; @@ -1502,7 +1502,7 @@ void PressChar(int vkey) return; case 'T': case 't': - if(debug_mode_key_inverted_v) { + if (debug_mode_key_inverted_v) { sprintf(tempstr, "PX = %i PY = %i", plr[myplr].WorldX, plr[myplr].WorldY); NetSendCmdString(1 << myplr, tempstr); sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]); @@ -1510,12 +1510,12 @@ void PressChar(int vkey) } return; case '|': - if(currlevel == 0 && debug_mode_key_w) { + if (currlevel == 0 && debug_mode_key_w) { GiveGoldCheat(); } return; case '~': - if(currlevel == 0 && debug_mode_key_w) { + if (currlevel == 0 && debug_mode_key_w) { StoresCheat(); } return; @@ -1533,7 +1533,7 @@ void LoadLvlGFX() { /// ASSERT: assert(! pDungeonCels); - switch((unsigned char)leveltype) { + switch ((unsigned char)leveltype) { case DTYPE_TOWN: pDungeonCels = LoadFileInMem("Levels\\TownData\\Town.CEL", 0); pMegaTiles = LoadFileInMem("Levels\\TownData\\Town.TIL", 0); @@ -1584,7 +1584,7 @@ void LoadAllGFX() void CreateLevel(int lvldir) { - switch(leveltype) { + switch (leveltype) { case DTYPE_TOWN: CreateTown(lvldir); InitTownTriggers(); @@ -1859,25 +1859,25 @@ void game_loop(BOOL bStartup) void game_logic() { - if(PauseMode == 2) { + if (PauseMode == 2) { return; } - if(PauseMode == 1) { + if (PauseMode == 1) { PauseMode = 2; } - if(gbMaxPlayers == 1 && gmenu_exception()) { + if (gbMaxPlayers == 1 && gmenu_exception()) { drawpanflag |= 1; return; } - if(!gmenu_exception() && sgnTimeoutCurs == 0) { + if (!gmenu_exception() && sgnTimeoutCurs == 0) { CheckCursMove(); track_process(); } - if(gbProcessPlayers) { + if (gbProcessPlayers) { ProcessPlayers(); } - if(leveltype != DTYPE_TOWN) { + if (leveltype != DTYPE_TOWN) { ProcessMonsters(); ProcessObjects(); ProcessMissiles(); @@ -1891,7 +1891,7 @@ void game_logic() } #ifdef _DEBUG - if(debug_mode_key_inverted_v && GetAsyncKeyState(VK_SHIFT) & 0x8000) { + if (debug_mode_key_inverted_v && GetAsyncKeyState(VK_SHIFT) & 0x8000) { ScrollView(); } #endif diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index aa251e1b6..7298f3dd4 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1495,7 +1495,7 @@ void DRLG_L5GChamber(int sx, int sy, BOOL topflag, BOOL bottomflag, BOOL leftfla { int i, j; - if(topflag == TRUE) { + if (topflag == TRUE) { dungeon[sx + 2][sy] = 12; dungeon[sx + 3][sy] = 12; dungeon[sx + 4][sy] = 3; @@ -1503,19 +1503,19 @@ void DRLG_L5GChamber(int sx, int sy, BOOL topflag, BOOL bottomflag, BOOL leftfla dungeon[sx + 8][sy] = 12; dungeon[sx + 9][sy] = 2; } - if(bottomflag == TRUE) { + if (bottomflag == TRUE) { sy += 11; dungeon[sx + 2][sy] = 10; dungeon[sx + 3][sy] = 12; dungeon[sx + 4][sy] = 8; dungeon[sx + 7][sy] = 5; dungeon[sx + 8][sy] = 12; - if(dungeon[sx + 9][sy] != 4) { + if (dungeon[sx + 9][sy] != 4) { dungeon[sx + 9][sy] = 21; } sy -= 11; } - if(leftflag == TRUE) { + if (leftflag == TRUE) { dungeon[sx][sy + 2] = 11; dungeon[sx][sy + 3] = 11; dungeon[sx][sy + 4] = 3; @@ -1523,21 +1523,21 @@ void DRLG_L5GChamber(int sx, int sy, BOOL topflag, BOOL bottomflag, BOOL leftfla dungeon[sx][sy + 8] = 11; dungeon[sx][sy + 9] = 1; } - if(rightflag == TRUE) { + if (rightflag == TRUE) { sx += 11; dungeon[sx][sy + 2] = 14; dungeon[sx][sy + 3] = 11; dungeon[sx][sy + 4] = 9; dungeon[sx][sy + 7] = 5; dungeon[sx][sy + 8] = 11; - if(dungeon[sx][sy + 9] != 4) { + if (dungeon[sx][sy + 9] != 4) { dungeon[sx][sy + 9] = 21; } sx -= 11; } - for(j = 1; j < 11; j++) { - for(i = 1; i < 11; i++) { + for (j = 1; j < 11; j++) { + for (i = 1; i < 11; i++) { dungeon[i + sx][j + sy] = 13; L5dflags[i + sx][j + sy] |= 0x40; } @@ -1720,13 +1720,13 @@ void DRLG_L5CornerFix() { int i, j; - for(j = 1; j < DMAXY - 1; j++) { - for(i = 1; i < DMAXX - 1; i++) { - if(!(L5dflags[i][j] & 0x80) && dungeon[i][j] == 17 && dungeon[i - 1][j] == 13 && dungeon[i][j - 1] == 1) { + for (j = 1; j < DMAXY - 1; j++) { + for (i = 1; i < DMAXX - 1; i++) { + if (!(L5dflags[i][j] & 0x80) && dungeon[i][j] == 17 && dungeon[i - 1][j] == 13 && dungeon[i][j - 1] == 1) { dungeon[i][j] = 16; L5dflags[i][j - 1] &= 0x80; } - if(dungeon[i][j] == 202 && dungeon[i + 1][j] == 13 && dungeon[i][j + 1] == 1) { + if (dungeon[i][j] == 202 && dungeon[i + 1][j] == 13 && dungeon[i][j + 1] == 1) { dungeon[i][j] = 8; } } diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index e11f6b2d5..2c4cfd2bd 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -73,18 +73,18 @@ void AddFenceDoors() { int i, j; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] == 7) { - if(dungeon[i - 1][j] <= 152 && dungeon[i - 1][j] >= 130 - && dungeon[i + 1][j] <= 152 && dungeon[i + 1][j] >= 130) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == 7) { + if (dungeon[i - 1][j] <= 152 && dungeon[i - 1][j] >= 130 + && dungeon[i + 1][j] <= 152 && dungeon[i + 1][j] >= 130) { dungeon[i][j] = 146; continue; } } - if(dungeon[i][j] == 7) { - if(dungeon[i][j - 1] <= 152 && dungeon[i][j - 1] >= 130 - && dungeon[i][j + 1] <= 152 && dungeon[i][j + 1] >= 130) { + if (dungeon[i][j] == 7) { + if (dungeon[i][j - 1] <= 152 && dungeon[i][j - 1] >= 130 + && dungeon[i][j + 1] <= 152 && dungeon[i][j + 1] >= 130) { dungeon[i][j] = 147; continue; } @@ -97,42 +97,42 @@ void FenceDoorFix() { int i, j; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] == 146) { - if(dungeon[i + 1][j] > 152 || dungeon[i + 1][j] < 130 - || dungeon[i - 1][j] > 152 || dungeon[i - 1][j] < 130) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == 146) { + if (dungeon[i + 1][j] > 152 || dungeon[i + 1][j] < 130 + || dungeon[i - 1][j] > 152 || dungeon[i - 1][j] < 130) { dungeon[i][j] = 7; continue; } } - if(dungeon[i][j] == 146) { - if(dungeon[i + 1][j] != 130 && dungeon[i - 1][j] != 130 - && dungeon[i + 1][j] != 132 && dungeon[i - 1][j] != 132 - && dungeon[i + 1][j] != 133 && dungeon[i - 1][j] != 133 - && dungeon[i + 1][j] != 134 && dungeon[i - 1][j] != 134 - && dungeon[i + 1][j] != 136 && dungeon[i - 1][j] != 136 - && dungeon[i + 1][j] != 138 && dungeon[i - 1][j] != 138 - && dungeon[i + 1][j] != 140 && dungeon[i - 1][j] != 140) { + if (dungeon[i][j] == 146) { + if (dungeon[i + 1][j] != 130 && dungeon[i - 1][j] != 130 + && dungeon[i + 1][j] != 132 && dungeon[i - 1][j] != 132 + && dungeon[i + 1][j] != 133 && dungeon[i - 1][j] != 133 + && dungeon[i + 1][j] != 134 && dungeon[i - 1][j] != 134 + && dungeon[i + 1][j] != 136 && dungeon[i - 1][j] != 136 + && dungeon[i + 1][j] != 138 && dungeon[i - 1][j] != 138 + && dungeon[i + 1][j] != 140 && dungeon[i - 1][j] != 140) { dungeon[i][j] = 7; continue; } } - if(dungeon[i][j] == 147) { - if(dungeon[i][j + 1] > 152 || dungeon[i][j + 1] < 130 - || dungeon[i][j - 1] > 152 || dungeon[i][j - 1] < 130) { + if (dungeon[i][j] == 147) { + if (dungeon[i][j + 1] > 152 || dungeon[i][j + 1] < 130 + || dungeon[i][j - 1] > 152 || dungeon[i][j - 1] < 130) { dungeon[i][j] = 7; continue; } } - if(dungeon[i][j] == 147) { - if(dungeon[i][j + 1] != 131 && dungeon[i][j - 1] != 131 - && dungeon[i][j + 1] != 132 && dungeon[i][j - 1] != 132 - && dungeon[i][j + 1] != 133 && dungeon[i][j - 1] != 133 - && dungeon[i][j + 1] != 135 && dungeon[i][j - 1] != 135 - && dungeon[i][j + 1] != 137 && dungeon[i][j - 1] != 137 - && dungeon[i][j + 1] != 138 && dungeon[i][j - 1] != 138 - && dungeon[i][j + 1] != 139 && dungeon[i][j - 1] != 139) { + if (dungeon[i][j] == 147) { + if (dungeon[i][j + 1] != 131 && dungeon[i][j - 1] != 131 + && dungeon[i][j + 1] != 132 && dungeon[i][j - 1] != 132 + && dungeon[i][j + 1] != 133 && dungeon[i][j - 1] != 133 + && dungeon[i][j + 1] != 135 && dungeon[i][j - 1] != 135 + && dungeon[i][j + 1] != 137 && dungeon[i][j - 1] != 137 + && dungeon[i][j + 1] != 138 && dungeon[i][j - 1] != 138 + && dungeon[i][j + 1] != 139 && dungeon[i][j - 1] != 139) { dungeon[i][j] = 7; continue; } @@ -153,40 +153,40 @@ BOOL DRLG_L3Anvil() found = FALSE; trys = 0; - while(!found && trys < 200) { + while (!found && trys < 200) { trys++; found = TRUE; ii = 2; - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(L3ANVIL[ii] != 0 && dungeon[xx + sx][yy + sy] != L3ANVIL[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (L3ANVIL[ii] != 0 && dungeon[xx + sx][yy + sy] != L3ANVIL[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } - if(!found) { + if (!found) { sx++; - if(sx == 29) { + if (sx == 29) { sx = 0; sy++; - if(sy == 29) { + if (sy == 29) { sy = 0; } } } } - if(trys >= 200) { + if (trys >= 200) { return TRUE; } ii = 123; - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(L3ANVIL[ii] != 0) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (L3ANVIL[ii] != 0) { dungeon[xx + sx][yy + sy] = L3ANVIL[ii]; } dflags[xx + sx][yy + sy] |= 0x80; @@ -206,16 +206,16 @@ void FixL3Warp() { int i, j; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 125 && dungeon[i + 1][j] == 125 && dungeon[i][j + 1] == 125 && dungeon[i + 1][j + 1] == 125) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 125 && dungeon[i + 1][j] == 125 && dungeon[i][j + 1] == 125 && dungeon[i + 1][j + 1] == 125) { dungeon[i][j] = 156; dungeon[i + 1][j] = 155; dungeon[i][j + 1] = 153; dungeon[i + 1][j + 1] = 154; return; } - if(dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 7) { + if (dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 7) { dungeon[i][j] = 7; } } @@ -226,21 +226,21 @@ void FixL3HallofHeroes() { int i, j; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 7) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 7) { dungeon[i][j] = 7; } } } - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 12 && dungeon[i + 1][j] == 7) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 12 && dungeon[i + 1][j] == 7) { dungeon[i][j] = 7; dungeon[i][j + 1] = 7; dungeon[i + 1][j + 1] = 7; } - if(dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 12 && dungeon[i][j + 1] == 7) { + if (dungeon[i][j] == 5 && dungeon[i + 1][j + 1] == 12 && dungeon[i][j + 1] == 7) { dungeon[i][j] = 7; dungeon[i + 1][j] = 7; dungeon[i + 1][j + 1] = 7; @@ -251,7 +251,7 @@ void FixL3HallofHeroes() void DRLG_L3LockRec(int x, int y) { - if(!lockout[x][y]) { + if (!lockout[x][y]) { return; } @@ -268,9 +268,9 @@ BOOL DRLG_L3Lockout() int i, j, t, fx, fy; t = 0; - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] != 0) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] != 0) { lockout[i][j] = TRUE; fx = i; fy = j; @@ -301,15 +301,15 @@ void CreateL3Dungeon(int rseed, int entry) DRLG_L3(entry); DRLG_L3Pass3(); - for(j = 0; j < 112; j++) { - for(i = 0; i < 112; i++) { - if(dPiece[i][j] >= 56 && dPiece[i][j] <= 147) { + for (j = 0; j < 112; j++) { + for (i = 0; i < 112; i++) { + if (dPiece[i][j] >= 56 && dPiece[i][j] <= 147) { DoLighting(i, j, 7, -1); - } else if(dPiece[i][j] >= 154 && dPiece[i][j] <= 161) { + } else if (dPiece[i][j] >= 154 && dPiece[i][j] <= 161) { DoLighting(i, j, 7, -1); - } else if(dPiece[i][j] == 150) { + } else if (dPiece[i][j] == 150) { DoLighting(i, j, 7, -1); - } else if(dPiece[i][j] == 152) { + } else if (dPiece[i][j] == 152) { DoLighting(i, j, 7, -1); } } @@ -338,7 +338,7 @@ void DRLG_L3(int entry) DRLG_L3CreateBlock(x2, y1, 2, 1); DRLG_L3CreateBlock(x1, y2, 2, 2); DRLG_L3CreateBlock(x1, y1, 2, 3); - if(QuestStatus(QTYPE_ANVIL)) { + if (QuestStatus(QTYPE_ANVIL)) { x1 = random(0, 10) + 10; y1 = random(0, 10) + 10; x2 = x1 + 12; @@ -350,46 +350,46 @@ void DRLG_L3(int entry) DRLG_L3FillStraights(); DRLG_L3FillDiags(); DRLG_L3Edges(); - if(DRLG_L3GetFloorArea() >= 600) { + if (DRLG_L3GetFloorArea() >= 600) { found = DRLG_L3Lockout(); } else { found = FALSE; } - } while(!found); + } while (!found); DRLG_L3MakeMegas(); - if(entry == 0) { + if (entry == 0) { genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, 1, 0); - if(!genok) { + if (!genok) { genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, 0, 1); - if(!genok && currlevel == 9) { + if (!genok && currlevel == 9) { genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, 0, 6); } } - } else if(entry == 1) { + } else if (entry == 1) { genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, 0, 0); - if(!genok) { + if (!genok) { genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, 1, 1); ViewX += 2; ViewY -= 2; - if(!genok && currlevel == 9) { + if (!genok && currlevel == 9) { genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, 0, 6); } } } else { genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, 0, 0); - if(!genok) { + if (!genok) { genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, 0, 1); - if(!genok && currlevel == 9) { + if (!genok && currlevel == 9) { genok = DRLG_L3PlaceMiniSet(L3HOLDWARP, 1, 1, -1, -1, 1, 6); } } } - if(!genok && QuestStatus(QTYPE_ANVIL)) { + if (!genok && QuestStatus(QTYPE_ANVIL)) { genok = DRLG_L3Anvil(); } - } while(genok == TRUE); + } while (genok == TRUE); DRLG_L3Pool(); - } while(!lavapool); + } while (!lavapool); DRLG_L3PoolFix(); FixL3Warp(); @@ -403,11 +403,11 @@ void DRLG_L3(int entry) FixL3HallofHeroes(); DRLG_L3River(); - if(QuestStatus(QTYPE_ANVIL)) { + if (QuestStatus(QTYPE_ANVIL)) { dungeon[setpc_x + 7][setpc_y + 5] = 7; dungeon[setpc_x + 8][setpc_y + 5] = 7; dungeon[setpc_x + 9][setpc_y + 5] = 7; - if(dungeon[setpc_x + 10][setpc_y + 5] == 17 || dungeon[setpc_x + 10][setpc_y + 5] == 18) { + if (dungeon[setpc_x + 10][setpc_y + 5] == 17 || dungeon[setpc_x + 10][setpc_y + 5] == 18) { dungeon[setpc_x + 10][setpc_y + 5] = 45; } } @@ -442,8 +442,8 @@ void DRLG_L3(int entry) DRLG_L3PlaceRndSet(L3XTRA4, 25); DRLG_L3PlaceRndSet(L3XTRA5, 25); - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { pdungeon[i][j] = dungeon[i][j]; } } @@ -457,8 +457,8 @@ void InitL3Dungeon() memset(dungeon, 0, sizeof(dungeon)); - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { dungeon[i][j] = 0; dflags[i][j] = 0; } @@ -469,39 +469,39 @@ BOOL DRLG_L3FillRoom(int x1, int y1, int x2, int y2) { int i, j, v; - if(x1 <= 1 || x2 >= 34 || y1 <= 1 || y2 >= 38) { + if (x1 <= 1 || x2 >= 34 || y1 <= 1 || y2 >= 38) { return FALSE; } v = 0; - for(j = y1; j <= y2; j++) { - for(i = x1; i <= x2; i++) { + for (j = y1; j <= y2; j++) { + for (i = x1; i <= x2; i++) { v += dungeon[i][j]; } } - if(v != 0) { + if (v != 0) { return FALSE; } - for(j = y1 + 1; j < y2; j++) { - for(i = x1 + 1; i < x2; i++) { + for (j = y1 + 1; j < y2; j++) { + for (i = x1 + 1; i < x2; i++) { dungeon[i][j] = 1; } } - for(j = y1; j <= y2; j++) { - if(random(0, 2) != 0) { + for (j = y1; j <= y2; j++) { + if (random(0, 2) != 0) { dungeon[x1][j] = 1; } - if(random(0, 2) != 0) { + if (random(0, 2) != 0) { dungeon[x2][j] = 1; } } - for(i = x1; i <= x2; i++) { - if(random(0, 2) != 0) { + for (i = x1; i <= x2; i++) { + if (random(0, 2) != 0) { dungeon[i][y1] = 1; } - if(random(0, 2) != 0) { + if (random(0, 2) != 0) { dungeon[i][y2] = 1; } } @@ -517,75 +517,75 @@ void DRLG_L3CreateBlock(int x, int y, int obs, int dir) blksizex = random(0, 2) + 3; blksizey = random(0, 2) + 3; - if(dir == 0) { + if (dir == 0) { y2 = y - 1; y1 = y2 - blksizey; - if(blksizex < obs) { + if (blksizex < obs) { x1 = random(0, blksizex) + x; } - if(blksizex == obs) { + if (blksizex == obs) { x1 = x; } - if(blksizex > obs) { + if (blksizex > obs) { x1 = x - random(0, blksizex); } x2 = blksizex + x1; } - if(dir == 3) { + if (dir == 3) { x2 = x - 1; x1 = x2 - blksizex; - if(blksizey < obs) { + if (blksizey < obs) { y1 = random(0, blksizey) + y; } - if(blksizey == obs) { + if (blksizey == obs) { y1 = y; } - if(blksizey > obs) { + if (blksizey > obs) { y1 = y - random(0, blksizey); } y2 = y1 + blksizey; } - if(dir == 2) { + if (dir == 2) { y1 = y + 1; y2 = y1 + blksizey; - if(blksizex < obs) { + if (blksizex < obs) { x1 = random(0, blksizex) + x; } - if(blksizex == obs) { + if (blksizex == obs) { x1 = x; } - if(blksizex > obs) { + if (blksizex > obs) { x1 = x - random(0, blksizex); } x2 = blksizex + x1; } - if(dir == 1) { + if (dir == 1) { x1 = x + 1; x2 = x1 + blksizex; - if(blksizey < obs) { + if (blksizey < obs) { y1 = random(0, blksizey) + y; } - if(blksizey == obs) { + if (blksizey == obs) { y1 = y; } - if(blksizey > obs) { + if (blksizey > obs) { y1 = y - random(0, blksizey); } y2 = y1 + blksizey; } - if(DRLG_L3FillRoom(x1, y1, x2, y2) == TRUE) { + if (DRLG_L3FillRoom(x1, y1, x2, y2) == TRUE) { contflag = random(0, 4); - if(contflag && dir != 2) { + if (contflag && dir != 2) { DRLG_L3CreateBlock(x1, y1, blksizey, 0); } - if(contflag && dir != 3) { + if (contflag && dir != 3) { DRLG_L3CreateBlock(x2, y1, blksizex, 1); } - if(contflag && dir != 0) { + if (contflag && dir != 0) { DRLG_L3CreateBlock(x1, y2, blksizey, 2); } - if(contflag && dir != 1) { + if (contflag && dir != 1) { DRLG_L3CreateBlock(x1, y1, blksizex, 3); } } @@ -595,8 +595,8 @@ void DRLG_L3FloorArea(int x1, int y1, int x2, int y2) { int i, j; - for(j = y1; j <= y2; j++) { - for(i = x1; i <= x2; i++) { + for (j = y1; j <= y2; j++) { + for (i = x1; i <= x2; i++) { dungeon[i][j] = 1; } } @@ -606,18 +606,18 @@ void DRLG_L3FillDiags() { int i, j, v; - for(j = 0; j < 39; j++) { - for(i = 0; i < 39; i++) { + for (j = 0; j < 39; j++) { + for (i = 0; i < 39; i++) { v = dungeon[i + 1][j + 1] + 2 * dungeon[i][j + 1] + 4 * dungeon[i + 1][j] + 8 * dungeon[i][j]; - if(v == 6) { - if(random(0, 2) == 0) { + if (v == 6) { + if (random(0, 2) == 0) { dungeon[i][j] = 1; } else { dungeon[i + 1][j + 1] = 1; } } - if(v == 9) { - if(random(0, 2) == 0) { + if (v == 9) { + if (random(0, 2) == 0) { dungeon[i + 1][j] = 1; } else { dungeon[i][j + 1] = 1; @@ -631,12 +631,12 @@ void DRLG_L3FillSingles() { int i, j; - for(j = 1; j < 39; j++) { - for(i = 1; i < 39; i++) { - if(dungeon[i][j] == 0 - && dungeon[i][j - 1] + dungeon[i - 1][j - 1] + dungeon[i + 1][j - 1] == 3 - && dungeon[i + 1][j] + dungeon[i - 1][j] == 2 - && dungeon[i][j + 1] + dungeon[i - 1][j + 1] + dungeon[i + 1][j + 1] == 3) { + for (j = 1; j < 39; j++) { + for (i = 1; i < 39; i++) { + if (dungeon[i][j] == 0 + && dungeon[i][j - 1] + dungeon[i - 1][j - 1] + dungeon[i + 1][j - 1] == 3 + && dungeon[i + 1][j] + dungeon[i - 1][j] == 2 + && dungeon[i][j + 1] + dungeon[i - 1][j + 1] + dungeon[i + 1][j + 1] == 3) { dungeon[i][j] = 1; } } @@ -647,17 +647,17 @@ void DRLG_L3FillStraights() { int i, j, xc, xs, yc, ys, k; - for(j = 0; j < 39; j++) { + for (j = 0; j < 39; j++) { xs = 0; - for(i = 0; i < 37; i++) { - if(dungeon[i][j] == 0 && dungeon[i][j + 1] == 1) { - if(xs == 0) { + for (i = 0; i < 37; i++) { + if (dungeon[i][j] == 0 && dungeon[i][j + 1] == 1) { + if (xs == 0) { xc = i; } xs++; } else { - if(xs > 3 && random(0, 2) != 0) { - for(k = xc; k < i; k++) { + if (xs > 3 && random(0, 2) != 0) { + for (k = xc; k < i; k++) { dungeon[k][j] = random(0, 2); } } @@ -665,17 +665,17 @@ void DRLG_L3FillStraights() } } } - for(j = 0; j < 39; j++) { + for (j = 0; j < 39; j++) { xs = 0; - for(i = 0; i < 37; i++) { - if(dungeon[i][j] == 1 && dungeon[i][j + 1] == 0) { - if(xs == 0) { + for (i = 0; i < 37; i++) { + if (dungeon[i][j] == 1 && dungeon[i][j + 1] == 0) { + if (xs == 0) { xc = i; } xs++; } else { - if(xs > 3 && random(0, 2) != 0) { - for(k = xc; k < i; k++) { + if (xs > 3 && random(0, 2) != 0) { + for (k = xc; k < i; k++) { dungeon[k][j + 1] = random(0, 2); } } @@ -683,17 +683,17 @@ void DRLG_L3FillStraights() } } } - for(i = 0; i < 39; i++) { + for (i = 0; i < 39; i++) { ys = 0; - for(j = 0; j < 37; j++) { - if(dungeon[i][j] == 0 && dungeon[i + 1][j] == 1) { - if(ys == 0) { + for (j = 0; j < 37; j++) { + if (dungeon[i][j] == 0 && dungeon[i + 1][j] == 1) { + if (ys == 0) { yc = j; } ys++; } else { - if(ys > 3 && random(0, 2) != 0) { - for(k = yc; k < j; k++) { + if (ys > 3 && random(0, 2) != 0) { + for (k = yc; k < j; k++) { dungeon[i][k] = random(0, 2); } } @@ -701,17 +701,17 @@ void DRLG_L3FillStraights() } } } - for(i = 0; i < 39; i++) { + for (i = 0; i < 39; i++) { ys = 0; - for(j = 0; j < 37; j++) { - if(dungeon[i][j] == 1 && dungeon[i + 1][j] == 0) { - if(ys == 0) { + for (j = 0; j < 37; j++) { + if (dungeon[i][j] == 1 && dungeon[i + 1][j] == 0) { + if (ys == 0) { yc = j; } ys++; } else { - if(ys > 3 && random(0, 2) != 0) { - for(k = yc; k < j; k++) { + if (ys > 3 && random(0, 2) != 0) { + for (k = yc; k < j; k++) { dungeon[i + 1][k] = random(0, 2); } } @@ -725,10 +725,10 @@ void DRLG_L3Edges() { int i, j; - for(j = 0; j < 40; j++) { + for (j = 0; j < 40; j++) { dungeon[39][j] = 0; } - for(i = 0; i < 40; i++) { + for (i = 0; i < 40; i++) { dungeon[i][39] = 0; } } @@ -739,8 +739,8 @@ int DRLG_L3GetFloorArea() gfa = 0; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { gfa += dungeon[i][j]; } } @@ -752,18 +752,18 @@ void DRLG_L3MakeMegas() { int i, j, v; - for(j = 0; j < 39; j++) { - for(i = 0; i < 39; i++) { + for (j = 0; j < 39; j++) { + for (i = 0; i < 39; i++) { v = dungeon[i + 1][j + 1] + 2 * dungeon[i][j + 1] + 4 * dungeon[i + 1][j] + 8 * dungeon[i][j]; - if(v == 6) { - if(random(0, 2) == 0) { + if (v == 6) { + if (random(0, 2) == 0) { v = 12; } else { v = 5; } } - if(v == 9) { - if(random(0, 2) == 0) { + if (v == 9) { + if (random(0, 2) == 0) { v = 13; } else { v = 14; @@ -773,7 +773,7 @@ void DRLG_L3MakeMegas() } dungeon[39][j] = 8; } - for(i = 0; i < 40; i++) { + for (i = 0; i < 40; i++) { dungeon[i][39] = 8; } } @@ -790,29 +790,29 @@ void DRLG_L3River() bail = FALSE; trys = 0; - while(trys < 200 && rivercnt < 4) { + while (trys < 200 && rivercnt < 4) { bail = FALSE; - while(!bail && trys < 200) { + while (!bail && trys < 200) { trys++; rx = 0; ry = 0; i = 0; - while((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && i < 100) { + while ((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && i < 100) { rx = random(0, 40); ry = random(0, 40); i++; - while((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && ry < 40) { + while ((dungeon[rx][ry] < 25 || dungeon[rx][ry] > 28) && ry < 40) { rx++; - if(rx >= 40) { + if (rx >= 40) { rx = 0; ry++; } } } - if(i >= 100) { + if (i >= 100) { return; } - switch(dungeon[rx][ry]) { + switch (dungeon[rx][ry]) { case 25: dir = 3; nodir = 2; @@ -839,77 +839,77 @@ void DRLG_L3River() riveramt = 1; nodir2 = 4; dircheck = 0; - while(dircheck < 4 && riveramt < 100) { + while (dircheck < 4 && riveramt < 100) { px = rx; py = ry; - if(dircheck == 0) { + if (dircheck == 0) { dir = random(0, 4); } else { dir = (dir + 1) & 3; } dircheck++; - while(dir == nodir || dir == nodir2) { + while (dir == nodir || dir == nodir2) { dir = (dir + 1) & 3; dircheck++; } - if(dir == 0 && ry > 0) { + if (dir == 0 && ry > 0) { ry--; } - if(dir == 1 && ry < 40) { + if (dir == 1 && ry < 40) { ry++; } - if(dir == 2 && rx < 40) { + if (dir == 2 && rx < 40) { rx++; } - if(dir == 3 && rx > 0) { + if (dir == 3 && rx > 0) { rx--; } - if(dungeon[rx][ry] == 7) { + if (dungeon[rx][ry] == 7) { dircheck = 0; - if(dir < 2) { + if (dir < 2) { river[2][riveramt] = (BYTE)random(0, 2) + 17; } - if(dir > 1) { + if (dir > 1) { river[2][riveramt] = (BYTE)random(0, 2) + 15; } river[0][riveramt] = rx; river[1][riveramt] = ry; riveramt++; - if(dir == 0 && pdir == 2 || dir == 3 && pdir == 1) { - if(riveramt > 2) { + if (dir == 0 && pdir == 2 || dir == 3 && pdir == 1) { + if (riveramt > 2) { river[2][riveramt - 2] = 22; } - if(dir == 0) { + if (dir == 0) { nodir2 = 1; } else { nodir2 = 2; } } - if(dir == 0 && pdir == 3 || dir == 2 && pdir == 1) { - if(riveramt > 2) { + if (dir == 0 && pdir == 3 || dir == 2 && pdir == 1) { + if (riveramt > 2) { river[2][riveramt - 2] = 21; } - if(dir == 0) { + if (dir == 0) { nodir2 = 1; } else { nodir2 = 3; } } - if(dir == 1 && pdir == 2 || dir == 3 && pdir == 0) { - if(riveramt > 2) { + if (dir == 1 && pdir == 2 || dir == 3 && pdir == 0) { + if (riveramt > 2) { river[2][riveramt - 2] = 20; } - if(dir == 1) { + if (dir == 1) { nodir2 = 0; } else { nodir2 = 2; } } - if(dir == 1 && pdir == 3 || dir == 2 && pdir == 0) { - if(riveramt > 2) { + if (dir == 1 && pdir == 3 || dir == 2 && pdir == 0) { + if (riveramt > 2) { river[2][riveramt - 2] = 19; } - if(dir == 1) { + if (dir == 1) { nodir2 = 0; } else { nodir2 = 3; @@ -921,95 +921,95 @@ void DRLG_L3River() ry = py; } } - if(dir == 0 && dungeon[rx][ry - 1] == 10 && dungeon[rx][ry - 2] == 8) { + if (dir == 0 && dungeon[rx][ry - 1] == 10 && dungeon[rx][ry - 2] == 8) { river[0][riveramt] = rx; river[1][riveramt] = ry - 1; river[2][riveramt] = 24; - if(pdir == 2) { + if (pdir == 2) { river[2][riveramt - 1] = 22; } - if(pdir == 3) { + if (pdir == 3) { river[2][riveramt - 1] = 21; } bail = TRUE; } - if(dir == 1 && dungeon[rx][ry + 1] == 2 && dungeon[rx][ry + 2] == 8) { + if (dir == 1 && dungeon[rx][ry + 1] == 2 && dungeon[rx][ry + 2] == 8) { river[0][riveramt] = rx; river[1][riveramt] = ry + 1; river[2][riveramt] = 42; - if(pdir == 2) { + if (pdir == 2) { river[2][riveramt - 1] = 20; } - if(pdir == 3) { + if (pdir == 3) { river[2][riveramt - 1] = 19; } bail = TRUE; } - if(dir == 2 && dungeon[rx + 1][ry] == 4 && dungeon[rx + 2][ry] == 8) { + if (dir == 2 && dungeon[rx + 1][ry] == 4 && dungeon[rx + 2][ry] == 8) { river[0][riveramt] = rx + 1; river[1][riveramt] = ry; river[2][riveramt] = 43; - if(pdir == 0) { + if (pdir == 0) { river[2][riveramt - 1] = 19; } - if(pdir == 1) { + if (pdir == 1) { river[2][riveramt - 1] = 21; } bail = TRUE; } - if(dir == 3 && dungeon[rx - 1][ry] == 9 && dungeon[rx - 2][ry] == 8) { + if (dir == 3 && dungeon[rx - 1][ry] == 9 && dungeon[rx - 2][ry] == 8) { river[0][riveramt] = rx - 1; river[1][riveramt] = ry; river[2][riveramt] = 23; - if(pdir == 0) { + if (pdir == 0) { river[2][riveramt - 1] = 20; } - if(pdir == 1) { + if (pdir == 1) { river[2][riveramt - 1] = 22; } bail = TRUE; } } - if(bail == TRUE && riveramt < 7) { + if (bail == TRUE && riveramt < 7) { bail = FALSE; } - if(bail == TRUE) { + if (bail == TRUE) { found = 0; lpcnt = 0; - while(found == 0 && lpcnt < 30) { + while (found == 0 && lpcnt < 30) { lpcnt++; bridge = random(0, riveramt); - if((river[2][bridge] == 15 || river[2][bridge] == 16) - && dungeon[river[0][bridge]][river[1][bridge] - 1] == 7 - && dungeon[river[0][bridge]][river[1][bridge] + 1] == 7) { + if ((river[2][bridge] == 15 || river[2][bridge] == 16) + && dungeon[river[0][bridge]][river[1][bridge] - 1] == 7 + && dungeon[river[0][bridge]][river[1][bridge] + 1] == 7) { found = 1; } - if((river[2][bridge] == 17 || river[2][bridge] == 18) - && dungeon[river[0][bridge] - 1][river[1][bridge]] == 7 - && dungeon[river[0][bridge] + 1][river[1][bridge]] == 7) { + if ((river[2][bridge] == 17 || river[2][bridge] == 18) + && dungeon[river[0][bridge] - 1][river[1][bridge]] == 7 + && dungeon[river[0][bridge] + 1][river[1][bridge]] == 7) { found = 2; } - for(i = 0; i < riveramt && found != 0; i++) { - if(found == 1 - && (river[1][bridge] - 1 == river[1][i] || river[1][bridge] + 1 == river[1][i]) - && river[0][bridge] == river[0][i]) { + for (i = 0; i < riveramt && found != 0; i++) { + if (found == 1 + && (river[1][bridge] - 1 == river[1][i] || river[1][bridge] + 1 == river[1][i]) + && river[0][bridge] == river[0][i]) { found = 0; } - if(found == 2 - && (river[0][bridge] - 1 == river[0][i] || river[0][bridge] + 1 == river[0][i]) - && river[1][bridge] == river[1][i]) { + if (found == 2 + && (river[0][bridge] - 1 == river[0][i] || river[0][bridge] + 1 == river[0][i]) + && river[1][bridge] == river[1][i]) { found = 0; } } } - if(found != 0) { - if(found == 1) { + if (found != 0) { + if (found == 1) { river[2][bridge] = 44; } else { river[2][bridge] = 45; } rivercnt++; - for(bridge = 0; bridge <= riveramt; bridge++) { + for (bridge = 0; bridge <= riveramt; bridge++) { dungeon[river[0][bridge]][river[1][bridge]] = river[2][bridge]; } } else { @@ -1026,41 +1026,41 @@ void DRLG_L3Pool() BYTE k; static BYTE poolsub[15] = { 0, 35, 26, 36, 25, 29, 34, 7, 33, 28, 27, 37, 32, 31, 30 }; - for(duny = 0; duny < 40; duny++) { - for(dunx = 0; dunx < 40; dunx++) { - if(dungeon[dunx][duny] != 8) { + for (duny = 0; duny < 40; duny++) { + for (dunx = 0; dunx < 40; dunx++) { + if (dungeon[dunx][duny] != 8) { continue; } dungeon[dunx][duny] |= 0x80; totarea = 1; - if(dunx + 1 < 40) { + if (dunx + 1 < 40) { found = DRLG_L3SpawnEdge(dunx + 1, duny, &totarea); } else { found = TRUE; } - if(dunx - 1 > 0 && !found) { + if (dunx - 1 > 0 && !found) { found = DRLG_L3SpawnEdge(dunx - 1, duny, &totarea); } else { found = TRUE; } - if(duny + 1 < 40 && !found) { + if (duny + 1 < 40 && !found) { found = DRLG_L3SpawnEdge(dunx, duny + 1, &totarea); } else { found = TRUE; } - if(duny - 1 > 0 && !found) { + if (duny - 1 > 0 && !found) { found = DRLG_L3SpawnEdge(dunx, duny - 1, &totarea); } else { found = TRUE; } poolchance = random(0, 100); - for(j = duny - totarea; j < duny + totarea; j++) { - for(i = dunx - totarea; i < dunx + totarea; i++) { - if(dungeon[i][j] & 0x80 && j >= 0 && j < 40 && i >= 0 && i < 40) { + for (j = duny - totarea; j < duny + totarea; j++) { + for (i = dunx - totarea; i < dunx + totarea; i++) { + if (dungeon[i][j] & 0x80 && j >= 0 && j < 40 && i >= 0 && i < 40) { dungeon[i][j] &= ~0x80; - if(totarea > 4 && poolchance < 25 && !found) { + if (totarea > 4 && poolchance < 25 && !found) { k = poolsub[dungeon[i][j]]; - if(k != 0 && k <= 37) { + if (k != 0 && k <= 37) { dungeon[i][j] = k; } lavapool = TRUE; @@ -1077,16 +1077,16 @@ BOOL DRLG_L3SpawnEdge(int x, int y, int *totarea) BYTE i; static BYTE spawntable[15] = { 0, 10, 3, 5, 12, 6, 9, 0, 0, 12, 3, 6, 9, 10, 5 }; - if(*totarea > 40) { + if (*totarea > 40) { return TRUE; } - if(x < 0 || y < 0 || x >= 40 || y >= 40) { + if (x < 0 || y < 0 || x >= 40 || y >= 40) { return TRUE; } - if(dungeon[x][y] & 0x80) { + if (dungeon[x][y] & 0x80) { return FALSE; } - if(dungeon[x][y] > 15) { + if (dungeon[x][y] > 15) { return TRUE; } @@ -1094,30 +1094,30 @@ BOOL DRLG_L3SpawnEdge(int x, int y, int *totarea) dungeon[x][y] |= 0x80; *totarea += 1; - if(i != 8) { - if(spawntable[i] & 8 && DRLG_L3Spawn(x, y - 1, totarea) == TRUE) { + if (i != 8) { + if (spawntable[i] & 8 && DRLG_L3Spawn(x, y - 1, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 4 && DRLG_L3Spawn(x, y + 1, totarea) == TRUE) { + if (spawntable[i] & 4 && DRLG_L3Spawn(x, y + 1, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 2 && DRLG_L3Spawn(x + 1, y, totarea) == TRUE) { + if (spawntable[i] & 2 && DRLG_L3Spawn(x + 1, y, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 1 && DRLG_L3Spawn(x - 1, y, totarea) == TRUE) { + if (spawntable[i] & 1 && DRLG_L3Spawn(x - 1, y, totarea) == TRUE) { return TRUE; } } else { - if(DRLG_L3SpawnEdge(x + 1, y, totarea) == TRUE) { + if (DRLG_L3SpawnEdge(x + 1, y, totarea) == TRUE) { return TRUE; } - if(DRLG_L3SpawnEdge(x - 1, y, totarea) == TRUE) { + if (DRLG_L3SpawnEdge(x - 1, y, totarea) == TRUE) { return TRUE; } - if(DRLG_L3SpawnEdge(x, y + 1, totarea) == TRUE) { + if (DRLG_L3SpawnEdge(x, y + 1, totarea) == TRUE) { return TRUE; } - if(DRLG_L3SpawnEdge(x, y - 1, totarea) == TRUE) { + if (DRLG_L3SpawnEdge(x, y - 1, totarea) == TRUE) { return TRUE; } } @@ -1130,16 +1130,16 @@ BOOL DRLG_L3Spawn(int x, int y, int *totarea) BYTE i; static BYTE spawntable[15] = { 0, 10, 67, 5, 44, 6, 9, 0, 0, 28, 131, 6, 9, 10, 5 }; - if(*totarea > 40) { + if (*totarea > 40) { return TRUE; } - if(x < 0 || y < 0 || x >= 40 || y >= 40) { + if (x < 0 || y < 0 || x >= 40 || y >= 40) { return TRUE; } - if(dungeon[x][y] & 0x80) { + if (dungeon[x][y] & 0x80) { return FALSE; } - if(dungeon[x][y] > 15) { + if (dungeon[x][y] > 15) { return TRUE; } @@ -1147,28 +1147,28 @@ BOOL DRLG_L3Spawn(int x, int y, int *totarea) dungeon[x][y] |= 0x80; *totarea += 1; - if(spawntable[i] & 8 && DRLG_L3Spawn(x, y - 1, totarea) == TRUE) { + if (spawntable[i] & 8 && DRLG_L3Spawn(x, y - 1, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 4 && DRLG_L3Spawn(x, y + 1, totarea) == TRUE) { + if (spawntable[i] & 4 && DRLG_L3Spawn(x, y + 1, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 2 && DRLG_L3Spawn(x + 1, y, totarea) == TRUE) { + if (spawntable[i] & 2 && DRLG_L3Spawn(x + 1, y, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 1 && DRLG_L3Spawn(x - 1, y, totarea) == TRUE) { + if (spawntable[i] & 1 && DRLG_L3Spawn(x - 1, y, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 0x80 && DRLG_L3SpawnEdge(x, y - 1, totarea) == TRUE) { + if (spawntable[i] & 0x80 && DRLG_L3SpawnEdge(x, y - 1, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 0x40 && DRLG_L3SpawnEdge(x, y + 1, totarea) == TRUE) { + if (spawntable[i] & 0x40 && DRLG_L3SpawnEdge(x, y + 1, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 0x20 && DRLG_L3SpawnEdge(x + 1, y, totarea) == TRUE) { + if (spawntable[i] & 0x20 && DRLG_L3SpawnEdge(x + 1, y, totarea) == TRUE) { return TRUE; } - if(spawntable[i] & 0x10 && DRLG_L3SpawnEdge(x - 1, y, totarea) == TRUE) { + if (spawntable[i] & 0x10 && DRLG_L3SpawnEdge(x - 1, y, totarea) == TRUE) { return TRUE; } @@ -1179,17 +1179,17 @@ void DRLG_L3PoolFix() { int dunx, duny; - for(duny = 0; duny < DMAXY; duny++) { - for(dunx = 0; dunx < DMAXX; dunx++) { - if(dungeon[dunx][duny] == 8) { - if(dungeon[dunx - 1][duny - 1] >= 25 && dungeon[dunx - 1][duny - 1] <= 41 - && dungeon[dunx - 1][duny] >= 25 && dungeon[dunx - 1][duny] <= 41 - && dungeon[dunx - 1][duny + 1] >= 25 && dungeon[dunx - 1][duny + 1] <= 41 - && dungeon[dunx][duny - 1] >= 25 && dungeon[dunx][duny - 1] <= 41 - && dungeon[dunx][duny + 1] >= 25 && dungeon[dunx][duny + 1] <= 41 - && dungeon[dunx + 1][duny - 1] >= 25 && dungeon[dunx + 1][duny - 1] <= 41 - && dungeon[dunx + 1][duny] >= 25 && dungeon[dunx + 1][duny] <= 41 - && dungeon[dunx + 1][duny + 1] >= 25 && dungeon[dunx + 1][duny + 1] <= 41) { + for (duny = 0; duny < DMAXY; duny++) { + for (dunx = 0; dunx < DMAXX; dunx++) { + if (dungeon[dunx][duny] == 8) { + if (dungeon[dunx - 1][duny - 1] >= 25 && dungeon[dunx - 1][duny - 1] <= 41 + && dungeon[dunx - 1][duny] >= 25 && dungeon[dunx - 1][duny] <= 41 + && dungeon[dunx - 1][duny + 1] >= 25 && dungeon[dunx - 1][duny + 1] <= 41 + && dungeon[dunx][duny - 1] >= 25 && dungeon[dunx][duny - 1] <= 41 + && dungeon[dunx][duny + 1] >= 25 && dungeon[dunx][duny + 1] <= 41 + && dungeon[dunx + 1][duny - 1] >= 25 && dungeon[dunx + 1][duny - 1] <= 41 + && dungeon[dunx + 1][duny] >= 25 && dungeon[dunx + 1][duny] <= 41 + && dungeon[dunx + 1][duny + 1] >= 25 && dungeon[dunx + 1][duny + 1] <= 41) { dungeon[dunx][duny] = 33; } } @@ -1205,60 +1205,60 @@ BOOL DRLG_L3PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy sw = miniset[0]; sh = miniset[1]; - if(tmax - tmin == 0) { + if (tmax - tmin == 0) { numt = 1; } else { numt = random(0, tmax - tmin) + tmin; } - for(i = 0; i < numt; i++) { + for (i = 0; i < numt; i++) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; trys = 0; - while(!found && trys < 200) { + while (!found && trys < 200) { trys++; found = TRUE; - if(cx != -1 && sx >= cx - sw && sx <= cx + 12) { + if (cx != -1 && sx >= cx - sw && sx <= cx + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } - if(cy != -1 && sy >= cy - sh && sy <= cy + 12) { + if (cy != -1 && sy >= cy - sh && sy <= cy + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } ii = 2; - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } - if(!found) { + if (!found) { sx++; - if(sx == 40 - sw) { + if (sx == 40 - sw) { sx = 0; sy++; - if(sy == 40 - sh) { + if (sy == 40 - sh) { sy = 0; } } } } - if(trys >= 200) { + if (trys >= 200) { return TRUE; } ii = sw * sh + 2; - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[ii] != 0) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[ii] != 0) { dungeon[xx + sx][yy + sy] = miniset[ii]; } ii++; @@ -1266,11 +1266,11 @@ BOOL DRLG_L3PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy } } - if(setview == TRUE) { + if (setview == TRUE) { ViewX = 2 * sx + 17; ViewY = 2 * sy + 19; } - if(ldir == 0) { + if (ldir == 0) { LvlViewX = 2 * sx + 17; LvlViewY = 2 * sy + 19; } @@ -1286,40 +1286,40 @@ void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper) sw = miniset[0]; sh = miniset[1]; - for(sy = 0; sy < 40 - sh; sy++) { - for(sx = 0; sx < 40 - sw; sx++) { + for (sy = 0; sy < 40 - sh; sy++) { + for (sx = 0; sx < 40 - sw; sx++) { found = TRUE; ii = 2; - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } kk = sw * sh + 2; - if(miniset[kk] >= 84 && miniset[kk] <= 100 && found == TRUE) { - if(dungeon[sx - 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { + if (miniset[kk] >= 84 && miniset[kk] <= 100 && found == TRUE) { + if (dungeon[sx - 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { found = FALSE; } - if(dungeon[sx + 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { + if (dungeon[sx + 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { found = FALSE; } - if(dungeon[sx][sy + 1] >= 84 && dungeon[sx - 1][sy] <= 100) { + if (dungeon[sx][sy + 1] >= 84 && dungeon[sx - 1][sy] <= 100) { found = FALSE; } - if(dungeon[sx][sy - 1] >= 84 && dungeon[sx - 1][sy] <= 100) { + if (dungeon[sx][sy - 1] >= 84 && dungeon[sx - 1][sy] <= 100) { found = FALSE; } } - if(found == TRUE && random(0, 100) < rndper) { - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[kk] != 0) { + if (found == TRUE && random(0, 100) < rndper) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[kk] != 0) { dungeon[xx + sx][yy + sy] = miniset[kk]; } kk++; @@ -1335,18 +1335,18 @@ void DRLG_L3Wood() int i, j, x, y, xx, yy, rt, rp, x1, y1, x2, y2; BOOL skip; - for(j = 0; j < DMAXY - 1; j++) { - for(i = 0; i < DMAXX - 1; i++) { - if(dungeon[i][j] == 10 && random(0, 2) != 0) { + for (j = 0; j < DMAXY - 1; j++) { + for (i = 0; i < DMAXX - 1; i++) { + if (dungeon[i][j] == 10 && random(0, 2) != 0) { x = i; - while(dungeon[x][j] == 10) { + while (dungeon[x][j] == 10) { x++; } x--; - if(x - i > 0) { + if (x - i > 0) { dungeon[i][j] = 127; - for(xx = i + 1; xx < x; xx++) { - if(random(0, 2) != 0) { + for (xx = i + 1; xx < x; xx++) { + if (random(0, 2) != 0) { dungeon[xx][j] = 126; } else { dungeon[xx][j] = 129; @@ -1355,16 +1355,16 @@ void DRLG_L3Wood() dungeon[x][j] = 128; } } - if(dungeon[i][j] == 9 && random(0, 2) != 0) { + if (dungeon[i][j] == 9 && random(0, 2) != 0) { y = j; - while(dungeon[i][y] == 9) { + while (dungeon[i][y] == 9) { y++; } y--; - if(y - j > 0) { + if (y - j > 0) { dungeon[i][j] = 123; - for(yy = j + 1; yy < y; yy++) { - if(random(0, 2) != 0) { + for (yy = j + 1; yy < y; yy++) { + if (random(0, 2) != 0) { dungeon[i][yy] = 121; } else { dungeon[i][yy] = 124; @@ -1373,15 +1373,15 @@ void DRLG_L3Wood() dungeon[i][y] = 122; } } - if(dungeon[i][j] == 11 && dungeon[i + 1][j] == 10 && dungeon[i][j + 1] == 9 && random(0, 2) != 0) { + if (dungeon[i][j] == 11 && dungeon[i + 1][j] == 10 && dungeon[i][j + 1] == 9 && random(0, 2) != 0) { dungeon[i][j] = 125; x = i + 1; - while(dungeon[x][j] == 10) { + while (dungeon[x][j] == 10) { x++; } x--; - for(xx = i + 1; xx < x; xx++) { - if(random(0, 2) != 0) { + for (xx = i + 1; xx < x; xx++) { + if (random(0, 2) != 0) { dungeon[xx][j] = 126; } else { dungeon[xx][j] = 129; @@ -1389,12 +1389,12 @@ void DRLG_L3Wood() } dungeon[x][j] = 128; y = j + 1; - while(dungeon[i][y] == 9) { + while (dungeon[i][y] == 9) { y++; } y--; - for(yy = j + 1; yy < y; yy++) { - if(random(0, 2) != 0) { + for (yy = j + 1; yy < y; yy++) { + if (random(0, 2) != 0) { dungeon[i][yy] = 121; } else { dungeon[i][yy] = 124; @@ -1405,111 +1405,111 @@ void DRLG_L3Wood() } } - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] != 7 || random(0, 1) != 0 || !SkipThemeRoom(i, j)) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] != 7 || random(0, 1) != 0 || !SkipThemeRoom(i, j)) { continue; } rt = random(0, 2); - if(rt == 0) { + if (rt == 0) { y1 = j; - while(WoodVertU(i, y1)) { + while (WoodVertU(i, y1)) { y1--; } y1++; y2 = j; - while(WoodVertD(i, y2)) { + while (WoodVertD(i, y2)) { y2++; } y2--; skip = TRUE; - if(dungeon[i][y1] == 7) { + if (dungeon[i][y1] == 7) { skip = FALSE; } - if(dungeon[i][y2] == 7) { + if (dungeon[i][y2] == 7) { skip = FALSE; } - if(y2 - y1 > 1 && skip) { + if (y2 - y1 > 1 && skip) { rp = random(0, y2 - y1 - 1) + y1 + 1; - for(y = y1; y <= y2; y++) { - if(y == rp) { + for (y = y1; y <= y2; y++) { + if (y == rp) { continue; } - if(dungeon[i][y] == 7) { - if(random(0, 2) != 0) { + if (dungeon[i][y] == 7) { + if (random(0, 2) != 0) { dungeon[i][y] = 135; } else { dungeon[i][y] = 137; } } - if(dungeon[i][y] == 10) { + if (dungeon[i][y] == 10) { dungeon[i][y] = 131; } - if(dungeon[i][y] == 126) { + if (dungeon[i][y] == 126) { dungeon[i][y] = 133; } - if(dungeon[i][y] == 129) { + if (dungeon[i][y] == 129) { dungeon[i][y] = 133; } - if(dungeon[i][y] == 2) { + if (dungeon[i][y] == 2) { dungeon[i][y] = 139; } - if(dungeon[i][y] == 134) { + if (dungeon[i][y] == 134) { dungeon[i][y] = 138; } - if(dungeon[i][y] == 136) { + if (dungeon[i][y] == 136) { dungeon[i][y] = 138; } } } } - if(rt == 1) { + if (rt == 1) { x1 = i; - while(WoodHorizL(x1, j)) { + while (WoodHorizL(x1, j)) { x1--; } x1++; x2 = i; - while(WoodHorizR(x2, j)) { + while (WoodHorizR(x2, j)) { x2++; } x2--; skip = TRUE; - if(dungeon[x1][j] == 7) { + if (dungeon[x1][j] == 7) { skip = FALSE; } - if(dungeon[x2][j] == 7) { + if (dungeon[x2][j] == 7) { skip = FALSE; } - if(x2 - x1 > 1 && skip) { + if (x2 - x1 > 1 && skip) { rp = random(0, x2 - x1 - 1) + x1 + 1; - for(x = x1; x <= x2; x++) { - if(x == rp) { + for (x = x1; x <= x2; x++) { + if (x == rp) { continue; } - if(dungeon[x][j] == 7) { - if(random(0, 2) != 0) { + if (dungeon[x][j] == 7) { + if (random(0, 2) != 0) { dungeon[x][j] = 134; } else { dungeon[x][j] = 136; } } - if(dungeon[x][j] == 9) { + if (dungeon[x][j] == 9) { dungeon[x][j] = 130; } - if(dungeon[x][j] == 121) { + if (dungeon[x][j] == 121) { dungeon[x][j] = 132; } - if(dungeon[x][j] == 124) { + if (dungeon[x][j] == 124) { dungeon[x][j] = 132; } - if(dungeon[x][j] == 4) { + if (dungeon[x][j] == 4) { dungeon[x][j] = 140; } - if(dungeon[x][j] == 135) { + if (dungeon[x][j] == 135) { dungeon[x][j] = 138; } - if(dungeon[x][j] == 137) { + if (dungeon[x][j] == 137) { dungeon[x][j] = 138; } } @@ -1524,24 +1524,24 @@ void DRLG_L3Wood() BOOL WoodVertU(int i, int y) { - if((dungeon[i + 1][y] > 152 || dungeon[i + 1][y] < 130) - && (dungeon[i - 1][y] > 152 || dungeon[i - 1][y] < 130)) { - if(dungeon[i][y] == 7) { + if ((dungeon[i + 1][y] > 152 || dungeon[i + 1][y] < 130) + && (dungeon[i - 1][y] > 152 || dungeon[i - 1][y] < 130)) { + if (dungeon[i][y] == 7) { return TRUE; } - if(dungeon[i][y] == 10) { + if (dungeon[i][y] == 10) { return TRUE; } - if(dungeon[i][y] == 126) { + if (dungeon[i][y] == 126) { return TRUE; } - if(dungeon[i][y] == 129) { + if (dungeon[i][y] == 129) { return TRUE; } - if(dungeon[i][y] == 134) { + if (dungeon[i][y] == 134) { return TRUE; } - if(dungeon[i][y] == 136) { + if (dungeon[i][y] == 136) { return TRUE; } } @@ -1551,18 +1551,18 @@ BOOL WoodVertU(int i, int y) BOOL WoodVertD(int i, int y) { - if((dungeon[i + 1][y] > 152 || dungeon[i + 1][y] < 130) - && (dungeon[i - 1][y] > 152 || dungeon[i - 1][y] < 130)) { - if(dungeon[i][y] == 7) { + if ((dungeon[i + 1][y] > 152 || dungeon[i + 1][y] < 130) + && (dungeon[i - 1][y] > 152 || dungeon[i - 1][y] < 130)) { + if (dungeon[i][y] == 7) { return TRUE; } - if(dungeon[i][y] == 2) { + if (dungeon[i][y] == 2) { return TRUE; } - if(dungeon[i][y] == 134) { + if (dungeon[i][y] == 134) { return TRUE; } - if(dungeon[i][y] == 136) { + if (dungeon[i][y] == 136) { return TRUE; } } @@ -1572,24 +1572,24 @@ BOOL WoodVertD(int i, int y) BOOL WoodHorizL(int x, int j) { - if((dungeon[x][j + 1] > 152 || dungeon[x][j + 1] < 130) - && (dungeon[x][j - 1] > 152 || dungeon[x][j - 1] < 130)) { - if(dungeon[x][j] == 7) { + if ((dungeon[x][j + 1] > 152 || dungeon[x][j + 1] < 130) + && (dungeon[x][j - 1] > 152 || dungeon[x][j - 1] < 130)) { + if (dungeon[x][j] == 7) { return TRUE; } - if(dungeon[x][j] == 9) { + if (dungeon[x][j] == 9) { return TRUE; } - if(dungeon[x][j] == 121) { + if (dungeon[x][j] == 121) { return TRUE; } - if(dungeon[x][j] == 124) { + if (dungeon[x][j] == 124) { return TRUE; } - if(dungeon[x][j] == 135) { + if (dungeon[x][j] == 135) { return TRUE; } - if(dungeon[x][j] == 137) { + if (dungeon[x][j] == 137) { return TRUE; } } @@ -1599,18 +1599,18 @@ BOOL WoodHorizL(int x, int j) BOOL WoodHorizR(int x, int j) { - if((dungeon[x][j + 1] > 152 || dungeon[x][j + 1] < 130) - && (dungeon[x][j - 1] > 152 || dungeon[x][j - 1] < 130)) { - if(dungeon[x][j] == 7) { + if ((dungeon[x][j + 1] > 152 || dungeon[x][j + 1] < 130) + && (dungeon[x][j - 1] > 152 || dungeon[x][j - 1] < 130)) { + if (dungeon[x][j] == 7) { return TRUE; } - if(dungeon[x][j] == 4) { + if (dungeon[x][j] == 4) { return TRUE; } - if(dungeon[x][j] == 135) { + if (dungeon[x][j] == 135) { return TRUE; } - if(dungeon[x][j] == 137) { + if (dungeon[x][j] == 137) { return TRUE; } } @@ -1736,9 +1736,9 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy) rh = *lm; lm += 2; - for(j = 0; j < rh; j++) { - for(i = 0; i < rw; i++) { - if(*lm != 0) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { + if (*lm != 0) { dungeon[i][j] = *lm; } else { dungeon[i][j] = 7; @@ -1746,9 +1746,9 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy) lm += 2; } } - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 0) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 0) { dungeon[i][j] = 8; } } @@ -1762,15 +1762,15 @@ void LoadL3Dungeon(char *sFileName, int vx, int vy) SetMapMonsters(pLevelMap, 0, 0); SetMapObjects(pLevelMap, 0, 0); - for(j = 0; j < 112; j++) { - for(i = 0; i < 112; i++) { - if(dPiece[i][j] >= 56 && dPiece[i][j] <= 147) { + for (j = 0; j < 112; j++) { + for (i = 0; i < 112; i++) { + if (dPiece[i][j] >= 56 && dPiece[i][j] <= 147) { DoLighting(i, j, 7, -1); - } else if(dPiece[i][j] >= 154 && dPiece[i][j] <= 161) { + } else if (dPiece[i][j] >= 154 && dPiece[i][j] <= 161) { DoLighting(i, j, 7, -1); - } else if(dPiece[i][j] == 150) { + } else if (dPiece[i][j] == 150) { DoLighting(i, j, 7, -1); - } else if(dPiece[i][j] == 152) { + } else if (dPiece[i][j] == 152) { DoLighting(i, j, 7, -1); } } @@ -1794,9 +1794,9 @@ void LoadPreL3Dungeon(char *sFileName, int vx, int vy) rh = *lm; lm += 2; - for(j = 0; j < rh; j++) { - for(i = 0; i < rw; i++) { - if(*lm != 0) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { + if (*lm != 0) { dungeon[i][j] = *lm; } else { dungeon[i][j] = 7; @@ -1804,9 +1804,9 @@ void LoadPreL3Dungeon(char *sFileName, int vx, int vy) lm += 2; } } - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dungeon[i][j] == 0) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dungeon[i][j] == 0) { dungeon[i][j] = 8; } } diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 55eae9b1e..0c70aa7a6 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -322,9 +322,9 @@ void DRLG_L4SetSPRoom(int rx1, int ry1) sp = (unsigned char *)&pSetPiece_2[4]; - for(j = 0; j < rh; j++) { - for(i = 0; i < rw; i++) { - if(*sp != 0) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { + if (*sp != 0) { dungeon[i + rx1][j + ry1] = *sp; dflags[i + rx1][j + ry1] |= 0x80; } else { @@ -342,9 +342,9 @@ void L4SaveQuads() int i, j, x, y; y = 0; - for(j = 0; j < 14; j++) { + for (j = 0; j < 14; j++) { x = 0; - for(i = 0; i < 14; i++) { + for (i = 0; i < 14; i++) { dflags[i + l4holdx][j + l4holdy] = 1; dflags[39 - x - l4holdx][j + l4holdy] = 1; dflags[i + l4holdx][39 - y - l4holdy] = 1; @@ -366,9 +366,9 @@ void DRLG_L4SetRoom(BYTE *pSetPiece, int rx1, int ry1) rh = pSetPiece[2]; sp = &pSetPiece[4]; - for(j = 0; j < rh; j++) { - for(i = 0; i < rw; i++) { - if(*sp != 0) { + for (j = 0; j < rh; j++) { + for (i = 0; i < rw; i++) { + if (*sp != 0) { dungeon[i + rx1][j + ry1] = *sp; dflags[i + rx1][j + ry1] |= 0x80; } else { @@ -389,7 +389,7 @@ void DRLG_LoadDiabQuads(BOOL preflag) DRLG_L4SetRoom(lpSetPiece, diabquad1x, diabquad1y); mem_free_dbg(lpSetPiece); - if(preflag) { + if (preflag) { lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2b.DUN", 0); } else { lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", 0); @@ -399,7 +399,7 @@ void DRLG_LoadDiabQuads(BOOL preflag) DRLG_L4SetRoom(lpSetPiece, diabquad2x, diabquad2y); mem_free_dbg(lpSetPiece); - if(preflag) { + if (preflag) { lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3b.DUN", 0); } else { lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", 0); @@ -409,7 +409,7 @@ void DRLG_LoadDiabQuads(BOOL preflag) DRLG_L4SetRoom(lpSetPiece, diabquad3x, diabquad3y); mem_free_dbg(lpSetPiece); - if(preflag) { + if (preflag) { lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4b.DUN", 0); } else { lpSetPiece = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", 0); @@ -422,13 +422,13 @@ void DRLG_LoadDiabQuads(BOOL preflag) BOOL IsDURWall(char d) { - if(d == 25) { + if (d == 25) { return TRUE; } - if(d == 28) { + if (d == 28) { return TRUE; } - if(d == 23) { + if (d == 23) { return TRUE; } @@ -437,13 +437,13 @@ BOOL IsDURWall(char d) BOOL IsDLLWall(char dd) { - if(dd == 27) { + if (dd == 27) { return TRUE; } - if(dd == 26) { + if (dd == 26) { return TRUE; } - if(dd == 22) { + if (dd == 22) { return TRUE; } @@ -454,10 +454,10 @@ void L4FixRim() { int i, j; - for(i = 0; i < 20; i++) { + for (i = 0; i < 20; i++) { dung[i][0] = 0; } - for(j = 0; j < 20; j++) { + for (j = 0; j < 20; j++) { dung[0][j] = 0; } } @@ -466,9 +466,9 @@ void DRLG_L4GeneralFix() { int i, j; - for(j = 0; j < 39; j++) { - for(i = 0; i < 39; i++) { - if((dungeon[i][j] == 24 || dungeon[i][j] == 122) && dungeon[i + 1][j] == 2 && dungeon[i][j + 1] == 5) { + for (j = 0; j < 39; j++) { + for (i = 0; i < 39; i++) { + if ((dungeon[i][j] == 24 || dungeon[i][j] == 122) && dungeon[i + 1][j] == 2 && dungeon[i][j + 1] == 5) { dungeon[i][j] = 17; } } @@ -506,17 +506,17 @@ void DRLG_L4(int entry) InitL4Dungeon(); L4firstRoom(); L4FixRim(); - } while(GetArea() < 173); + } while (GetArea() < 173); uShape(); L4makeDungeon(); L4makeDmt(); L4tileFix(); - if(currlevel == 16) { + if (currlevel == 16) { L4SaveQuads(); } - if(QuestStatus(QTYPE_WARLRD) || currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { - for(spi = SP4x1; spi < SP4x2; spi++) { - for(spj = SP4y1; spj < SP4y2; spj++) { + if (QuestStatus(QTYPE_WARLRD) || currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + for (spi = SP4x1; spi < SP4x2; spi++) { + for (spj = SP4y1; spj < SP4y2; spj++) { dflags[spi][spj] = 1; } } @@ -524,67 +524,67 @@ void DRLG_L4(int entry) L4AddWall(); DRLG_L4FloodTVal(); DRLG_L4TransFix(); - if(setloadflag_2) { + if (setloadflag_2) { DRLG_L4SetSPRoom(SP4x1, SP4y1); } - if(currlevel == 16) { + if (currlevel == 16) { DRLG_LoadDiabQuads(TRUE); } - if(QuestStatus(QTYPE_WARLRD)) { - if(entry == 0) { + if (QuestStatus(QTYPE_WARLRD)) { + if (entry == 0) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); - if(doneflag && currlevel == 13) { + if (doneflag && currlevel == 13) { doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); } ViewX++; - } else if(entry == 1) { + } else if (entry == 1) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag && currlevel == 13) { + if (doneflag && currlevel == 13) { doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); } ViewX = 2 * setpc_x + 22; ViewY = 2 * setpc_y + 22; } else { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag && currlevel == 13) { + if (doneflag && currlevel == 13) { doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 1, 6); } ViewX++; } - } else if(currlevel != 15) { - if(entry == 0) { + } else if (currlevel != 15) { + if (entry == 0) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); - if(doneflag && currlevel != 16) { + if (doneflag && currlevel != 16) { doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, 0, 1); } - if(doneflag && currlevel == 13) { + if (doneflag && currlevel == 13) { doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); } ViewX++; - } else if(entry == 1) { + } else if (entry == 1) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag && currlevel != 16) { + if (doneflag && currlevel != 16) { doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, 1, 1); } - if(doneflag && currlevel == 13) { + if (doneflag && currlevel == 13) { doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 0, 6); } ViewY++; } else { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag && currlevel != 16) { + if (doneflag && currlevel != 16) { doneflag = DRLG_L4PlaceMiniSet(L4DSTAIRS, 1, 1, -1, -1, 0, 1); } - if(doneflag && currlevel == 13) { + if (doneflag && currlevel == 13) { doneflag = DRLG_L4PlaceMiniSet(L4TWARP, 1, 1, -1, -1, 1, 6); } ViewX++; } } else { - if(entry == 0) { + if (entry == 0) { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 1, 0); - if(doneflag) { - if(gbMaxPlayers == 1 && quests[QTYPE_MOD]._qactive != 2) { + if (doneflag) { + if (gbMaxPlayers == 1 && quests[QTYPE_MOD]._qactive != 2) { doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, 0, 1); } else { doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, 0, 1); @@ -593,8 +593,8 @@ void DRLG_L4(int entry) ViewX++; } else { doneflag = DRLG_L4PlaceMiniSet(L4USTAIRS, 1, 1, -1, -1, 0, 0); - if(doneflag) { - if(gbMaxPlayers == 1 && quests[QTYPE_MOD]._qactive != 2) { + if (doneflag) { + if (gbMaxPlayers == 1 && quests[QTYPE_MOD]._qactive != 2) { doneflag = DRLG_L4PlaceMiniSet(L4PENTA, 1, 1, -1, -1, 1, 1); } else { doneflag = DRLG_L4PlaceMiniSet(L4PENTA2, 1, 1, -1, -1, 1, 1); @@ -603,11 +603,11 @@ void DRLG_L4(int entry) ViewY++; } } - } while(!doneflag); + } while (!doneflag); DRLG_L4GeneralFix(); - if(currlevel != 16) { + if (currlevel != 16) { DRLG_PlaceThemeRooms(7, 10, 6, 8, 1); } @@ -616,9 +616,9 @@ void DRLG_L4(int entry) DRLG_L4Subs(); DRLG_Init_Globals(); - if(QuestStatus(QTYPE_WARLRD)) { - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + if (QuestStatus(QTYPE_WARLRD)) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { pdungeon[i][j] = dungeon[i][j]; } } @@ -626,21 +626,21 @@ void DRLG_L4(int entry) DRLG_CheckQuests(SP4x1, SP4y1); - if(currlevel == 15) { - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] == 98) { + if (currlevel == 15) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == 98) { Make_SetPC(i - 1, j - 1, 5, 5); } - if(dungeon[i][j] == 107) { + if (dungeon[i][j] == 107) { Make_SetPC(i - 1, j - 1, 5, 5); } } } } - if(currlevel == 16) { - for(j = 0; j < DMAXY; j++) { - for(i = 0; i < DMAXX; i++) { + if (currlevel == 16) { + for (j = 0; j < DMAXY; j++) { + for (i = 0; i < DMAXX; i++) { pdungeon[i][j] = dungeon[i][j]; } } @@ -653,28 +653,28 @@ void DRLG_L4Shadows() int x, y; BOOL okflag; - for(y = 1; y < 40; y++) { - for(x = 1; x < 40; x++) { + for (y = 1; y < 40; y++) { + for (x = 1; x < 40; x++) { okflag = FALSE; - if(dungeon[x][y] == 3) { + if (dungeon[x][y] == 3) { okflag = TRUE; } - if(dungeon[x][y] == 4) { + if (dungeon[x][y] == 4) { okflag = TRUE; } - if(dungeon[x][y] == 8) { + if (dungeon[x][y] == 8) { okflag = TRUE; } - if(dungeon[x][y] == 15) { + if (dungeon[x][y] == 15) { okflag = TRUE; } - if(!okflag) { + if (!okflag) { continue; } - if(dungeon[x - 1][y] == 6) { + if (dungeon[x - 1][y] == 6) { dungeon[x - 1][y] = 47; } - if(dungeon[x - 1][y - 1] == 6) { + if (dungeon[x - 1][y - 1] == 6) { dungeon[x - 1][y - 1] = 48; } } @@ -688,8 +688,8 @@ void InitL4Dungeon() memset(dung, 0, sizeof(dung)); memset(L4dungeon, 0, sizeof(L4dungeon)); - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { dungeon[i][j] = 30; dflags[i][j] = 0; } @@ -700,11 +700,11 @@ void L4makeDmt() { int i, j, val, dmtx, dmty; - for(j = 0, dmty = 1; dmty <= 77; j++, dmty += 2) { - for(i = 0, dmtx = 1; dmtx <= 77; i++, dmtx += 2) { - val = L4dungeon[dmtx+1][dmty+1]; - val = 2 * val + L4dungeon[dmtx][dmty+1]; - val = 2 * val + L4dungeon[dmtx+1][dmty]; + for (j = 0, dmty = 1; dmty <= 77; j++, dmty += 2) { + for (i = 0, dmtx = 1; dmtx <= 77; i++, dmtx += 2) { + val = L4dungeon[dmtx + 1][dmty + 1]; + val = 2 * val + L4dungeon[dmtx][dmty + 1]; + val = 2 * val + L4dungeon[dmtx + 1][dmty]; val = 2 * val + L4dungeon[dmtx][dmty]; dungeon[i][j] = L4ConvTbl[val]; } @@ -715,98 +715,98 @@ void L4AddWall() { int i, j, x, y; - for(j = 0; j < 40; j++) { - for(i = 0; i < 40; i++) { - if(dflags[i][j] != 0) { + for (j = 0; j < 40; j++) { + for (i = 0; i < 40; i++) { + if (dflags[i][j] != 0) { continue; } - if(dungeon[i][j] == 10 && random(0, 100) < 100) { + if (dungeon[i][j] == 10 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 12 && random(0, 100) < 100) { + if (dungeon[i][j] == 12 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 13 && random(0, 100) < 100) { + if (dungeon[i][j] == 13 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 15 && random(0, 100) < 100) { + if (dungeon[i][j] == 15 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 16 && random(0, 100) < 100) { + if (dungeon[i][j] == 16 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 21 && random(0, 100) < 100) { + if (dungeon[i][j] == 21 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 22 && random(0, 100) < 100) { + if (dungeon[i][j] == 22 && random(0, 100) < 100) { x = L4HWallOk(i, j); - if(x != -1) { + if (x != -1) { L4HorizWall(i, j, x); } } - if(dungeon[i][j] == 8 && random(0, 100) < 100) { + if (dungeon[i][j] == 8 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 9 && random(0, 100) < 100) { + if (dungeon[i][j] == 9 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 11 && random(0, 100) < 100) { + if (dungeon[i][j] == 11 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 14 && random(0, 100) < 100) { + if (dungeon[i][j] == 14 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 15 && random(0, 100) < 100) { + if (dungeon[i][j] == 15 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 16 && random(0, 100) < 100) { + if (dungeon[i][j] == 16 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 21 && random(0, 100) < 100) { + if (dungeon[i][j] == 21 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } - if(dungeon[i][j] == 23 && random(0, 100) < 100) { + if (dungeon[i][j] == 23 && random(0, 100) < 100) { y = L4VWallOk(i, j); - if(y != -1) { + if (y != -1) { L4VertWall(i, j, y); } } @@ -819,46 +819,46 @@ int L4HWallOk(int i, int j) int x; BOOL wallok; - for(x = 1; dungeon[i + x][j] == 6; x++) { - if(dflags[i + x][j] != 0) { + for (x = 1; dungeon[i + x][j] == 6; x++) { + if (dflags[i + x][j] != 0) { break; } - if(dungeon[i + x][j - 1] != 6) { + if (dungeon[i + x][j - 1] != 6) { break; } - if(dungeon[i + x][j + 1] != 6) { + if (dungeon[i + x][j + 1] != 6) { break; } } wallok = FALSE; - if(dungeon[i + x][j] == 10) { + if (dungeon[i + x][j] == 10) { wallok = TRUE; } - if(dungeon[i + x][j] == 12) { + if (dungeon[i + x][j] == 12) { wallok = TRUE; } - if(dungeon[i + x][j] == 13) { + if (dungeon[i + x][j] == 13) { wallok = TRUE; } - if(dungeon[i + x][j] == 15) { + if (dungeon[i + x][j] == 15) { wallok = TRUE; } - if(dungeon[i + x][j] == 16) { + if (dungeon[i + x][j] == 16) { wallok = TRUE; } - if(dungeon[i + x][j] == 21) { + if (dungeon[i + x][j] == 21) { wallok = TRUE; } - if(dungeon[i + x][j] == 22) { + if (dungeon[i + x][j] == 22) { wallok = TRUE; } - if(x <= 3) { + if (x <= 3) { wallok = FALSE; } - if(wallok) { + if (wallok) { return x; } else { return -1; @@ -870,49 +870,49 @@ int L4VWallOk(int i, int j) int y; BOOL wallok; - for(y = 1; dungeon[i][j + y] == 6; y++) { - if(dflags[i][j + y] != 0) { + for (y = 1; dungeon[i][j + y] == 6; y++) { + if (dflags[i][j + y] != 0) { break; } - if(dungeon[i - 1][j + y] != 6) { + if (dungeon[i - 1][j + y] != 6) { break; } - if(dungeon[i + 1][j + y] != 6) { + if (dungeon[i + 1][j + y] != 6) { break; } } wallok = FALSE; - if(dungeon[i][j + y] == 8) { + if (dungeon[i][j + y] == 8) { wallok = TRUE; } - if(dungeon[i][j + y] == 9) { + if (dungeon[i][j + y] == 9) { wallok = TRUE; } - if(dungeon[i][j + y] == 11) { + if (dungeon[i][j + y] == 11) { wallok = TRUE; } - if(dungeon[i][j + y] == 14) { + if (dungeon[i][j + y] == 14) { wallok = TRUE; } - if(dungeon[i][j + y] == 15) { + if (dungeon[i][j + y] == 15) { wallok = TRUE; } - if(dungeon[i][j + y] == 16) { + if (dungeon[i][j + y] == 16) { wallok = TRUE; } - if(dungeon[i][j + y] == 21) { + if (dungeon[i][j + y] == 21) { wallok = TRUE; } - if(dungeon[i][j + y] == 23) { + if (dungeon[i][j + y] == 23) { wallok = TRUE; } - if(y <= 3) { + if (y <= 3) { wallok = FALSE; } - if(wallok) { + if (wallok) { return y; } else { return -1; @@ -923,30 +923,30 @@ void L4HorizWall(int i, int j, int dx) { int xx; - if(dungeon[i][j] == 13) { + if (dungeon[i][j] == 13) { dungeon[i][j] = 17; } - if(dungeon[i][j] == 16) { + if (dungeon[i][j] == 16) { dungeon[i][j] = 11; } - if(dungeon[i][j] == 12) { + if (dungeon[i][j] == 12) { dungeon[i][j] = 14; } - for(xx = 1; xx < dx; xx++) { + for (xx = 1; xx < dx; xx++) { dungeon[i + xx][j] = 2; } - if(dungeon[i + dx][j] == 15) { + if (dungeon[i + dx][j] == 15) { dungeon[i + dx][j] = 14; } - if(dungeon[i + dx][j] == 10) { + if (dungeon[i + dx][j] == 10) { dungeon[i + dx][j] = 17; } - if(dungeon[i + dx][j] == 21) { + if (dungeon[i + dx][j] == 21) { dungeon[i + dx][j] = 23; } - if(dungeon[i + dx][j] == 22) { + if (dungeon[i + dx][j] == 22) { dungeon[i + dx][j] = 29; } @@ -955,10 +955,10 @@ void L4HorizWall(int i, int j, int dx) dungeon[i + xx + 2][j] = 56; dungeon[i + xx + 1][j] = 60; - if(dungeon[i + xx][j - 1] == 6) { + if (dungeon[i + xx][j - 1] == 6) { dungeon[i + xx][j - 1] = 58; } - if(dungeon[i + xx + 1][j - 1] == 6) { + if (dungeon[i + xx + 1][j - 1] == 6) { dungeon[i + xx + 1][j - 1] = 59; } } @@ -967,33 +967,33 @@ void L4VertWall(int i, int j, int dy) { int yy; - if(dungeon[i][j] == 14) { + if (dungeon[i][j] == 14) { dungeon[i][j] = 17; } - if(dungeon[i][j] == 8) { + if (dungeon[i][j] == 8) { dungeon[i][j] = 9; } - if(dungeon[i][j] == 15) { + if (dungeon[i][j] == 15) { dungeon[i][j] = 10; } - for(yy = 1; yy < dy; yy++) { + for (yy = 1; yy < dy; yy++) { dungeon[i][j + yy] = 1; } - if(dungeon[i][j + dy] == 11) { + if (dungeon[i][j + dy] == 11) { dungeon[i][j + dy] = 17; } - if(dungeon[i][j + dy] == 9) { + if (dungeon[i][j + dy] == 9) { dungeon[i][j + dy] = 10; } - if(dungeon[i][j + dy] == 16) { + if (dungeon[i][j + dy] == 16) { dungeon[i][j + dy] = 13; } - if(dungeon[i][j + dy] == 21) { + if (dungeon[i][j + dy] == 21) { dungeon[i][j + dy] = 22; } - if(dungeon[i][j + dy] == 23) { + if (dungeon[i][j + dy] == 23) { dungeon[i][j + dy] = 29; } @@ -1002,10 +1002,10 @@ void L4VertWall(int i, int j, int dy) dungeon[i][j + yy + 2] = 52; dungeon[i][j + yy + 1] = 6; - if(dungeon[i - 1][j + yy] == 6) { + if (dungeon[i - 1][j + yy] == 6) { dungeon[i - 1][j + yy] = 54; } - if(dungeon[i - 1][j + yy - 1] == 6) { + if (dungeon[i - 1][j + yy - 1] == 6) { dungeon[i - 1][j + yy - 1] = 55; } } @@ -1361,19 +1361,19 @@ void DRLG_L4Subs() int x, y, i, rv; BYTE c; - for(y = 0; y < 40; y++) { - for(x = 0; x < 40; x++) { - if(random(0, 3) == 0) { + for (y = 0; y < 40; y++) { + for (x = 0; x < 40; x++) { + if (random(0, 3) == 0) { c = L4BTYPES[dungeon[x][y]]; - if(c != 0 && dflags[x][y] == 0) { + if (c != 0 && dflags[x][y] == 0) { rv = random(0, 16); i = -1; - while(rv >= 0) { + while (rv >= 0) { i++; - if(i == sizeof(L4BTYPES)) { + if (i == sizeof(L4BTYPES)) { i = 0; } - if(c == L4BTYPES[i]) { + if (c == L4BTYPES[i]) { rv--; } } @@ -1382,10 +1382,10 @@ void DRLG_L4Subs() } } } - for(y = 0; y < 40; y++) { - for(x = 0; x < 40; x++) { - if(random(0, 10) == 0) { - if(L4BTYPES[dungeon[x][y]] == 6 && dflags[x][y] == 0) { + for (y = 0; y < 40; y++) { + for (x = 0; x < 40; x++) { + if (random(0, 10) == 0) { + if (L4BTYPES[dungeon[x][y]] == 6 && dflags[x][y] == 0) { dungeon[x][y] = random(0, 3) + 95; } } @@ -1397,8 +1397,8 @@ void L4makeDungeon() { int i, j, k, l; - for(j = 0; j < 20; j++) { - for(i = 0; i < 20; i++) { + for (j = 0; j < 20; j++) { + for (i = 0; i < 20; i++) { k = i << 1; l = j << 1; L4dungeon[k][l] = dung[i][j]; @@ -1407,8 +1407,8 @@ void L4makeDungeon() L4dungeon[k + 1][l + 1] = dung[i][j]; } } - for(j = 0; j < 20; j++) { - for(i = 0; i < 20; i++) { + for (j = 0; j < 20; j++) { + for (i = 0; i < 20; i++) { k = i << 1; l = j << 1; L4dungeon[k][l + 40] = dung[i][19 - j]; @@ -1417,8 +1417,8 @@ void L4makeDungeon() L4dungeon[k + 1][l + 41] = dung[i][19 - j]; } } - for(j = 0; j < 20; j++) { - for(i = 0; i < 20; i++) { + for (j = 0; j < 20; j++) { + for (i = 0; i < 20; i++) { k = i << 1; l = j << 1; L4dungeon[k + 40][l] = dung[19 - i][j]; @@ -1427,8 +1427,8 @@ void L4makeDungeon() L4dungeon[k + 41][l + 1] = dung[19 - i][j]; } } - for(j = 0; j < 20; j++) { - for(i = 0; i < 20; i++) { + for (j = 0; j < 20; j++) { + for (i = 0; i < 20; i++) { k = i << 1; l = j << 1; L4dungeon[k + 40][l + 40] = dung[19 - i][19 - j]; @@ -1443,13 +1443,13 @@ void uShape() { int j, i, rv; - for(j = 19; j >= 0; j--) { - for(i = 19; i >= 0; i--) { - if(dung[i][j] != 1) { + for (j = 19; j >= 0; j--) { + for (i = 19; i >= 0; i--) { + if (dung[i][j] != 1) { hallok[j] = FALSE; } - if(dung[i][j] == 1) { - if(dung[i][j + 1] == 1 && dung[i + 1][j + 1] == 0) { + if (dung[i][j] == 1) { + if (dung[i][j + 1] == 1 && dung[i + 1][j + 1] == 0) { hallok[j] = TRUE; } else { hallok[j] = FALSE; @@ -1461,9 +1461,9 @@ void uShape() rv = random(0, 19) + 1; do { - if(hallok[rv]) { - for(i = 19; i >= 0; i--) { - if(dung[i][rv] == 1) { + if (hallok[rv]) { + for (i = 19; i >= 0; i--) { + if (dung[i][rv] == 1) { i = -1; rv = 0; } else { @@ -1473,19 +1473,19 @@ void uShape() } } else { rv++; - if(rv == 20) { + if (rv == 20) { rv = 1; } } - } while(rv != 0); + } while (rv != 0); - for(i = 19; i >= 0; i--) { - for(j = 19; j >= 0; j--) { - if(dung[i][j] != 1) { + for (i = 19; i >= 0; i--) { + for (j = 19; j >= 0; j--) { + if (dung[i][j] != 1) { hallok[i] = FALSE; } - if(dung[i][j] == 1) { - if(dung[i + 1][j] == 1 && dung[i + 1][j + 1] == 0) { + if (dung[i][j] == 1) { + if (dung[i + 1][j] == 1 && dung[i + 1][j + 1] == 0) { hallok[i] = TRUE; } else { hallok[i] = FALSE; @@ -1497,9 +1497,9 @@ void uShape() rv = random(0, 19) + 1; do { - if(hallok[rv]) { - for(j = 19; j >= 0; j--) { - if(dung[rv][j] == 1) { + if (hallok[rv]) { + for (j = 19; j >= 0; j--) { + if (dung[rv][j] == 1) { j = -1; rv = 0; } else { @@ -1509,11 +1509,11 @@ void uShape() } } else { rv++; - if(rv == 20) { + if (rv == 20) { rv = 1; } } - } while(rv != 0); + } while (rv != 0); } long GetArea() @@ -1523,9 +1523,9 @@ long GetArea() rv = 0; - for(j = 0; j < 20; j++) { - for(i = 0; i < 20; i++) { - if(dung[i][j] == 1) { + for (j = 0; j < 20; j++) { + for (i = 0; i < 20; i++) { + if (dung[i][j] == 1) { rv++; } } @@ -1538,12 +1538,12 @@ void L4firstRoom() { int x, y, w, h, rndx, rndy; /* xmin, xmax, ymin, ymax */ - if(currlevel != 16) { - if(currlevel == quests[QTYPE_WARLRD]._qlevel && quests[QTYPE_WARLRD]._qactive) { + if (currlevel != 16) { + if (currlevel == quests[QTYPE_WARLRD]._qlevel && quests[QTYPE_WARLRD]._qactive) { /// ASSERT: assert(gbMaxPlayers == 1); w = 11; h = 11; - } else if(currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + } else if (currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { w = 11; h = 11; } else { @@ -1556,23 +1556,23 @@ void L4firstRoom() } rndx = random(0, 19 - w - ((20 - w) >> 1) + 1) + ((20 - w) >> 1); - if(rndx + w > 19) { + if (rndx + w > 19) { x = 19 - w + 1; } else { x = rndx; } rndy = random(0, 19 - h - ((20 - h) >> 1) + 1) + ((20 - h) >> 1); - if(rndy + h > 19) { + if (rndy + h > 19) { y = 19 - h + 1; } else { y = rndy; } - if(currlevel == 16) { + if (currlevel == 16) { l4holdx = x; l4holdy = y; } - if(QuestStatus(QTYPE_WARLRD) || currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { + if (QuestStatus(QTYPE_WARLRD) || currlevel == quests[QTYPE_VB]._qlevel && gbMaxPlayers != 1) { SP4x1 = x + 1; SP4y1 = y + 1; SP4x2 = SP4x1 + w; @@ -1592,8 +1592,8 @@ void L4drawRoom(int x, int y, int width, int height) { int i, j; - for(j = 0; j < height; j++) { - for(i = 0; i < width; i++) { + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { dung[i + x][j + y] = 1; } } @@ -1608,51 +1608,51 @@ void L4roomGen(int x, int y, int w, int h, int dir) int dirProb = random(0, 4); - switch(dir == 1 ? dirProb != 0 : dirProb == 0) { - case FALSE: - num = 0; - do { - cw = (random(0, 5) + 2) & ~1; - ch = (random(0, 5) + 2) & ~1; - cy1 = h/2 + y - ch/2; - cx1 = x-cw; - ran = L4checkRoom(cx1-1, cy1-1, ch+2, cw+1); /// BUGFIX: swap args 3 and 4 ("ch+2" and "cw+1") - num++; - } while(ran == FALSE && num < 20); - - if(ran == TRUE) - L4drawRoom(cx1, cy1, cw, ch); - cx2 = x+w; - ran2 = L4checkRoom(cx2, cy1-1, cw+1, ch+2); - if(ran2 == TRUE) - L4drawRoom(cx2, cy1, cw, ch); - if(ran == TRUE) - L4roomGen(cx1, cy1, cw, ch, 1); - if(ran2 == TRUE) - L4roomGen(cx2, cy1, cw, ch, 1); - break; - case TRUE: - num = 0; - do { - width = (random(0, 5) + 2) & ~1; - height = (random(0, 5) + 2) & ~1; - rx = w/2 + x - width/2; - ry = y-height; - ran = L4checkRoom(rx-1, ry-1, width+2, height+1); - num++; - } while(ran == FALSE && num < 20); - - if(ran == TRUE) - L4drawRoom(rx, ry, width, height); - ry2 = y+h; - ran2 = L4checkRoom(rx-1, ry2, width+2, height+1); - if(ran2 == TRUE) - L4drawRoom(rx, ry2, width, height); - if(ran == TRUE) - L4roomGen(rx, ry, width, height, 0); - if(ran2 == TRUE) - L4roomGen(rx, ry2, width, height, 0); - break; + switch (dir == 1 ? dirProb != 0 : dirProb == 0) { + case FALSE: + num = 0; + do { + cw = (random(0, 5) + 2) & ~1; + ch = (random(0, 5) + 2) & ~1; + cy1 = h / 2 + y - ch / 2; + cx1 = x - cw; + ran = L4checkRoom(cx1 - 1, cy1 - 1, ch + 2, cw + 1); /// BUGFIX: swap args 3 and 4 ("ch+2" and "cw+1") + num++; + } while (ran == FALSE && num < 20); + + if (ran == TRUE) + L4drawRoom(cx1, cy1, cw, ch); + cx2 = x + w; + ran2 = L4checkRoom(cx2, cy1 - 1, cw + 1, ch + 2); + if (ran2 == TRUE) + L4drawRoom(cx2, cy1, cw, ch); + if (ran == TRUE) + L4roomGen(cx1, cy1, cw, ch, 1); + if (ran2 == TRUE) + L4roomGen(cx2, cy1, cw, ch, 1); + break; + case TRUE: + num = 0; + do { + width = (random(0, 5) + 2) & ~1; + height = (random(0, 5) + 2) & ~1; + rx = w / 2 + x - width / 2; + ry = y - height; + ran = L4checkRoom(rx - 1, ry - 1, width + 2, height + 1); + num++; + } while (ran == FALSE && num < 20); + + if (ran == TRUE) + L4drawRoom(rx, ry, width, height); + ry2 = y + h; + ran2 = L4checkRoom(rx - 1, ry2, width + 2, height + 1); + if (ran2 == TRUE) + L4drawRoom(rx, ry2, width, height); + if (ran == TRUE) + L4roomGen(rx, ry, width, height, 0); + if (ran2 == TRUE) + L4roomGen(rx, ry2, width, height, 0); + break; } } @@ -1660,16 +1660,16 @@ BOOL L4checkRoom(int x, int y, int width, int height) { int i, j; - if(x <= 0 || y <= 0) { + if (x <= 0 || y <= 0) { return FALSE; } - for(j = 0; j < height; j++) { - for(i = 0; i < width; i++) { - if(i + x < 0 || i + x >= 20 || j + y < 0 || j + y >= 20) { + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + if (i + x < 0 || i + x >= 20 || j + y < 0 || j + y >= 20) { return FALSE; } - if(dung[i + x][j + y] != 0) { + if (dung[i + x][j + y] != 0) { return FALSE; } } @@ -1686,61 +1686,61 @@ BOOL DRLG_L4PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int c sw = miniset[0]; sh = miniset[1]; - if(tmax - tmin == 0) { + if (tmax - tmin == 0) { numt = 1; } else { numt = random(0, tmax - tmin) + tmin; } - for(i = 0; i < numt; i++) { + for (i = 0; i < numt; i++) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; - for(bailcnt = 0; !found && bailcnt < 200; bailcnt++) { + for (bailcnt = 0; !found && bailcnt < 200; bailcnt++) { found = TRUE; - if(sx >= SP4x1 && sx <= SP4x2 && sy >= SP4y1 && sy <= SP4y2) { + if (sx >= SP4x1 && sx <= SP4x2 && sy >= SP4y1 && sy <= SP4y2) { found = FALSE; } - if(cx != -1 && sx >= cx - sw && sx <= cx + 12) { + if (cx != -1 && sx >= cx - sw && sx <= cx + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } - if(cy != -1 && sy >= cy - sh && sy <= cy + 12) { + if (cy != -1 && sy >= cy - sh && sy <= cy + 12) { sx = random(0, 40 - sw); sy = random(0, 40 - sh); found = FALSE; } ii = 2; - for(yy = 0; yy < sh && found == TRUE; yy++) { - for(xx = 0; xx < sw && found == TRUE; xx++) { - if(miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { + for (yy = 0; yy < sh && found == TRUE; yy++) { + for (xx = 0; xx < sw && found == TRUE; xx++) { + if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = FALSE; } - if(dflags[xx + sx][yy + sy] != 0) { + if (dflags[xx + sx][yy + sy] != 0) { found = FALSE; } ii++; } } - if(!found) { + if (!found) { sx++; - if(sx == 40 - sw) { + if (sx == 40 - sw) { sx = 0; sy++; - if(sy == 40 - sh) { + if (sy == 40 - sh) { sy = 0; } } } } - if(bailcnt >= 200) { + if (bailcnt >= 200) { return FALSE; } ii = sw * sh + 2; - for(yy = 0; yy < sh; yy++) { - for(xx = 0; xx < sw; xx++) { - if(miniset[ii] != 0) { + for (yy = 0; yy < sh; yy++) { + for (xx = 0; xx < sw; xx++) { + if (miniset[ii] != 0) { dungeon[xx + sx][yy + sy] = miniset[ii]; dflags[xx + sx][yy + sy] |= 8; } @@ -1749,15 +1749,15 @@ BOOL DRLG_L4PlaceMiniSet(const unsigned char *miniset, int tmin, int tmax, int c } } - if(currlevel == 15) { + if (currlevel == 15) { quests[15]._qtx = sx + 1; quests[15]._qty = sy + 1; } - if(setview == TRUE) { + if (setview == TRUE) { ViewX = 2 * sx + 21; ViewY = 2 * sy + 22; } - if(ldir == 0) { + if (ldir == 0) { LvlViewX = 2 * sx + 21; LvlViewY = 2 * sy + 22; } @@ -1770,10 +1770,10 @@ void DRLG_L4FloodTVal() int i, j, xx, yy; yy = 16; - for(j = 0; j < DMAXY; j++) { + for (j = 0; j < DMAXY; j++) { xx = 16; - for(i = 0; i < DMAXX; i++) { - if(dungeon[i][j] == 6 && dTransVal[xx][yy] == 0) { + for (i = 0; i < DMAXX; i++) { + if (dungeon[i][j] == 6 && dTransVal[xx][yy] == 0) { DRLG_L4FTVR(i, j, xx, yy, 0); TransVal++; } @@ -1785,33 +1785,33 @@ void DRLG_L4FloodTVal() void DRLG_L4FTVR(int i, int j, int x, int y, int d) { - if(dTransVal[x][y] != 0 || dungeon[i][j] != 6) { - if(d == 1) { + if (dTransVal[x][y] != 0 || dungeon[i][j] != 6) { + if (d == 1) { dTransVal[x][y] = TransVal; dTransVal[x][y + 1] = TransVal; } - if(d == 2) { + if (d == 2) { dTransVal[x + 1][y] = TransVal; dTransVal[x + 1][y + 1] = TransVal; } - if(d == 3) { + if (d == 3) { dTransVal[x][y] = TransVal; dTransVal[x + 1][y] = TransVal; } - if(d == 4) { + if (d == 4) { dTransVal[x][y + 1] = TransVal; dTransVal[x + 1][y + 1] = TransVal; } - if(d == 5) { + if (d == 5) { dTransVal[x + 1][y + 1] = TransVal; } - if(d == 6) { + if (d == 6) { dTransVal[x][y + 1] = TransVal; } - if(d == 7) { + if (d == 7) { dTransVal[x + 1][y] = TransVal; } - if(d == 8) { + if (d == 8) { dTransVal[x][y] = TransVal; } } else { @@ -1835,35 +1835,35 @@ void DRLG_L4TransFix() int i, j, xx, yy; yy = 16; - for(j = 0; j < DMAXY; j++) { + for (j = 0; j < DMAXY; j++) { xx = 16; - for(i = 0; i < DMAXX; i++) { - if(IsDURWall(dungeon[i][j]) && dungeon[i][j - 1] == 18) { + for (i = 0; i < DMAXX; i++) { + if (IsDURWall(dungeon[i][j]) && dungeon[i][j - 1] == 18) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(IsDLLWall(dungeon[i][j]) && dungeon[i + 1][j] == 19) { + if (IsDLLWall(dungeon[i][j]) && dungeon[i + 1][j] == 19) { dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 18) { + if (dungeon[i][j] == 18) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 19) { + if (dungeon[i][j] == 19) { dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 24) { + if (dungeon[i][j] == 24) { dTransVal[xx + 1][yy] = dTransVal[xx][yy]; dTransVal[xx][yy + 1] = dTransVal[xx][yy]; dTransVal[xx + 1][yy + 1] = dTransVal[xx][yy]; } - if(dungeon[i][j] == 57) { + if (dungeon[i][j] == 57) { dTransVal[xx - 1][yy] = dTransVal[xx][yy + 1]; dTransVal[xx][yy] = dTransVal[xx][yy + 1]; } - if(dungeon[i][j] == 53) { + if (dungeon[i][j] == 53) { dTransVal[xx][yy - 1] = dTransVal[xx + 1][yy]; dTransVal[xx][yy] = dTransVal[xx + 1][yy]; } @@ -1877,12 +1877,12 @@ void DRLG_L4Corners() { int i, j; - for(j = 1; j < DMAXY - 1; j++) { - for(i = 1; i < DMAXX - 1; i++) { - if(dungeon[i][j] >= 18 && dungeon[i][j] <= 30) { - if(dungeon[i + 1][j] < 18) { + for (j = 1; j < DMAXY - 1; j++) { + for (i = 1; i < DMAXX - 1; i++) { + if (dungeon[i][j] >= 18 && dungeon[i][j] <= 30) { + if (dungeon[i + 1][j] < 18) { dungeon[i][j] += 98; - } else if(dungeon[i][j + 1] < 18) { + } else if (dungeon[i][j + 1] < 18) { dungeon[i][j] += 98; } } diff --git a/Source/effects.cpp b/Source/effects.cpp index 7b40d9dfb..1b52c7efe 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1095,7 +1095,7 @@ int RndSFX(int psfx) nRand = 3; else return psfx; - return psfx + random(165, nRand); + return psfx + random(165, nRand); } void PlaySfxLoc(int psfx, int x, int y) @@ -1162,7 +1162,6 @@ void effects_update() } } - void effects_cleanup_sfx() { DWORD i; diff --git a/Source/error.cpp b/Source/error.cpp index 97681dd36..51d74ccf9 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -91,13 +91,13 @@ void DrawDiabloMsg() CelDecodeOnly(591, 366, (BYTE *)pSTextSlidCels, 3, 12); sx = 173; - for(i = 0; i < 35; i++) { + for (i = 0; i < 35; i++) { CelDecodeOnly(sx, 318, (BYTE *)pSTextSlidCels, 5, 12); CelDecodeOnly(sx, 366, (BYTE *)pSTextSlidCels, 7, 12); sx += 12; } sy = 330; - for(i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { CelDecodeOnly(165, sy, (BYTE *)pSTextSlidCels, 6, 12); CelDecodeOnly(591, sy, (BYTE *)pSTextSlidCels, 8, 12); sy += 12; @@ -116,29 +116,29 @@ void DrawDiabloMsg() len = strlen(tempstr); width = 0; - for(i = 0; i < len; i++) { + for (i = 0; i < len; i++) { width += fontkern[fontframe[gbFontTransTbl[(BYTE)tempstr[i]]]] + 1; } - if(width < 442) { + if (width < 442) { off += (442 - width) >> 1; } - for(i = 0; i < len; i++) { + for (i = 0; i < len; i++) { c = fontframe[gbFontTransTbl[(BYTE)tempstr[i]]]; - if(c != '\0') { + if (c != '\0') { CPrintString(off, c, COL_GOLD); } off += fontkern[c] + 1; } - if(msgdelay > 0) { + if (msgdelay > 0) { msgdelay--; } - if(msgdelay == 0) { + if (msgdelay == 0) { msgcnt--; msgdelay = 70; - if(msgcnt == 0) { + if (msgcnt == 0) { msgflag = 0; } else { msgflag = msgtable[msgcnt]; diff --git a/Source/fault.cpp b/Source/fault.cpp index 459a724b1..bd158df68 100644 --- a/Source/fault.cpp +++ b/Source/fault.cpp @@ -24,7 +24,7 @@ void fault_init_filter() void fault_cleanup_filter_atexit() { - atexit((void (__cdecl *)(void ))fault_cleanup_filter); + atexit((void(__cdecl *)(void))fault_cleanup_filter); } LPTOP_LEVEL_EXCEPTION_FILTER __cdecl fault_cleanup_filter() diff --git a/Source/gendung.cpp b/Source/gendung.cpp index ae704344f..c56362010 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -52,16 +52,16 @@ char nMissileTable[2049]; char *pSetPiece_2; char setlvltype; // weak BOOLEAN setlevel; -int LvlViewY; // weak -int LvlViewX; // weak -int dmaxx; // weak -int dmaxy; // weak -int setpc_h; // weak -int setpc_w; // weak -int setpc_x; // idb -int ViewX; // idb -int ViewY; // idb -int setpc_y; // idb +int LvlViewY; // weak +int LvlViewX; // weak +int dmaxx; // weak +int dmaxy; // weak +int setpc_h; // weak +int setpc_w; // weak +int setpc_x; // idb +int ViewX; // idb +int ViewY; // idb +int setpc_y; // idb char dMissile[MAXDUNX][MAXDUNY]; int dminx; // weak int dminy; // weak @@ -122,14 +122,14 @@ void FillSolidBlockTbls() void MakeSpeedCels() { - int i, j, k, x, y, mt, t, z; + int i, j, x, y, mt, t, z; int total_frames, blocks, total_size, frameidx, blk_cnt, nDataSize; WORD m; BOOL blood_flag; DWORD *pFrameTable; MICROS *pMap; #ifndef USE_ASM - int l; + int l, k; BYTE width, pix; BYTE *src, *dst, *tbl; #endif @@ -576,8 +576,8 @@ void DRLG_MRectTrans(int x1, int y1, int x2, int y2) x2 = 2 * x2 + 16; y2 = 2 * y2 + 16; - for(j = y1; j <= y2; j++) { - for(i = x1; i <= x2; i++) { + for (j = y1; j <= y2; j++) { + for (i = x1; i <= x2; i++) { dTransVal[i][j] = TransVal; } } @@ -769,60 +769,60 @@ void DRLG_CreateThemeRoom(int themeIndex) { int xx, yy; - for(yy = themeLoc[themeIndex].y; yy < themeLoc[themeIndex].y + themeLoc[themeIndex].height; yy++) { - for(xx = themeLoc[themeIndex].x; xx < themeLoc[themeIndex].x + themeLoc[themeIndex].width; xx++) { - if(leveltype == DTYPE_CATACOMBS) { - if(yy == themeLoc[themeIndex].y - && xx >= themeLoc[themeIndex].x - && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width - || yy == themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1 - && xx >= themeLoc[themeIndex].x - && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width) { + for (yy = themeLoc[themeIndex].y; yy < themeLoc[themeIndex].y + themeLoc[themeIndex].height; yy++) { + for (xx = themeLoc[themeIndex].x; xx < themeLoc[themeIndex].x + themeLoc[themeIndex].width; xx++) { + if (leveltype == DTYPE_CATACOMBS) { + if (yy == themeLoc[themeIndex].y + && xx >= themeLoc[themeIndex].x + && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width + || yy == themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1 + && xx >= themeLoc[themeIndex].x + && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width) { dungeon[xx][yy] = 2; - } else if(xx == themeLoc[themeIndex].x - && yy >= themeLoc[themeIndex].y - && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height - || xx == themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1 - && yy >= themeLoc[themeIndex].y - && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height) { + } else if (xx == themeLoc[themeIndex].x + && yy >= themeLoc[themeIndex].y + && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height + || xx == themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1 + && yy >= themeLoc[themeIndex].y + && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height) { dungeon[xx][yy] = 1; } else { dungeon[xx][yy] = 3; } } - if(leveltype == DTYPE_CAVES) { - if(yy == themeLoc[themeIndex].y - && xx >= themeLoc[themeIndex].x - && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width - || yy == themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1 - && xx >= themeLoc[themeIndex].x - && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width) { + if (leveltype == DTYPE_CAVES) { + if (yy == themeLoc[themeIndex].y + && xx >= themeLoc[themeIndex].x + && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width + || yy == themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1 + && xx >= themeLoc[themeIndex].x + && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width) { dungeon[xx][yy] = 134; - } else if(xx == themeLoc[themeIndex].x - && yy >= themeLoc[themeIndex].y - && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height - || xx == themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1 - && yy >= themeLoc[themeIndex].y - && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height) { + } else if (xx == themeLoc[themeIndex].x + && yy >= themeLoc[themeIndex].y + && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height + || xx == themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1 + && yy >= themeLoc[themeIndex].y + && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height) { dungeon[xx][yy] = 137; } else { dungeon[xx][yy] = 7; } } - if(leveltype == DTYPE_HELL) { - if(yy == themeLoc[themeIndex].y - && xx >= themeLoc[themeIndex].x - && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width - || yy == themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1 - && xx >= themeLoc[themeIndex].x - && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width) { + if (leveltype == DTYPE_HELL) { + if (yy == themeLoc[themeIndex].y + && xx >= themeLoc[themeIndex].x + && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width + || yy == themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1 + && xx >= themeLoc[themeIndex].x + && xx <= themeLoc[themeIndex].x + themeLoc[themeIndex].width) { dungeon[xx][yy] = 2; - } else if(xx == themeLoc[themeIndex].x - && yy >= themeLoc[themeIndex].y - && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height - || xx == themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1 - && yy >= themeLoc[themeIndex].y - && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height) { + } else if (xx == themeLoc[themeIndex].x + && yy >= themeLoc[themeIndex].y + && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height + || xx == themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1 + && yy >= themeLoc[themeIndex].y + && yy <= themeLoc[themeIndex].y + themeLoc[themeIndex].height) { dungeon[xx][yy] = 1; } else { dungeon[xx][yy] = 6; @@ -831,27 +831,27 @@ void DRLG_CreateThemeRoom(int themeIndex) } } - if(leveltype == DTYPE_CATACOMBS) { + if (leveltype == DTYPE_CATACOMBS) { dungeon[themeLoc[themeIndex].x][themeLoc[themeIndex].y] = 8; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y] = 7; dungeon[themeLoc[themeIndex].x][themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1] = 9; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1] = 6; } - if(leveltype == DTYPE_CAVES) { + if (leveltype == DTYPE_CAVES) { dungeon[themeLoc[themeIndex].x][themeLoc[themeIndex].y] = 150; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y] = 151; dungeon[themeLoc[themeIndex].x][themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1] = 152; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1] = 138; } - if(leveltype == DTYPE_HELL) { + if (leveltype == DTYPE_HELL) { dungeon[themeLoc[themeIndex].x][themeLoc[themeIndex].y] = 9; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y] = 16; dungeon[themeLoc[themeIndex].x][themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1] = 15; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height - 1] = 12; } - if(leveltype == DTYPE_CATACOMBS) { - switch(random(0, 2)) { + if (leveltype == DTYPE_CATACOMBS) { + switch (random(0, 2)) { case 0: dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height / 2] = 4; break; @@ -860,8 +860,8 @@ void DRLG_CreateThemeRoom(int themeIndex) break; } } - if(leveltype == DTYPE_CAVES) { - switch(random(0, 2)) { + if (leveltype == DTYPE_CAVES) { + switch (random(0, 2)) { case 0: dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height / 2] = 147; break; @@ -870,8 +870,8 @@ void DRLG_CreateThemeRoom(int themeIndex) break; } } - if(leveltype == DTYPE_HELL) { - switch(random(0, 2)) { + if (leveltype == DTYPE_HELL) { + switch (random(0, 2)) { case 0: dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height / 2 - 1] = 53; dungeon[themeLoc[themeIndex].x + themeLoc[themeIndex].width - 1][themeLoc[themeIndex].y + themeLoc[themeIndex].height / 2] = 6; @@ -934,9 +934,9 @@ void DRLG_HoldThemeRooms() { int i, x, y, xx, yy; - for(i = 0; i < themeCount; i++) { - for(y = themeLoc[i].y; y < themeLoc[i].y + themeLoc[i].height - 1; y++) { - for(x = themeLoc[i].x; x < themeLoc[i].x + themeLoc[i].width - 1; x++) { + for (i = 0; i < themeCount; i++) { + for (y = themeLoc[i].y; y < themeLoc[i].y + themeLoc[i].height - 1; y++) { + for (x = themeLoc[i].x; x < themeLoc[i].x + themeLoc[i].width - 1; x++) { xx = 2 * x + 16; yy = 2 * y + 16; dFlags[xx][yy] |= BFLAG_POPULATED; diff --git a/Source/init.cpp b/Source/init.cpp index 21d59ec6f..b1aab02b7 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -54,7 +54,7 @@ void init_run_office_from_start_menu() { LPITEMIDLIST idl; - if(!killed_mom_parent) { + if (!killed_mom_parent) { return; } @@ -62,7 +62,7 @@ void init_run_office_from_start_menu() char szPath[256] = ""; /// BUGFIX: size should be at least 'MAX_PATH' idl = NULL; - if(SHGetSpecialFolderLocation(GetDesktopWindow(), CSIDL_STARTMENU, &idl) == NOERROR) { + if (SHGetSpecialFolderLocation(GetDesktopWindow(), CSIDL_STARTMENU, &idl) == NOERROR) { SHGetPathFromIDList(idl, szPath); init_run_office(szPath); } @@ -76,31 +76,31 @@ void init_run_office(char *dir) char szFirst[MAX_PATH]; strcpy(szFirst, dir); - if(szFirst[0] != '\0' && szFirst[strlen(szFirst) - 1] == '\\') { + if (szFirst[0] != '\0' && szFirst[strlen(szFirst) - 1] == '\\') { strcat(szFirst, "*"); } else { strcat(szFirst, "\\*"); } hSearch = FindFirstFile(szFirst, &find); - if(hSearch == INVALID_HANDLE_VALUE) { + if (hSearch == INVALID_HANDLE_VALUE) { return; } - while(1) { - if(find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - if(strcmp(find.cFileName, ".") != 0 && strcmp(find.cFileName, "..") != 0) { + while (1) { + if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + if (strcmp(find.cFileName, ".") != 0 && strcmp(find.cFileName, "..") != 0) { char szNext[MAX_PATH] = ""; - if(dir[0] != '\0' && dir[strlen(dir) - 1] == '\\') { + if (dir[0] != '\0' && dir[strlen(dir) - 1] == '\\') { sprintf(szNext, "%s%s\\", dir, find.cFileName); } else { sprintf(szNext, "%s\\%s\\", dir, find.cFileName); } init_run_office(szNext); } - } else if(_strcmpi(find.cFileName, "Microsoft Office Shortcut Bar.lnk") == 0) { + } else if (_strcmpi(find.cFileName, "Microsoft Office Shortcut Bar.lnk") == 0) { ShellExecute(GetDesktopWindow(), "open", find.cFileName, "", dir, SW_SHOWNORMAL); } - if(!FindNextFile(hSearch, &find)) { + if (!FindNextFile(hSearch, &find)) { break; } } @@ -227,8 +227,8 @@ void init_archives() #ifdef COPYPROT int result; #endif - memset (&fileinfo, 0, sizeof (fileinfo)); - fileinfo.size = sizeof (fileinfo); + memset(&fileinfo, 0, sizeof(fileinfo)); + fileinfo.size = sizeof(fileinfo); fileinfo.versionstring = gszVersionNumber; fileinfo.executablefile = diablo_exe_path; fileinfo.originalarchivefile = diabdat_mpq_path; @@ -329,22 +329,23 @@ BOOL init_read_test_file(char *pszPath, char *pszArchive, int flags, HANDLE *phA char szDrive[MAX_PATH]; dwSize = GetLogicalDriveStrings(sizeof(szDrive), szDrive); - if(dwSize == 0 || dwSize > sizeof(szDrive)) { + if (dwSize == 0 || dwSize > sizeof(szDrive)) { return FALSE; } - while(*pszArchive == '\\') { + while (*pszArchive == '\\') { pszArchive++; } pszDrive = szDrive; - while(*pszDrive != '\0') { + while (*pszDrive != '\0') { pszRoot = pszDrive; - while(*pszDrive++ != '\0'); - if(GetDriveType(pszRoot) == DRIVE_CDROM) { + while (*pszDrive++ != '\0') + ; + if (GetDriveType(pszRoot) == DRIVE_CDROM) { strcpy(pszPath, pszRoot); strcat(pszPath, pszArchive); - if(SFileOpenArchive(pszPath, flags, 1, phArchive)) { + if (SFileOpenArchive(pszPath, flags, 1, phArchive)) { return TRUE; } } diff --git a/Source/interfac.cpp b/Source/interfac.cpp index a1efeffbd..aaafde213 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -243,9 +243,9 @@ void InitCutscene(unsigned int uMsg) { /// ASSERT: assert(! sgpBackCel); - switch(uMsg) { + switch (uMsg) { case WM_DIABNEXTLVL: - switch(gnLevelTypeTbl[currlevel]) { + switch (gnLevelTypeTbl[currlevel]) { case 0: sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); LoadPalette("Gendata\\Cuttt.pal"); @@ -267,7 +267,7 @@ void InitCutscene(unsigned int uMsg) progress_id = 1; break; case 4: - if(currlevel < 15) { + if (currlevel < 15) { sgpBackCel = LoadFileInMem("Gendata\\Cut4.CEL", 0); LoadPalette("Gendata\\Cut4.pal"); progress_id = 1; @@ -285,12 +285,12 @@ void InitCutscene(unsigned int uMsg) } break; case WM_DIABPREVLVL: - if(gnLevelTypeTbl[currlevel - 1] == 0) { + if (gnLevelTypeTbl[currlevel - 1] == 0) { sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); LoadPalette("Gendata\\Cuttt.pal"); progress_id = 1; } else { - switch(gnLevelTypeTbl[currlevel]) { + switch (gnLevelTypeTbl[currlevel]) { case 0: sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); LoadPalette("Gendata\\Cuttt.pal"); @@ -325,11 +325,11 @@ void InitCutscene(unsigned int uMsg) } break; case WM_DIABSETLVL: - if(setlvlnum == SL_BONECHAMB) { + if (setlvlnum == SL_BONECHAMB) { sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; - } else if(setlvlnum == SL_VILEBETRAYER) { + } else if (setlvlnum == SL_VILEBETRAYER) { sgpBackCel = LoadFileInMem("Gendata\\Cutportr.CEL", 0); LoadPalette("Gendata\\Cutportr.pal"); progress_id = 1; @@ -340,11 +340,11 @@ void InitCutscene(unsigned int uMsg) } break; case WM_DIABRTNLVL: - if(setlvlnum == SL_BONECHAMB) { + if (setlvlnum == SL_BONECHAMB) { sgpBackCel = LoadFileInMem("Gendata\\Cut2.CEL", 0); LoadPalette("Gendata\\Cut2.pal"); progress_id = 2; - } else if(setlvlnum == SL_VILEBETRAYER) { + } else if (setlvlnum == SL_VILEBETRAYER) { sgpBackCel = LoadFileInMem("Gendata\\Cutportr.CEL", 0); LoadPalette("Gendata\\Cutportr.pal"); progress_id = 1; @@ -371,7 +371,7 @@ void InitCutscene(unsigned int uMsg) break; case WM_DIABTOWNWARP: case WM_DIABTWARPUP: - switch(gnLevelTypeTbl[plr[myplr].plrlevel]) { + switch (gnLevelTypeTbl[plr[myplr].plrlevel]) { case 0: sgpBackCel = LoadFileInMem("Gendata\\Cuttt.CEL", 0); LoadPalette("Gendata\\Cuttt.pal"); diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 9c850037e..23a44ee32 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -215,14 +215,14 @@ void DrawQText() ty = qtexty; doneflag = FALSE; - while(!doneflag) { + while (!doneflag) { w = 0; s = p; l = 0; - while(*s != '\n' && *s != '|' && w < 543) { + while (*s != '\n' && *s != '|' && w < 543) { c = gbFontTransTbl[(BYTE)*s]; s++; - if(c != '\0') { + if (c != '\0') { tempstr[l] = c; w += mfontkern[mfontframe[c]] + 2; } else { @@ -231,60 +231,60 @@ void DrawQText() l++; } tempstr[l] = '\0'; - if(*s == '|') { + if (*s == '|') { tempstr[l] = '\0'; doneflag = TRUE; - } else if(*s != '\n') { - while(tempstr[l] != ' ' && l > 0) { + } else if (*s != '\n') { + while (tempstr[l] != ' ' && l > 0) { tempstr[l] = '\0'; l--; } } - for(i = 0; tempstr[i]; i++) { + for (i = 0; tempstr[i]; i++) { p++; c = mfontframe[gbFontTransTbl[(BYTE)tempstr[i]]]; - if(*p == '\n') { + if (*p == '\n') { p++; } - if(c != 0) { + if (c != 0) { PrintQTextChr(tx, ty, (BYTE *)pMedTextCels, c); } tx += mfontkern[c] + 2; } - if(pnl == NULL) { + if (pnl == NULL) { pnl = p; } tx = 112; ty += 38; - if(ty > 501) { + if (ty > 501) { doneflag = TRUE; } } currTime = GetTickCount(); - while(1) { - if(sgLastScroll <= 0) { + while (1) { + if (sgLastScroll <= 0) { qtexty--; qtexty += sgLastScroll; } else { scrolltexty--; - if(scrolltexty != 0) { + if (scrolltexty != 0) { qtexty--; } } - if(scrolltexty == 0) { + if (scrolltexty == 0) { scrolltexty = sgLastScroll; } - if(qtexty <= 209) { + if (qtexty <= 209) { qtexty += 38; qtextptr = pnl; - if(*pnl == '|') { + if (*pnl == '|') { qtextflag = 0; } break; } qtextSpd += 50; - if(currTime - qtextSpd >= 0x7FFFFFFF) { + if (currTime - qtextSpd >= 0x7FFFFFFF) { break; } } diff --git a/Source/monster.cpp b/Source/monster.cpp index 3ccfda100..06587819e 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -60,7 +60,7 @@ int rnd10[4] = { 10, 15, 20, 30 }; int rnd20[4] = { 20, 30, 40, 50 }; int rnd60[4] = { 60, 70, 80, 90 }; -void(*AiProc[])(int i) = { +void (*AiProc[])(int i) = { &MAI_Zombie, &MAI_Fat, &MAI_SkelSd, @@ -1045,7 +1045,7 @@ void SetMapMonsters(unsigned char *pMap, int startx, int starty) PlaceUniqueMonst(UMT_RED_VEX, 0, 0); PlaceUniqueMonst(UMT_BLACKJADE, 0, 0); } - lm = (WORD*)pMap; + lm = (WORD *)pMap; rw = *lm; lm++; rh = *lm; @@ -1167,7 +1167,7 @@ void M_Enemy(int i) continue; if (!(Monst->_mFlags & MFLAG_GOLEM) && ((abs(monster[mi]._mx - Monst->_mx) >= 2 || abs(monster[mi]._my - Monst->_my) >= 2) && !M_Ranged(i) - || (!(Monst->_mFlags & MFLAG_GOLEM) && !(monster[mi]._mFlags & MFLAG_GOLEM)))) { + || (!(Monst->_mFlags & MFLAG_GOLEM) && !(monster[mi]._mFlags & MFLAG_GOLEM)))) { continue; } sameroom = dTransVal[Monst->_mx][Monst->_my] == dTransVal[monster[mi]._mx][monster[mi]._my]; @@ -1564,17 +1564,17 @@ void M_DiabloDeath(int i, BOOL sendmsg) AddLight(Monst->_mx, Monst->_my, 8); DoVision(Monst->_mx, Monst->_my, 8, FALSE, TRUE); if (abs(ViewX - Monst->_mx) > abs(ViewY - Monst->_my)) - dist = abs (ViewX - Monst->_mx); + dist = abs(ViewX - Monst->_mx); else - dist = abs (ViewY - Monst->_my); + dist = abs(ViewY - Monst->_my); if (dist > 20) dist = 20; j = ViewX << 16; k = ViewY << 16; Monst->_mVar3 = j; Monst->_mVar4 = k; - Monst->_mVar5 = (int) ((j - (Monst->_mx << 16)) / (double)dist); - Monst->_mVar6 = (int) ((k - (Monst->_my << 16)) / (double)dist); + Monst->_mVar5 = (int)((j - (Monst->_mx << 16)) / (double)dist); + Monst->_mVar6 = (int)((k - (Monst->_my << 16)) / (double)dist); } void M2MStartHit(int mid, int i, int dam) @@ -2808,7 +2808,7 @@ BOOL M_CallWalk(int i, int md) BOOL M_PathWalk(int i) { char path[25]; - BOOL(* Check) + BOOL(*Check) (int, int, int); if ((DWORD)i >= MAXMONSTERS) @@ -3632,11 +3632,11 @@ void MAI_Scav(int i) continue; done = dDead[Monst->_mx + x][Monst->_my + y] != 0 && LineClearF( - CheckNoSolid, - Monst->_mx, - Monst->_my, - Monst->_mx + x, - Monst->_my + y); + CheckNoSolid, + Monst->_mx, + Monst->_my, + Monst->_mx + x, + Monst->_my + y); } } x--; @@ -3649,11 +3649,11 @@ void MAI_Scav(int i) continue; done = dDead[Monst->_mx + x][Monst->_my + y] != 0 && LineClearF( - CheckNoSolid, - Monst->_mx, - Monst->_my, - Monst->_mx + x, - Monst->_my + y); + CheckNoSolid, + Monst->_mx, + Monst->_my, + Monst->_mx + x, + Monst->_my + y); } } x++; @@ -4080,8 +4080,8 @@ void MAI_Rhino(int i) v = random(134, 100); if (v >= 2 * Monst->_mint + 33 && (Monst->_mVar1 != MM_WALK && Monst->_mVar1 != MM_WALK2 && Monst->_mVar1 != MM_WALK3 - || Monst->_mVar2 - || v >= 2 * Monst->_mint + 83)) { + || Monst->_mVar2 + || v >= 2 * Monst->_mint + 83)) { M_StartDelay(i, random(135, 10) + 10); } else { M_CallWalk(i, md); @@ -4164,8 +4164,8 @@ void MAI_Counselor(int i) } } if (Monst->_mmode == MM_STAND) { - M_StartDelay(i, random(125, 10) + 5); - } + M_StartDelay(i, random(125, 10) + 5); + } } } @@ -4500,16 +4500,16 @@ void ProcessMonsters() DeleteMonsterList(); /// ASSERT: assert((DWORD)nummonsters <= MAXMONSTERS); - for(i = 0; i < nummonsters; i++) { + for (i = 0; i < nummonsters; i++) { mi = monstactive[i]; Monst = &monster[mi]; raflag = FALSE; - if(gbMaxPlayers > 1) { + if (gbMaxPlayers > 1) { SetRndSeed(Monst->_mAISeed); Monst->_mAISeed = GetRndSeed(); } - if(!(monster[mi]._mFlags & MFLAG_NOHEAL) && Monst->_mhitpoints < Monst->_mmaxhp && Monst->_mhitpoints >> 6 > 0) { - if(Monst->mLevel <= 1) { + if (!(monster[mi]._mFlags & MFLAG_NOHEAL) && Monst->_mhitpoints < Monst->_mmaxhp && Monst->_mhitpoints >> 6 > 0) { + if (Monst->mLevel <= 1) { Monst->_mhitpoints += Monst->mLevel; } else { Monst->_mhitpoints += Monst->mLevel >> 1; @@ -4517,12 +4517,12 @@ void ProcessMonsters() } mx = Monst->_mx; my = Monst->_my; - if(dFlags[mx][my] & BFLAG_VISIBLE && Monst->_msquelch == 0 && Monst->MType->mtype == MT_CLEAVER) { + if (dFlags[mx][my] & BFLAG_VISIBLE && Monst->_msquelch == 0 && Monst->MType->mtype == MT_CLEAVER) { PlaySFX(USFX_CLEAVER); } - if(Monst->_mFlags & MFLAG_TARGETS_MONSTER) { + if (Monst->_mFlags & MFLAG_TARGETS_MONSTER) { _menemy = Monst->_menemy; - if((DWORD)_menemy >= MAXMONSTERS) { + if ((DWORD)_menemy >= MAXMONSTERS) { app_fatal("Illegal enemy monster %d for monster \"%s\"", _menemy, Monst->mName); } Monst->_lastx = monster[Monst->_menemy]._mfutx; @@ -4531,26 +4531,26 @@ void ProcessMonsters() Monst->_menemyy = Monst->_lasty; } else { _menemy = Monst->_menemy; - if((DWORD)_menemy >= MAX_PLRS) { + if ((DWORD)_menemy >= MAX_PLRS) { app_fatal("Illegal enemy player %d for monster \"%s\"", _menemy, Monst->mName); } Monst->_menemyx = plr[Monst->_menemy]._px; Monst->_menemyy = plr[Monst->_menemy]._py; - if(dFlags[mx][my] & BFLAG_VISIBLE) { + if (dFlags[mx][my] & BFLAG_VISIBLE) { Monst->_msquelch = 255; Monst->_lastx = plr[Monst->_menemy]._px; Monst->_lasty = plr[Monst->_menemy]._py; - } else if(Monst->_msquelch != 0 && Monst->_mAi != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype' + } else if (Monst->_msquelch != 0 && Monst->_mAi != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype' Monst->_msquelch--; } } do { - if(!(Monst->_mFlags & MFLAG_SEARCH)) { + if (!(Monst->_mFlags & MFLAG_SEARCH)) { AiProc[Monst->_mAi](mi); - } else if(!MAI_Path(mi)) { + } else if (!MAI_Path(mi)) { AiProc[Monst->_mAi](mi); } - switch(Monst->_mmode) { + switch (Monst->_mmode) { case MM_STAND: raflag = M_DoStand(mi); break; @@ -4606,22 +4606,22 @@ void ProcessMonsters() raflag = M_DoTalk(mi); break; } - if(raflag) { + if (raflag) { GroupUnity(mi); } - } while(raflag); - if(Monst->_mmode != MM_STONE) { + } while (raflag); + if (Monst->_mmode != MM_STONE) { Monst->_mAnimCnt++; - if(!(Monst->_mFlags & MFLAG_ALLOW_SPECIAL) && Monst->_mAnimCnt >= Monst->_mAnimDelay) { + if (!(Monst->_mFlags & MFLAG_ALLOW_SPECIAL) && Monst->_mAnimCnt >= Monst->_mAnimDelay) { Monst->_mAnimCnt = 0; - if(Monst->_mFlags & MFLAG_LOCK_ANIMATION) { + if (Monst->_mFlags & MFLAG_LOCK_ANIMATION) { Monst->_mAnimFrame--; - if(Monst->_mAnimFrame == 0) { + if (Monst->_mAnimFrame == 0) { Monst->_mAnimFrame = Monst->_mAnimLen; } } else { Monst->_mAnimFrame++; - if(Monst->_mAnimFrame > Monst->_mAnimLen) { + if (Monst->_mAnimFrame > Monst->_mAnimLen) { Monst->_mAnimFrame = 1; } } @@ -4670,12 +4670,12 @@ BOOL DirOK(int i, int mdir) return FALSE; } if (mdir == DIR_N) { - if (SolidLoc(fx + 1, fy) || SolidLoc(fx, fy + 1)) - return FALSE; - } + if (SolidLoc(fx + 1, fy) || SolidLoc(fx, fy + 1)) + return FALSE; + } if (mdir == DIR_S) - if (SolidLoc(fx - 1, fy) || SolidLoc(fx, fy - 1)) - return FALSE; + if (SolidLoc(fx - 1, fy) || SolidLoc(fx, fy - 1)) + return FALSE; if (monster[i].leaderflag == 1) { if (abs(fx - monster[monster[i].leader]._mfutx) >= 4 || abs(fy - monster[monster[i].leader]._mfuty) >= 4) { @@ -4691,12 +4691,14 @@ BOOL DirOK(int i, int mdir) if (y < 0 || y >= MAXDUNY || x < 0 || x >= MAXDUNX) continue; mi = dMonster[x][y]; - if (mi < 0) mi = -mi; - if (mi != 0) mi--; + if (mi < 0) + mi = -mi; + if (mi != 0) + mi--; if (monster[mi].leaderflag == 1 - && monster[mi].leader == i - && monster[mi]._mfutx == x - && monster[mi]._mfuty == y) { + && monster[mi].leader == i + && monster[mi]._mfutx == x + && monster[mi]._mfuty == y) { mcount++; } } @@ -4714,7 +4716,7 @@ BOOL CheckNoSolid(int x, int y) return nSolidTable[dPiece[x][y]] == 0; } -BOOL LineClearF(BOOL(*Clear)(int, int), int x1, int y1, int x2, int y2) +BOOL LineClearF(BOOL (*Clear)(int, int), int x1, int y1, int x2, int y2) { int xorg, yorg; int dx, dy; @@ -4801,7 +4803,7 @@ BOOL LineClear(int x1, int y1, int x2, int y2) return LineClearF(PosOkMissile, x1, y1, x2, y2); } -BOOL LineClearF1(BOOL(*Clear)(int, int, int), int monst, int x1, int y1, int x2, int y2) +BOOL LineClearF1(BOOL (*Clear)(int, int, int), int monst, int x1, int y1, int x2, int y2) { int xorg, yorg; int dx, dy; @@ -5027,7 +5029,7 @@ void PrintMonstHistory(int mt) if (!res) { strcpy(tempstr, "No magic resistance"); AddPanelString(tempstr, TRUE); - } else{ + } else { if (res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING)) { strcpy(tempstr, "Resists : "); if (res & RESIST_MAGIC) @@ -5231,34 +5233,34 @@ BOOL PosOkMonst3(int i, int x, int y) ret = TRUE; isdoor = FALSE; - if(ret && dObject[x][y] != 0) { + if (ret && dObject[x][y] != 0) { oi = dObject[x][y] > 0 ? dObject[x][y] - 1 : -(dObject[x][y] + 1); objtype = object[oi]._otype; isdoor = objtype == OBJ_L1LDOOR || objtype == OBJ_L1RDOOR - || objtype == OBJ_L2LDOOR || objtype == OBJ_L2RDOOR - || objtype == OBJ_L3LDOOR || objtype == OBJ_L3RDOOR; - if(object[oi]._oSolidFlag && !isdoor) { + || objtype == OBJ_L2LDOOR || objtype == OBJ_L2RDOOR + || objtype == OBJ_L3LDOOR || objtype == OBJ_L3RDOOR; + if (object[oi]._oSolidFlag && !isdoor) { ret = FALSE; } } - if(ret) { + if (ret) { ret = (!SolidLoc(x, y) || isdoor) && dPlayer[x][y] == 0 && dMonster[x][y] == 0; } - if(ret && dMissile[x][y] != 0 && i >= 0) { + if (ret && dMissile[x][y] != 0 && i >= 0) { mi = dMissile[x][y]; - if(mi > 0) { - if(missile[mi]._mitype == MIS_FIREWALL) { + if (mi > 0) { + if (missile[mi]._mitype == MIS_FIREWALL) { fire = TRUE; } else { - for(j = 0; j < nummissiles; j++) { + for (j = 0; j < nummissiles; j++) { mi = missileactive[j]; - if(missile[mi]._mitype == MIS_FIREWALL) { + if (missile[mi]._mitype == MIS_FIREWALL) { fire = TRUE; } } } } - if(fire && (!(monster[i].mMagicRes & IMUNE_FIRE) || monster[i].MType->mtype == MT_DIABLO)) { + if (fire && (!(monster[i].mMagicRes & IMUNE_FIRE) || monster[i].MType->mtype == MT_DIABLO)) { ret = FALSE; } } @@ -5526,4 +5528,3 @@ void decode_enemy(int m, int enemy) monster[m]._menemyy = monster[enemy]._mfuty; } } - diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 61dcd710c..4c37d4f1a 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -437,7 +437,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) save_archive_open = FALSE; sghArchive = CreateFile(pszArchive, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, dwFlagsAndAttributes, NULL); if (sghArchive == INVALID_HANDLE_VALUE) { - sghArchive = CreateFile(pszArchive, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, dwFlagsAndAttributes | (hidden ? FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN : 0), NULL); + sghArchive = CreateFile(pszArchive, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, dwFlagsAndAttributes | (hidden ? FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN : 0), NULL); if (sghArchive == INVALID_HANDLE_VALUE) return FALSE; save_archive_open = TRUE; diff --git a/Source/multi.cpp b/Source/multi.cpp index 0e235a501..9366ae861 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -14,7 +14,7 @@ BOOLEAN sgbPlayerTurnBitTbl[MAX_PLRS]; BOOLEAN sgbPlayerLeftGameTbl[MAX_PLRS]; int sgbSentThisCycle; // idb BOOL gbShouldValidatePackage; -BYTE gbActivePlayers; // weak +BYTE gbActivePlayers; // weak BOOLEAN gbGameDestroyed; BOOLEAN sgbSendDeltaTbl[MAX_PLRS]; _gamedata sgGameInitInfo; @@ -360,21 +360,21 @@ void multi_begin_timeout() int i, nTicks, nState, nLowestActive, nLowestPlayer; BYTE bGroupPlayers, bGroupCount; - if(!sgbTimeout) { + if (!sgbTimeout) { return; } #ifdef _DEBUG - if(debug_mode_key_i) { + if (debug_mode_key_i) { return; } #endif nTicks = GetTickCount() - sglTimeoutStart; - if(nTicks > 20000) { + if (nTicks > 20000) { gbRunGame = FALSE; return; } - if(nTicks < 10000) { + if (nTicks < 10000) { return; } @@ -382,15 +382,15 @@ void multi_begin_timeout() nLowestPlayer = -1; bGroupPlayers = 0; bGroupCount = 0; - for(i = 0; i < MAX_PLRS; i++) { + for (i = 0; i < MAX_PLRS; i++) { nState = player_state[i]; - if(nState & 0x10000) { - if(nLowestPlayer == -1) { + if (nState & 0x10000) { + if (nLowestPlayer == -1) { nLowestPlayer = i; } - if(nState & 0x40000) { + if (nState & 0x40000) { bGroupPlayers++; - if(nLowestActive == -1) { + if (nLowestActive == -1) { nLowestActive = i; } } else { @@ -405,23 +405,23 @@ void multi_begin_timeout() #ifdef _DEBUG dumphist( - "(%d) grp:%d ngrp:%d lowp:%d lowa:%d", - myplr, - bGroupPlayers, - bGroupCount, - nLowestPlayer, - nLowestActive); + "(%d) grp:%d ngrp:%d lowp:%d lowa:%d", + myplr, + bGroupPlayers, + bGroupCount, + nLowestPlayer, + nLowestActive); #endif - if(bGroupPlayers < bGroupCount) { + if (bGroupPlayers < bGroupCount) { gbGameDestroyed = TRUE; - } else if(bGroupPlayers == bGroupCount) { - if(nLowestPlayer != nLowestActive) { + } else if (bGroupPlayers == bGroupCount) { + if (nLowestPlayer != nLowestActive) { gbGameDestroyed = TRUE; - } else if(nLowestActive == myplr) { + } else if (nLowestActive == myplr) { multi_check_drop_player(); } - } else if(nLowestActive == myplr) { + } else if (nLowestActive == myplr) { multi_check_drop_player(); } } @@ -505,7 +505,7 @@ void multi_process_network_packets() } } } - multi_handle_all_packets(dwID, (BYTE *)(pkt + 1), dwMsgSize - sizeof (TPktHdr)); + multi_handle_all_packets(dwID, (BYTE *)(pkt + 1), dwMsgSize - sizeof(TPktHdr)); } if (SErrGetLastError() != STORM_ERROR_NO_MESSAGES_WAITING) nthread_terminate_game("SNetReceiveMsg"); @@ -517,9 +517,9 @@ void multi_handle_all_packets(int pnum, BYTE *pData, int nSize) { int nLen; - while(nSize != 0) { + while (nSize != 0) { nLen = ParseCmd(pnum, (TCmd *)pData); - if(nLen == 0) { + if (nLen == 0) { break; } pData += nLen; diff --git a/Source/objects.cpp b/Source/objects.cpp index 9cd8c0ba4..d843ce6b3 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1515,11 +1515,10 @@ void Obj_Circle(int i) object[i]._oVar6 = 2; return; } - } - else { + } else { if (object[i]._ox == 26 && object[i]._oy == 46) { - object[i]._oVar6 = 1; - return; + object[i]._oVar6 = 1; + return; } } object[i]._oVar6 = 0; diff --git a/Source/path.cpp b/Source/path.cpp index 008bff719..faf7c1611 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -38,7 +38,7 @@ char path_directions[9] = { 5, 1, 6, 2, 0, 3, 8, 4, 7 }; * check that each step is a valid position. Store the step directions (see * path_directions) in path, which must have room for 24 steps */ -int FindPath(BOOL(*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, char *path) +int FindPath(BOOL (*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, char *path) { PATHNODE *path_start, *next_node, *current; int path_length, i; @@ -161,7 +161,7 @@ BOOL path_solid_pieces(PATHNODE *pPath, int dx, int dy) * * return 0 if we ran out of preallocated nodes to use, else 1 */ -BOOL path_get_path(BOOL(*PosOk)(int, int, int), int PosOkArg, PATHNODE *pPath, int x, int y) +BOOL path_get_path(BOOL (*PosOk)(int, int, int), int PosOkArg, PATHNODE *pPath, int x, int y) { int dx, dy; int i; diff --git a/Source/themes.cpp b/Source/themes.cpp index 6ded1cde0..2cb88b303 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -600,7 +600,7 @@ void Theme_SkelRoom(int t) AddObject(OBJ_SKFIRE, xp, yp); - if(random(0, monstrnd[leveltype - 1]) != 0) { + if (random(0, monstrnd[leveltype - 1]) != 0) { i = PreSpawnSkeleton(); SpawnSkeleton(i, xp - 1, yp - 1); } else { @@ -610,25 +610,25 @@ void Theme_SkelRoom(int t) i = PreSpawnSkeleton(); SpawnSkeleton(i, xp, yp - 1); - if(random(0, monstrnd[leveltype - 1]) != 0) { + if (random(0, monstrnd[leveltype - 1]) != 0) { i = PreSpawnSkeleton(); SpawnSkeleton(i, xp + 1, yp - 1); } else { AddObject(OBJ_BANNERR, xp + 1, yp - 1); } - if(random(0, monstrnd[leveltype - 1]) != 0) { + if (random(0, monstrnd[leveltype - 1]) != 0) { i = PreSpawnSkeleton(); SpawnSkeleton(i, xp - 1, yp); } else { AddObject(OBJ_BANNERM, xp - 1, yp); } - if(random(0, monstrnd[leveltype - 1]) != 0) { + if (random(0, monstrnd[leveltype - 1]) != 0) { i = PreSpawnSkeleton(); SpawnSkeleton(i, xp + 1, yp); } else { AddObject(OBJ_BANNERM, xp + 1, yp); } - if(random(0, monstrnd[leveltype - 1]) != 0) { + if (random(0, monstrnd[leveltype - 1]) != 0) { i = PreSpawnSkeleton(); SpawnSkeleton(i, xp - 1, yp + 1); } else { @@ -638,17 +638,17 @@ void Theme_SkelRoom(int t) i = PreSpawnSkeleton(); SpawnSkeleton(i, xp, yp + 1); - if(random(0, monstrnd[leveltype - 1]) != 0) { + if (random(0, monstrnd[leveltype - 1]) != 0) { i = PreSpawnSkeleton(); SpawnSkeleton(i, xp + 1, yp + 1); } else { AddObject(OBJ_BANNERL, xp + 1, yp + 1); } - if(dObject[xp][yp - 3] == 0) { + if (dObject[xp][yp - 3] == 0) { AddObject(OBJ_SKELBOOK, xp, yp - 2); } - if(dObject[xp][yp + 3] == 0) { + if (dObject[xp][yp + 3] == 0) { AddObject(OBJ_SKELBOOK, xp, yp + 2); } } @@ -702,7 +702,7 @@ void Theme_Library(int t) TFit_Shrine(t); - if(themeVar1 == 1) { + if (themeVar1 == 1) { AddObject(OBJ_BOOKCANDLE, themex - 1, themey); AddObject(OBJ_BOOKCASER, themex, themey); AddObject(OBJ_BOOKCANDLE, themex + 1, themey); @@ -712,11 +712,11 @@ void Theme_Library(int t) AddObject(OBJ_BOOKCANDLE, themex, themey + 1); } - for(yp = 1; yp < MAXDUNY - 1; yp++) { - for(xp = 1; xp < MAXDUNX - 1; xp++) { - if(CheckThemeObj3(xp, yp, t, -1) && dMonster[xp][yp] == 0 && random(0, librnd[leveltype - 1]) == 0) { + for (yp = 1; yp < MAXDUNY - 1; yp++) { + for (xp = 1; xp < MAXDUNX - 1; xp++) { + if (CheckThemeObj3(xp, yp, t, -1) && dMonster[xp][yp] == 0 && random(0, librnd[leveltype - 1]) == 0) { AddObject(OBJ_BOOKSTAND, xp, yp); - if(random(0, 2 * librnd[leveltype - 1]) != 0) { + if (random(0, 2 * librnd[leveltype - 1]) != 0) { oi = dObject[xp][yp] - 1; object[oi]._oSelFlag = 0; object[oi]._oAnimFrame += 2; @@ -725,9 +725,9 @@ void Theme_Library(int t) } } - if(!QuestStatus(QTYPE_ZHAR)) { + if (!QuestStatus(QTYPE_ZHAR)) { PlaceThemeMonsts(t, monstrnd[leveltype]); /// BUGFIX: `leveltype - 1` - } else if(t != zharlib) { + } else if (t != zharlib) { PlaceThemeMonsts(t, monstrnd[leveltype]); /// BUGFIX: `leveltype - 1` } } diff --git a/Source/town.cpp b/Source/town.cpp index 7dd5e10c9..10e81e78e 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -449,7 +449,7 @@ void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some if (dFlags[x][y] & BFLAG_MISSILE) { DrawClippedMissile(x, y, sx, sy, 0, 8, 0); } - if(dArch[x][y] != 0) { + if (dArch[x][y] != 0) { town_special_lower(pBuff, dArch[x][y]); } } @@ -631,7 +631,7 @@ void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, if (dFlags[x][y] & BFLAG_MISSILE) { DrawClippedMissile(x, y, sx, sy, a5, 8, 0); } - if(dArch[x][y] != 0) { + if (dArch[x][y] != 0) { town_special_lower(&pBuff[PitchTbl[16 * a5]], dArch[x][y]); } } @@ -825,7 +825,7 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int if (dFlags[x][y] & BFLAG_MISSILE) { DrawMissile(x, y, sx, sy, 0, dir, 0); } - if(dArch[x][y] != 0) { + if (dArch[x][y] != 0) { town_special_upper(pBuff, dArch[x][y]); } } diff --git a/Source/towners.cpp b/Source/towners.cpp index ac93bc92d..5607d124d 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -124,7 +124,7 @@ void SetTownerGPtrs(BYTE *pData, BYTE **pAnim) #ifdef USE_ASM BYTE *src; - for(i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { src = pData; __asm { mov eax, src @@ -143,7 +143,7 @@ void SetTownerGPtrs(BYTE *pData, BYTE **pAnim) pFrameTable = (DWORD *)pData; - for(i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { pAnim[i] = &pData[pFrameTable[i]]; } #endif @@ -182,8 +182,8 @@ void InitQstSnds(int i) tl++; for (j = 0; j < 16; j++) { towner[i].qsts[j]._qsttype = quests[j]._qtype; - towner[i].qsts[j]._qstmsg = ((int*)(Qtalklist + tl))[j]; - if (((int*)(Qtalklist + tl))[j] != -1) + towner[i].qsts[j]._qstmsg = ((int *)(Qtalklist + tl))[j]; + if (((int *)(Qtalklist + tl))[j] != -1) towner[i].qsts[j]._qstmsgact = TRUE; else towner[i].qsts[j]._qstmsgact = FALSE; @@ -607,37 +607,37 @@ void TalkToTowner(int p, int t) dx = abs(plr[p].WorldX - towner[t]._tx); dy = abs(plr[p].WorldY - towner[t]._ty); #ifdef _DEBUG - if(!debug_mode_key_d && (dx >= 2 || dy >= 2)) { + if (!debug_mode_key_d && (dx >= 2 || dy >= 2)) { return; } #else - if(dx >= 2 || dy >= 2) { + if (dx >= 2 || dy >= 2) { return; } #endif - if(qtextflag) { + if (qtextflag) { return; } towner[t]._tMsgSaid = FALSE; - if(pcurs >= CURSOR_FIRSTITEM && !DropItemBeforeTrig()) { + if (pcurs >= CURSOR_FIRSTITEM && !DropItemBeforeTrig()) { return; } - if(t == GetActiveTowner(TOWN_TAVERN)) { - if(!plr[p]._pLvlVisited[0] && !towner[t]._tMsgSaid) { + if (t == GetActiveTowner(TOWN_TAVERN)) { + if (!plr[p]._pLvlVisited[0] && !towner[t]._tMsgSaid) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; InitQTextMsg(QUEST_INTRO); towner[t]._tMsgSaid = TRUE; } - if((plr[p]._pLvlVisited[2] || plr[p]._pLvlVisited[4]) && quests[QTYPE_KING]._qactive != 0) { - if(quests[QTYPE_KING]._qvar2 == 0 && !towner[t]._tMsgSaid) { + if ((plr[p]._pLvlVisited[2] || plr[p]._pLvlVisited[4]) && quests[QTYPE_KING]._qactive != 0) { + if (quests[QTYPE_KING]._qvar2 == 0 && !towner[t]._tMsgSaid) { quests[QTYPE_KING]._qvar2 = 1; quests[QTYPE_KING]._qlog = TRUE; - if(quests[QTYPE_KING]._qactive == 1) { + if (quests[QTYPE_KING]._qactive == 1) { quests[QTYPE_KING]._qactive = 2; quests[QTYPE_KING]._qvar1 = 1; } @@ -647,7 +647,7 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; NetSendCmdQuest(TRUE, QTYPE_KING); } - if(quests[QTYPE_KING]._qactive == 3 && quests[QTYPE_KING]._qvar2 == 1 && !towner[t]._tMsgSaid) { + if (quests[QTYPE_KING]._qactive == 3 && quests[QTYPE_KING]._qvar2 == 1 && !towner[t]._tMsgSaid) { quests[QTYPE_KING]._qvar2 = 2; quests[QTYPE_KING]._qvar1 = 2; towner[t]._tbtcnt = 150; @@ -657,10 +657,10 @@ void TalkToTowner(int p, int t) NetSendCmdQuest(TRUE, QTYPE_KING); } } - if(gbMaxPlayers == 1 && plr[p]._pLvlVisited[3] && quests[QTYPE_BOL]._qactive != 0) { - if((quests[QTYPE_BOL]._qactive == 1 || quests[QTYPE_BOL]._qactive == 2) && quests[QTYPE_BOL]._qvar2 == 0 && !towner[t]._tMsgSaid) { + if (gbMaxPlayers == 1 && plr[p]._pLvlVisited[3] && quests[QTYPE_BOL]._qactive != 0) { + if ((quests[QTYPE_BOL]._qactive == 1 || quests[QTYPE_BOL]._qactive == 2) && quests[QTYPE_BOL]._qvar2 == 0 && !towner[t]._tMsgSaid) { quests[QTYPE_BOL]._qvar2 = 1; - if(quests[QTYPE_BOL]._qactive == 1) { + if (quests[QTYPE_BOL]._qactive == 1) { quests[QTYPE_BOL]._qvar1 = 1; quests[QTYPE_BOL]._qactive = 2; } @@ -670,7 +670,7 @@ void TalkToTowner(int p, int t) InitQTextMsg(QUEST_BANNER2); towner[t]._tMsgSaid = TRUE; } - if(quests[QTYPE_BOL]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, &i) != NULL && !towner[t]._tMsgSaid) { + if (quests[QTYPE_BOL]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, &i) != NULL && !towner[t]._tMsgSaid) { quests[QTYPE_BOL]._qactive = 3; quests[QTYPE_BOL]._qvar1 = 3; RemoveInvItem(p, i); @@ -681,31 +681,31 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; } } - if(!qtextflag) { + if (!qtextflag) { TownerTalk(QUEST_OGDEN1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_TAVERN); } } - } else if(t == GetActiveTowner(TOWN_DEADGUY)) { - if(quests[QTYPE_BUTCH]._qactive == 2 && quests[QTYPE_BUTCH]._qvar1 == 1) { + } else if (t == GetActiveTowner(TOWN_DEADGUY)) { + if (quests[QTYPE_BUTCH]._qactive == 2 && quests[QTYPE_BUTCH]._qvar1 == 1) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; quests[QTYPE_BUTCH]._qvar1 = 1; - if(plr[p]._pClass == 0 && !effect_is_playing(PS_WARR8)) { + if (plr[p]._pClass == 0 && !effect_is_playing(PS_WARR8)) { PlaySFX(PS_WARR8); - } else if(plr[p]._pClass == 1 && !effect_is_playing(PS_ROGUE8)) { + } else if (plr[p]._pClass == 1 && !effect_is_playing(PS_ROGUE8)) { PlaySFX(PS_ROGUE8); - } else if(plr[p]._pClass == 2 && !effect_is_playing(PS_MAGE8)) { + } else if (plr[p]._pClass == 2 && !effect_is_playing(PS_MAGE8)) { PlaySFX(PS_MAGE8); } towner[t]._tMsgSaid = TRUE; - } else if(quests[QTYPE_BUTCH]._qactive == 3 && quests[QTYPE_BUTCH]._qvar1 == 1) { + } else if (quests[QTYPE_BUTCH]._qactive == 3 && quests[QTYPE_BUTCH]._qvar1 == 1) { quests[QTYPE_BUTCH]._qvar1 = 1; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; towner[t]._tMsgSaid = TRUE; - } else if(quests[QTYPE_BUTCH]._qactive == 1 || quests[QTYPE_BUTCH]._qactive == 2 && quests[QTYPE_BUTCH]._qvar1 == 0) { + } else if (quests[QTYPE_BUTCH]._qactive == 1 || quests[QTYPE_BUTCH]._qactive == 2 && quests[QTYPE_BUTCH]._qvar1 == 0) { quests[QTYPE_BUTCH]._qactive = 2; quests[QTYPE_BUTCH]._qlog = TRUE; quests[QTYPE_BUTCH]._qmsg = QUEST_BUTCH9; @@ -717,13 +717,13 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; NetSendCmdQuest(TRUE, QTYPE_BUTCH); } - } else if(t == GetActiveTowner(TOWN_SMITH)) { - if(gbMaxPlayers == 1) { - if(plr[p]._pLvlVisited[4] && quests[QTYPE_INFRA]._qactive != 0) { - if(quests[QTYPE_INFRA]._qvar2 == 0) { + } else if (t == GetActiveTowner(TOWN_SMITH)) { + if (gbMaxPlayers == 1) { + if (plr[p]._pLvlVisited[4] && quests[QTYPE_INFRA]._qactive != 0) { + if (quests[QTYPE_INFRA]._qvar2 == 0) { quests[QTYPE_INFRA]._qvar2 = 1; quests[QTYPE_INFRA]._qlog = TRUE; - if(quests[QTYPE_INFRA]._qactive == 1) { + if (quests[QTYPE_INFRA]._qactive == 1) { quests[QTYPE_INFRA]._qactive = 2; quests[QTYPE_INFRA]._qvar1 = 1; } @@ -732,7 +732,7 @@ void TalkToTowner(int p, int t) InitQTextMsg(QUEST_INFRA5); towner[t]._tMsgSaid = TRUE; } - if(quests[QTYPE_INFRA]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, &i) != NULL && !towner[t]._tMsgSaid) { + if (quests[QTYPE_INFRA]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, &i) != NULL && !towner[t]._tMsgSaid) { quests[QTYPE_INFRA]._qactive = 3; quests[QTYPE_INFRA]._qvar2 = 2; quests[QTYPE_INFRA]._qvar1 = 2; @@ -744,15 +744,15 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; } } - if(plr[p]._pLvlVisited[9] && quests[QTYPE_ANVIL]._qactive != 0) { - if((quests[QTYPE_ANVIL]._qactive == 1 || quests[QTYPE_ANVIL]._qactive == 2) && quests[QTYPE_ANVIL]._qvar2 == 0) { - if(towner[t]._tMsgSaid) { + if (plr[p]._pLvlVisited[9] && quests[QTYPE_ANVIL]._qactive != 0) { + if ((quests[QTYPE_ANVIL]._qactive == 1 || quests[QTYPE_ANVIL]._qactive == 2) && quests[QTYPE_ANVIL]._qvar2 == 0) { + if (towner[t]._tMsgSaid) { goto SKIPANVIL; /* TODO: fix */ } - if(quests[QTYPE_INFRA]._qvar2 == 2 || quests[QTYPE_INFRA]._qactive == 2 && quests[QTYPE_INFRA]._qvar2 == 1) { + if (quests[QTYPE_INFRA]._qvar2 == 2 || quests[QTYPE_INFRA]._qactive == 2 && quests[QTYPE_INFRA]._qvar2 == 1) { quests[QTYPE_ANVIL]._qvar2 = 1; quests[QTYPE_ANVIL]._qlog = TRUE; - if(quests[QTYPE_ANVIL]._qactive == 1) { + if (quests[QTYPE_ANVIL]._qactive == 1) { quests[QTYPE_ANVIL]._qactive = 2; quests[QTYPE_ANVIL]._qvar1 = 1; } @@ -762,7 +762,7 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; } } - if(quests[QTYPE_ANVIL]._qvar2 == 1 && PlrHasItem(p, IDI_ANVIL, &i) != NULL && !towner[t]._tMsgSaid) { + if (quests[QTYPE_ANVIL]._qvar2 == 1 && PlrHasItem(p, IDI_ANVIL, &i) != NULL && !towner[t]._tMsgSaid) { quests[QTYPE_ANVIL]._qactive = 3; quests[QTYPE_ANVIL]._qvar2 = 2; quests[QTYPE_ANVIL]._qvar1 = 2; @@ -775,15 +775,15 @@ void TalkToTowner(int p, int t) } } } -SKIPANVIL: - if(!qtextflag) { + SKIPANVIL: + if (!qtextflag) { TownerTalk(QUEST_GRISWOLD1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_SMITH); } } - } else if(t == GetActiveTowner(TOWN_WITCH)) { - if(quests[QTYPE_BLKM]._qactive == 1 && PlrHasItem(p, IDI_FUNGALTM, &i) != NULL) { + } else if (t == GetActiveTowner(TOWN_WITCH)) { + if (quests[QTYPE_BLKM]._qactive == 1 && PlrHasItem(p, IDI_FUNGALTM, &i) != NULL) { RemoveInvItem(p, i); quests[QTYPE_BLKM]._qactive = 2; quests[QTYPE_BLKM]._qlog = TRUE; @@ -792,9 +792,9 @@ SKIPANVIL: towner[t]._tVar1 = p; InitQTextMsg(QUEST_MUSH8); towner[t]._tMsgSaid = TRUE; - } else if(quests[QTYPE_BLKM]._qactive == 2) { - if(quests[QTYPE_BLKM]._qvar1 >= 2 && quests[QTYPE_BLKM]._qvar1 <= 4) { - if(PlrHasItem(p, IDI_MUSHROOM, &i) != NULL) { + } else if (quests[QTYPE_BLKM]._qactive == 2) { + if (quests[QTYPE_BLKM]._qvar1 >= 2 && quests[QTYPE_BLKM]._qvar1 <= 4) { + if (PlrHasItem(p, IDI_MUSHROOM, &i) != NULL) { RemoveInvItem(p, i); quests[QTYPE_BLKM]._qvar1 = 5; Qtalklist[TOWN_HEALER]._qblkm = QUEST_MUSH3; @@ -804,7 +804,7 @@ SKIPANVIL: quests[QTYPE_BLKM]._qmsg = QUEST_MUSH10; InitQTextMsg(QUEST_MUSH10); towner[t]._tMsgSaid = TRUE; - } else if(quests[QTYPE_BLKM]._qmsg != QUEST_MUSH9) { + } else if (quests[QTYPE_BLKM]._qmsg != QUEST_MUSH9) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; quests[QTYPE_BLKM]._qmsg = QUEST_MUSH9; @@ -813,14 +813,14 @@ SKIPANVIL: } } else { Item = PlrHasItem(p, IDI_SPECELIX, &i); - if(Item != NULL) { + if (Item != NULL) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; InitQTextMsg(QUEST_MUSH12); quests[QTYPE_BLKM]._qactive = 3; towner[t]._tMsgSaid = TRUE; AllItemsList[Item->IDidx].iUsable = TRUE; - } else if(PlrHasItem(p, IDI_BRAIN, &i) != NULL && quests[QTYPE_BLKM]._qvar2 != QUEST_MUSH11) { + } else if (PlrHasItem(p, IDI_BRAIN, &i) != NULL && quests[QTYPE_BLKM]._qvar2 != QUEST_MUSH11) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; quests[QTYPE_BLKM]._qvar2 = QUEST_MUSH11; @@ -829,30 +829,30 @@ SKIPANVIL: } } } - if(!qtextflag) { + if (!qtextflag) { TownerTalk(QUEST_ADRIA1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_WITCH); } } - } else if(t == GetActiveTowner(TOWN_BMAID)) { - if(!qtextflag) { + } else if (t == GetActiveTowner(TOWN_BMAID)) { + if (!qtextflag) { TownerTalk(QUEST_GILLIAN1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_BARMAID); } } - } else if(t == GetActiveTowner(TOWN_DRUNK)) { - if(!qtextflag) { + } else if (t == GetActiveTowner(TOWN_DRUNK)) { + if (!qtextflag) { TownerTalk(QUEST_FARNHAM1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_DRUNK); } } - } else if(t == GetActiveTowner(TOWN_HEALER)) { - if(gbMaxPlayers == 1) { - if(plr[p]._pLvlVisited[1] && !towner[t]._tMsgSaid) { - if(quests[QTYPE_PW]._qactive == 1) { + } else if (t == GetActiveTowner(TOWN_HEALER)) { + if (gbMaxPlayers == 1) { + if (plr[p]._pLvlVisited[1] && !towner[t]._tMsgSaid) { + if (quests[QTYPE_PW]._qactive == 1) { quests[QTYPE_PW]._qactive = 2; quests[QTYPE_PW]._qlog = TRUE; quests[QTYPE_PW]._qmsg = QUEST_POISON3; @@ -861,7 +861,7 @@ SKIPANVIL: towner[t]._tVar1 = p; InitQTextMsg(QUEST_POISON3); towner[t]._tMsgSaid = TRUE; - } else if(quests[QTYPE_PW]._qactive == 3 && quests[QTYPE_PW]._qvar1 != 2) { + } else if (quests[QTYPE_PW]._qactive == 3 && quests[QTYPE_PW]._qvar1 != 2) { quests[QTYPE_PW]._qvar1 = 2; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; @@ -870,7 +870,7 @@ SKIPANVIL: towner[t]._tMsgSaid = TRUE; } } - if(quests[QTYPE_BLKM]._qactive == 2 && quests[QTYPE_BLKM]._qmsg == QUEST_MUSH10 && PlrHasItem(p, IDI_BRAIN, &i) != NULL) { + if (quests[QTYPE_BLKM]._qactive == 2 && quests[QTYPE_BLKM]._qmsg == QUEST_MUSH10 && PlrHasItem(p, IDI_BRAIN, &i) != NULL) { RemoveInvItem(p, i); SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0); InitQTextMsg(QUEST_MUSH4); @@ -878,22 +878,22 @@ SKIPANVIL: Qtalklist[TOWN_HEALER]._qblkm = -1; } } - if(!qtextflag) { + if (!qtextflag) { TownerTalk(QUEST_PEPIN1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_HEALER); } } - } else if(t == GetActiveTowner(TOWN_PEGBOY)) { - if(!qtextflag) { + } else if (t == GetActiveTowner(TOWN_PEGBOY)) { + if (!qtextflag) { TownerTalk(QUEST_WIRT1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_BOY); } } - } else if(t == GetActiveTowner(TOWN_STORY)) { - if(gbMaxPlayers == 1) { - if(quests[QTYPE_VB]._qactive == 1 && PlrHasItem(p, IDI_LAZSTAFF, &i) != NULL) { + } else if (t == GetActiveTowner(TOWN_STORY)) { + if (gbMaxPlayers == 1) { + if (quests[QTYPE_VB]._qactive == 1 && PlrHasItem(p, IDI_LAZSTAFF, &i) != NULL) { RemoveInvItem(p, i); quests[QTYPE_VB]._qvar1 = 2; towner[t]._tbtcnt = 150; @@ -902,7 +902,7 @@ SKIPANVIL: quests[QTYPE_VB]._qactive = 2; quests[QTYPE_VB]._qlog = TRUE; towner[t]._tMsgSaid = TRUE; - } else if(quests[QTYPE_VB]._qactive == 3 && quests[QTYPE_VB]._qvar1 == 7) { + } else if (quests[QTYPE_VB]._qactive == 3 && quests[QTYPE_VB]._qvar1 == 7) { quests[QTYPE_VB]._qvar1 = 8; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; @@ -911,15 +911,15 @@ SKIPANVIL: towner[t]._tMsgSaid = TRUE; } } - if(gbMaxPlayers != 1) { - if(quests[QTYPE_VB]._qactive == 2 && !quests[QTYPE_VB]._qlog) { + if (gbMaxPlayers != 1) { + if (quests[QTYPE_VB]._qactive == 2 && !quests[QTYPE_VB]._qlog) { towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; InitQTextMsg(QUEST_VILE1); towner[t]._tMsgSaid = TRUE; quests[QTYPE_VB]._qlog = TRUE; NetSendCmdQuest(TRUE, QTYPE_VB); - } else if(quests[QTYPE_VB]._qactive == 3 && quests[QTYPE_VB]._qvar1 == 7) { + } else if (quests[QTYPE_VB]._qactive == 3 && quests[QTYPE_VB]._qvar1 == 7) { quests[QTYPE_VB]._qvar1 = 8; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; @@ -930,13 +930,13 @@ SKIPANVIL: NetSendCmdQuest(TRUE, QTYPE_MOD); } } - if(!qtextflag) { + if (!qtextflag) { TownerTalk(QUEST_STORY1, t); - if(storeflag) { + if (storeflag) { StartStore(STORE_STORY); } } - } else if(towner[t]._ttype == TOWN_COW && !qtextflag) { + } else if (towner[t]._ttype == TOWN_COW && !qtextflag) { CowSFX(p); } } diff --git a/Source/trigs.cpp b/Source/trigs.cpp index 12cf9de74..6928d668d 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -101,8 +101,8 @@ void InitTownTriggers() numtrigs = 1; - if(gbMaxPlayers == MAX_PLRS) { - for(i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) { + if (gbMaxPlayers == MAX_PLRS) { + for (i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) { townwarps[i] = TRUE; } trigs[1]._tx = 49; @@ -119,10 +119,10 @@ void InitTownTriggers() trigs[3]._tlvl = 13; numtrigs = 4; } else { - for(i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { townwarps[i] = FALSE; } - if(plr[myplr].pTownWarps & 1) { + if (plr[myplr].pTownWarps & 1) { trigs[1]._tx = 49; trigs[1]._ty = 21; trigs[1]._tmsg = WM_DIABTOWNWARP; @@ -130,7 +130,7 @@ void InitTownTriggers() numtrigs = 2; townwarps[0] = TRUE; } - if(plr[myplr].pTownWarps & 2) { + if (plr[myplr].pTownWarps & 2) { townwarps[1] = TRUE; trigs[numtrigs]._tx = 17; trigs[numtrigs]._ty = 69; @@ -138,7 +138,7 @@ void InitTownTriggers() trigs[numtrigs]._tlvl = 9; numtrigs++; } - if(plr[myplr].pTownWarps & 4) { + if (plr[myplr].pTownWarps & 4) { townwarps[2] = TRUE; trigs[numtrigs]._tx = 41; trigs[numtrigs]._ty = 80; @@ -204,7 +204,6 @@ void InitL2Triggers() trigs[numtrigs]._tmsg = WM_DIABNEXTLVL; numtrigs++; } - } } trigflag = 0; @@ -227,7 +226,7 @@ void InitL3Triggers() if (dPiece[i][j] == 168) { trigs[numtrigs]._tx = i; trigs[numtrigs]._ty = j; - trigs[numtrigs] ._tmsg = WM_DIABNEXTLVL; + trigs[numtrigs]._tmsg = WM_DIABNEXTLVL; numtrigs++; } @@ -238,7 +237,6 @@ void InitL3Triggers() numtrigs++; } } - } trigflag = 0; } @@ -654,12 +652,12 @@ void CheckTrigForce() { trigflag = FALSE; - if(MouseY > VIEWPORT_HEIGHT - 1) { + if (MouseY > VIEWPORT_HEIGHT - 1) { return; } - if(!setlevel) { - switch(leveltype) { + if (!setlevel) { + switch (leveltype) { case DTYPE_TOWN: trigflag = ForceTownTrig(); break; @@ -676,11 +674,11 @@ void CheckTrigForce() trigflag = ForceL4Trig(); break; } - if(leveltype != DTYPE_TOWN && !trigflag) { + if (leveltype != DTYPE_TOWN && !trigflag) { trigflag = ForceQuests(); } } else { - switch(setlvlnum) { + switch (setlvlnum) { case SL_SKELKING: trigflag = ForceSKingTrig(); break; @@ -693,7 +691,7 @@ void CheckTrigForce() } } - if(trigflag) { + if (trigflag) { ClearPanel(); } } diff --git a/format.sh b/format.sh deleted file mode 100755 index 8c5a8e365..000000000 --- a/format.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -ROOT=`pwd` - -CPP_DONE="doom.cpp movie.cpp pfile.cpp player.cpp plrmsg.cpp sound.cpp spells.cpp tmsg.cpp" - -cd ${ROOT}/Source -for f in $CPP_DONE; do - echo "Formatting $f" - clang-format -style=file -i $f -done - -H_DONE="enums.h structs.h" - -cd ${ROOT} -for f in $H_DONE; do - echo "Formatting $f" - clang-format -style=file -i $f -done