diff --git a/Source/automap.cpp b/Source/automap.cpp index 87cb7bceb..5656e87f4 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -104,7 +104,7 @@ void InitAutomap() for (y = 0; y < MAXDUNY; y++) { for (x = 0; x < MAXDUNX; x++) - dFlags[x][y] &= ~DFLAG_EXPLORED; + dFlags[x][y] &= ~BFLAG_EXPLORED; } } diff --git a/Source/control.cpp b/Source/control.cpp index bc8b49b48..756c3a208 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2,7 +2,7 @@ DEVILUTION_BEGIN_NAMESPACE -char sgbNextTalkSave; // weak +BYTE sgbNextTalkSave; BYTE sgbTalkSavePos; BYTE *pDurIcons; BYTE *pChrButtons; @@ -2432,80 +2432,63 @@ void control_set_gold_curs(int pnum) } void DrawTalkPan() -{ - int v0; // esi - signed int v1; // edi - signed int v2; // esi - char *v3; // eax - int v4; // esi - int v5; // esi - int v6; // ebx - int v7; // eax - int a4; // [esp+4h] [ebp-Ch] - char *a1; // [esp+8h] [ebp-8h] - int v10; // [esp+Ch] [ebp-4h] - - v0 = 0; - if (talkflag) { - DrawPanelBox(175, sgbPlrTalkTbl + 20, 294, 5, 239, 516); - v1 = 293; - do { - DrawPanelBox((v0 >> 1) + 175, sgbPlrTalkTbl + v0 + 25, v1, 1, (v0 >> 1) + 239, v0 + 521); - ++v0; - --v1; - } while (v1 > 283); - DrawPanelBox(185, sgbPlrTalkTbl + 35, 274, 30, 249, 531); - DrawPanelBox(180, sgbPlrTalkTbl + 65, 284, 5, 244, 561); - v2 = 0; - do { - DrawPanelBox(180, sgbPlrTalkTbl + v2 + 70, v2 + 284, 1, 244, v2 + 566); - ++v2; - } while (v2 < 10); - DrawPanelBox(170, sgbPlrTalkTbl + 80, 310, 55, 234, 576); - v3 = sgszTalkMsg; - v4 = 0; - do { - v3 = control_print_talk_msg(v3, 0, v4, &a4, 0); - if (!v3) - goto LABEL_10; - v4 += 13; - } while (v4 < 39); - *v3 = 0; - LABEL_10: - CelDecDatOnly(gpBuffer + a4, pCelBuff, frame, 12); - v5 = 0; - a1 = plr[0]._pName; - v10 = 0; - frame = (frame & 7) + 1; - while (v10 == myplr) { - LABEL_21: - a1 += 21720; - ++v10; - if ((INT_PTR)a1 >= (INT_PTR)&plr[4]._pName) - return; - } - if (whisper[v10]) { - v6 = 3; - if (!talkbtndown[v5]) { - LABEL_18: - if (*(a1 - 291)) - control_print_talk_msg(a1, 46, 18 * v5 + 60, &a4, v6); - ++v5; - goto LABEL_21; +{ int i, off, talk_btn, color, nCel, x; + char *msg; + + off = 0; + if (!talkflag) + return; + + DrawPanelBox(175, sgbPlrTalkTbl + 20, 294, 5, 239, 516); + for (i = 293; i > 283; off++, i--) { + DrawPanelBox((off >> 1) + 175, sgbPlrTalkTbl + off + 25, i, 1, (off >> 1) + 239, off + 521); + } + DrawPanelBox(185, sgbPlrTalkTbl + 35, 274, 30, 249, 531); + DrawPanelBox(180, sgbPlrTalkTbl + 65, 284, 5, 244, 561); + for (i = 0; i < 10; i++) { + DrawPanelBox(180, sgbPlrTalkTbl + i + 70, i + 284, 1, 244, i + 566); + } + DrawPanelBox(170, sgbPlrTalkTbl + 80, 310, 55, 234, 576); + msg = sgszTalkMsg; + for (i = 0; i < 39; i += 13) { + msg = control_print_talk_msg(msg, 0, i, &x, 0); + if (!msg) + break; + } + if (msg) + *msg = '\0'; + CelDecDatOnly(gpBuffer + x, pCelBuff, frame, 12); + talk_btn = 0; + frame = (frame & 7) + 1; + for (i = 0; i < 4; i++) { + if (i == myplr) + continue; + if (whisper[i]) { + color = COL_GOLD; + if (talkbtndown[talk_btn]) { + if (talk_btn != 0) + nCel = 4; + else + nCel = 3; + CelDecodeOnly(236, 596 + 18 * talk_btn, pTalkBtns, nCel, 61); } - v7 = (v5 != 0) + 3; } else { - v7 = (v5 != 0) + 1; - v6 = 2; - if (talkbtndown[v5]) - v7 = (v5 != 0) + 5; + color = COL_RED; + if (talk_btn != 0) + nCel = 2; + else + nCel = 1; + if (talkbtndown[talk_btn]) + nCel += 4; + CelDecodeOnly(236, 596 + 18 * talk_btn, pTalkBtns, nCel, 61); + } + if (plr[i].plractive) { + control_print_talk_msg(plr[i]._pName, 46, 60 + talk_btn * 18, &x, color); } - CelDecodeOnly(236, 18 * v5 + 596, pTalkBtns, v7, 61); - goto LABEL_18; + + talk_btn++; } } -// 4B8840: using guessed type int sgbPlrTalkTbl; -// 4B8960: using guessed type int talkflag; char *control_print_talk_msg(char *msg, int x, int y, int *a4, int color) { @@ -2575,7 +2558,7 @@ void control_release_talk_btn() } } -void control_reset_talk_msg() +void control_reset_talk_msg(char* msg) { int i, pmask; pmask = 0; @@ -2671,43 +2654,32 @@ BOOL control_presskeys(int vkey) void control_press_enter() { - signed int v0; // esi - char(*v1)[80]; // ebp - char v2; // al - int v3; // ecx - char *v4; // ebp + int i; + BYTE talk_save; if (sgszTalkMsg[0]) { - control_reset_talk_msg(); - v0 = 0; - v1 = sgszTalkSave; - do { - if (!strcmp((const char *)v1, sgszTalkMsg)) + control_reset_talk_msg(sgszTalkMsg); + for (i = 0; i < 8; i++) { + if (!strcmp(sgszTalkSave[i], sgszTalkMsg)) break; - ++v1; - ++v0; - } while ((INT_PTR)v1 < (INT_PTR)&sgszTalkSave[8]); - if (v0 < 8) { - v2 = sgbNextTalkSave; - v3 = (sgbNextTalkSave - 1) & 7; - if (v0 != v3) { - v4 = sgszTalkSave[v3]; - strcpy(sgszTalkSave[v0], sgszTalkSave[v3]); - strcpy(v4, sgszTalkMsg); - v2 = sgbNextTalkSave; - } + } + if (i >= 8) { + strcpy(sgszTalkSave[sgbNextTalkSave], sgszTalkMsg); + sgbNextTalkSave = sgbNextTalkSave + 1; + sgbNextTalkSave &= 7; } else { - strcpy(sgszTalkSave[(unsigned char)sgbNextTalkSave], sgszTalkMsg); - v2 = (sgbNextTalkSave + 1) & 7; - sgbNextTalkSave = (sgbNextTalkSave + 1) & 7; + talk_save = sgbNextTalkSave - 1; + talk_save &= 7; + if (i != talk_save) { + strcpy(sgszTalkSave[i], sgszTalkSave[talk_save]); + strcpy(sgszTalkSave[talk_save], sgszTalkMsg); + } } - sgszTalkMsg[0] = 0; - sgbTalkSavePos = v2; + sgszTalkMsg[0] = '\0'; + sgbTalkSavePos = sgbNextTalkSave; } control_reset_talk(); } -// 4B84CC: using guessed type char sgbNextTalkSave; -// 4B84CD: using guessed type char sgbTalkSavePos; void control_up_down(int v) { diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 826fb0358..6949a3ecd 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -293,7 +293,7 @@ void CheckCursMove() if(leveltype != DTYPE_TOWN) { if(pcurstemp != -1) { - if(!flipflag && dMonster[mx + 2][my + 1] != 0 && dFlags[mx + 2][my + 1] & DFLAG_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(mi == pcurstemp && monster[mi]._mhitpoints >> 6 > 0 && monster[mi].MData->mSelFlag & 4) { cursmx = mx + 1; /// BUGFIX: 'mx + 2' @@ -301,7 +301,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(flipflag && dMonster[mx + 1][my + 2] != 0 && dFlags[mx + 1][my + 2] & DFLAG_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) { cursmx = mx + 1; @@ -309,7 +309,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(dMonster[mx + 2][my + 2] != 0 && dFlags[mx + 2][my + 2] & DFLAG_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) { cursmx = mx + 2; @@ -317,7 +317,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(!flipflag && dMonster[mx + 1][my] != 0 && dFlags[mx + 1][my] & DFLAG_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) { cursmx = mx + 1; @@ -325,7 +325,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(flipflag && dMonster[mx][my + 1] != 0 && dFlags[mx][my + 1] & DFLAG_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) { cursmx = mx; @@ -333,7 +333,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(dMonster[mx][my] != 0 && dFlags[mx][my] & DFLAG_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) { cursmx = mx; @@ -341,7 +341,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(dMonster[mx + 1][my + 1] != 0 && dFlags[mx + 1][my + 1] & DFLAG_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) { cursmx = mx + 1; @@ -361,7 +361,7 @@ void CheckCursMove() return; } } - if(!flipflag && dMonster[mx + 2][my + 1] != 0 && dFlags[mx + 2][my + 1] & DFLAG_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) { cursmx = mx + 2; @@ -369,7 +369,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(flipflag && dMonster[mx + 1][my + 2] != 0 && dFlags[mx + 1][my + 2] & DFLAG_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) { cursmx = mx + 1; @@ -377,7 +377,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(dMonster[mx + 2][my + 2] != 0 && dFlags[mx + 2][my + 2] & DFLAG_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) { cursmx = mx + 2; @@ -385,7 +385,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(!flipflag && dMonster[mx + 1][my] != 0 && dFlags[mx + 1][my] & DFLAG_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) { cursmx = mx + 1; @@ -393,7 +393,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(flipflag && dMonster[mx][my + 1] != 0 && dFlags[mx][my + 1] & DFLAG_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) { cursmx = mx; @@ -401,7 +401,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(dMonster[mx][my] != 0 && dFlags[mx][my] & DFLAG_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) { cursmx = mx; @@ -409,7 +409,7 @@ void CheckCursMove() pcursmonst = mi; } } - if(dMonster[mx + 1][my + 1] != 0 && dFlags[mx + 1][my + 1] & DFLAG_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) { cursmx = mx + 1; @@ -476,7 +476,7 @@ void CheckCursMove() pcursplr = bv; } } - if(dFlags[mx][my] & DFLAG_DEAD_PLAYER) { + 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; @@ -488,7 +488,7 @@ void CheckCursMove() if(pcurs == CURSOR_RESURRECT) { for(xx = -1; xx < 2; xx++) { for(yy = -1; yy < 2; yy++) { - if(dFlags[mx + xx][my + yy] & DFLAG_DEAD_PLAYER) { + 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; diff --git a/Source/debug.cpp b/Source/debug.cpp index 7df9af5b3..41dd39393 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -88,8 +88,8 @@ void CheckDungeonClear() if (dPlayer[i][j]) app_fatal("Players not cleared"); - dMonsDbg[currlevel][i][j] = dFlags[i][j] & DFLAG_VISIBLE; - dFlagDbg[currlevel][i][j] = dFlags[i][j] & DFLAG_POPULATED; + dMonsDbg[currlevel][i][j] = dFlags[i][j] & BFLAG_VISIBLE; + dFlagDbg[currlevel][i][j] = dFlags[i][j] & BFLAG_POPULATED; } } } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index c5e955024..30c75abc3 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -793,7 +793,7 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) BOOL LeftMouseDown(int wParam) { - if (gmenu_left_mouse(1) || control_check_talk_btn() || sgnTimeoutCurs) + if (gmenu_left_mouse(TRUE) || control_check_talk_btn() || sgnTimeoutCurs) return 0; if (deathflag) { control_check_btn_press(); @@ -984,7 +984,7 @@ BOOL TryIconCurs() void LeftMouseUp() { - gmenu_left_mouse(0); + gmenu_left_mouse(FALSE); control_release_talk_btn(); if (panbtndown) CheckBtnUp(); @@ -1772,7 +1772,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) } else { for (i = 0; i < MAXDUNX; i++) { for (j = 0; j < MAXDUNY; j++) - dFlags[i][j] |= DFLAG_LIT; + dFlags[i][j] |= BFLAG_LIT; } InitTowners(); @@ -1838,7 +1838,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) else SyncInitPlrPos(i); } else { - dFlags[plr[i].WorldX][plr[i].WorldY] |= DFLAG_DEAD_PLAYER; + dFlags[plr[i].WorldX][plr[i].WorldY] |= BFLAG_DEAD_PLAYER; } } } diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index c8dfb764d..44004f695 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -355,7 +355,7 @@ void LoadL2Dungeon(char *sFileName, int vx, int vy) for (i = 0; i < rw; i++) { if (*lm != 0) { dungeon[i][j] = *lm; - dflags[i][j] |= DFLAG_EXPLORED; + dflags[i][j] |= 0x80; } else { dungeon[i][j] = 3; } @@ -530,7 +530,7 @@ void LoadPreL2Dungeon(char *sFileName, int vx, int vy) for (i = 0; i < rw; i++) { if (*lm != 0) { dungeon[i][j] = *lm; - dflags[i][j] |= DFLAG_EXPLORED; + dflags[i][j] |= 0x80; } else { dungeon[i][j] = 3; } diff --git a/Source/gendung.cpp b/Source/gendung.cpp index b88dbbbe1..be3974ca5 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -567,28 +567,20 @@ void DRLG_InitTrans() void DRLG_MRectTrans(int x1, int y1, int x2, int y2) { - int v4; // esi - int v5; // edi - int i; // eax - char *v7; // edx - int j; // ecx - int ty_enda; // [esp+10h] [ebp+8h] - - v4 = 2 * x1 + 17; - v5 = 2 * x2 + 16; - i = 2 * y1 + 17; - for (ty_enda = 2 * y2 + 16; i <= ty_enda; ++i) { - if (v4 <= v5) { - v7 = &dTransVal[v4][i]; - j = v5 - v4 + 1; - do { - *v7 = TransVal; - v7 += 112; - --j; - } while (j); + int i, j; + + x1 = 2 * x1 + 17; + y1 = 2 * y1 + 17; + x2 = 2 * x2 + 16; + y2 = 2 * y2 + 16; + + for(j = y1; j <= y2; j++) { + for(i = x1; i <= x2; i++) { + dTransVal[i][j] = TransVal; } } - ++TransVal; + + TransVal++; } // 5A5590: using guessed type char TransVal; @@ -977,48 +969,19 @@ void DRLG_PlaceThemeRooms(int minSize, int maxSize, int floor, int freq, int rnd void DRLG_HoldThemeRooms() { - int *v0; // esi - int v1; // edi - int v2; // edx - int v3; // ebx - int v4; // edi - int v5; // ecx - int v6; // eax - int v7; // [esp+0h] [ebp-Ch] - int v8; // [esp+4h] [ebp-8h] - int v9; // [esp+8h] [ebp-4h] - - if (themeCount > 0) { - v0 = &themeLoc[0].height; - v8 = themeCount; - do { - v1 = *(v0 - 3); - if (v1 < v1 + *v0 - 1) { - v2 = *(v0 - 4); - v3 = 2 * v1 + 16; - v7 = v2 + *(v0 - 1) - 1; - v9 = *v0 - 1; - do { - if (v2 < v7) { - v4 = 224 * (v2 + 8); - v5 = v7 - v2; - do { - v6 = v3 + v4; - v4 += 224; - dFlags[0][v6] |= DFLAG_POPULATED; - dFlags[1][v6] |= DFLAG_POPULATED; - dFlags[0][v6 + 1] |= DFLAG_POPULATED; - dFlags[1][v6 + 1] |= DFLAG_POPULATED; - --v5; - } while (v5); - } - v3 += 2; - --v9; - } while (v9); + 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++) { + xx = 2 * x + 16; + yy = 2 * y + 16; + dFlags[xx][yy] |= BFLAG_POPULATED; + dFlags[xx + 1][yy] |= BFLAG_POPULATED; + dFlags[xx][yy + 1] |= BFLAG_POPULATED; + dFlags[xx + 1][yy + 1] |= BFLAG_POPULATED; } - v0 += 5; - --v8; - } while (v8); + } } } diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index e9fb2efe1..2495ce818 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -341,49 +341,66 @@ BOOLEAN gmenu_valid_mouse_pos(int *plOffset) return 1; } -int gmenu_left_mouse(int a1) +BOOL gmenu_left_mouse(BOOL isDown) { - int result; // eax - unsigned int v2; // eax - unsigned int v3; // eax - TMenuItem *v4; // esi - unsigned int v5; // eax - //LPARAM v6; // ecx - int a1a; // [esp+4h] [ebp-4h] - - if (a1) { - if (!sgpCurrentMenu || MouseY >= 352) - return 0; + BOOL result; + TMenuItem *v3; + DWORD v4, v5; + int dummy; + + if (!isDown) { + if (mouseNavigation) { + mouseNavigation = 0; + result = TRUE; + } else { + result = FALSE; + } + + } else { + + if (!sgpCurrentMenu) { + return FALSE; + } + if (MouseY >= 352) { + return FALSE; + } if (MouseY - 117 >= 0) { - v2 = (MouseY - 117) / 45; - if (v2 < sgCurrentMenuIdx) { - v3 = v2; - v4 = &sgpCurrentMenu[v3]; - if ((v4->dwFlags & 0x80000000) != 0) { - v5 = (unsigned int)gmenu_get_lfont(&sgpCurrentMenu[v3]) >> 1; - if (MouseX >= 320 - v5 && MouseX <= v5 + 320) { - sgpCurrItem = v4; - PlaySFX(IS_TITLEMOV); - if (v4->dwFlags & 0x40000000) { - mouseNavigation = gmenu_valid_mouse_pos(&a1a); - gmenu_on_mouse_move(); + v4 = (MouseY - 117) / 45; + //v4 /= 45; + if (v4 < sgCurrentMenuIdx) { + v3 = &sgpCurrentMenu[v4]; + if ((sgpCurrentMenu[v4].dwFlags & 0x80000000) != 0) { + v5 = gmenu_get_lfont(v3); + if (MouseX >= 320 - (v5 >> 1)) { + if (MouseX <= (v5 >> 1) + 320) { + sgpCurrItem = v3; + PlaySFX(IS_TITLEMOV); + if (v3->dwFlags & 0x40000000) { + mouseNavigation = gmenu_valid_mouse_pos(&dummy); + gmenu_on_mouse_move(); + } else { + sgpCurrItem->fnMenu(TRUE); + } + result = TRUE; } else { - sgpCurrItem->fnMenu(TRUE); + result = TRUE; } + } else { + result = TRUE; } + } else { + result = TRUE; } + } else { + result = TRUE; } + } else { + result = TRUE; } - } else { - result = 0; - if (!mouseNavigation) - return result; - mouseNavigation = 0; } - return 1; + return result; } -// 634464: using guessed type char mouseNavigation; -// 63448C: using guessed type int sgCurrentMenuIdx; + void gmenu_enable(TMenuItem *pMenuItem, BOOL enable) { diff --git a/Source/gmenu.h b/Source/gmenu.h index 5d960ee07..8c2be2277 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -28,7 +28,7 @@ BOOL gmenu_presskeys(int a1); void gmenu_left_right(BOOL isRight); BOOL gmenu_on_mouse_move(); BOOLEAN gmenu_valid_mouse_pos(int *plOffset); -int gmenu_left_mouse(int a1); +BOOL gmenu_left_mouse(BOOL isDown); void gmenu_enable(TMenuItem *pMenuItem, BOOL enable); void gmenu_slider_set(TMenuItem *pItem, int min, int max, int gamma); int gmenu_slider_get(TMenuItem *pItem, int min, int max); diff --git a/Source/items.cpp b/Source/items.cpp index 8223624c6..d4b81c54b 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -208,7 +208,7 @@ BOOL ItemPlace(int xp, int yp) return FALSE; if (dObject[xp][yp]) return FALSE; - if (dFlags[xp][yp] & DFLAG_POPULATED) + if (dFlags[xp][yp] & BFLAG_POPULATED) return FALSE; if (nSolidTable[dPiece[xp][yp]]) return FALSE; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index d241da636..136cc023d 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -658,7 +658,7 @@ void DoUnVision(int nXPos, int nYPos, int nRadius) for (i = x1; i < x2; i++) { for (j = y1; j < y2; j++) { - dFlags[i][j] &= ~(DFLAG_VISIBLE | DFLAG_LIT); + dFlags[i][j] &= ~(BFLAG_VISIBLE | BFLAG_LIT); } } } @@ -673,12 +673,12 @@ void DoVision(int nXPos, int nYPos, int nRadius, BOOL doautomap, BOOL visible) if (dFlags[nXPos][nYPos] >= 0) { SetAutomapView(nXPos, nXPos); } - dFlags[nXPos][nYPos] |= DFLAG_EXPLORED; + dFlags[nXPos][nYPos] |= BFLAG_EXPLORED; } if (visible) { - dFlags[nXPos][nYPos] |= DFLAG_LIT; + dFlags[nXPos][nYPos] |= BFLAG_LIT; } - dFlags[nXPos][nYPos] |= DFLAG_VISIBLE; + dFlags[nXPos][nYPos] |= BFLAG_VISIBLE; } for (v = 0; v < 4; v++) { @@ -732,12 +732,12 @@ void DoVision(int nXPos, int nYPos, int nRadius, BOOL doautomap, BOOL visible) if (dFlags[nCrawlX][nCrawlY] >= 0) { SetAutomapView(nCrawlX, nCrawlY); } - dFlags[nCrawlX][nCrawlY] |= DFLAG_EXPLORED; + dFlags[nCrawlX][nCrawlY] |= BFLAG_EXPLORED; } if (visible) { - dFlags[nCrawlX][nCrawlY] |= DFLAG_LIT; + dFlags[nCrawlX][nCrawlY] |= BFLAG_LIT; } - dFlags[nCrawlX][nCrawlY] |= DFLAG_VISIBLE; + dFlags[nCrawlX][nCrawlY] |= BFLAG_VISIBLE; if (!nBlockerFlag) { nTrans = dTransVal[nCrawlX][nCrawlY]; if (nTrans != 0) { diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index a0fd0da40..c7f3d4cba 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -358,7 +358,7 @@ void SaveGame() } for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) - BSave(dFlags[i][j] & ~(DFLAG_MISSILE | DFLAG_VISIBLE | DFLAG_DEAD_PLAYER)); + BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); } for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) @@ -558,7 +558,7 @@ void SaveLevel() for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) - BSave(dFlags[i][j] & ~(DFLAG_MISSILE | DFLAG_VISIBLE | DFLAG_DEAD_PLAYER)); + BSave(dFlags[i][j] & ~(BFLAG_MISSILE | BFLAG_VISIBLE | BFLAG_DEAD_PLAYER)); } for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 54bc2f152..e2a0796e3 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -386,7 +386,7 @@ void PutMissile(int i) if (x <= 0 || y <= 0 || x >= MAXDUNX || y >= MAXDUNY) missile[i]._miDelFlag = TRUE; if (!missile[i]._miDelFlag) { - dFlags[x][y] |= DFLAG_MISSILE; + dFlags[x][y] |= BFLAG_MISSILE; if (dMissile[x][y] == 0) dMissile[x][y] = i + 1; else @@ -428,7 +428,7 @@ void GetMissilePos(int i) void MoveMissilePos(int i) { - int dx, dy; + int dx, dy, x, y; switch (missile[i]._mimfnum) { case DIR_S: @@ -464,7 +464,9 @@ void MoveMissilePos(int i) dy = 1; break; } - if (PosOkMonst(missile[i]._misource, missile[i]._mix + dx, missile[i]._miy + dy)) { + x = missile[i]._mix + dx; + y = missile[i]._miy + dy; + if (PosOkMonst(missile[i]._misource, x, y)) { missile[i]._mix += dx; missile[i]._miy += dy; missile[i]._mixoff += (dy << 5) - (dx << 5); @@ -1203,7 +1205,7 @@ void InitMissiles() } for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { - dFlags[i][j] &= ~DFLAG_MISSILE; + dFlags[i][j] &= ~BFLAG_MISSILE; } } } @@ -4065,7 +4067,7 @@ void ProcessMissiles() int i, mi; for (i = 0; i < nummissiles; i++) { - dFlags[missile[missileactive[i]]._mix][missile[missileactive[i]]._miy] &= ~DFLAG_MISSILE; + dFlags[missile[missileactive[i]]._mix][missile[missileactive[i]]._miy] &= ~BFLAG_MISSILE; dMissile[missile[missileactive[i]]._mix][missile[missileactive[i]]._miy] = 0; } @@ -4146,7 +4148,7 @@ void missiles_process_charge() void ClearMissileSpot(int mi) { - dFlags[missile[mi]._mix][missile[mi]._miy] &= ~DFLAG_MISSILE; + dFlags[missile[mi]._mix][missile[mi]._miy] &= ~BFLAG_MISSILE; dMissile[missile[mi]._mix][missile[mi]._miy] = 0; } diff --git a/Source/monster.cpp b/Source/monster.cpp index 4434969a5..0fd3bdc99 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -534,11 +534,11 @@ BOOL MonstPlace(int xp, int yp) f = dFlags[xp][yp]; - if (f & DFLAG_VISIBLE) { + if (f & BFLAG_VISIBLE) { return FALSE; } - if (f & DFLAG_POPULATED) { + if (f & BFLAG_POPULATED) { return FALSE; } @@ -1346,7 +1346,7 @@ void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int y dMonster[fx][fy] = -(i + 1); monster[i]._mVar4 = x; monster[i]._mVar5 = y; - dFlags[x][y] |= DFLAG_MONSTER; + dFlags[x][y] |= BFLAG_MONSTLR; monster[i]._moldx = monster[i]._mx; monster[i]._moldy = monster[i]._my; monster[i]._mfutx = fx; @@ -1464,9 +1464,9 @@ void M_ClearSquares(int i) } if (mx + 1 < MAXDUNX) - dFlags[mx + 1][my] &= ~DFLAG_MONSTER; + dFlags[mx + 1][my] &= ~BFLAG_MONSTLR; if (my + 1 < MAXDUNY) - dFlags[mx][my + 1] &= ~DFLAG_MONSTER; + dFlags[mx][my + 1] &= ~BFLAG_MONSTLR; } void M_GetKnockback(int i) @@ -1967,7 +1967,7 @@ BOOL M_DoWalk3(int i) dMonster[monster[i]._mx][monster[i]._my] = 0; monster[i]._mx = monster[i]._mVar1; monster[i]._my = monster[i]._mVar2; - dFlags[monster[i]._mVar4][monster[i]._mVar5] &= ~DFLAG_MONSTER; + dFlags[monster[i]._mVar4][monster[i]._mVar5] &= ~BFLAG_MONSTLR; dMonster[monster[i]._mx][monster[i]._my] = i + 1; if (monster[i]._uniqtype) ChangeLightXY(monster[i].mlid, monster[i]._mx, monster[i]._my); @@ -2903,7 +2903,7 @@ void MAI_Zombie(int i) mx = Monst->_mx; my = Monst->_my; - if (!(dFlags[mx][my] & DFLAG_VISIBLE)) { + if (!(dFlags[mx][my] & BFLAG_VISIBLE)) { return; } @@ -4190,13 +4190,13 @@ void MAI_Garbud(int i) if (Monst->mtalkmsg < QUEST_GARBUD4 && Monst->mtalkmsg > QUEST_DOOM10 - && !(dFlags[_mx][_my] & DFLAG_VISIBLE) + && !(dFlags[_mx][_my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { Monst->_mgoal = MGOAL_INQUIRING; Monst->mtalkmsg++; } - if (dFlags[_mx][_my] & DFLAG_VISIBLE) { + if (dFlags[_mx][_my] & BFLAG_VISIBLE) { if (Monst->mtalkmsg == QUEST_GARBUD4) { if (!effect_is_playing(USFX_GARBUD4) && Monst->_mgoal == MGOAL_TALKING) { Monst->_mgoal = MGOAL_NORMAL; @@ -4231,12 +4231,12 @@ void MAI_Zhar(int i) my = Monst->_my; mx = Monst->_mx; md = M_GetDir(i); - if (Monst->mtalkmsg == QUEST_ZHAR1 && !(dFlags[mx][my] & DFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { + if (Monst->mtalkmsg == QUEST_ZHAR1 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { Monst->mtalkmsg = QUEST_ZHAR2; Monst->_mgoal = MGOAL_INQUIRING; } - if (dFlags[mx][my] & DFLAG_VISIBLE) { + if (dFlags[mx][my] & BFLAG_VISIBLE) { _mx = Monst->_mx - Monst->_menemyx; _my = Monst->_my - Monst->_menemyy; if (abs(_mx) > abs(_my)) @@ -4278,7 +4278,7 @@ void MAI_SnotSpil(int i) my = Monst->_my; md = M_GetDir(i); - if (Monst->mtalkmsg == QUEST_BANNER10 && !(dFlags[mx][my] & DFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { + if (Monst->mtalkmsg == QUEST_BANNER10 && !(dFlags[mx][my] & BFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { Monst->mtalkmsg = QUEST_BANNER11; Monst->_mgoal = MGOAL_INQUIRING; } @@ -4288,7 +4288,7 @@ void MAI_SnotSpil(int i) Monst->_mgoal = MGOAL_NORMAL; } - if (dFlags[mx][my] & DFLAG_VISIBLE) { + if (dFlags[mx][my] & BFLAG_VISIBLE) { if (Monst->mtalkmsg == QUEST_BANNER12) { if (!effect_is_playing(USFX_SNOT3) && Monst->_mgoal == MGOAL_TALKING) { ObjChangeMap(setpc_x, setpc_y, setpc_x + setpc_w + 1, setpc_y + setpc_h + 1); @@ -4327,7 +4327,7 @@ void MAI_Lazurus(int i) mx = Monst->_mx; my = Monst->_my; md = M_GetDir(i); - if (dFlags[mx][my] & DFLAG_VISIBLE) { + if (dFlags[mx][my] & BFLAG_VISIBLE) { if (gbMaxPlayers == 1) { if (Monst->mtalkmsg == QUEST_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && plr[myplr].WorldX == QUEST_VILE13 && plr[myplr].WorldY == 46) { PlayInGameMovie("gendata\\fprst3.smk"); @@ -4377,7 +4377,7 @@ void MAI_Lazhelp(int i) _my = Monst->_my; md = M_GetDir(i); - if (dFlags[_mx][_my] & DFLAG_VISIBLE) { + if (dFlags[_mx][_my] & BFLAG_VISIBLE) { if (gbMaxPlayers == 1) { if (quests[QTYPE_VB]._qvar1 <= 5) { Monst->_mgoal = MGOAL_INQUIRING; @@ -4411,12 +4411,12 @@ void MAI_Lachdanan(int i) _mx = Monst->_mx; _my = Monst->_my; md = M_GetDir(i); - if (Monst->mtalkmsg == QUEST_VEIL9 && !(dFlags[_mx][_my] & DFLAG_VISIBLE) && monster[i]._mgoal == MGOAL_TALKING) { + if (Monst->mtalkmsg == QUEST_VEIL9 && !(dFlags[_mx][_my] & BFLAG_VISIBLE) && monster[i]._mgoal == MGOAL_TALKING) { Monst->mtalkmsg = QUEST_VEIL10; monster[i]._mgoal = MGOAL_INQUIRING; } - if (dFlags[_mx][_my] & DFLAG_VISIBLE) { + if (dFlags[_mx][_my] & BFLAG_VISIBLE) { if (Monst->mtalkmsg == QUEST_VEIL11) { if (!effect_is_playing(USFX_LACH3) && Monst->_mgoal == MGOAL_TALKING) { Monst->mtalkmsg = 0; @@ -4448,7 +4448,7 @@ void MAI_Warlord(int i) mx = Monst->_mx; my = Monst->_my; md = M_GetDir(i); - if (dFlags[mx][my] & DFLAG_VISIBLE) { + if (dFlags[mx][my] & BFLAG_VISIBLE) { if (Monst->mtalkmsg == QUEST_WARLRD9 && Monst->_mgoal == MGOAL_INQUIRING) Monst->_mmode = MM_TALK; if (Monst->mtalkmsg == QUEST_WARLRD9 && !effect_is_playing(USFX_WARLRD1) && Monst->_mgoal == MGOAL_TALKING) { @@ -4519,7 +4519,7 @@ void ProcessMonsters() } mx = Monst->_mx; my = Monst->_my; - if(dFlags[mx][my] & DFLAG_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) { @@ -4538,7 +4538,7 @@ void ProcessMonsters() } Monst->_menemyx = plr[Monst->_menemy]._px; Monst->_menemyy = plr[Monst->_menemy]._py; - if(dFlags[mx][my] & DFLAG_VISIBLE) { + if(dFlags[mx][my] & BFLAG_VISIBLE) { Monst->_msquelch = 255; Monst->_lastx = plr[Monst->_menemy]._px; Monst->_lasty = plr[Monst->_menemy]._py; @@ -4664,11 +4664,11 @@ BOOL DirOK(int i, int mdir) if (fy < 0 || fy >= MAXDUNY || fx < 0 || fx >= MAXDUNX || !PosOkMonst(i, fx, fy)) return FALSE; if (mdir == DIR_E) { - if (SolidLoc(fx, fy + 1) || dFlags[fx][fy + 1] & DFLAG_MONSTER) + if (SolidLoc(fx, fy + 1) || dFlags[fx][fy + 1] & BFLAG_MONSTLR) return FALSE; } if (mdir == DIR_W) { - if (SolidLoc(fx + 1, fy) || dFlags[fx + 1][fy] & DFLAG_MONSTER) + if (SolidLoc(fx + 1, fy) || dFlags[fx + 1][fy] & BFLAG_MONSTLR) return FALSE; } if (mdir == DIR_N) { @@ -4708,7 +4708,7 @@ BOOL DirOK(int i, int mdir) BOOL PosOkMissile(int x, int y) { - return !nMissileTable[dPiece[x][y]] && !(dFlags[x][y] & DFLAG_MONSTER); + return !nMissileTable[dPiece[x][y]] && !(dFlags[x][y] & BFLAG_MONSTLR); } BOOL CheckNoSolid(int x, int y) diff --git a/Source/msg.cpp b/Source/msg.cpp index d2d8b4b61..c0cc0400f 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -2279,7 +2279,7 @@ int On_PLAYER_JOINLEVEL(TCmdLocParam1 *pCmd, int pnum) NewPlrAnim(pnum, plr[pnum]._pDAnim[0], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; plr[pnum]._pVar8 = plr[pnum]._pAnimLen << 1; - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= DFLAG_DEAD_PLAYER; + dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; } plr[pnum]._pvid = AddVision(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum]._pLightRad, pnum == myplr); diff --git a/Source/multi.cpp b/Source/multi.cpp index 1be467245..969bcba57 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -156,35 +156,30 @@ void NetSendHiPri(BYTE *pbMsg, BYTE bLen) } // 679760: using guessed type int gdwNormalMsgSize; -unsigned char *multi_recv_packet(TBuffer *packet, unsigned char *a2, int *a3) -{ - TBuffer *v3; // esi - unsigned char *result; // eax - BYTE *v5; // ebx - size_t v6; // edi - char *v7; // ebx - unsigned char *v8; // [esp+4h] [ebp-4h] - - v3 = packet; - result = a2; - v8 = a2; - if (packet->dwNextWriteOffset) { - v5 = packet->bData; - while (*v5) { - v6 = *v5; - if (v6 > *a3) +BYTE *multi_recv_packet(TBuffer *packet, BYTE *body, int *size) +{ + BYTE *src_ptr; + size_t chunk_size; + + if (packet->dwNextWriteOffset != 0) { + src_ptr = packet->bData; + while (TRUE) { + if (*src_ptr == 0) break; - v7 = (char *)(v5 + 1); - memcpy(v8, v7, v6); - v8 += v6; - v5 = (BYTE *)&v7[v6]; - *a3 -= v6; + chunk_size = *src_ptr; + if (chunk_size > *size) + break; + src_ptr++; + memcpy(body, src_ptr, chunk_size); + body += chunk_size; + src_ptr += chunk_size; + *size -= chunk_size; } - memcpy(v3->bData, v5, (size_t)&v3->bData[v3->dwNextWriteOffset - (UINT_PTR)v5 + 1]); /* memcpy_0 */ - v3->dwNextWriteOffset += (char *)v3 - (char *)v5 + 4; - result = v8; + memcpy(packet->bData, src_ptr, (packet->bData - src_ptr) + packet->dwNextWriteOffset + 1); + packet->dwNextWriteOffset += (packet->bData - src_ptr); + return body; } - return result; + return body; } void multi_send_msg_packet(int pmask, BYTE *a2, BYTE len) @@ -365,54 +360,73 @@ void multi_mon_seeds() void multi_begin_timeout() { - unsigned char bGroupPlayers; // bl - signed int v1; // eax - signed int nLowestActive; // esi - signed int nLowestPlayer; // edi - signed int v4; // eax - int v5; // edx - unsigned char v6; // [esp+Fh] [ebp-1h] + int i, nTicks, nState, nLowestActive, nLowestPlayer; + BYTE bGroupPlayers, bGroupCount; - bGroupPlayers = 0; + if(!sgbTimeout) { + return; + } #ifdef _DEBUG - if (sgbTimeout && !debug_mode_key_i) -#else - if (sgbTimeout) + if(debug_mode_key_i) { + return; + } #endif - { - v1 = GetTickCount() - sglTimeoutStart; - if (v1 <= 20000) { - if (v1 >= 10000) { - v6 = 0; - nLowestActive = -1; - nLowestPlayer = -1; - v4 = 0; - do { - v5 = player_state[v4]; - if (v5 & 0x10000) { - if (nLowestPlayer == -1) - nLowestPlayer = v4; - if (v5 & 0x40000) { - ++bGroupPlayers; - if (nLowestActive == -1) - nLowestActive = v4; - } else { - ++v6; - } - } - ++v4; - } while (v4 < MAX_PLRS); - if (bGroupPlayers >= v6 && (bGroupPlayers != v6 || nLowestPlayer == nLowestActive)) { - if (nLowestActive == myplr) - multi_check_drop_player(); - } else { - gbGameDestroyed = TRUE; + + nTicks = GetTickCount() - sglTimeoutStart; + if(nTicks > 20000) { + gbRunGame = FALSE; + return; + } + if(nTicks < 10000) { + return; + } + + nLowestActive = -1; + nLowestPlayer = -1; + bGroupPlayers = 0; + bGroupCount = 0; + for(i = 0; i < MAX_PLRS; i++) { + nState = player_state[i]; + if(nState & 0x10000) { + if(nLowestPlayer == -1) { + nLowestPlayer = i; + } + if(nState & 0x40000) { + bGroupPlayers++; + if(nLowestActive == -1) { + nLowestActive = i; } + } else { + bGroupCount++; } - } else { - gbRunGame = FALSE; } } + + /// ASSERT: assert(bGroupPlayers); + /// ASSERT: assert(nLowestActive != -1); + /// ASSERT: assert(nLowestPlayer != -1); + +#ifdef _DEBUG + dumphist( + "(%d) grp:%d ngrp:%d lowp:%d lowa:%d", + myplr, + bGroupPlayers, + bGroupCount, + nLowestPlayer, + nLowestActive); +#endif + + if(bGroupPlayers < bGroupCount) { + gbGameDestroyed = TRUE; + } else if(bGroupPlayers == bGroupCount) { + if(nLowestPlayer != nLowestActive) { + gbGameDestroyed = TRUE; + } else if(nLowestActive == myplr) { + multi_check_drop_player(); + } + } else if(nLowestActive == myplr) { + multi_check_drop_player(); + } } // 67862D: using guessed type char gbGameDestroyed; // 678644: using guessed type int sglTimeoutStart; @@ -957,7 +971,7 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, BOOL recv) NewPlrAnim(pnum, plr[pnum]._pDAnim[0], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; plr[pnum]._pVar8 = 2 * plr[pnum]._pAnimLen; - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= DFLAG_DEAD_PLAYER; + dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; } } #ifdef _DEBUG diff --git a/Source/multi.h b/Source/multi.h index 3fbb1d8b7..5851c0488 100644 --- a/Source/multi.h +++ b/Source/multi.h @@ -24,7 +24,7 @@ void multi_copy_packet(TBuffer *buf, void *packet, BYTE size); void multi_send_packet(void *packet, BYTE dwSize); void NetRecvPlrData(TPkt *pkt); void NetSendHiPri(BYTE *pbMsg, BYTE bLen); -unsigned char *multi_recv_packet(TBuffer *packet, unsigned char *a2, int *a3); +BYTE *multi_recv_packet(TBuffer *packet, BYTE *body, int *size); void multi_send_msg_packet(int pmask, BYTE *a2, BYTE len); void multi_msg_countdown(); void multi_parse_turn(int pnum, int turn); diff --git a/Source/objects.cpp b/Source/objects.cpp index 99548d140..de78dc8c4 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -132,7 +132,7 @@ BOOL RndLocOk(int xp, int yp) return FALSE; if (dObject[xp][yp]) return FALSE; - if (dFlags[xp][yp] & DFLAG_POPULATED) + if (dFlags[xp][yp] & BFLAG_POPULATED) return FALSE; if (nSolidTable[dPiece[xp][yp]]) return FALSE; @@ -421,7 +421,7 @@ void AddL3Objs(int x1, int y1, int x2, int y2) BOOL WallTrapLocOk(int xp, int yp) { - if (dFlags[xp][yp] & DFLAG_POPULATED) + if (dFlags[xp][yp] & BFLAG_POPULATED) return FALSE; return TRUE; } @@ -453,7 +453,7 @@ void AddL2Torches() BOOL TorchLocOK(int xp, int yp) { - if (dFlags[xp][yp] & DFLAG_POPULATED) + if (dFlags[xp][yp] & BFLAG_POPULATED) return FALSE; return nTrapTable[dPiece[xp][yp]] != FALSE; diff --git a/Source/player.cpp b/Source/player.cpp index 5373e3a8d..2f5cbbb8d 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1007,11 +1007,11 @@ BOOL PlrDirOK(int pnum, int dir) isOk = TRUE; if (dir == DIR_E) { - isOk = !SolidLoc(px, py + 1) && !(dFlags[px][py + 1] & DFLAG_PLAYER); + isOk = !SolidLoc(px, py + 1) && !(dFlags[px][py + 1] & BFLAG_PLAYERLR); } if (isOk && dir == DIR_W) { - isOk = !SolidLoc(px + 1, py) && !(dFlags[px + 1][py] & DFLAG_PLAYER); + isOk = !SolidLoc(px + 1, py) && !(dFlags[px + 1][py] & BFLAG_PLAYERLR); } return isOk; @@ -1377,7 +1377,7 @@ void StartWalk3(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int dPlayer[px][py] = -1 - pnum; plr[pnum]._pVar4 = x; plr[pnum]._pVar5 = y; - dFlags[x][y] |= DFLAG_PLAYER; + dFlags[x][y] |= BFLAG_PLAYERLR; plr[pnum]._pxoff = xoff; plr[pnum]._pyoff = yoff; @@ -1557,8 +1557,8 @@ void FixPlrWalkTags(int pnum) } if (dx >= 0 && dx < MAXDUNX - 1 && dy >= 0 && dy < MAXDUNY - 1) { - dFlags[dx + 1][dy] &= ~DFLAG_PLAYER; - dFlags[dx][dy + 1] &= ~DFLAG_PLAYER; + dFlags[dx + 1][dy] &= ~BFLAG_PLAYERLR; + dFlags[dx][dy + 1] &= ~BFLAG_PLAYERLR; } } @@ -1573,8 +1573,8 @@ void RemovePlrFromMap(int pnum) for (y = 1; y < MAXDUNY; y++) for (x = 1; x < MAXDUNX; x++) if (dPlayer[x][y - 1] == pn || dPlayer[x - 1][y] == pn) - if (dFlags[x][y] & DFLAG_PLAYER) - dFlags[x][y] &= ~DFLAG_PLAYER; + if (dFlags[x][y] & BFLAG_PLAYERLR) + dFlags[x][y] &= ~BFLAG_PLAYERLR; for (y = 0; y < MAXDUNY; y++) for (x = 0; x < MAXDUNX; x++) @@ -1705,7 +1705,7 @@ void StartPlayerKill(int pnum, int earflag) if (plr[pnum].plrlevel == currlevel) { FixPlayerLocation(pnum, plr[pnum]._pdir); RemovePlrFromMap(pnum); - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= DFLAG_DEAD_PLAYER; + dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; SetPlayerOld(pnum); if (pnum == myplr) { @@ -2195,7 +2195,7 @@ BOOL PM_DoWalk3(int pnum) if (plr[pnum]._pVar8 == vel) { dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = 0; - dFlags[plr[pnum]._pVar4][plr[pnum]._pVar5] &= ~DFLAG_PLAYER; + dFlags[plr[pnum]._pVar4][plr[pnum]._pVar5] &= ~BFLAG_PLAYERLR; plr[pnum].WorldX = plr[pnum]._pVar1; plr[pnum].WorldY = plr[pnum]._pVar2; dPlayer[plr[pnum]._pVar1][plr[pnum]._pVar2] = pnum + 1; @@ -2946,7 +2946,7 @@ BOOL PM_DoDeath(int pnum) plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen; plr[pnum]._pAnimDelay = 10000; - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= DFLAG_DEAD_PLAYER; + dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; } if (plr[pnum]._pVar8 < 100) { diff --git a/Source/portal.cpp b/Source/portal.cpp index 9c85b85fc..f7b725760 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -104,7 +104,7 @@ void RemovePortalMissile(int id) for (i = 0; i < nummissiles; i++) { mi = missileactive[i]; if (missile[mi]._mitype == MIS_TOWN && missile[mi]._misource == id) { - dFlags[missile[mi]._mix][missile[mi]._miy] &= ~DFLAG_MISSILE; + dFlags[missile[mi]._mix][missile[mi]._miy] &= ~BFLAG_MISSILE; dMissile[missile[mi]._mix][missile[mi]._miy] = 0; if (portal[id].level) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index ed1320a46..2fb89c5a6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -202,7 +202,7 @@ void DrawDeadPlayer(int x, int y, int sx, int sy, int CelSkip, int CelCap, BOOL else DrawPlrProc = DrawPlayer; - dFlags[x][y] &= ~DFLAG_DEAD_PLAYER; + dFlags[x][y] &= ~BFLAG_DEAD_PLAYER; for (i = 0; i < MAX_PLRS; i++) { p = &plr[i]; @@ -218,7 +218,7 @@ void DrawDeadPlayer(int x, int y, int sx, int sy, int CelSkip, int CelCap, BOOL // app_fatal("Drawing dead player %d \"%s\": facing %d, frame %d of %d", i, p->_pName, p->_pdir, nCel, pFrameTable[0]); break; } - dFlags[x][y] |= DFLAG_DEAD_PLAYER; + dFlags[x][y] |= BFLAG_DEAD_PLAYER; px = sx + p->_pxoff - p->_pAnimWidth2; py = sy + p->_pyoff; DrawPlrProc(i, x, y, px, py, p->_pAnimData, p->_pAnimFrame, p->_pAnimWidth, CelSkip, CelCap); @@ -231,7 +231,7 @@ void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel int l; DWORD *pFrameTable; - if (dFlags[x][y] & DFLAG_LIT || plr[myplr]._pInfraFlag || !setlevel && !currlevel) { + if (dFlags[x][y] & BFLAG_LIT || plr[myplr]._pInfraFlag || !setlevel && !currlevel) { if (!pCelBuff) { // app_fatal("Drawing player %d \"%s\": NULL Cel Buffer", pnum, plr[pnum]._pName); return; @@ -266,7 +266,7 @@ void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel misfiledata[MFILE_MANASHLD].mAnimWidth[0], CelSkip, CelCap); - } else if (!(dFlags[x][y] & DFLAG_LIT) || plr[myplr]._pInfraFlag && light_table_index > 8) { + } else if (!(dFlags[x][y] & BFLAG_LIT) || plr[myplr]._pInfraFlag && light_table_index > 8) { Cl2DecodeFrm3(px, py, pCelBuff, nCel, nWidth, CelSkip, CelCap, 1); if (plr[pnum].pManaShield) Cl2DecodeFrm3( @@ -304,7 +304,7 @@ void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i int l; DWORD *pFrameTable; - if (dFlags[x][y] & DFLAG_LIT || plr[myplr]._pInfraFlag) { + if (dFlags[x][y] & BFLAG_LIT || plr[myplr]._pInfraFlag) { if (!pCelBuff) { // app_fatal("Drawing player %d \"%s\" clipped: NULL Cel Buffer", pnum, plr[pnum]._pName); return; @@ -339,7 +339,7 @@ void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i misfiledata[MFILE_MANASHLD].mAnimWidth[0], CelSkip, CelCap); - } else if (!(dFlags[x][y] & DFLAG_LIT) || plr[myplr]._pInfraFlag && light_table_index > 8) { + } else if (!(dFlags[x][y] & BFLAG_LIT) || plr[myplr]._pInfraFlag && light_table_index > 8) { Cl2DecodeFrm5(px, py, pCelBuff, nCel, nWidth, CelSkip, CelCap, 1); if (plr[pnum].pManaShield) Cl2DecodeFrm5( @@ -706,10 +706,10 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, negPlr = dPlayer[sx][sy - 1]; negMon = dMonster[sx][sy - 1]; - if(visiondebug && bFlag & DFLAG_LIT) { + if(visiondebug && bFlag & BFLAG_LIT) { Cel2DecodeHdrOnly(pBuff, (BYTE *)pSquareCel, 1, 64, 0, 8); } - if(MissilePreFlag && bFlag & DFLAG_MISSILE) { + if(MissilePreFlag && bFlag & BFLAG_MISSILE) { DrawClippedMissile(sx, sy, dx, dy, 0, 8, 1); } if(light_table_index < lightmax) { @@ -768,7 +768,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, } } } - if(bFlag & DFLAG_PLAYER) { + if(bFlag & BFLAG_PLAYERLR) { p = -(negPlr + 1); if((DWORD)p < MAX_PLRS) { pPlayer = &plr[p]; @@ -785,7 +785,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, // app_fatal("draw player clipped: tried to draw illegal player %d", p); } } - if(bFlag & DFLAG_MONSTER && (bFlag & DFLAG_LIT || plr[myplr]._pInfraFlag) && negMon < 0) { + if(bFlag & BFLAG_MONSTLR && (bFlag & BFLAG_LIT || plr[myplr]._pInfraFlag) && negMon < 0) { draw_monster_num = -(negMon + 1); if((DWORD)draw_monster_num < MAXMONSTERS) { pMonster = &monster[draw_monster_num]; @@ -808,7 +808,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, // app_fatal("Draw Monster Clipped: tried to draw illegal monster %d", draw_monster_num); } } - if(bFlag & DFLAG_DEAD_PLAYER) { + if(bFlag & BFLAG_DEAD_PLAYER) { DrawDeadPlayer(sx, sy, dx, dy, 0, 8, 1); } if(bPlr > 0) { @@ -828,7 +828,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, // app_fatal("draw player clipped: tried to draw illegal player %d", p); } } - if(nMon > 0 && (bFlag & DFLAG_LIT || plr[myplr]._pInfraFlag)) { + if(nMon > 0 && (bFlag & BFLAG_LIT || plr[myplr]._pInfraFlag)) { draw_monster_num = nMon - 1; if((DWORD)draw_monster_num < MAXMONSTERS) { pMonster = &monster[draw_monster_num]; @@ -851,7 +851,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy, // app_fatal("Draw Monster Clipped: tried to draw illegal monster %d", draw_monster_num); } } - if(bFlag & DFLAG_MISSILE) { + if(bFlag & BFLAG_MISSILE) { DrawClippedMissile(sx, sy, dx, dy, 0, 8, 0); } if(bObj != 0 && light_table_index < lightmax) { @@ -930,7 +930,7 @@ void DrawClippedMonster(int x, int y, int mx, int my, int m, int CelSkip, int Ce return; } - if (!(dFlags[x][y] & DFLAG_LIT)) { + if (!(dFlags[x][y] & BFLAG_LIT)) { Cl2DecodeFrm5(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width, CelSkip, CelCap, 1); } else { trans = 0; @@ -1170,10 +1170,10 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks negPlr = dPlayer[sx][sy - 1]; negMon = dMonster[sx][sy - 1]; - if(visiondebug && bFlag & DFLAG_LIT) { + if(visiondebug && bFlag & BFLAG_LIT) { Cel2DecodeHdrOnly(pBuff, (BYTE *)pSquareCel, 1, 64, CelSkip, 8); } - if(MissilePreFlag && bFlag & DFLAG_MISSILE) { + if(MissilePreFlag && bFlag & BFLAG_MISSILE) { DrawClippedMissile(sx, sy, dx, dy, CelSkip, 8, 1); } if(light_table_index < lightmax) { @@ -1232,7 +1232,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks } } } - if(bFlag & DFLAG_PLAYER) { + if(bFlag & BFLAG_PLAYERLR) { p = -(negPlr + 1); if((DWORD)p < MAX_PLRS) { pPlayer = &plr[p]; @@ -1249,7 +1249,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks // app_fatal("draw player clipped: tried to draw illegal player %d", p); } } - if(bFlag & DFLAG_MONSTER && (bFlag & DFLAG_LIT || plr[myplr]._pInfraFlag) && negMon < 0) { + if(bFlag & BFLAG_MONSTLR && (bFlag & BFLAG_LIT || plr[myplr]._pInfraFlag) && negMon < 0) { draw_monster_num = -(negMon + 1); if((DWORD)draw_monster_num < MAXMONSTERS) { pMonster = &monster[draw_monster_num]; @@ -1272,7 +1272,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks // app_fatal("Draw Monster Clipped: tried to draw illegal monster %d", draw_monster_num); } } - if(bFlag & DFLAG_DEAD_PLAYER) { + if(bFlag & BFLAG_DEAD_PLAYER) { DrawDeadPlayer(sx, sy, dx, dy, CelSkip, 8, 1); } if(bPlr > 0) { @@ -1292,7 +1292,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks // app_fatal("draw player clipped: tried to draw illegal player %d", p); } } - if(nMon > 0 && (bFlag & DFLAG_LIT || plr[myplr]._pInfraFlag)) { + if(nMon > 0 && (bFlag & BFLAG_LIT || plr[myplr]._pInfraFlag)) { draw_monster_num = nMon - 1; if((DWORD)draw_monster_num < MAXMONSTERS) { pMonster = &monster[draw_monster_num]; @@ -1315,7 +1315,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks // app_fatal("Draw Monster Clipped: tried to draw illegal monster %d", draw_monster_num); } } - if(bFlag & DFLAG_MISSILE) { + if(bFlag & BFLAG_MISSILE) { DrawClippedMissile(sx, sy, dx, dy, CelSkip, 8, 0); } if(bObj != 0 && light_table_index < lightmax) { @@ -1808,7 +1808,7 @@ void DrawMonster(int x, int y, int mx, int my, int m, int CelSkip, int CelCap) return; } - if (!(dFlags[x][y] & DFLAG_LIT)) { + if (!(dFlags[x][y] & BFLAG_LIT)) { Cl2DecodeFrm3(mx, my, monster[m]._mAnimData, monster[m]._mAnimFrame, monster[m].MType->width, CelSkip, CelCap, 1); } else { trans = 0; diff --git a/Source/themes.cpp b/Source/themes.cpp index 380eda59e..b1f2ba8c2 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -361,7 +361,7 @@ BOOL CheckThemeRoom(int tv) for (i = 0; i < MAXDUNX; i++) { if (dTransVal[i][j] != tv) continue; - if (dFlags[i][j] & DFLAG_POPULATED) + if (dFlags[i][j] & BFLAG_POPULATED) return FALSE; tarea++; @@ -464,7 +464,7 @@ void HoldThemeRooms() for (y = 0; y < MAXDUNY; y++) { for (x = 0; x < MAXDUNX; x++) { if (dTransVal[x][y] == (char)themes[i].ttval) { - dFlags[x][y] |= DFLAG_POPULATED; + dFlags[x][y] |= BFLAG_POPULATED; } } } diff --git a/Source/town.cpp b/Source/town.cpp index 38585296c..8feaf5d4d 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -405,7 +405,7 @@ void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some } Cel2DrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, 8); } - if (dFlags[x][y] & DFLAG_MONSTER) { + if (dFlags[x][y] & BFLAG_MONSTLR) { mi = -(dMonster[x][y - 1] + 1); px = sx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { @@ -421,7 +421,7 @@ void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some } Cel2DrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, 8); } - if (dFlags[x][y] & DFLAG_PLAYER) { + if (dFlags[x][y] & BFLAG_PLAYERLR) { bv = -(dPlayer[x][y - 1] + 1); px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; py = sy + plr[bv]._pyoff; @@ -433,7 +433,7 @@ void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some town_draw_clipped_e_flag(pBuff - 64, x - 1, y + 1, sx - 64, sy); } } - if (dFlags[x][y] & DFLAG_DEAD_PLAYER) { + if (dFlags[x][y] & BFLAG_DEAD_PLAYER) { DrawDeadPlayer(x, y, sx, sy, 0, 8, 1); } if (dPlayer[x][y] > 0) { @@ -448,7 +448,7 @@ void town_draw_clipped_town(BYTE *pBuff, int x, int y, int sx, int sy, BOOL some town_draw_clipped_e_flag(pBuff - 64, x - 1, y + 1, sx - 64, sy); } } - if (dFlags[x][y] & DFLAG_MISSILE) { + if (dFlags[x][y] & BFLAG_MISSILE) { DrawClippedMissile(x, y, sx, sy, 0, 8, 0); } if(dArch[x][y] != 0) { @@ -587,7 +587,7 @@ void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, } Cel2DrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, a5, 8); } - if (dFlags[x][y] & DFLAG_MONSTER) { + if (dFlags[x][y] & BFLAG_MONSTLR) { mi = -(dMonster[x][y - 1] + 1); px = sx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { @@ -603,7 +603,7 @@ void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, } Cel2DrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, a5, 8); } - if (dFlags[x][y] & DFLAG_PLAYER) { + if (dFlags[x][y] & BFLAG_PLAYERLR) { bv = -(dPlayer[x][y - 1] + 1); px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; py = sy + plr[bv]._pyoff; @@ -615,7 +615,7 @@ void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, town_draw_clipped_e_flag_2(pBuff - 64, x - 1, y + 1, a4, a5, sx - 64, sy); } } - if (dFlags[x][y] & DFLAG_DEAD_PLAYER) { + if (dFlags[x][y] & BFLAG_DEAD_PLAYER) { DrawDeadPlayer(x, y, sx, sy, a5, 8, 1); } if (dPlayer[x][y] > 0) { @@ -630,7 +630,7 @@ void town_draw_clipped_town_2(BYTE *pBuff, int x, int y, int a4, int a5, int sx, town_draw_clipped_e_flag_2(pBuff - 64, x - 1, y + 1, a4, a5, sx - 64, sy); } } - if (dFlags[x][y] & DFLAG_MISSILE) { + if (dFlags[x][y] & BFLAG_MISSILE) { DrawClippedMissile(x, y, sx, sy, a5, 8, 0); } if(dArch[x][y] != 0) { @@ -777,7 +777,7 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int /// ASSERT: assert(item[bv]._iAnimData); CelDrawHdrOnly(px, sy, item[bv]._iAnimData, item[bv]._iAnimFrame, item[bv]._iAnimWidth, 0, dir); } - if (dFlags[x][y] & DFLAG_MONSTER) { + if (dFlags[x][y] & BFLAG_MONSTLR) { mi = -(dMonster[x][y - 1] + 1); px = sx - towner[mi]._tAnimWidth2; if (mi == pcursmonst) { @@ -795,7 +795,7 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int /// ASSERT: assert(towner[mi]._tAnimData); CelDrawHdrOnly(px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth, 0, dir); } - if (dFlags[x][y] & DFLAG_PLAYER) { + if (dFlags[x][y] & BFLAG_PLAYERLR) { bv = -(dPlayer[x][y - 1] + 1); px = sx + plr[bv]._pxoff - plr[bv]._pAnimWidth2; py = sy + plr[bv]._pyoff; @@ -808,7 +808,7 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int town_draw_e_flag(pBuff - 64, x - 1, y + 1, a4, dir, sx - 64, sy); } } - if (dFlags[x][y] & DFLAG_DEAD_PLAYER) { + if (dFlags[x][y] & BFLAG_DEAD_PLAYER) { DrawDeadPlayer(x, y, sx, sy, 0, dir, 0); } if (dPlayer[x][y] > 0) { @@ -824,7 +824,7 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int town_draw_e_flag(pBuff - 64, x - 1, y + 1, a4, dir, sx - 64, sy); } } - if (dFlags[x][y] & DFLAG_MISSILE) { + if (dFlags[x][y] & BFLAG_MISSILE) { DrawMissile(x, y, sx, sy, 0, dir, 0); } if(dArch[x][y] != 0) { diff --git a/Source/trigs.cpp b/Source/trigs.cpp index 1cd52a1d1..db1571425 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -595,7 +595,7 @@ void Freeupstairs() for (yy = 0; yy < MAXTRIGGERS; yy++) { for (xx = 0; xx < MAXTRIGGERS; xx++) { - dFlags[tx - 2 + xx][ty - 2 + yy] |= DFLAG_POPULATED; + dFlags[tx - 2 + xx][ty - 2 + yy] |= BFLAG_POPULATED; } } } diff --git a/enums.h b/enums.h index d7b2d4b5c..d39b41d11 100644 --- a/enums.h +++ b/enums.h @@ -1840,14 +1840,14 @@ typedef enum dungeon_type { } dungeon_type; typedef enum dflag { - DFLAG_MISSILE = 0x01, - DFLAG_VISIBLE = 0x02, - DFLAG_DEAD_PLAYER = 0x04, - DFLAG_POPULATED = 0x08, - DFLAG_MONSTER = 0x10, - DFLAG_PLAYER = 0x20, - DFLAG_LIT = 0x40, - DFLAG_EXPLORED = 0x80, + BFLAG_MISSILE = 0x01, + BFLAG_VISIBLE = 0x02, + BFLAG_DEAD_PLAYER = 0x04, + BFLAG_POPULATED = 0x08, + BFLAG_MONSTLR = 0x10, + BFLAG_PLAYERLR = 0x20, + BFLAG_LIT = 0x40, + BFLAG_EXPLORED = 0x80, } dflag; typedef enum dungeon_message {