diff --git a/Source/_render.cpp b/Source/_render.cpp index 582ce3786..32a18be26 100644 --- a/Source/_render.cpp +++ b/Source/_render.cpp @@ -741,7 +741,7 @@ __declspec(naked) void drawTopArchesUpperScreen(BYTE *pBuff) mov edx, esi and edx, 2 add esi, edx - // loc_4637C0: + // loc_4637C0: sub edi, 320h add edi, ebp sub ebp, 2 @@ -876,7 +876,7 @@ __declspec(naked) void drawTopArchesUpperScreen(BYTE *pBuff) mov edx, esi and edx, 2 add esi, edx - // loc_4638F1: + // loc_4638F1: sub edi, 320h add edi, ebp add ebp, 2 @@ -1198,7 +1198,7 @@ __declspec(naked) void drawTopArchesUpperScreen(BYTE *pBuff) mov edx, esi and edx, 2 add esi, edx - // loc_463BDB: + // loc_463BDB: sub edi, 320h add edi, ebp sub ebp, 2 @@ -5465,7 +5465,7 @@ __declspec(naked) void drawTopArchesLowerScreen(BYTE *pBuff) mov edx, esi and edx, 2 add esi, edx - // loc_466780: + // loc_466780: sub edi, 320h add edi, ebp sub ebp, 2 @@ -5623,7 +5623,7 @@ __declspec(naked) void drawTopArchesLowerScreen(BYTE *pBuff) mov edx, esi and edx, 2 add esi, edx - // loc_4668F8: + // loc_4668F8: sub edi, 320h add edi, ebp add ebp, 2 @@ -5999,7 +5999,7 @@ __declspec(naked) void drawTopArchesLowerScreen(BYTE *pBuff) mov edx, esi and edx, 2 add esi, edx - // loc_466C80: + // loc_466C80: sub edi, 320h add edi, ebp sub ebp, 2 @@ -6289,7 +6289,7 @@ __declspec(naked) void drawTopArchesLowerScreen(BYTE *pBuff) sub edi, 320h sub edx, 2 jge loc_466EC1 - // loc_466F3F: + // loc_466F3F: mov edx, 2 mov eax, edi sub eax, gpBufEnd @@ -6630,7 +6630,7 @@ __declspec(naked) void drawTopArchesLowerScreen(BYTE *pBuff) sub edi, 320h sub edx, 2 jge loc_467240 - // loc_4672BE: + // loc_4672BE: mov edx, 8 loc_4672C3: cmp edi, gpBufEnd diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 431187476..c892654cd 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -519,7 +519,7 @@ static void FreeDlg() #ifdef HELLFIRE __declspec(naked) #endif -void __cdecl app_fatal(const char *pszFmt, ...) + void __cdecl app_fatal(const char *pszFmt, ...) { va_list va; diff --git a/Source/automap.cpp b/Source/automap.cpp index bc1d6d52a..86e440e08 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -462,7 +462,7 @@ void SearchAutomapItem() for (i = x1; i < x2; i++) { for (j = y1; j < y2; j++) { - if (dItem[i][j] != 0){ + if (dItem[i][j] != 0) { px = i - 2 * AutoMapXOfs - ViewX; py = j - 2 * AutoMapYOfs - ViewY; diff --git a/Source/diablo.cpp b/Source/diablo.cpp index e582279a1..1ed23971f 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -874,7 +874,7 @@ static BOOL LeftMouseDown(int wParam) if (doomflag) { doom_close(); return FALSE; - } + } if (spselflag) { SetSpell(); @@ -919,7 +919,6 @@ static BOOL LeftMouseDown(int wParam) if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) NewCursor(CURSOR_HAND); } - return FALSE; } @@ -1686,7 +1685,7 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) void LoadLvlGFX() { - assert(! pDungeonCels); + assert(!pDungeonCels); switch (leveltype) { case DTYPE_TOWN: @@ -1756,7 +1755,7 @@ void LoadLvlGFX() void LoadAllGFX() { - assert(! pSpeedCels); + assert(!pSpeedCels); pSpeedCels = DiabloAllocPtr(0x100000); IncProgress(); IncProgress(); @@ -1782,7 +1781,7 @@ void CreateLevel(int lvldir) InitL1Triggers(); Freeupstairs(); #ifdef HELLFIRE - if(currlevel < 21) { + if (currlevel < 21) { LoadRndLvlPal(1); } else { LoadRndLvlPal(5); @@ -1803,7 +1802,7 @@ void CreateLevel(int lvldir) InitL3Triggers(); Freeupstairs(); #ifdef HELLFIRE - if(currlevel < 17) { + if (currlevel < 17) { LoadRndLvlPal(3); } else { LoadRndLvlPal(6); @@ -1922,7 +1921,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) InitObjects(); InitItems(); #ifdef HELLFIRE - if ( currlevel < 17 ) + if (currlevel < 17) #endif CreateThemeRooms(); glMid3Seed[currlevel] = GetRndSeed(); @@ -1967,7 +1966,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) ResyncMPQuests(); #ifndef SPAWN } else { - assert(! pSpeedCels); + assert(!pSpeedCels); pSpeedCels = DiabloAllocPtr(0x100000); LoadSetMap(); IncProgress(); @@ -2036,21 +2035,18 @@ void LoadGameLevel(BOOL firstflag, int lvldir) } #ifdef HELLFIRE - if ( currlevel >= 21 ) - { - if ( currlevel == 21 ) - { + if (currlevel >= 21) { + if (currlevel == 21) { items_427ABA(CornerStone.x, CornerStone.y); } - if ( quests[Q_NAKRUL]._qactive == QUEST_DONE && currlevel == 24 ) - { + if (quests[Q_NAKRUL]._qactive == QUEST_DONE && currlevel == 24) { objects_454BA8(); } } #endif #ifdef HELLFIRE - if ( currlevel >= 17 ) + if (currlevel >= 17) music_start(currlevel > 20 ? TMUSIC_L5 : TMUSIC_L6); else music_start(leveltype); @@ -2189,13 +2185,13 @@ static PlayerStruct *get_plr_mem(PlayerStruct *p) r = malloc(rand() & 0x7FFF); pPlayer = (PlayerStruct *)malloc(sizeof(PlayerStruct) * MAX_PLRS); - if(r != NULL) { + if (r != NULL) { free(r); } - if(pPlayer == NULL) { + if (pPlayer == NULL) { return p; } - if(p != NULL) { + if (p != NULL) { memcpy(pPlayer, p, sizeof(PlayerStruct) * MAX_PLRS); free(p); } @@ -2207,7 +2203,7 @@ void alloc_plr() { plr = get_plr_mem(NULL); - if(plr == NULL) { + if (plr == NULL) { app_fatal("Unable to initialize memory"); } diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 1d76c8629..3a6cc4055 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -566,288 +566,285 @@ void drlg_l1_crypt_lavafloor() { int i, j; - for ( j = 1; j < 40; j++ ) - { - for ( i = 1; i < 40; i++ ) - { - switch ( dungeon[i][j] ) - { + for (j = 1; j < 40; j++) { + for (i = 1; i < 40; i++) { + switch (dungeon[i][j]) { case 5: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 7: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 8: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 9: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 10: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 11: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 12: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 14: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 15: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 17: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 95: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 96: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 208; break; case 116: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 118: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 119: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 120: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 121: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 122: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 211; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 212; break; case 123: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 125: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 126: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 128: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 133: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 135: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 136: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 137: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 213; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 214; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 138: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 139: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 215; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 216; break; case 140: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 217; break; case 142: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 143: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 213; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 214; break; case 145: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 213; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 214; break; case 150: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 217; break; case 152: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 153: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 154: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 155: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 205; break; case 156: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 157: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 217; break; case 159: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 160: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 206; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 207; break; case 162: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 209; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 210; break; case 167: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 209; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 210; break; case 187: - if ( dungeon[i][j - 1] == 13 ) + if (dungeon[i][j - 1] == 13) dungeon[i][j - 1] = 208; break; case 185: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 186: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 203; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 204; break; case 192: - if ( dungeon[i - 1][j] == 13 ) + if (dungeon[i - 1][j] == 13) dungeon[i - 1][j] = 209; - if ( dungeon[i - 1][j - 1] == 13 ) + if (dungeon[i - 1][j - 1] == 13) dungeon[i - 1][j - 1] = 210; break; } @@ -2527,15 +2524,15 @@ static void DRLG_L5DirtFix() } else { for (j = 0; j < DMAXY - 1; j++) { for (i = 0; i < DMAXX - 1; i++) { - if ( dungeon[i][j] == 19 ) + if (dungeon[i][j] == 19) dungeon[i][j] = 83; - if ( dungeon[i][j] == 21 ) + if (dungeon[i][j] == 21) dungeon[i][j] = 85; - if ( dungeon[i][j] == 23 ) + if (dungeon[i][j] == 23) dungeon[i][j] = 87; - if ( dungeon[i][j] == 24 ) + if (dungeon[i][j] == 24) dungeon[i][j] = 88; - if ( dungeon[i][j] == 18 ) + if (dungeon[i][j] == 18) dungeon[i][j] = 82; } } @@ -2645,82 +2642,64 @@ static void DRLG_L5(int entry) } #ifdef HELLFIRE } else if (entry == 0) { - if ( currlevel < 21 ) - { - if ( DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0 ) + if (currlevel < 21) { + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) doneflag = 0; - if ( DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0 ) + if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) doneflag = 0; - } - else if ( currlevel == 21 ) - { - if ( DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, 0, -1, 6) < 0 ) + } else if (currlevel == 21) { + if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, 0, -1, 6) < 0) doneflag = 0; - if ( DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0 ) + if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) doneflag = 0; ViewY++; - } - else - { - if ( DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0 ) + } else { + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) doneflag = 0; - if ( currlevel != 24 ) - { - if ( DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0 ) + if (currlevel != 24) { + if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) doneflag = 0; } ViewY++; } - } else if ( entry == 1 ) { - if ( currlevel < 21 ) - { - if ( DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 0, -1, 0) < 0 ) + } else if (entry == 1) { + if (currlevel < 21) { + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 0, -1, 0) < 0) doneflag = 0; - if ( DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0 ) + if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0) doneflag = 0; ViewY--; - } - else if ( currlevel == 21 ) - { - if ( DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, 0, -1, 6) < 0 ) + } else if (currlevel == 21) { + if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, 0, -1, 6) < 0) doneflag = 0; - if ( DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0 ) + if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0) doneflag = 0; ViewY += 3; - } - else - { - if ( DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0 ) + } else { + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) doneflag = 0; - if ( currlevel != 24 ) - { - if ( DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0 ) + if (currlevel != 24) { + if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 1, -1, 1) < 0) doneflag = 0; } ViewY += 3; } } else { - if ( currlevel < 21 ) - { - if ( DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 0, -1, 0) < 0 ) + if (currlevel < 21) { + if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, 0, -1, 0) < 0) doneflag = 0; - if ( DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0 ) + if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) doneflag = 0; - } - else if ( currlevel == 21 ) - { - if ( DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, 1, -1, 6) < 0 ) + } else if (currlevel == 21) { + if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, 1, -1, 6) < 0) doneflag = 0; - if ( DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0 ) + if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) doneflag = 0; - } - else - { - if ( DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0 ) + } else { + if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, 1, -1, 0) < 0) doneflag = 0; - if ( currlevel != 24 ) - { - if ( DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0 ) + if (currlevel != 24) { + if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, 0, -1, 1) < 0) doneflag = 0; } } @@ -2763,12 +2742,9 @@ static void DRLG_L5(int entry) } #ifdef HELLFIRE - if ( currlevel < 21 ) - { + if (currlevel < 21) { DRLG_L5Subs(); - } - else - { + } else { drlg_l1_crypt_pattern1(10); drlg_l1_crypt_rndset(byte_48A1B4, 95); drlg_l1_crypt_rndset(byte_48A1B8, 95); @@ -2776,8 +2752,7 @@ static void DRLG_L5(int entry) drlg_l1_crypt_rndset(byte_48A1C8, 100); drlg_l1_crypt_rndset(byte_48A1E0, 60); drlg_l1_crypt_lavafloor(); - switch ( currlevel ) - { + switch (currlevel) { case 21: drlg_l1_crypt_pattern2(30); drlg_l1_crypt_pattern3(15); @@ -2875,24 +2850,20 @@ void CreateL5Dungeon(DWORD rseed, int entry) DRLG_FreeL1SP(); #ifdef HELLFIRE - if ( currlevel < 17 ) + if (currlevel < 17) DRLG_InitL1Vals(); else DRLG_InitL5Vals(); DRLG_SetPC(); - for ( j = dminy; j < dmaxy; j++ ) - { - for ( i = dminx; i < dmaxx; i++ ) - { - if ( dPiece[i][j] == 290 ) - { + for (j = dminy; j < dmaxy; j++) { + for (i = dminx; i < dmaxx; i++) { + if (dPiece[i][j] == 290) { UberRow = i; UberCol = j; } - if ( dPiece[i][j] == 317 ) - { + if (dPiece[i][j] == 317) { CornerStone.x = i; CornerStone.y = j; } diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 28324e638..55a47643c 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -57,7 +57,7 @@ BYTE VARCH2[] = { 47, 44, 0, 0, // clang-format on - }; +}; /** Miniset: Arch vertical. */ BYTE VARCH3[] = { // clang-format off @@ -354,6 +354,7 @@ BYTE VARCH21[] = { }; /** Miniset: Arch vertical - open wall. */ BYTE VARCH22[] = { + // clang-format off 2, 3, // width, height 2, 7, // search diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 548fb888d..b3937c58b 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -503,7 +503,7 @@ const BYTE L3XTRA5[] = { /** Miniset: Anvil of Fury island. */ const BYTE L3ANVIL[] = { - // clang-format on + // clang-format off 11, 11, // width, height 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // search @@ -541,7 +541,7 @@ const BYTE byte_48A780[] = { 1, 1, 7, 30 }; const BYTE byte_48A784[] = { 1, 1, 7, 31 }; const BYTE byte_48A788[] = { 1, 1, 7, 32 }; const BYTE byte_48A790[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -554,7 +554,7 @@ const BYTE byte_48A790[] = { // clang-format on }; const BYTE byte_48A7A8[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -585,7 +585,7 @@ const BYTE byte_48A7F8[] = { 1, 1, 10, 48 }; const BYTE byte_48A7FC[] = { 1, 1, 11, 49 }; const BYTE byte_48A800[] = { 1, 1, 11, 50 }; const BYTE byte_48A808[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -598,7 +598,7 @@ const BYTE byte_48A808[] = { // clang-format on }; const BYTE byte_48A820[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -611,7 +611,7 @@ const BYTE byte_48A820[] = { // clang-format on }; const BYTE byte_48A838[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -624,7 +624,7 @@ const BYTE byte_48A838[] = { // clang-format on }; const BYTE byte_48A850[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -637,7 +637,7 @@ const BYTE byte_48A850[] = { // clang-format on }; const BYTE byte_48A868[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -650,7 +650,7 @@ const BYTE byte_48A868[] = { // clang-format on }; const BYTE byte_48A880[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -663,7 +663,7 @@ const BYTE byte_48A880[] = { // clang-format on }; const BYTE byte_48A898[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -676,7 +676,7 @@ const BYTE byte_48A898[] = { // clang-format on }; const BYTE byte_48A8B0[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -689,7 +689,7 @@ const BYTE byte_48A8B0[] = { // clang-format on }; const BYTE byte_48A8C8[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -702,7 +702,7 @@ const BYTE byte_48A8C8[] = { // clang-format on }; const BYTE byte_48A8E0[] = { - // clang-format on + // clang-format off 3, 3, // width, height 7, 7, 7, // search @@ -715,7 +715,7 @@ const BYTE byte_48A8E0[] = { // clang-format on }; const BYTE L6ISLE1[] = { - // clang-format on + // clang-format off 2, 3, // width, height 5, 14, // search @@ -728,7 +728,7 @@ const BYTE L6ISLE1[] = { // clang-format on }; const BYTE L6ISLE2[] = { - // clang-format on + // clang-format off 3, 2, // width, height 5, 2, 14, // search @@ -739,7 +739,7 @@ const BYTE L6ISLE2[] = { // clang-format on }; const BYTE L6ISLE3[] = { - // clang-format on + // clang-format off 2, 3, // width, height 5, 14, // search @@ -752,7 +752,7 @@ const BYTE L6ISLE3[] = { // clang-format on }; const BYTE L6ISLE4[] = { - // clang-format on + // clang-format off 3, 2, // width, height 5, 2, 14, // search @@ -763,7 +763,7 @@ const BYTE L6ISLE4[] = { // clang-format on }; const BYTE L6ISLE5[] = { - // clang-format on + // clang-format off 2, 2, // width, height 5, 14, // search @@ -774,7 +774,7 @@ const BYTE L6ISLE5[] = { // clang-format on }; const BYTE byte_48A948[] = { - // clang-format on + // clang-format off 4, 4, // width, height 7, 7, 7, 7, // search @@ -789,7 +789,7 @@ const BYTE byte_48A948[] = { // clang-format on }; const BYTE byte_48A970[] = { - // clang-format on + // clang-format off 4, 4, // width, height 7, 7, 7, 7, // search @@ -804,7 +804,7 @@ const BYTE byte_48A970[] = { // clang-format on }; const BYTE byte_48A998[] = { - // clang-format on + // clang-format off 4, 5, // width, height 7, 7, 7, 7, // search @@ -821,7 +821,7 @@ const BYTE byte_48A998[] = { // clang-format on }; const BYTE byte_48A9C8[] = { - // clang-format on + // clang-format off 4, 5, // width, height 7, 7, 7, 7, // search @@ -2359,7 +2359,7 @@ static void DRLG_L3(int entry) genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, TRUE, 0); #ifdef HELLFIRE } else { - if ( currlevel != 17 ) + if (currlevel != 17) genok = DRLG_L3PlaceMiniSet(L6UP, 1, 1, -1, -1, TRUE, 0); else genok = DRLG_L3PlaceMiniSet(L6HOLDWARP, 1, 1, -1, -1, TRUE, 6); @@ -2372,7 +2372,7 @@ static void DRLG_L3(int entry) genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, FALSE, 1); #ifdef HELLFIRE } else { - if ( currlevel != 20 ) + if (currlevel != 20) genok = DRLG_L3PlaceMiniSet(L6DOWN, 1, 1, -1, -1, FALSE, 1); } #endif @@ -2387,7 +2387,7 @@ static void DRLG_L3(int entry) genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, FALSE, 0); #ifdef HELLFIRE } else { - if ( currlevel != 17 ) + if (currlevel != 17) genok = DRLG_L3PlaceMiniSet(L6UP, 1, 1, -1, -1, FALSE, 0); else genok = DRLG_L3PlaceMiniSet(L6HOLDWARP, 1, 1, -1, -1, FALSE, 6); @@ -2402,8 +2402,7 @@ static void DRLG_L3(int entry) ViewY -= 2; #ifdef HELLFIRE } else { - if ( currlevel != 20 ) - { + if (currlevel != 20) { genok = DRLG_L3PlaceMiniSet(L6DOWN, 1, 1, -1, -1, TRUE, 1); ViewX += 2; ViewY -= 2; @@ -2421,7 +2420,7 @@ static void DRLG_L3(int entry) genok = DRLG_L3PlaceMiniSet(L3UP, 1, 1, -1, -1, FALSE, 0); #ifdef HELLFIRE } else { - if ( currlevel != 17 ) + if (currlevel != 17) genok = DRLG_L3PlaceMiniSet(L6UP, 1, 1, -1, -1, FALSE, 0); else genok = DRLG_L3PlaceMiniSet(L6HOLDWARP, 1, 1, -1, -1, TRUE, 6); @@ -2434,7 +2433,7 @@ static void DRLG_L3(int entry) genok = DRLG_L3PlaceMiniSet(L3DOWN, 1, 1, -1, -1, FALSE, 1); #ifdef HELLFIRE } else { - if ( currlevel != 20 ) + if (currlevel != 20) genok = DRLG_L3PlaceMiniSet(L6DOWN, 1, 1, -1, -1, FALSE, 1); } #endif @@ -2457,7 +2456,7 @@ static void DRLG_L3(int entry) lavapool += drlg_l3_hive_rnd_piece(byte_48A9C8, 40); lavapool += drlg_l3_hive_rnd_piece(byte_48A948, 50); lavapool += drlg_l3_hive_rnd_piece(byte_48A970, 60); - if ( lavapool < 3 ) + if (lavapool < 3) lavapool = FALSE; } #endif diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 14c6a920a..2c0823f05 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -241,9 +241,9 @@ static void L4makeDmt() for (j = 0, dmty = 1; dmty <= 77; j++, dmty += 2) { for (i = 0, dmtx = 1; dmtx <= 77; i++, dmtx += 2) { val = 8 * L4dungeon[dmtx + 1][dmty + 1] - + 4 * L4dungeon[dmtx][dmty + 1] - + 2 * L4dungeon[dmtx + 1][dmty] - + L4dungeon[dmtx][dmty]; + + 4 * L4dungeon[dmtx][dmty + 1] + + 2 * L4dungeon[dmtx + 1][dmty] + + L4dungeon[dmtx][dmty]; idx = L4ConvTbl[val]; dungeon[i][j] = idx; } diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index a733fc9fd..003815f76 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -13,7 +13,7 @@ BOOL jogging_opt = TRUE; /** Contains the game menu items of the single player menu. */ TMenuItem sgSingleMenu[] = { -// clang-format off + // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Save Game", &gamemenu_save_game }, { GMENU_ENABLED, "Options", &gamemenu_options }, @@ -25,11 +25,11 @@ TMenuItem sgSingleMenu[] = { { GMENU_ENABLED, "Quit Hellfire", &gamemenu_quit_game }, #endif { GMENU_ENABLED, NULL, NULL } -// clang-format on + // clang-format on }; /** Contains the game menu items of the multi player menu. */ TMenuItem sgMultiMenu[] = { -// clang-format off + // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Options", &gamemenu_options }, { GMENU_ENABLED, "New Game", &gamemenu_new_game }, @@ -40,10 +40,10 @@ TMenuItem sgMultiMenu[] = { { GMENU_ENABLED, "Quit Hellfire", &gamemenu_quit_game }, #endif { GMENU_ENABLED, NULL, NULL }, -// clang-format on + // clang-format on }; TMenuItem sgOptionsMenu[] = { -// clang-format off + // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_music_volume }, { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_sound_volume }, @@ -55,7 +55,7 @@ TMenuItem sgOptionsMenu[] = { #endif { GMENU_ENABLED , "Previous Menu", &gamemenu_previous }, { GMENU_ENABLED , NULL, NULL }, -// clang-format on + // clang-format on }; /** Specifies the menu names for music enabled and disabled. */ const char *const music_toggle_names[] = { @@ -303,17 +303,17 @@ void gamemenu_music_volume(BOOL bActivate) #else music_start(leveltype); #endif - } - } else { - volume = gamemenu_slider_music_sound(&sgOptionsMenu[0]); - sound_get_or_set_music_volume(volume); - if (volume == VOLUME_MIN) { - if (gbMusicOn) { - gbMusicOn = FALSE; - music_stop(); - } - } else if (!gbMusicOn) { - gbMusicOn = TRUE; + } + } else { + volume = gamemenu_slider_music_sound(&sgOptionsMenu[0]); + sound_get_or_set_music_volume(volume); + if (volume == VOLUME_MIN) { + if (gbMusicOn) { + gbMusicOn = FALSE; + music_stop(); + } + } else if (!gbMusicOn) { + gbMusicOn = TRUE; #ifdef HELLFIRE int lt; if (currlevel >= 17) { @@ -327,9 +327,9 @@ void gamemenu_music_volume(BOOL bActivate) #else music_start(leveltype); #endif - } - } - gamemenu_get_music(); + } + } + gamemenu_get_music(); } void gamemenu_sound_volume(BOOL bActivate) diff --git a/Source/gendung.cpp b/Source/gendung.cpp index d68e08669..7c312767d 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -176,7 +176,7 @@ void FillSolidBlockTbls() break; case DTYPE_CATHEDRAL: #ifdef HELLFIRE - if ( currlevel < 17 ) + if (currlevel < 17) pSBFile = LoadFileInMem("Levels\\L1Data\\L1.SOL", &dwTiles); else pSBFile = LoadFileInMem("NLevels\\L5Data\\L5.SOL", &dwTiles); @@ -189,7 +189,7 @@ void FillSolidBlockTbls() break; case DTYPE_CAVES: #ifdef HELLFIRE - if ( currlevel < 17 ) + if (currlevel < 17) pSBFile = LoadFileInMem("Levels\\L3Data\\L3.SOL", &dwTiles); else pSBFile = LoadFileInMem("NLevels\\L6Data\\L6.SOL", &dwTiles); diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 0aa313bac..3e9291eaf 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -236,7 +236,7 @@ void gmenu_draw() #ifdef HELLFIRE ticks = GetTickCount(); if ((int)(ticks - LogoAnim_tick) > 25) { - LogoAnim_frame++; + LogoAnim_frame++; if (LogoAnim_frame > 16) LogoAnim_frame = 1; LogoAnim_tick = ticks; diff --git a/Source/inv.cpp b/Source/inv.cpp index da20fae26..adef1a812 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -228,7 +228,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -250,7 +250,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -276,7 +276,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -288,7 +288,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw(RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw(RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -298,7 +298,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -324,7 +324,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -336,7 +336,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw(RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw(RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -346,7 +346,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -372,7 +372,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -384,7 +384,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw(RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw(RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -394,7 +394,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -423,7 +423,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, screen_x, screen_y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -435,7 +435,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw(screen_x, screen_y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -445,7 +445,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(screen_x, screen_y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -464,8 +464,8 @@ void DrawInv() cel_transparency_active = TRUE; pBuff = frame_width == INV_SLOT_SIZE_PX - ? &gpBuffer[SCREENXY(RIGHT_PANEL_X + 197, SCREEN_Y)] - : &gpBuffer[SCREENXY(RIGHT_PANEL_X + 183, SCREEN_Y)]; + ? &gpBuffer[SCREENXY(RIGHT_PANEL_X + 197, SCREEN_Y)] + : &gpBuffer[SCREENXY(RIGHT_PANEL_X + 183, SCREEN_Y)]; #ifdef HELLFIRE if (frame <= 179) { #endif @@ -502,7 +502,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, screen_x, screen_y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -514,7 +514,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw(screen_x, screen_y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -524,7 +524,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(screen_x, screen_y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(screen_x, screen_y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -550,7 +550,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline(color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline(color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -562,7 +562,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw(RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw(RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8); @@ -572,7 +572,7 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed(RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed(RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -612,11 +612,11 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelBlitOutline( - color, - InvRect[j + SLOTXY_INV_FIRST].X + SCREEN_X, - InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1, - pCursCels, frame, frame_width, 0, 8); + CelBlitOutline( + color, + InvRect[j + SLOTXY_INV_FIRST].X + SCREEN_X, + InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1, + pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelBlitOutline( @@ -632,10 +632,10 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelClippedDraw( - InvRect[j + SLOTXY_INV_FIRST].X + SCREEN_X, - InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1, - pCursCels, frame, frame_width, 0, 8); + CelClippedDraw( + InvRect[j + SLOTXY_INV_FIRST].X + SCREEN_X, + InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1, + pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE } else { CelClippedDraw( @@ -648,10 +648,10 @@ void DrawInv() #ifdef HELLFIRE if (frame <= 179) { #endif - CelDrawLightRed( - InvRect[j + SLOTXY_INV_FIRST].X + SCREEN_X, - InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1, - pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed( + InvRect[j + SLOTXY_INV_FIRST].X + SCREEN_X, + InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1, + pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE } else { CelDrawLightRed( @@ -694,7 +694,7 @@ void DrawInvBelt() #ifdef HELLFIRE if (frame <= 179) #endif - CelBlitOutline(color, InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels, frame, frame_width, 0, 8); + CelBlitOutline(color, InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE else CelBlitOutline(color, InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels2, frame - 179, frame_width, 0, 8); @@ -705,7 +705,7 @@ void DrawInvBelt() #ifdef HELLFIRE if (frame <= 179) #endif - CelClippedDraw(InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels, frame, frame_width, 0, 8); + CelClippedDraw(InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels, frame, frame_width, 0, 8); #ifdef HELLFIRE else CelClippedDraw(InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels2, frame - 179, frame_width, 0, 8); @@ -714,7 +714,7 @@ void DrawInvBelt() #ifdef HELLFIRE if (frame <= 179) #endif - CelDrawLightRed(InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels, frame, frame_width, 0, 8, 1); + CelDrawLightRed(InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels, frame, frame_width, 0, 8, 1); #ifdef HELLFIRE else CelDrawLightRed(InvRect[i + SLOTXY_BELT_FIRST].X + SCREEN_X, InvRect[i + SLOTXY_BELT_FIRST].Y + SCREEN_Y - 1, pCursCels2, frame - 179, frame_width, 0, 8, 1); @@ -1095,13 +1095,12 @@ void CheckInvPaste(int pnum, int mx, int my) done = TRUE; if (il == ILOC_ONEHAND && plr[pnum].HoldItem._iLoc == ILOC_TWOHAND) { #ifdef HELLFIRE - if (plr[pnum]._pClass == PC_BARBARIAN - && (plr[pnum].HoldItem._itype == ITYPE_SWORD || plr[pnum].HoldItem._itype == ITYPE_MACE) - ) - il = ILOC_ONEHAND; - else + if (plr[pnum]._pClass == PC_BARBARIAN + && (plr[pnum].HoldItem._itype == ITYPE_SWORD || plr[pnum].HoldItem._itype == ITYPE_MACE)) + il = ILOC_ONEHAND; + else #endif - il = ILOC_TWOHAND; + il = ILOC_TWOHAND; done = TRUE; } if (plr[pnum].HoldItem._iLoc == ILOC_UNEQUIPABLE && il == ILOC_BELT) { @@ -2761,9 +2760,9 @@ void UseStaffCharge(int pnum) if (plr[pnum].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_NONE && (plr[pnum].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_STAFF #ifdef HELLFIRE - || plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_UNIQUE // BUGFIX: myplr->pnum + || plr[myplr].InvBody[INVLOC_HAND_LEFT]._iMiscId == IMISC_UNIQUE // BUGFIX: myplr->pnum #endif - ) + ) && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iSpell == plr[pnum]._pRSpell && plr[pnum].InvBody[INVLOC_HAND_LEFT]._iCharges > 0) { plr[pnum].InvBody[INVLOC_HAND_LEFT]._iCharges--; diff --git a/Source/inv.h b/Source/inv.h index f25f4ac31..b7326fc2b 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -37,7 +37,8 @@ void DrawInvMsg(const char *msg); int InvPutItem(int pnum, int x, int y); int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, DWORD ibuff #ifdef HELLFIRE - , int to_hit, int max_dam, int min_str, int min_mag, int min_dex, int ac + , + int to_hit, int max_dam, int min_str, int min_mag, int min_dex, int ac #endif ); char CheckInvHLight(); diff --git a/Source/itemdat.cpp b/Source/itemdat.cpp index 503771a06..140551a81 100644 --- a/Source/itemdat.cpp +++ b/Source/itemdat.cpp @@ -323,7 +323,7 @@ const PLStruct PL_Prefix[] = { /** Contains the data related to each item suffix. */ const PLStruct PL_Suffix[] = { - // clang-format off +// clang-format off // PLName, PLPower, PLParam1, PLParam2, PLMinLvl, PLIType, PLGOE, PLDouble, PLOk, PLMinVal, PLMaxVal, PLMultVal #ifdef HELLFIRE { "quality", IPL_DAMMOD, 1, 2, 2, PLT_WEAP | PLT_STAFF | PLT_BOW , 0, FALSE, TRUE, 100, 200, 2 }, diff --git a/Source/items.cpp b/Source/items.cpp index bfc15a4f5..72d50b3a4 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -304,6 +304,7 @@ char *off_4A5AC4 = "SItem"; int idoppely = 16; /** Maps from Griswold premium item number to a quality level delta as added to the base quality level. */ int premiumlvladd[SMITH_PREMIUM_ITEMS] = { + // clang-format off -1, -1, #ifdef HELLFIRE @@ -325,6 +326,7 @@ int premiumlvladd[SMITH_PREMIUM_ITEMS] = { 3, 3, #endif + // clang-format on }; #ifdef HELLFIRE @@ -436,14 +438,14 @@ int items_42342E(int i) res = 0; for (j = 0; j < NUM_INVLOC; j++) { - if (plr[i].InvBody[j]._iClass != ITYPE_NONE && - (plr[i].InvBody[j]._itype == ITYPE_LARMOR || plr[i].InvBody[j]._itype == ITYPE_MARMOR || plr[i].InvBody[j]._itype == ITYPE_HARMOR) - && res < plr[i].InvBody[j]._iIvalue) + if (plr[i].InvBody[j]._iClass != ITYPE_NONE + && (plr[i].InvBody[j]._itype == ITYPE_LARMOR || plr[i].InvBody[j]._itype == ITYPE_MARMOR || plr[i].InvBody[j]._itype == ITYPE_HARMOR) + && res < plr[i].InvBody[j]._iIvalue) res = plr[i].InvBody[j]._iIvalue; } for (j = 0; j < NUM_INV_GRID_ELEM; j++) { - if (plr[i].InvList[j]._iClass != ITYPE_NONE && - (plr[i].InvList[j]._itype == ITYPE_LARMOR || plr[i].InvList[j]._itype == ITYPE_MARMOR || plr[i].InvList[j]._itype == ITYPE_HARMOR) + if (plr[i].InvList[j]._iClass != ITYPE_NONE + && (plr[i].InvList[j]._itype == ITYPE_LARMOR || plr[i].InvList[j]._itype == ITYPE_MARMOR || plr[i].InvList[j]._itype == ITYPE_HARMOR) && res < plr[i].InvList[j]._iIvalue) res = plr[i].InvList[j]._iIvalue; } @@ -893,9 +895,9 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) else if (plr[p].InvBody[INVLOC_HAND_RIGHT]._itype == ITYPE_SHIELD) plr[p]._pIAC -= plr[p].InvBody[INVLOC_HAND_RIGHT]._iAC / 2; } else if (plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_STAFF && plr[p].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_STAFF && plr[p].InvBody[INVLOC_HAND_LEFT]._itype != ITYPE_BOW && plr[p].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_BOW) { - plr[p]._pDamageMod += plr[p]._pLevel * plr[p]._pVitality / 100; + plr[p]._pDamageMod += plr[p]._pLevel * plr[p]._pVitality / 100; } - plr[p]._pIAC += plr[p]._pLevel/4; + plr[p]._pIAC += plr[p]._pLevel / 4; } #endif else { @@ -1744,12 +1746,12 @@ void GetBookSpell(int i, int lvl) #ifdef HELLFIRE else #endif - if (spelldata[bs].sType == STYPE_LIGHTNING) + if (spelldata[bs].sType == STYPE_LIGHTNING) item[i]._iCurs = ICURS_BOOK_BLUE; #ifdef HELLFIRE else #endif - if (spelldata[bs].sType == STYPE_MAGIC) + if (spelldata[bs].sType == STYPE_MAGIC) item[i]._iCurs = ICURS_BOOK_GREY; } @@ -2568,7 +2570,7 @@ void GetItemBonus(int i, int idata, int minlvl, int maxlvl, BOOL onlygood) #ifdef HELLFIRE if (allowspells) #endif - GetStaffSpell(i, maxlvl, onlygood); + GetStaffSpell(i, maxlvl, onlygood); #ifdef HELLFIRE else GetItemPower(i, minlvl, maxlvl, 0x100, onlygood); @@ -2626,7 +2628,7 @@ int RndItem(int m) for (i = 0; AllItemsList[i].iLoc != ILOC_INVALID; i++) { if (AllItemsList[i].iRnd == IDROP_DOUBLE && monster[m].mLevel >= AllItemsList[i].iMinMLvl #ifdef HELLFIRE - && ri < 512 + && ri < 512 #endif ) { ril[ri] = i; @@ -2634,7 +2636,7 @@ int RndItem(int m) } if (AllItemsList[i].iRnd && monster[m].mLevel >= AllItemsList[i].iMinMLvl #ifdef HELLFIRE - && ri < 512 + && ri < 512 #endif ) { ril[ri] = i; @@ -4010,7 +4012,7 @@ void PrintItemPower(char plidx, ItemStruct *x) sprintf(tempstr, "Fire hit damage: %i", x->_iFMinDam); else #endif - sprintf(tempstr, "Fire hit damage: %i-%i", x->_iFMinDam, x->_iFMaxDam); + sprintf(tempstr, "Fire hit damage: %i-%i", x->_iFMinDam, x->_iFMaxDam); break; case IPL_LIGHTDAM: #ifdef HELLFIRE @@ -4018,7 +4020,7 @@ void PrintItemPower(char plidx, ItemStruct *x) sprintf(tempstr, "Lightning hit damage: %i", x->_iLMinDam); else #endif - sprintf(tempstr, "Lightning hit damage: %i-%i", x->_iLMinDam, x->_iLMaxDam); + sprintf(tempstr, "Lightning hit damage: %i-%i", x->_iLMinDam, x->_iLMaxDam); break; case IPL_STR: case IPL_STR_CURSE: @@ -4078,7 +4080,7 @@ void PrintItemPower(char plidx, ItemStruct *x) sprintf(tempstr, "fire arrows damage: %i", x->_iFMinDam); else #endif - sprintf(tempstr, "fire arrows damage: %i-%i", x->_iFMinDam, x->_iFMaxDam); + sprintf(tempstr, "fire arrows damage: %i-%i", x->_iFMinDam, x->_iFMaxDam); break; case IPL_LIGHT_ARROWS: #ifdef HELLFIRE @@ -4086,7 +4088,7 @@ void PrintItemPower(char plidx, ItemStruct *x) sprintf(tempstr, "lightning arrows damage %i", x->_iLMinDam); else #endif - sprintf(tempstr, "lightning arrows damage %i-%i", x->_iLMinDam, x->_iLMaxDam); + sprintf(tempstr, "lightning arrows damage %i-%i", x->_iLMinDam, x->_iLMaxDam); break; case IPL_THORNS: strcpy(tempstr, "attacker takes 1-3 damage"); @@ -4431,7 +4433,7 @@ void PrintItemDetails(ItemStruct *x) sprintf(tempstr, "damage: %i Dur: %i/%i", x->_iMinDam, x->_iDurability, x->_iMaxDur); } else #endif - if (x->_iMaxDur == DUR_INDESTRUCTIBLE) + if (x->_iMaxDur == DUR_INDESTRUCTIBLE) sprintf(tempstr, "damage: %i-%i Indestructible", x->_iMinDam, x->_iMaxDam); else sprintf(tempstr, "damage: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); @@ -4450,7 +4452,7 @@ void PrintItemDetails(ItemStruct *x) sprintf(tempstr, "dam: %i Dur: %i/%i", x->_iMinDam, x->_iDurability, x->_iMaxDur); else #endif - sprintf(tempstr, "dam: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); + sprintf(tempstr, "dam: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); sprintf(tempstr, "Charges: %i/%i", x->_iCharges, x->_iMaxCharges); AddPanelString(tempstr, TRUE); } @@ -4498,7 +4500,7 @@ void PrintItemDur(ItemStruct *x) sprintf(tempstr, "damage: %i Dur: %i/%i", x->_iMinDam, x->_iDurability, x->_iMaxDur); } else #endif - if (x->_iMaxDur == DUR_INDESTRUCTIBLE) + if (x->_iMaxDur == DUR_INDESTRUCTIBLE) sprintf(tempstr, "damage: %i-%i Indestructible", x->_iMinDam, x->_iMaxDam); else sprintf(tempstr, "damage: %i-%i Dur: %i/%i", x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); @@ -4819,8 +4821,7 @@ int RndSmithItem(int lvl) #ifdef HELLFIRE if (AllItemsList[i].iRnd == IDROP_DOUBLE && ri < 512) { #else - if (AllItemsList[i].iRnd == IDROP_DOUBLE) - { + if (AllItemsList[i].iRnd == IDROP_DOUBLE) { #endif ril[ri] = i; ri++; @@ -5211,7 +5212,7 @@ void SpawnBoy(int lvl) { int itype; - if (boylevel> 1 || boyitem._itype == ITYPE_NONE) { + if (boylevel > 1 || boyitem._itype == ITYPE_NONE) { do { item[0]._iSeed = GetRndSeed(); SetRndSeed(item[0]._iSeed); @@ -5460,24 +5461,24 @@ void RecreateWitchItem(int ii, int idx, int lvl, int iseed) volatile int hi_predelnik = random_(0, 1); iblvl = lvl; GetItemAttrs(ii, idx, iblvl); - } else{ + } else { #endif - SetRndSeed(iseed); - itype = RndWitchItem(lvl) - 1; - GetItemAttrs(ii, itype, lvl); - iblvl = -1; - if (random_(51, 100) <= 5) - iblvl = 2 * lvl; - if (iblvl == -1 && item[ii]._iMiscId == IMISC_STAFF) - iblvl = 2 * lvl; - if (iblvl != -1) + SetRndSeed(iseed); + itype = RndWitchItem(lvl) - 1; + GetItemAttrs(ii, itype, lvl); + iblvl = -1; + if (random_(51, 100) <= 5) + iblvl = 2 * lvl; + if (iblvl == -1 && item[ii]._iMiscId == IMISC_STAFF) + iblvl = 2 * lvl; + if (iblvl != -1) #ifdef HELLFIRE - GetItemBonus(ii, itype, iblvl >> 1, iblvl, TRUE, TRUE); - } + GetItemBonus(ii, itype, iblvl >> 1, iblvl, TRUE, TRUE); + } #else GetItemBonus(ii, itype, iblvl >> 1, iblvl, TRUE); #endif -} + } item[ii]._iSeed = iseed; item[ii]._iCreateInfo = lvl | CF_WITCH; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 7583bdf62..73b2926ca 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -568,7 +568,7 @@ void DoLighting(int nXPos, int nYPos, int nRadius, int Lnum) #endif } - mult = xoff + 8*yoff; + mult = xoff + 8 * yoff; for (y = 0; y < min_y; y++) { for (x = 1; x < max_x; x++) { radius_block = lightblock[mult][y][x]; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 61641d3e3..80525fbb2 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -1045,13 +1045,13 @@ void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, if (dMonster[mx][my] < 0 && monster[-(dMonster[mx][my] + 1)]._mmode == MM_STONE && MonsterMHit( - missile[i]._misource, - -(dMonster[mx][my] + 1), - mindam, - maxdam, - missile[i]._midist, - missile[i]._mitype, - shift)) { + missile[i]._misource, + -(dMonster[mx][my] + 1), + mindam, + maxdam, + missile[i]._midist, + missile[i]._mitype, + shift)) { if (!nodel) missile[i]._mirange = 0; missile[i]._miHitFlag = TRUE; @@ -1060,13 +1060,13 @@ void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, if (dPlayer[mx][my] > 0 && dPlayer[mx][my] - 1 != missile[i]._misource && Plr2PlrMHit( - missile[i]._misource, - dPlayer[mx][my] - 1, - mindam, - maxdam, - missile[i]._midist, - missile[i]._mitype, - shift)) { + missile[i]._misource, + dPlayer[mx][my] - 1, + mindam, + maxdam, + missile[i]._midist, + missile[i]._mitype, + shift)) { if (!nodel) missile[i]._mirange = 0; missile[i]._miHitFlag = TRUE; @@ -1082,14 +1082,14 @@ void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, } if (dPlayer[mx][my] > 0 && PlayerMHit( - dPlayer[mx][my] - 1, - missile[i]._misource, - missile[i]._midist, - mindam, - maxdam, - missile[i]._mitype, - shift, - 0)) { + dPlayer[mx][my] - 1, + missile[i]._misource, + missile[i]._midist, + mindam, + maxdam, + missile[i]._mitype, + shift, + 0)) { if (!nodel) missile[i]._mirange = 0; missile[i]._miHitFlag = TRUE; @@ -3119,7 +3119,7 @@ void AddBlodboil(int mi, int sx, int sy, int dx, int dy, int midir, char mienemy #ifndef SPAWN PS_ROGUE70, PS_MAGE70, - PS_MAGE70, // BUGFIX: PS_MONK70? + PS_MAGE70, // BUGFIX: PS_MONK70? PS_ROGUE70, #else 0, @@ -3883,12 +3883,12 @@ void MI_Fireball(int i) } if (missile[i]._miyvel > 0 && (TransList[dTransVal[mx + 1][my]] && nSolidTable[dPiece[mx + 1][my]] - || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { + || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { missile[i]._miyoff -= 32; } if (missile[i]._mixvel > 0 && (TransList[dTransVal[mx][my + 1]] && nSolidTable[dPiece[mx][my + 1]] - || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { + || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { missile[i]._mixoff -= 32; } missile[i]._mimfnum = 0; @@ -4094,12 +4094,12 @@ void mi_immolation(int i) } if (missile[i]._miyvel > 0 && (TransList[dTransVal[mx + 1][my]] && nSolidTable[dPiece[mx + 1][my]] - || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { + || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { missile[i]._miyoff -= 32; } if (missile[i]._mixvel > 0 && (TransList[dTransVal[mx][my + 1]] && nSolidTable[dPiece[mx][my + 1]] - || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { + || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { missile[i]._mixoff -= 32; } missile[i]._mimfnum = 0; diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index accde15e2..f9e8f8ded 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -402,7 +402,7 @@ char MonstAvailTbl[] = { #ifdef HELLFIRE MAT_RETAIL, // Satyr Lord #else - MAT_NEVER, // Lord Sayter + MAT_NEVER, // Lord Sayter #endif MAT_RETAIL, // Flesh Clan MAT_RETAIL, // Stone Clan @@ -453,7 +453,7 @@ char MonstAvailTbl[] = { #ifdef HELLFIRE MAT_RETAIL, // Devil Kin Brute #else - MAT_NEVER, // Devil Kin Brute + MAT_NEVER, // Devil Kin Brute #endif MAT_RETAIL, // Winged-Demon MAT_RETAIL, // Gargoyle @@ -474,7 +474,7 @@ char MonstAvailTbl[] = { #ifdef HELLFIRE MAT_RETAIL, // The Shredded #else - MAT_NEVER, // Unraveler + MAT_NEVER, // Unraveler #endif MAT_NEVER, // Hollow One MAT_NEVER, // Pain Master diff --git a/Source/monster.cpp b/Source/monster.cpp index 222ad6a9e..d699fda81 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1395,7 +1395,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]; @@ -2738,7 +2738,7 @@ BOOL M_DoRSpAttack(int i) #ifdef HELLFIRE if (Monsters[i].Snds[3][0] != 0) #endif - PlayEffect(i, 3); + PlayEffect(i, 3); } if (monster[i]._mAi == AI_MEGA && monster[i]._mAnimFrame == 3) { @@ -4295,11 +4295,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--; @@ -4312,11 +4312,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++; @@ -4365,7 +4365,7 @@ void MAI_Garg(int i) return; } - if (Monst->_mhitpoints_mmaxhp>> 1 && !(Monst->_mFlags & MFLAG_NOHEAL)) + if (Monst->_mhitpoints_mmaxhp> > 1 && !(Monst->_mFlags & MFLAG_NOHEAL)) Monst->_mgoal = MGOAL_RETREAT; if (Monst->_mgoal == MGOAL_RETREAT) { if (abs(dx) >= Monst->_mint + 2 || abs(dy) >= Monst->_mint + 2) { @@ -4754,8 +4754,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); diff --git a/Source/msg.cpp b/Source/msg.cpp index 6d6349a38..8adc69c7d 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -54,7 +54,7 @@ static void msg_pre_packet() i = -1; for (TMegaPkt *pkt = sgpMegaPkt; pkt != NULL; pkt = pkt->pNext) { - BYTE * data = pkt->data; + BYTE *data = pkt->data; int spaceLeft = sizeof(pkt->data); while (spaceLeft != pkt->dwSpaceLeft) { if (*data == FAKE_CMD_SETID) { @@ -317,12 +317,12 @@ static void DeltaImportJunk(BYTE *src) #endif src += sizeof(DPortal); SetPortalStats( - i, - TRUE, - sgJunk.portal[i].x, - sgJunk.portal[i].y, - sgJunk.portal[i].level, - sgJunk.portal[i].ltype); + i, + TRUE, + sgJunk.portal[i].x, + sgJunk.portal[i].y, + sgJunk.portal[i].level, + sgJunk.portal[i].ltype); } } @@ -500,14 +500,14 @@ void delta_sync_golem(TCmdGolem *pG, int pnum, BYTE bLevel) if (gbMaxPlayers == 1) return; - sgbDeltaChanged = TRUE; - DMonsterStr *pD = &sgLevels[bLevel].monster[pnum]; - pD->_mx = pG->_mx; - pD->_my = pG->_my; - pD->_mactive = UCHAR_MAX; - pD->_menemy = pG->_menemy; - pD->_mdir = pG->_mdir; - pD->_mhitpoints = pG->_mhitpoints; + sgbDeltaChanged = TRUE; + DMonsterStr *pD = &sgLevels[bLevel].monster[pnum]; + pD->_mx = pG->_mx; + pD->_my = pG->_my; + pD->_mactive = UCHAR_MAX; + pD->_menemy = pG->_menemy; + pD->_mdir = pG->_mdir; + pD->_mhitpoints = pG->_mhitpoints; } void delta_leave_sync(BYTE bLevel) @@ -618,10 +618,10 @@ static void delta_put_item(TCmdPItem *pI, int x, int y, BYTE bLevel) TCmdPItem *pD = sgLevels[bLevel].item; for (i = 0; i < MAXITEMS; i++, pD++) { if (pD->bCmd != CMD_WALKXY - && pD->bCmd != 0xFF - && pD->wIndx == pI->wIndx - && pD->wCI == pI->wCI - && pD->dwSeed == pI->dwSeed) { + && pD->bCmd != 0xFF + && pD->wIndx == pI->wIndx + && pD->wCI == pI->wCI + && pD->dwSeed == pI->dwSeed) { if (pD->bCmd == CMD_ACK_PLRINFO) return; app_fatal("Trying to drop a floor item?"); @@ -665,10 +665,10 @@ void DeltaAddItem(int ii) TCmdPItem *pD = sgLevels[currlevel].item; for (i = 0; i < MAXITEMS; i++, pD++) { if (pD->bCmd != 0xFF - && pD->wIndx == item[ii].IDidx - && pD->wCI == item[ii]._iCreateInfo - && pD->dwSeed == item[ii]._iSeed - && (pD->bCmd == CMD_WALKXY || pD->bCmd == CMD_STAND)) { + && pD->wIndx == item[ii].IDidx + && pD->wCI == item[ii]._iCreateInfo + && pD->dwSeed == item[ii]._iSeed + && (pD->bCmd == CMD_WALKXY || pD->bCmd == CMD_STAND)) { return; } } @@ -772,9 +772,9 @@ void DeltaLoadLevel() if (sgLevels[currlevel].item[i].bCmd != 0xFF) { if (sgLevels[currlevel].item[i].bCmd == CMD_WALKXY) { ii = FindGetItem( - sgLevels[currlevel].item[i].wIndx, - sgLevels[currlevel].item[i].wCI, - sgLevels[currlevel].item[i].dwSeed); + sgLevels[currlevel].item[i].wIndx, + sgLevels[currlevel].item[i].wCI, + sgLevels[currlevel].item[i].dwSeed); if (ii != -1) { if (dItem[item[ii]._ix][item[ii]._iy] == ii + 1) dItem[item[ii]._ix][item[ii]._iy] = 0; @@ -787,23 +787,23 @@ void DeltaLoadLevel() itemactive[numitems] = ii; if (sgLevels[currlevel].item[i].wIndx == IDI_EAR) { RecreateEar( - ii, - sgLevels[currlevel].item[i].wCI, - sgLevels[currlevel].item[i].dwSeed, - sgLevels[currlevel].item[i].bId, - sgLevels[currlevel].item[i].bDur, - sgLevels[currlevel].item[i].bMDur, - sgLevels[currlevel].item[i].bCh, - sgLevels[currlevel].item[i].bMCh, - sgLevels[currlevel].item[i].wValue, - sgLevels[currlevel].item[i].dwBuff); + ii, + sgLevels[currlevel].item[i].wCI, + sgLevels[currlevel].item[i].dwSeed, + sgLevels[currlevel].item[i].bId, + sgLevels[currlevel].item[i].bDur, + sgLevels[currlevel].item[i].bMDur, + sgLevels[currlevel].item[i].bCh, + sgLevels[currlevel].item[i].bMCh, + sgLevels[currlevel].item[i].wValue, + sgLevels[currlevel].item[i].dwBuff); } else { RecreateItem( - ii, - sgLevels[currlevel].item[i].wIndx, - sgLevels[currlevel].item[i].wCI, - sgLevels[currlevel].item[i].dwSeed, - sgLevels[currlevel].item[i].wValue); + ii, + sgLevels[currlevel].item[i].wIndx, + sgLevels[currlevel].item[i].wCI, + sgLevels[currlevel].item[i].dwSeed, + sgLevels[currlevel].item[i].wValue); if (sgLevels[currlevel].item[i].bId) item[ii]._iIdentified = TRUE; item[ii]._iDurability = sgLevels[currlevel].item[i].bDur; @@ -1472,7 +1472,8 @@ static DWORD On_GETITEM(TCmd *pCmd, int pnum) if (currlevel != p->bLevel) { ii = SyncPutItem(myplr, plr[myplr]._px, plr[myplr]._py, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff #ifdef HELLFIRE - , p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC + , + p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC #endif ); if (ii != -1) @@ -1538,7 +1539,8 @@ static DWORD On_AGETITEM(TCmd *pCmd, int pnum) if (currlevel != p->bLevel) { int ii = SyncPutItem(myplr, plr[myplr]._px, plr[myplr]._py, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff #ifdef HELLFIRE - , p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC + , + p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC #endif ); if (ii != -1) @@ -1583,7 +1585,8 @@ static DWORD On_PUTITEM(TCmd *pCmd, int pnum) else ii = SyncPutItem(pnum, p->x, p->y, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff #ifdef HELLFIRE - , p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC + , + p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC #endif ); if (ii != -1) { @@ -1610,7 +1613,8 @@ static DWORD On_SYNCPUTITEM(TCmd *pCmd, int pnum) else if (currlevel == plr[pnum].plrlevel) { int ii = SyncPutItem(pnum, p->x, p->y, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff #ifdef HELLFIRE - , p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC + , + p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC #endif ); if (ii != -1) { @@ -1638,7 +1642,8 @@ static DWORD On_RESPAWNITEM(TCmd *pCmd, int pnum) if (currlevel == plr[pnum].plrlevel && pnum != myplr) { SyncPutItem(pnum, p->x, p->y, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff #ifdef HELLFIRE - , p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC + , + p->wToHit, p->wMaxDam, p->bMinStr, p->bMinMag, p->bMinDex, p->bAC #endif ); } diff --git a/Source/objects.cpp b/Source/objects.cpp index 023f5651a..908712658 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1977,9 +1977,9 @@ void Obj_Door(int i) dx = object[i]._ox; dy = object[i]._oy; dok = dMonster[dx][dy] == 0; - dok = dok HFAND (dItem[dx][dy] == 0); - dok = dok HFAND (dDead[dx][dy] == 0); - dok = dok HFAND (dPlayer[dx][dy] == 0); + dok = dok HFAND(dItem[dx][dy] == 0); + dok = dok HFAND(dDead[dx][dy] == 0); + dok = dok HFAND(dPlayer[dx][dy] == 0); object[i]._oSelFlag = 2; object[i]._oVar4 = dok ? 1 : 2; object[i]._oMissFlag = TRUE; @@ -2409,40 +2409,40 @@ void DoorSet(int oi, int dx, int dy) #ifdef HELLFIRE if (currlevel < 17) { #endif - if (pn == 43) - ObjSetMicro(dx, dy, 392); - if (pn == 45) - ObjSetMicro(dx, dy, 394); - if (pn == 50 && object[oi]._otype == OBJ_L1LDOOR) - ObjSetMicro(dx, dy, 411); - if (pn == 50 && object[oi]._otype == OBJ_L1RDOOR) - ObjSetMicro(dx, dy, 412); - if (pn == 54) - ObjSetMicro(dx, dy, 397); - if (pn == 55) - ObjSetMicro(dx, dy, 398); - if (pn == 61) - ObjSetMicro(dx, dy, 399); - if (pn == 67) - ObjSetMicro(dx, dy, 400); - if (pn == 68) - ObjSetMicro(dx, dy, 401); - if (pn == 69) - ObjSetMicro(dx, dy, 403); - if (pn == 70) - ObjSetMicro(dx, dy, 404); - if (pn == 72) - ObjSetMicro(dx, dy, 406); - if (pn == 212) - ObjSetMicro(dx, dy, 407); - if (pn == 354) - ObjSetMicro(dx, dy, 409); - if (pn == 355) - ObjSetMicro(dx, dy, 410); - if (pn == 411) - ObjSetMicro(dx, dy, 396); - if (pn == 412) - ObjSetMicro(dx, dy, 396); + if (pn == 43) + ObjSetMicro(dx, dy, 392); + if (pn == 45) + ObjSetMicro(dx, dy, 394); + if (pn == 50 && object[oi]._otype == OBJ_L1LDOOR) + ObjSetMicro(dx, dy, 411); + if (pn == 50 && object[oi]._otype == OBJ_L1RDOOR) + ObjSetMicro(dx, dy, 412); + if (pn == 54) + ObjSetMicro(dx, dy, 397); + if (pn == 55) + ObjSetMicro(dx, dy, 398); + if (pn == 61) + ObjSetMicro(dx, dy, 399); + if (pn == 67) + ObjSetMicro(dx, dy, 400); + if (pn == 68) + ObjSetMicro(dx, dy, 401); + if (pn == 69) + ObjSetMicro(dx, dy, 403); + if (pn == 70) + ObjSetMicro(dx, dy, 404); + if (pn == 72) + ObjSetMicro(dx, dy, 406); + if (pn == 212) + ObjSetMicro(dx, dy, 407); + if (pn == 354) + ObjSetMicro(dx, dy, 409); + if (pn == 355) + ObjSetMicro(dx, dy, 410); + if (pn == 411) + ObjSetMicro(dx, dy, 396); + if (pn == 412) + ObjSetMicro(dx, dy, 396); #ifdef HELLFIRE } else { if (pn == 75) @@ -2564,14 +2564,14 @@ void OperateL1RDoor(int pnum, int oi, DIABOOL sendflag) #ifdef HELLFIRE if (currlevel < 17) { #endif - if (object[oi]._oVar2 != 50) { - ObjSetMicro(xp - 1, yp, object[oi]._oVar2); - } else { - if (dPiece[xp - 1][yp] == 396) - ObjSetMicro(xp - 1, yp, 411); - else - ObjSetMicro(xp - 1, yp, 50); - } + if (object[oi]._oVar2 != 50) { + ObjSetMicro(xp - 1, yp, object[oi]._oVar2); + } else { + if (dPiece[xp - 1][yp] == 396) + ObjSetMicro(xp - 1, yp, 411); + else + ObjSetMicro(xp - 1, yp, 50); + } #ifdef HELLFIRE } else { if (object[oi]._oVar2 != 86) { @@ -2672,14 +2672,14 @@ void OperateL1LDoor(int pnum, int oi, DIABOOL sendflag) #ifdef HELLFIRE if (currlevel < 17) { #endif - if (object[oi]._oVar2 != 50) { - ObjSetMicro(xp, yp - 1, object[oi]._oVar2); - } else { - if (dPiece[xp][yp - 1] == 396) - ObjSetMicro(xp, yp - 1, 412); - else - ObjSetMicro(xp, yp - 1, 50); - } + if (object[oi]._oVar2 != 50) { + ObjSetMicro(xp, yp - 1, object[oi]._oVar2); + } else { + if (dPiece[xp][yp - 1] == 396) + ObjSetMicro(xp, yp - 1, 412); + else + ObjSetMicro(xp, yp - 1, 50); + } #ifdef HELLFIRE } else { if (object[oi]._oVar2 != 86) { @@ -2729,8 +2729,8 @@ void OperateL2RDoor(int pnum, int oi, DIABOOL sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, object[oi]._ox, yp); dok = dMonster[xp][yp] == 0; - dok = dok HFAND (dItem[xp][yp] == 0); - dok = dok HFAND (dDead[xp][yp] == 0); + dok = dok HFAND(dItem[xp][yp] == 0); + dok = dok HFAND(dDead[xp][yp] == 0); if (dok) { if (pnum == myplr && sendflag) NetSendCmdParam1(TRUE, CMD_CLOSEDOOR, oi); @@ -2774,8 +2774,8 @@ void OperateL2LDoor(int pnum, int oi, BOOL sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, object[oi]._ox, yp); dok = dMonster[xp][yp] == 0; - dok = dok HFAND (dItem[xp][yp] == 0); - dok = dok HFAND (dDead[xp][yp] == 0); + dok = dok HFAND(dItem[xp][yp] == 0); + dok = dok HFAND(dDead[xp][yp] == 0); if (dok) { if (pnum == myplr && sendflag) NetSendCmdParam1(TRUE, CMD_CLOSEDOOR, oi); @@ -2820,8 +2820,8 @@ void OperateL3RDoor(int pnum, int oi, DIABOOL sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, object[oi]._ox, yp); dok = dMonster[xp][yp] == 0; - dok = dok HFAND (dItem[xp][yp] == 0); - dok = dok HFAND (dDead[xp][yp] == 0); + dok = dok HFAND(dItem[xp][yp] == 0); + dok = dok HFAND(dDead[xp][yp] == 0); if (dok) { if (pnum == myplr && sendflag) NetSendCmdParam1(TRUE, CMD_CLOSEDOOR, oi); @@ -2866,8 +2866,8 @@ void OperateL3LDoor(int pnum, int oi, DIABOOL sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, object[oi]._ox, yp); dok = dMonster[xp][yp] == 0; - dok = dok HFAND (dItem[xp][yp] == 0); - dok = dok HFAND (dDead[xp][yp] == 0); + dok = dok HFAND(dItem[xp][yp] == 0); + dok = dok HFAND(dDead[xp][yp] == 0); if (dok) { if (pnum == myplr && sendflag) NetSendCmdParam1(TRUE, CMD_CLOSEDOOR, oi); @@ -5262,13 +5262,13 @@ void GetObjectStr(int i) case OBJ_BARREL: case OBJ_BARRELEX: #ifdef HELLFIRE - if (currlevel > 16 && currlevel < 21) // for hive levels - strcpy(infostr, "Pod"); //Then a barrel is called a pod + if (currlevel > 16 && currlevel < 21) // for hive levels + strcpy(infostr, "Pod"); //Then a barrel is called a pod else if (currlevel > 20 && currlevel < 25) // for crypt levels - strcpy(infostr, "Urn"); //Then a barrel is called an urn + strcpy(infostr, "Urn"); //Then a barrel is called an urn else #endif - strcpy(infostr, "Barrel"); + strcpy(infostr, "Barrel"); break; case OBJ_SKELBOOK: strcpy(infostr, "Skeleton Tome"); diff --git a/Source/pack.cpp b/Source/pack.cpp index 2edbc568a..1d149c0b3 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -9,7 +9,8 @@ #ifndef HELLFIRE static #endif -void PackItem(PkItemStruct *id, ItemStruct *is) + void + PackItem(PkItemStruct *id, ItemStruct *is) { if (is->_itype == ITYPE_NONE) { id->idx = 0xFFFF; @@ -136,7 +137,8 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield) #ifndef HELLFIRE static #endif -void UnPackItem(PkItemStruct *is, ItemStruct *id) + void + UnPackItem(PkItemStruct *is, ItemStruct *id) { if (is->idx == 0xFFFF) { id->_itype = ITYPE_NONE; diff --git a/Source/palette.cpp b/Source/palette.cpp index 9598ab084..a1514d0ee 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -305,8 +305,6 @@ void palette_update_crypt() system_palette[i].peGreen = col.peGreen; system_palette[i].peBlue = col.peBlue; - - dword_6E2D58 = 0; } else { dword_6E2D58++; diff --git a/Source/player.cpp b/Source/player.cpp index 23a285e7a..40d8f64ed 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -108,6 +108,7 @@ int StrengthTbl[NUM_CLASSES] = { }; /** Maps from player_class to starting stat in magic. */ int MagicTbl[NUM_CLASSES] = { + // clang-format off 10, 15, 35, @@ -116,6 +117,7 @@ int MagicTbl[NUM_CLASSES] = { 20, 0, #endif + // clang-format on }; /** Maps from player_class to starting stat in dexterity. */ int DexterityTbl[NUM_CLASSES] = { @@ -162,6 +164,7 @@ const char *const ClassStrTblOld[] = { }; /** Maps from player_class to maximum stats. */ int MaxStats[NUM_CLASSES][4] = { + // clang-format off { 250, 50, 60, 100 }, { 55, 70, 250, 80 }, { 45, 250, 85, 80 }, @@ -170,6 +173,7 @@ int MaxStats[NUM_CLASSES][4] = { { 120, 120, 120, 100 }, { 255, 0, 55, 150 }, #endif + // clang-format on }; /** Specifies the experience point limit of each level. */ int ExpLvlsTbl[MAXCHARLEVEL] = { @@ -2082,9 +2086,9 @@ void DropHalfPlayersGold(int pnum) for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) { if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && #ifndef HELLFIRE - plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { + plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { #else - plr[pnum].SpdList[i]._ivalue != MaxGold) { + plr[pnum].SpdList[i]._ivalue != MaxGold) { #endif if (hGold < plr[pnum].SpdList[i]._ivalue) { plr[pnum].SpdList[i]._ivalue -= hGold; @@ -2137,9 +2141,9 @@ void DropHalfPlayersGold(int pnum) for (i = 0; i < plr[pnum]._pNumInv && hGold > 0; i++) { if (plr[pnum].InvList[i]._itype == ITYPE_GOLD && #ifndef HELLFIRE - plr[pnum].InvList[i]._ivalue != GOLD_MAX_LIMIT) { + plr[pnum].InvList[i]._ivalue != GOLD_MAX_LIMIT) { #else - plr[pnum].InvList[i]._ivalue != MaxGold) { + plr[pnum].InvList[i]._ivalue != MaxGold) { #endif if (hGold < plr[pnum].InvList[i]._ivalue) { plr[pnum].InvList[i]._ivalue -= hGold; @@ -3848,7 +3852,7 @@ void ProcessPlayers() break; default: #endif - PlaySFX(sfxdnum); + PlaySFX(sfxdnum); #ifdef HELLFIRE } #endif @@ -4703,7 +4707,7 @@ void PlayDungMsgs() sfxdnum = PS_MAGE92; } else #endif - if (plr[myplr]._pClass == PC_MONK) { + if (plr[myplr]._pClass == PC_MONK) { sfxdnum = PS_MONK92; } #ifndef SPAWN diff --git a/Source/quests.cpp b/Source/quests.cpp index ab2bd437a..7aba6a483 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -120,29 +120,29 @@ void InitQuests() for (z = 0; z < MAXQUESTS; z++) { if (gbMaxPlayers > 1 && !(questlist[z]._qflags & QUEST_ANY)) continue; - quests[z]._qtype = questlist[z]._qdtype; - if (gbMaxPlayers > 1) { - quests[z]._qlevel = questlist[z]._qdmultlvl; - if (!delta_quest_inited(initiatedQuests)) { - quests[z]._qactive = QUEST_INIT; - quests[z]._qvar1 = 0; - quests[z]._qlog = FALSE; - } - initiatedQuests++; - } else { + quests[z]._qtype = questlist[z]._qdtype; + if (gbMaxPlayers > 1) { + quests[z]._qlevel = questlist[z]._qdmultlvl; + if (!delta_quest_inited(initiatedQuests)) { quests[z]._qactive = QUEST_INIT; - quests[z]._qlevel = questlist[z]._qdlvl; quests[z]._qvar1 = 0; quests[z]._qlog = FALSE; } - - quests[z]._qslvl = questlist[z]._qslvl; - quests[z]._qtx = 0; - quests[z]._qty = 0; - quests[z]._qidx = z; - quests[z]._qlvltype = questlist[z]._qlvlt; - quests[z]._qvar2 = 0; - quests[z]._qmsg = questlist[z]._qdmsg; + initiatedQuests++; + } else { + quests[z]._qactive = QUEST_INIT; + quests[z]._qlevel = questlist[z]._qdlvl; + quests[z]._qvar1 = 0; + quests[z]._qlog = FALSE; + } + + quests[z]._qslvl = questlist[z]._qslvl; + quests[z]._qtx = 0; + quests[z]._qty = 0; + quests[z]._qidx = z; + quests[z]._qlvltype = questlist[z]._qlvlt; + quests[z]._qvar2 = 0; + quests[z]._qmsg = questlist[z]._qdmsg; } if (gbMaxPlayers == 1) { diff --git a/Source/sha.cpp b/Source/sha.cpp index 472c88d20..c392d47b1 100644 --- a/Source/sha.cpp +++ b/Source/sha.cpp @@ -11,7 +11,6 @@ #define SHA1CircularShift(bits, word) \ (((word) << (bits)) | ((word) >> (32 - (bits)))) - SHA1Context sgSHA1[3]; static void SHA1Init(SHA1Context *context) diff --git a/Source/town.cpp b/Source/town.cpp index ef23ed36d..4ac8578e3 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -1575,7 +1575,8 @@ void T_FillTile(BYTE *P3Tiles, int xx, int yy, int t) } #ifdef HELLFIRE -void town_4751C6(){ +void town_4751C6() +{ dPiece[78][60] = 0x48a; dPiece[79][60] = 0x48b; dPiece[78][61] = 0x48c; @@ -1625,7 +1626,8 @@ void town_4751C6(){ SetTownMicros(); } -void town_475379(){ +void town_475379() +{ dPiece[78][60] = 0x48a; dPiece[79][60] = 0x4eb; dPiece[78][61] = 0x4ec; @@ -1675,7 +1677,8 @@ void town_475379(){ SetTownMicros(); } -void town_47552C(){ +void town_47552C() +{ dPiece[36][21] = 0x52b; dPiece[37][21] = 0x52c; dPiece[36][22] = 0x52d; @@ -1689,7 +1692,8 @@ void town_47552C(){ SetTownMicros(); } -void town_475595(){ +void town_475595() +{ dPiece[36][21] = 0x533; dPiece[37][21] = 0x534; dPiece[36][22] = 0x535; @@ -1739,16 +1743,13 @@ void T_Pass3() if (gbMaxPlayers == 1) { #endif #ifdef HELLFIRE - if(quests[Q_FARMER]._qactive == 3 || quests[Q_FARMER]._qactive == 10 - || quests[Q_JERSEY]._qactive == 3 || quests[Q_JERSEY]._qactive == 10) - { + if (quests[Q_FARMER]._qactive == 3 || quests[Q_FARMER]._qactive == 10 + || quests[Q_JERSEY]._qactive == 3 || quests[Q_JERSEY]._qactive == 10) { town_4751C6(); - } - else - { + } else { town_475379(); } - if ( quests[Q_GRAVE]._qactive == 3 || plr[myplr]._pLvlVisited[21] ) + if (quests[Q_GRAVE]._qactive == 3 || plr[myplr]._pLvlVisited[21]) town_475595(); else town_47552C(); @@ -1788,18 +1789,14 @@ void T_Pass3() } } #ifdef HELLFIRE - else - { - if(quests[Q_FARMER]._qactive == 3 || quests[Q_FARMER]._qactive == 10 - || quests[Q_JERSEY]._qactive == 3 || quests[Q_JERSEY]._qactive == 10) - { + else { + if (quests[Q_FARMER]._qactive == 3 || quests[Q_FARMER]._qactive == 10 + || quests[Q_JERSEY]._qactive == 3 || quests[Q_JERSEY]._qactive == 10) { town_4751C6(); - } - else - { + } else { town_475379(); } - if ( quests[Q_GRAVE]._qactive == 3 || plr[myplr]._pLvlVisited[21] ) + if (quests[Q_GRAVE]._qactive == 3 || plr[myplr]._pLvlVisited[21]) town_475595(); else town_47552C(); diff --git a/Source/town.h b/Source/town.h index e1bea8026..3770ba694 100644 --- a/Source/town.h +++ b/Source/town.h @@ -12,8 +12,8 @@ void town_draw_town_all(BYTE *pBuff, int x, int y, int row, int CelCap, int sx, void T_DrawView(int StartX, int StartY); #ifdef HELLFIRE void town_4751C6(); -void town_475595(); -#endif +void town_475595(); +#endif void CreateTown(int entry); #endif /* __TOWN_H__ */ diff --git a/Source/towners.cpp b/Source/towners.cpp index 90b95835f..0a6579fb6 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -829,19 +829,19 @@ void TalkToTowner(int p, int t) #ifdef HELLFIRE if (quests[Q_SKELKING]._qactive != QUEST_NOTAVAIL) #endif - if (quests[Q_SKELKING]._qvar2 == 0 && !towner[t]._tMsgSaid) { - quests[Q_SKELKING]._qvar2 = 1; - quests[Q_SKELKING]._qlog = TRUE; - if (quests[Q_SKELKING]._qactive == QUEST_INIT) { - quests[Q_SKELKING]._qactive = QUEST_ACTIVE; - quests[Q_SKELKING]._qvar1 = 1; + if (quests[Q_SKELKING]._qvar2 == 0 && !towner[t]._tMsgSaid) { + quests[Q_SKELKING]._qvar2 = 1; + quests[Q_SKELKING]._qlog = TRUE; + if (quests[Q_SKELKING]._qactive == QUEST_INIT) { + quests[Q_SKELKING]._qactive = QUEST_ACTIVE; + quests[Q_SKELKING]._qvar1 = 1; + } + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_KING2); + towner[t]._tMsgSaid = TRUE; + NetSendCmdQuest(TRUE, Q_SKELKING); } - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_KING2); - towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, Q_SKELKING); - } if (quests[Q_SKELKING]._qactive == QUEST_DONE && quests[Q_SKELKING]._qvar2 == 1 && !towner[t]._tMsgSaid) { quests[Q_SKELKING]._qvar2 = 2; quests[Q_SKELKING]._qvar1 = 2; @@ -854,88 +854,92 @@ void TalkToTowner(int p, int t) } if (gbMaxPlayers == 1) { if (plr[p]._pLvlVisited[3] && quests[Q_LTBANNER]._qactive != QUEST_NOTAVAIL) { - if ((quests[Q_LTBANNER]._qactive == QUEST_INIT || quests[Q_LTBANNER]._qactive == QUEST_ACTIVE) && quests[Q_LTBANNER]._qvar2 == 0 && !towner[t]._tMsgSaid) { - quests[Q_LTBANNER]._qvar2 = 1; - if (quests[Q_LTBANNER]._qactive == QUEST_INIT) { - quests[Q_LTBANNER]._qvar1 = 1; - quests[Q_LTBANNER]._qactive = QUEST_ACTIVE; + if ((quests[Q_LTBANNER]._qactive == QUEST_INIT || quests[Q_LTBANNER]._qactive == QUEST_ACTIVE) && quests[Q_LTBANNER]._qvar2 == 0 && !towner[t]._tMsgSaid) { + quests[Q_LTBANNER]._qvar2 = 1; + if (quests[Q_LTBANNER]._qactive == QUEST_INIT) { + quests[Q_LTBANNER]._qvar1 = 1; + quests[Q_LTBANNER]._qactive = QUEST_ACTIVE; + } + quests[Q_LTBANNER]._qlog = TRUE; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_BANNER2); + towner[t]._tMsgSaid = TRUE; } - quests[Q_LTBANNER]._qlog = TRUE; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_BANNER2); - towner[t]._tMsgSaid = TRUE; - } #ifdef HELLFIRE } if (!towner[t]._tMsgSaid && PlrHasItem(p, IDI_BANNER, i) != NULL) { #else if (quests[Q_LTBANNER]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, i) != NULL && !towner[t]._tMsgSaid) { #endif - quests[Q_LTBANNER]._qactive = QUEST_DONE; - quests[Q_LTBANNER]._qvar1 = 3; - RemoveInvItem(p, i); - CreateItem(UITEM_HARCREST, towner[t]._tx, towner[t]._ty + 1); - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_BANNER3); - towner[t]._tMsgSaid = TRUE; - } + quests[Q_LTBANNER]._qactive = QUEST_DONE; + quests[Q_LTBANNER]._qvar1 = 3; + RemoveInvItem(p, i); + CreateItem(UITEM_HARCREST, towner[t]._tx, towner[t]._ty + 1); + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_BANNER3); + towner[t]._tMsgSaid = TRUE; } + } #ifndef HELLFIRE - } + } #endif - if (!qtextflag) { - TownerTalk(TEXT_OGDEN1, t); - if (storeflag) { - StartStore(STORE_TAVERN); - } + if (!qtextflag) { + TownerTalk(TEXT_OGDEN1, t); + if (storeflag) { + StartStore(STORE_TAVERN); } - } else if (t == GetActiveTowner(TOWN_DEADGUY)) { - if (quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qvar1 == 1) { - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - quests[Q_BUTCHER]._qvar1 = 1; + } +} +else if (t == GetActiveTowner(TOWN_DEADGUY)) +{ + if (quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qvar1 == 1) { + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + quests[Q_BUTCHER]._qvar1 = 1; #ifndef SPAWN - if (plr[p]._pClass == PC_WARRIOR && !effect_is_playing(PS_WARR8)) { - PlaySFX(PS_WARR8); - } else if (plr[p]._pClass == PC_ROGUE && !effect_is_playing(PS_ROGUE8)) { - PlaySFX(PS_ROGUE8); - } else if (plr[p]._pClass == PC_SORCERER && !effect_is_playing(PS_MAGE8)) { - PlaySFX(PS_MAGE8); + if (plr[p]._pClass == PC_WARRIOR && !effect_is_playing(PS_WARR8)) { + PlaySFX(PS_WARR8); + } else if (plr[p]._pClass == PC_ROGUE && !effect_is_playing(PS_ROGUE8)) { + PlaySFX(PS_ROGUE8); + } else if (plr[p]._pClass == PC_SORCERER && !effect_is_playing(PS_MAGE8)) { + PlaySFX(PS_MAGE8); #ifdef HELLFIRE - } else if (plr[p]._pClass == PC_MONK && !effect_is_playing(PS_MONK8)) { - PlaySFX(PS_MONK8); - } else if (plr[p]._pClass == PC_BARD && !effect_is_playing(PS_ROGUE8)) { - PlaySFX(PS_ROGUE8); - } else if (plr[p]._pClass == PC_BARBARIAN && !effect_is_playing(PS_WARR8)) { - PlaySFX(PS_WARR8); -#endif - } + } else if (plr[p]._pClass == PC_MONK && !effect_is_playing(PS_MONK8)) { + PlaySFX(PS_MONK8); + } else if (plr[p]._pClass == PC_BARD && !effect_is_playing(PS_ROGUE8)) { + PlaySFX(PS_ROGUE8); + } else if (plr[p]._pClass == PC_BARBARIAN && !effect_is_playing(PS_WARR8)) { + PlaySFX(PS_WARR8); #endif - towner[t]._tMsgSaid = TRUE; - } else if (quests[Q_BUTCHER]._qactive == QUEST_DONE && quests[Q_BUTCHER]._qvar1 == 1) { - quests[Q_BUTCHER]._qvar1 = 1; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - towner[t]._tMsgSaid = TRUE; - } else if (quests[Q_BUTCHER]._qactive == QUEST_INIT || quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qvar1 == 0) { - quests[Q_BUTCHER]._qactive = QUEST_ACTIVE; - quests[Q_BUTCHER]._qlog = TRUE; - quests[Q_BUTCHER]._qmsg = TEXT_BUTCH9; - quests[Q_BUTCHER]._qvar1 = 1; - towner[t]._tbtcnt = 50; - towner[t]._tVar1 = p; - towner[t]._tVar2 = 3; - InitQTextMsg(TEXT_BUTCH9); - towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, Q_BUTCHER); } - } else if (t == GetActiveTowner(TOWN_SMITH)) { - if (gbMaxPlayers == 1) { - if (plr[p]._pLvlVisited[4] && quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) { +#endif + towner[t]._tMsgSaid = TRUE; + } else if (quests[Q_BUTCHER]._qactive == QUEST_DONE && quests[Q_BUTCHER]._qvar1 == 1) { + quests[Q_BUTCHER]._qvar1 = 1; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + towner[t]._tMsgSaid = TRUE; + } else if (quests[Q_BUTCHER]._qactive == QUEST_INIT || quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qvar1 == 0) { + quests[Q_BUTCHER]._qactive = QUEST_ACTIVE; + quests[Q_BUTCHER]._qlog = TRUE; + quests[Q_BUTCHER]._qmsg = TEXT_BUTCH9; + quests[Q_BUTCHER]._qvar1 = 1; + towner[t]._tbtcnt = 50; + towner[t]._tVar1 = p; + towner[t]._tVar2 = 3; + InitQTextMsg(TEXT_BUTCH9); + towner[t]._tMsgSaid = TRUE; + NetSendCmdQuest(TRUE, Q_BUTCHER); + } +} +else if (t == GetActiveTowner(TOWN_SMITH)) +{ + if (gbMaxPlayers == 1) { + if (plr[p]._pLvlVisited[4] && quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) { #ifdef HELLFIRE - if (quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) + if (quests[Q_ROCK]._qactive != QUEST_NOTAVAIL) #endif if (quests[Q_ROCK]._qvar2 == 0) { quests[Q_ROCK]._qvar2 = 1; @@ -950,151 +954,159 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; } #ifdef HELLFIRE - } - if (!towner[t]._tMsgSaid && PlrHasItem(p, IDI_ROCK, i) != NULL) { + } + if (!towner[t]._tMsgSaid && PlrHasItem(p, IDI_ROCK, i) != NULL) { #else - if (quests[Q_ROCK]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, i) != NULL && !towner[t]._tMsgSaid) { + if (quests[Q_ROCK]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, i) != NULL && !towner[t]._tMsgSaid) { #endif - quests[Q_ROCK]._qactive = QUEST_DONE; - quests[Q_ROCK]._qvar2 = 2; - quests[Q_ROCK]._qvar1 = 2; - RemoveInvItem(p, i); - CreateItem(UITEM_INFRARING, towner[t]._tx, towner[t]._ty + 1); - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_INFRA7); - towner[t]._tMsgSaid = TRUE; - } + quests[Q_ROCK]._qactive = QUEST_DONE; + quests[Q_ROCK]._qvar2 = 2; + quests[Q_ROCK]._qvar1 = 2; + RemoveInvItem(p, i); + CreateItem(UITEM_INFRARING, towner[t]._tx, towner[t]._ty + 1); + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_INFRA7); + towner[t]._tMsgSaid = TRUE; + } #ifndef HELLFIRE - } + } #endif - if (plr[p]._pLvlVisited[9] && quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) { - if ((quests[Q_ANVIL]._qactive == QUEST_INIT || quests[Q_ANVIL]._qactive == QUEST_ACTIVE) && quests[Q_ANVIL]._qvar2 == 0 && !towner[t]._tMsgSaid) { - if (quests[Q_ROCK]._qvar2 == 2 || quests[Q_ROCK]._qactive == QUEST_ACTIVE && quests[Q_ROCK]._qvar2 == 1) { - quests[Q_ANVIL]._qvar2 = 1; - quests[Q_ANVIL]._qlog = TRUE; - if (quests[Q_ANVIL]._qactive == QUEST_INIT) { - quests[Q_ANVIL]._qactive = QUEST_ACTIVE; - quests[Q_ANVIL]._qvar1 = 1; - } - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_ANVIL5); - towner[t]._tMsgSaid = TRUE; - } + if (plr[p]._pLvlVisited[9] && quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) { + if ((quests[Q_ANVIL]._qactive == QUEST_INIT || quests[Q_ANVIL]._qactive == QUEST_ACTIVE) && quests[Q_ANVIL]._qvar2 == 0 && !towner[t]._tMsgSaid) { + if (quests[Q_ROCK]._qvar2 == 2 || quests[Q_ROCK]._qactive == QUEST_ACTIVE && quests[Q_ROCK]._qvar2 == 1) { + quests[Q_ANVIL]._qvar2 = 1; + quests[Q_ANVIL]._qlog = TRUE; + if (quests[Q_ANVIL]._qactive == QUEST_INIT) { + quests[Q_ANVIL]._qactive = QUEST_ACTIVE; + quests[Q_ANVIL]._qvar1 = 1; } -#ifdef HELLFIRE + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_ANVIL5); + towner[t]._tMsgSaid = TRUE; } - if (!towner[t]._tMsgSaid && PlrHasItem(p, IDI_ANVIL, i) != NULL) { + } +#ifdef HELLFIRE + } + if (!towner[t]._tMsgSaid && PlrHasItem(p, IDI_ANVIL, i) != NULL) { #else - if (quests[Q_ANVIL]._qvar2 == 1 && PlrHasItem(p, IDI_ANVIL, i) != NULL) { - if (!towner[t]._tMsgSaid) { + if (quests[Q_ANVIL]._qvar2 == 1 && PlrHasItem(p, IDI_ANVIL, i) != NULL) { + if (!towner[t]._tMsgSaid) { #endif - quests[Q_ANVIL]._qactive = QUEST_DONE; - quests[Q_ANVIL]._qvar2 = 2; - quests[Q_ANVIL]._qvar1 = 2; - RemoveInvItem(p, i); - CreateItem(UITEM_GRISWOLD, towner[t]._tx, towner[t]._ty + 1); - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_ANVIL7); - towner[t]._tMsgSaid = TRUE; + quests[Q_ANVIL]._qactive = QUEST_DONE; + quests[Q_ANVIL]._qvar2 = 2; + quests[Q_ANVIL]._qvar1 = 2; + RemoveInvItem(p, i); + CreateItem(UITEM_GRISWOLD, towner[t]._tx, towner[t]._ty + 1); + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_ANVIL7); + towner[t]._tMsgSaid = TRUE; #ifndef HELLFIRE - } - } + } +} #endif +} +} +if (!qtextflag) { + TownerTalk(TEXT_GRISWOLD1, t); + if (storeflag) { + StartStore(STORE_SMITH); + } +} +} +else if (t == GetActiveTowner(TOWN_WITCH)) +{ + if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && PlrHasItem(p, IDI_FUNGALTM, i) != NULL) { + RemoveInvItem(p, i); + quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE; + quests[Q_MUSHROOM]._qlog = TRUE; + quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_MUSH8); + towner[t]._tMsgSaid = TRUE; + } else if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) { + if (quests[Q_MUSHROOM]._qvar1 >= QS_TOMEGIVEN && quests[Q_MUSHROOM]._qvar1 <= QS_MUSHPICKED) { + if (PlrHasItem(p, IDI_MUSHROOM, i) != NULL) { + RemoveInvItem(p, i); + quests[Q_MUSHROOM]._qvar1 = 5; + Qtalklist[TOWN_HEALER]._qblkm = TEXT_MUSH3; + Qtalklist[TOWN_WITCH]._qblkm = -1; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + quests[Q_MUSHROOM]._qmsg = TEXT_MUSH10; + InitQTextMsg(TEXT_MUSH10); + towner[t]._tMsgSaid = TRUE; + } else if (quests[Q_MUSHROOM]._qmsg != TEXT_MUSH9) { + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + quests[Q_MUSHROOM]._qmsg = TEXT_MUSH9; + InitQTextMsg(TEXT_MUSH9); + towner[t]._tMsgSaid = TRUE; } - } - if (!qtextflag) { - TownerTalk(TEXT_GRISWOLD1, t); - if (storeflag) { - StartStore(STORE_SMITH); - } - } - } else if (t == GetActiveTowner(TOWN_WITCH)) { - if (quests[Q_MUSHROOM]._qactive == QUEST_INIT && PlrHasItem(p, IDI_FUNGALTM, i) != NULL) { - RemoveInvItem(p, i); - quests[Q_MUSHROOM]._qactive = QUEST_ACTIVE; - quests[Q_MUSHROOM]._qlog = TRUE; - quests[Q_MUSHROOM]._qvar1 = QS_TOMEGIVEN; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_MUSH8); - towner[t]._tMsgSaid = TRUE; - } else if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE) { - if (quests[Q_MUSHROOM]._qvar1 >= QS_TOMEGIVEN && quests[Q_MUSHROOM]._qvar1 <= QS_MUSHPICKED) { - if (PlrHasItem(p, IDI_MUSHROOM, i) != NULL) { - RemoveInvItem(p, i); - quests[Q_MUSHROOM]._qvar1 = 5; - Qtalklist[TOWN_HEALER]._qblkm = TEXT_MUSH3; - Qtalklist[TOWN_WITCH]._qblkm = -1; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - quests[Q_MUSHROOM]._qmsg = TEXT_MUSH10; - InitQTextMsg(TEXT_MUSH10); - towner[t]._tMsgSaid = TRUE; - } else if (quests[Q_MUSHROOM]._qmsg != TEXT_MUSH9) { - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - quests[Q_MUSHROOM]._qmsg = TEXT_MUSH9; - InitQTextMsg(TEXT_MUSH9); - towner[t]._tMsgSaid = TRUE; - } - } else { - Item = PlrHasItem(p, IDI_SPECELIX, i); - if (Item != NULL) { - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_MUSH12); - quests[Q_MUSHROOM]._qactive = QUEST_DONE; - towner[t]._tMsgSaid = TRUE; - AllItemsList[Item->IDidx].iUsable = TRUE; - } else if (PlrHasItem(p, IDI_BRAIN, i) != NULL && quests[Q_MUSHROOM]._qvar2 != TEXT_MUSH11) { - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - quests[Q_MUSHROOM]._qvar2 = TEXT_MUSH11; - InitQTextMsg(TEXT_MUSH11); - towner[t]._tMsgSaid = TRUE; - } + } else { + Item = PlrHasItem(p, IDI_SPECELIX, i); + if (Item != NULL) { + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_MUSH12); + quests[Q_MUSHROOM]._qactive = QUEST_DONE; + towner[t]._tMsgSaid = TRUE; + AllItemsList[Item->IDidx].iUsable = TRUE; + } else if (PlrHasItem(p, IDI_BRAIN, i) != NULL && quests[Q_MUSHROOM]._qvar2 != TEXT_MUSH11) { + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + quests[Q_MUSHROOM]._qvar2 = TEXT_MUSH11; + InitQTextMsg(TEXT_MUSH11); + towner[t]._tMsgSaid = TRUE; } } - if (!qtextflag) { - TownerTalk(TEXT_ADRIA1, t); - if (storeflag) { - StartStore(STORE_WITCH); - } + } + if (!qtextflag) { + TownerTalk(TEXT_ADRIA1, t); + if (storeflag) { + StartStore(STORE_WITCH); } - } else if (t == GetActiveTowner(TOWN_BMAID)) { + } +} +else if (t == GetActiveTowner(TOWN_BMAID)) +{ #ifdef HELLFIRE - if (plr[p]._pLvlVisited[21] == false && PlrHasItem(p, IDI_MAPOFDOOM, i)) { - quests[Q_GRAVE]._qactive = 2; - quests[Q_GRAVE]._qlog = 1; - quests[Q_GRAVE]._qmsg = TEXT_GRAVE8; - InitQTextMsg(TEXT_GRAVE8); - towner[t]._tMsgSaid = TRUE; - } + if (plr[p]._pLvlVisited[21] == false && PlrHasItem(p, IDI_MAPOFDOOM, i)) { + quests[Q_GRAVE]._qactive = 2; + quests[Q_GRAVE]._qlog = 1; + quests[Q_GRAVE]._qmsg = TEXT_GRAVE8; + InitQTextMsg(TEXT_GRAVE8); + towner[t]._tMsgSaid = TRUE; + } #endif - if (!qtextflag) { - TownerTalk(TEXT_GILLIAN1, t); - if (storeflag) { - StartStore(STORE_BARMAID); - } + if (!qtextflag) { + TownerTalk(TEXT_GILLIAN1, t); + if (storeflag) { + StartStore(STORE_BARMAID); } - } else if (t == GetActiveTowner(TOWN_DRUNK)) { - if (!qtextflag) { - TownerTalk(TEXT_FARNHAM1, t); - if (storeflag) { - StartStore(STORE_DRUNK); - } + } +} +else if (t == GetActiveTowner(TOWN_DRUNK)) +{ + if (!qtextflag) { + TownerTalk(TEXT_FARNHAM1, t); + if (storeflag) { + StartStore(STORE_DRUNK); } - } else if (t == GetActiveTowner(TOWN_HEALER)) { - if (gbMaxPlayers == 1) { + } +} +else if (t == GetActiveTowner(TOWN_HEALER)) +{ + if (gbMaxPlayers == 1) { #ifdef HELLFIRE - if (plr[p]._pLvlVisited[1] || plr[p]._pLvlVisited[5]) { + if (plr[p]._pLvlVisited[1] || plr[p]._pLvlVisited[5]) { #else - if (plr[p]._pLvlVisited[1]) { + if (plr[p]._pLvlVisited[1]) { #endif - if (!towner[t]._tMsgSaid) { + if (!towner[t]._tMsgSaid) { if (quests[Q_PWATER]._qactive == QUEST_INIT) { quests[Q_PWATER]._qactive = QUEST_ACTIVE; quests[Q_PWATER]._qlog = TRUE; @@ -1113,304 +1125,316 @@ void TalkToTowner(int p, int t) towner[t]._tMsgSaid = TRUE; } } - } - if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && quests[Q_MUSHROOM]._qmsg == TEXT_MUSH10 && PlrHasItem(p, IDI_BRAIN, i) != NULL) { - RemoveInvItem(p, i); - SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0); - InitQTextMsg(TEXT_MUSH4); - quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN; - Qtalklist[TOWN_HEALER]._qblkm = -1; - } } - if (!qtextflag) { - TownerTalk(TEXT_PEPIN1, t); - if (storeflag) { - StartStore(STORE_HEALER); - } + if (quests[Q_MUSHROOM]._qactive == QUEST_ACTIVE && quests[Q_MUSHROOM]._qmsg == TEXT_MUSH10 && PlrHasItem(p, IDI_BRAIN, i) != NULL) { + RemoveInvItem(p, i); + SpawnQuestItem(IDI_SPECELIX, towner[t]._tx, towner[t]._ty + 1, 0, 0); + InitQTextMsg(TEXT_MUSH4); + quests[Q_MUSHROOM]._qvar1 = QS_BRAINGIVEN; + Qtalklist[TOWN_HEALER]._qblkm = -1; } - } else if (t == GetActiveTowner(TOWN_PEGBOY)) { - if (!qtextflag) { - TownerTalk(TEXT_WIRT1, t); - if (storeflag) { - StartStore(STORE_BOY); - } + } + if (!qtextflag) { + TownerTalk(TEXT_PEPIN1, t); + if (storeflag) { + StartStore(STORE_HEALER); } - } else if (t == GetActiveTowner(TOWN_STORY)) { - if (gbMaxPlayers == 1) { - if (quests[Q_BETRAYER]._qactive == QUEST_INIT && PlrHasItem(p, IDI_LAZSTAFF, i) != NULL) { - RemoveInvItem(p, i); - quests[Q_BETRAYER]._qvar1 = 2; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_VILE1); - towner[t]._tMsgSaid = TRUE; - quests[Q_BETRAYER]._qactive = QUEST_ACTIVE; - quests[Q_BETRAYER]._qlog = TRUE; - } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { - quests[Q_BETRAYER]._qvar1 = 8; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_VILE3); - towner[t]._tMsgSaid = TRUE; - quests[Q_DIABLO]._qlog = TRUE; - } + } +} +else if (t == GetActiveTowner(TOWN_PEGBOY)) +{ + if (!qtextflag) { + TownerTalk(TEXT_WIRT1, t); + if (storeflag) { + StartStore(STORE_BOY); } - if (gbMaxPlayers != 1) { - if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && !quests[Q_BETRAYER]._qlog) { - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_VILE1); - towner[t]._tMsgSaid = TRUE; - quests[Q_BETRAYER]._qlog = TRUE; - NetSendCmdQuest(TRUE, Q_BETRAYER); - } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { - quests[Q_BETRAYER]._qvar1 = 8; - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_VILE3); - towner[t]._tMsgSaid = TRUE; - NetSendCmdQuest(TRUE, Q_BETRAYER); - quests[Q_DIABLO]._qlog = TRUE; - NetSendCmdQuest(TRUE, Q_DIABLO); - } + } +} +else if (t == GetActiveTowner(TOWN_STORY)) +{ + if (gbMaxPlayers == 1) { + if (quests[Q_BETRAYER]._qactive == QUEST_INIT && PlrHasItem(p, IDI_LAZSTAFF, i) != NULL) { + RemoveInvItem(p, i); + quests[Q_BETRAYER]._qvar1 = 2; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_VILE1); + towner[t]._tMsgSaid = TRUE; + quests[Q_BETRAYER]._qactive = QUEST_ACTIVE; + quests[Q_BETRAYER]._qlog = TRUE; + } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { + quests[Q_BETRAYER]._qvar1 = 8; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_VILE3); + towner[t]._tMsgSaid = TRUE; + quests[Q_DIABLO]._qlog = TRUE; } - if (!qtextflag) { - TownerTalk(TEXT_STORY1, t); - if (storeflag) { - StartStore(STORE_STORY); - } + } + if (gbMaxPlayers != 1) { + if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE && !quests[Q_BETRAYER]._qlog) { + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_VILE1); + towner[t]._tMsgSaid = TRUE; + quests[Q_BETRAYER]._qlog = TRUE; + NetSendCmdQuest(TRUE, Q_BETRAYER); + } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { + quests[Q_BETRAYER]._qvar1 = 8; + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_VILE3); + towner[t]._tMsgSaid = TRUE; + NetSendCmdQuest(TRUE, Q_BETRAYER); + quests[Q_DIABLO]._qlog = TRUE; + NetSendCmdQuest(TRUE, Q_DIABLO); } - } else if (towner[t]._ttype == TOWN_COW) { - if (!qtextflag) - CowSFX(p); + } + if (!qtextflag) { + TownerTalk(TEXT_STORY1, t); + if (storeflag) { + StartStore(STORE_STORY); + } + } +} +else if (towner[t]._ttype == TOWN_COW) +{ + if (!qtextflag) + CowSFX(p); #ifdef HELLFIRE - } else if (towner[t]._ttype == TOWN_FARMER) { - if (!qtextflag) { - qt = 277; +} +else if (towner[t]._ttype == TOWN_FARMER) +{ + if (!qtextflag) { + qt = 277; + t2 = 1; + switch (quests[Q_FARMER]._qactive) { + case 0: + if (PlrHasItem(p, IDI_RUNEBOMB, i)) { + qt = TEXT_FARMER2; + quests[Q_FARMER]._qactive = 2; + quests[Q_FARMER]._qvar1 = 1; + quests[Q_FARMER]._qlog = 1; + quests[Q_FARMER]._qmsg = TEXT_FARMER1; + break; + } else if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) { + qt = 309; + if (plr[myplr]._pLvlVisited[2]) + qt = 281; + if (plr[myplr]._pLvlVisited[5]) + qt = 308; + if (plr[myplr]._pLvlVisited[7]) + qt = 310; + } else { + qt = TEXT_FARMER1; + quests[Q_FARMER]._qactive = 2; + quests[Q_FARMER]._qvar1 = 1; + quests[Q_FARMER]._qlog = 1; + quests[Q_FARMER]._qmsg = TEXT_FARMER1; + SpawnRuneBomb(towner[t]._tx + 1, towner[t]._ty); + t2 = 1; + break; + } + case 2: + if (PlrHasItem(p, IDI_RUNEBOMB, i)) + qt = TEXT_FARMER2; + else + qt = TEXT_FARMER3; + break; + case 1: + if (PlrHasItem(p, IDI_RUNEBOMB, i)) { + qt = TEXT_FARMER2; + quests[Q_FARMER]._qactive = 2; + quests[Q_FARMER]._qvar1 = 1; + quests[Q_FARMER]._qmsg = TEXT_FARMER1; + quests[Q_FARMER]._qlog = 1; + } else if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) { + qt = TEXT_FARMER8; + if (plr[myplr]._pLvlVisited[2]) { + qt = TEXT_FARMER5; + } + if (plr[myplr]._pLvlVisited[5]) { + qt = TEXT_FARMER7; + } + if (plr[myplr]._pLvlVisited[7]) { + qt = TEXT_FARMER9; + } + } else { + qt = TEXT_FARMER1; + quests[Q_FARMER]._qactive = 2; + quests[Q_FARMER]._qvar1 = 1; + quests[Q_FARMER]._qlog = 1; + quests[Q_FARMER]._qmsg = TEXT_FARMER1; + SpawnRuneBomb(towner[t]._tx + 1, towner[t]._ty); + t2 = 1; + } + break; + case 3: + qt = TEXT_FARMER4; + SpawnRewardItem(IDI_AURIC, towner[t]._tx + 1, towner[t]._ty); + quests[Q_FARMER]._qactive = 10; + quests[Q_FARMER]._qlog = 0; t2 = 1; - switch (quests[Q_FARMER]._qactive) { + break; + case 10: + qt = -1; + break; + default: + quests[Q_FARMER]._qactive = 0; + qt = TEXT_FARMER4; + break; + } + if (qt != -1) { + if (t2) + InitQTextMsg(qt); + else + PlaySFX(alltext[qt].sfxnr); + } + if (gbMaxPlayers != 1) { + NetSendCmdQuest(TRUE, Q_FARMER); + } + } +} +else if (towner[t]._ttype == TOWN_COWFARM) +{ + if (!qtextflag) { + qt = 297; + t2 = 1; + if (PlrHasItem(p, IDI_GREYSUIT, i)) { + qt = TEXT_JERSEY7; + RemoveInvItem(p, i); + } else if (PlrHasItem(p, IDI_BROWNSUIT, i)) { + CreateItem(UITEM_BOVINE, towner[t]._tx + 1, towner[t]._ty); + RemoveInvItem(p, i); + qt = TEXT_JERSEY8; + quests[Q_JERSEY]._qactive = 3; + } else if (PlrHasItem(p, IDI_RUNEBOMB, i)) { + qt = TEXT_JERSEY5; + quests[Q_JERSEY]._qactive = 2; + quests[Q_JERSEY]._qvar1 = 1; + quests[Q_JERSEY]._qmsg = TEXT_JERSEY4; + quests[Q_JERSEY]._qlog = 1; + } else { + switch (quests[Q_JERSEY]._qactive) { case 0: - if (PlrHasItem(p, IDI_RUNEBOMB, i)) { - qt = TEXT_FARMER2; - quests[Q_FARMER]._qactive = 2; - quests[Q_FARMER]._qvar1 = 1; - quests[Q_FARMER]._qlog = 1; - quests[Q_FARMER]._qmsg = TEXT_FARMER1; - break; - } else if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) { - qt = 309; - if (plr[myplr]._pLvlVisited[2]) - qt = 281; - if (plr[myplr]._pLvlVisited[5]) - qt = 308; - if (plr[myplr]._pLvlVisited[7]) - qt = 310; - } else { - qt = TEXT_FARMER1; - quests[Q_FARMER]._qactive = 2; - quests[Q_FARMER]._qvar1 = 1; - quests[Q_FARMER]._qlog = 1; - quests[Q_FARMER]._qmsg = TEXT_FARMER1; - SpawnRuneBomb(towner[t]._tx + 1, towner[t]._ty); - t2 = 1; - break; - } - case 2: - if (PlrHasItem(p, IDI_RUNEBOMB, i)) - qt = TEXT_FARMER2; - else - qt = TEXT_FARMER3; + qt = TEXT_JERSEY1; + quests[Q_JERSEY]._qactive = 7; break; case 1: - if (PlrHasItem(p, IDI_RUNEBOMB, i)) { - qt = TEXT_FARMER2; - quests[Q_FARMER]._qactive = 2; - quests[Q_FARMER]._qvar1 = 1; - quests[Q_FARMER]._qmsg = TEXT_FARMER1; - quests[Q_FARMER]._qlog = 1; - } else if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) { - qt = TEXT_FARMER8; - if (plr[myplr]._pLvlVisited[2]) { - qt = TEXT_FARMER5; - } - if (plr[myplr]._pLvlVisited[5]) { - qt = TEXT_FARMER7; - } - if (plr[myplr]._pLvlVisited[7]) { - qt = TEXT_FARMER9; + qt = TEXT_JERSEY1; + quests[23]._qactive = 7; + break; + case 2: + qt = TEXT_JERSEY5; + break; + case 3: + qt = TEXT_JERSEY1; + break; + case 7: + qt = TEXT_JERSEY2; + quests[Q_JERSEY]._qactive = 8; + break; + case 8: + qt = TEXT_JERSEY3; + quests[Q_JERSEY]._qactive = 9; + break; + case 9: + if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) { + switch (random_(0, 4) + 9) { + case 9: + qt = TEXT_JERSEY9; + break; + case 10: + qt = TEXT_JERSEY10; + break; + case 11: + qt = TEXT_JERSEY11; + break; + default: + qt = TEXT_JERSEY12; } + break; } else { - qt = TEXT_FARMER1; - quests[Q_FARMER]._qactive = 2; - quests[Q_FARMER]._qvar1 = 1; - quests[Q_FARMER]._qlog = 1; - quests[Q_FARMER]._qmsg = TEXT_FARMER1; + qt = TEXT_JERSEY4; + quests[Q_JERSEY]._qactive = 2; + quests[Q_JERSEY]._qvar1 = 1; + quests[Q_JERSEY]._qmsg = TEXT_JERSEY4; + quests[Q_JERSEY]._qlog = 1; SpawnRuneBomb(towner[t]._tx + 1, towner[t]._ty); t2 = 1; } break; - case 3: - qt = TEXT_FARMER4; - SpawnRewardItem(IDI_AURIC, towner[t]._tx + 1, towner[t]._ty); - quests[Q_FARMER]._qactive = 10; - quests[Q_FARMER]._qlog = 0; + default: + qt = TEXT_JERSEY5; + quests[Q_JERSEY]._qactive = 0; + break; + } + } + if (qt != -1) { + if (t2) + InitQTextMsg(qt); + else + PlaySFX(alltext[qt].sfxnr); + } + if (gbMaxPlayers != 1) { + NetSendCmdQuest(TRUE, Q_JERSEY); + } + } +} +else if (towner[t]._ttype == TOWN_GIRL) +{ + if (!qtextflag) { + qt = 282; + t2 = 0; + if (!PlrHasItem(p, IDI_THEODORE, i) || quests[Q_GIRL]._qactive == 3) { + switch (quests[Q_GIRL]._qactive) { + case 0: + qt = TEXT_GIRL2; + quests[Q_GIRL]._qactive = 2; + quests[Q_GIRL]._qvar1 = 1; + quests[Q_GIRL]._qlog = 1; + quests[Q_GIRL]._qmsg = TEXT_GIRL2; + t2 = 1; + break; + case 1: + qt = TEXT_GIRL2; + quests[Q_GIRL]._qvar1 = 1; + quests[Q_GIRL]._qlog = 1; + quests[Q_GIRL]._qmsg = TEXT_GIRL2; + quests[Q_GIRL]._qactive = 2; + t2 = 1; + break; + case 2: + qt = TEXT_GIRL3; t2 = 1; break; - case 10: + case 3: qt = -1; break; default: - quests[Q_FARMER]._qactive = 0; - qt = TEXT_FARMER4; + quests[Q_GIRL]._qactive = 0; + qt = TEXT_GIRL1; break; } - if (qt != -1) { - if (t2) - InitQTextMsg(qt); - else - PlaySFX(alltext[qt].sfxnr); - } - if (gbMaxPlayers != 1) { - NetSendCmdQuest(TRUE, Q_FARMER); - } - } - } else if (towner[t]._ttype == TOWN_COWFARM) { - if (!qtextflag) { - qt = 297; + } else { + qt = TEXT_GIRL4; + RemoveInvItem(p, i); + CreateAmulet(towner[t]._tx, towner[t]._ty, 13, 0, 1); + quests[Q_GIRL]._qlog = 0; + quests[Q_GIRL]._qactive = 3; t2 = 1; - if (PlrHasItem(p, IDI_GREYSUIT, i)) { - qt = TEXT_JERSEY7; - RemoveInvItem(p, i); - } else if (PlrHasItem(p, IDI_BROWNSUIT, i)) { - CreateItem(UITEM_BOVINE, towner[t]._tx + 1, towner[t]._ty); - RemoveInvItem(p, i); - qt = TEXT_JERSEY8; - quests[Q_JERSEY]._qactive = 3; - } else if (PlrHasItem(p, IDI_RUNEBOMB, i)) { - qt = TEXT_JERSEY5; - quests[Q_JERSEY]._qactive = 2; - quests[Q_JERSEY]._qvar1 = 1; - quests[Q_JERSEY]._qmsg = TEXT_JERSEY4; - quests[Q_JERSEY]._qlog = 1; - } else { - switch (quests[Q_JERSEY]._qactive) { - case 0: - qt = TEXT_JERSEY1; - quests[Q_JERSEY]._qactive = 7; - break; - case 1: - qt = TEXT_JERSEY1; - quests[23]._qactive = 7; - break; - case 2: - qt = TEXT_JERSEY5; - break; - case 3: - qt = TEXT_JERSEY1; - break; - case 7: - qt = TEXT_JERSEY2; - quests[Q_JERSEY]._qactive = 8; - break; - case 8: - qt = TEXT_JERSEY3; - quests[Q_JERSEY]._qactive = 9; - break; - case 9: - if (!plr[myplr]._pLvlVisited[9] && plr[myplr]._pLevel < 15) { - switch (random_(0, 4) + 9) { - case 9: - qt = TEXT_JERSEY9; - break; - case 10: - qt = TEXT_JERSEY10; - break; - case 11: - qt = TEXT_JERSEY11; - break; - default: - qt = TEXT_JERSEY12; - } - break; - } else { - qt = TEXT_JERSEY4; - quests[Q_JERSEY]._qactive = 2; - quests[Q_JERSEY]._qvar1 = 1; - quests[Q_JERSEY]._qmsg = TEXT_JERSEY4; - quests[Q_JERSEY]._qlog = 1; - SpawnRuneBomb(towner[t]._tx + 1, towner[t]._ty); - t2 = 1; - } - break; - default: - qt = TEXT_JERSEY5; - quests[Q_JERSEY]._qactive = 0; - break; - } - } - if (qt != -1) { - if (t2) - InitQTextMsg(qt); - else - PlaySFX(alltext[qt].sfxnr); - } - if (gbMaxPlayers != 1) { - NetSendCmdQuest(TRUE, Q_JERSEY); - } } - } else if (towner[t]._ttype == TOWN_GIRL) { - if (!qtextflag) { - qt = 282; - t2 = 0; - if (!PlrHasItem(p, IDI_THEODORE, i) || quests[Q_GIRL]._qactive == 3) { - switch (quests[Q_GIRL]._qactive) { - case 0: - qt = TEXT_GIRL2; - quests[Q_GIRL]._qactive = 2; - quests[Q_GIRL]._qvar1 = 1; - quests[Q_GIRL]._qlog = 1; - quests[Q_GIRL]._qmsg = TEXT_GIRL2; - t2 = 1; - break; - case 1: - qt = TEXT_GIRL2; - quests[Q_GIRL]._qvar1 = 1; - quests[Q_GIRL]._qlog = 1; - quests[Q_GIRL]._qmsg = TEXT_GIRL2; - quests[Q_GIRL]._qactive = 2; - t2 = 1; - break; - case 2: - qt = TEXT_GIRL3; - t2 = 1; - break; - case 3: - qt = -1; - break; - default: - quests[Q_GIRL]._qactive = 0; - qt = TEXT_GIRL1; - break; - } + if (qt != -1) { + if (t2 != 0) { + InitQTextMsg(qt); } else { - qt = TEXT_GIRL4; - RemoveInvItem(p, i); - CreateAmulet(towner[t]._tx, towner[t]._ty, 13, 0, 1); - quests[Q_GIRL]._qlog = 0; - quests[Q_GIRL]._qactive = 3; - t2 = 1; - } - if (qt != -1) { - if (t2 != 0) { - InitQTextMsg(qt); - } else { - PlaySFX(alltext[qt].sfxnr); - } - } - if (gbMaxPlayers != 1) { - NetSendCmdQuest(TRUE, Q_GIRL); + PlaySFX(alltext[qt].sfxnr); } } -#endif + if (gbMaxPlayers != 1) { + NetSendCmdQuest(TRUE, Q_GIRL); + } } +#endif +} } diff --git a/Source/trigs.cpp b/Source/trigs.cpp index 4bbe1071e..82613629b 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -17,7 +17,7 @@ int TownDownList[] = { 716, 715, 719, 720, 721, 723, 724, 725, 726, 727, -1 }; int TownWarp1List[] = { 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1181, 1183, 1185, -1 }; #ifdef HELLFIRE int TownCryptList[] = { 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, -1 }; -int TownHiveList[] = { 1307,1308,1309,1310, -1}; +int TownHiveList[] = { 1307, 1308, 1309, 1310, -1 }; #endif /** Specifies the dungeon piece IDs which constitute stairways leading up from the cathedral. */ int L1UpList[] = { 127, 129, 130, 131, 132, 133, 135, 137, 138, 139, 140, -1 }; @@ -71,7 +71,6 @@ void InitTownTriggers() trigs[numtrigs]._tmsg = WM_DIABNEXTLVL; numtrigs++; - #ifndef SPAWN if (gbMaxPlayers == MAX_PLRS) { for (i = 0; i < sizeof(townwarps) / sizeof(townwarps[0]); i++) { diff --git a/defs.h b/defs.h index c81519c23..4b1b7da24 100644 --- a/defs.h +++ b/defs.h @@ -130,7 +130,7 @@ // 256 kilobytes + 3 bytes (demo leftover) for file magic (262147) // final game uses 4-byte magic instead of 3 -#define FILEBUFF ((256*1024)+3) +#define FILEBUFF ((256 * 1024) + 3) #define PMSG_COUNT 8 @@ -216,22 +216,22 @@ #define DIALOG_TOP ((SCREEN_HEIGHT - PANEL_HEIGHT) / 2 - 18) #define DIALOG_Y (SCREEN_Y + DIALOG_TOP) -#define SCREENXY(x, y) ((x) + SCREEN_X + ((y) + SCREEN_Y) * BUFFER_WIDTH) +#define SCREENXY(x, y) ((x) + SCREEN_X + ((y) + SCREEN_Y) * BUFFER_WIDTH) -#define MemFreeDbg(p) \ -{ \ - void *p__p; \ - p__p = p; \ - p = NULL; \ - mem_free_dbg(p__p); \ -} +#define MemFreeDbg(p) \ + { \ + void *p__p; \ + p__p = p; \ + p = NULL; \ + mem_free_dbg(p__p); \ + } #undef assert #ifndef _DEBUG #define assert(exp) ((void)0) #else -#define assert(exp) (void)( (exp) || (assert_fail(__LINE__, __FILE__, #exp), 0) ) +#define assert(exp) (void)((exp) || (assert_fail(__LINE__, __FILE__, #exp), 0)) #endif #ifndef INVALID_FILE_ATTRIBUTES diff --git a/enums.h b/enums.h index 0ebaecbb8..85c92df58 100644 --- a/enums.h +++ b/enums.h @@ -1850,11 +1850,11 @@ typedef enum monster_resistance { RESIST_MAGIC = 0x01, RESIST_FIRE = 0x02, RESIST_LIGHTNING = 0x04, - IMMUNE_MAGIC = 0x08, - IMMUNE_FIRE = 0x10, - IMMUNE_LIGHTNING = 0x20, - IMMUNE_NULL_40 = 0x40, - IMMUNE_ACID = 0x80, + IMMUNE_MAGIC = 0x08, + IMMUNE_FIRE = 0x10, + IMMUNE_LIGHTNING = 0x20, + IMMUNE_NULL_40 = 0x40, + IMMUNE_ACID = 0x80, } monster_resistance; typedef enum missile_resistance { @@ -2130,81 +2130,81 @@ typedef enum _speech_id { TEXT_HBLOODY = 0x104, TEXT_HBLINDING = 0x105, TEXT_HBLOODWAR = 0x106, - TEXT_BBONER = 0x107, - TEXT_BBLOODY = 0x108, - TEXT_BBLINDING = 0x109, - TEXT_BBLOODWAR = 0x10A, - TEXT_GRAVE1 = 0x10B, - TEXT_GRAVE2 = 0x10C, - TEXT_GRAVE3 = 0x10D, - TEXT_GRAVE4 = 0x10E, - TEXT_GRAVE5 = 0x10F, - TEXT_GRAVE6 = 0x110, - TEXT_GRAVE7 = 0x111, - TEXT_GRAVE8 = 0x112, - TEXT_GRAVE9 = 0x113, - TEXT_GRAVE10 = 0x114, - TEXT_FARMER1 = 0x115, - TEXT_FARMER2 = 0x116, - TEXT_FARMER3 = 0x117, - TEXT_FARMER4 = 0x118, - TEXT_FARMER5 = 0x119, - TEXT_GIRL1 = 0x11A, - TEXT_GIRL2 = 0x11B, - TEXT_GIRL3 = 0x11C, - TEXT_GIRL4 = 0x11D, - TEXT_DEFILER1 = 0x11E, - TEXT_DEFILER2 = 0x11F, - TEXT_DEFILER3 = 0x120, - TEXT_DEFILER4 = 0x121, - TEXT_DEFILER5 = 0x122, - TEXT_NAKRUL1 = 0x123, - TEXT_NAKRUL2 = 0x124, - TEXT_NAKRUL3 = 0x125, - TEXT_NAKRUL4 = 0x126, - TEXT_NAKRUL5 = 0x127, - TEXT_CORNSTN = 0x128, - TEXT_JERSEY1 = 0x129, - TEXT_JERSEY2 = 0x12A, - TEXT_JERSEY3 = 0x12B, - TEXT_JERSEY4 = 0x12C, - TEXT_JERSEY5 = 0x12D, - TEXT_JERSEY6 = 0x12E, - TEXT_JERSEY7 = 0x12F, - TEXT_JERSEY8 = 0x130, - TEXT_JERSEY9 = 0x131, - TEXT_TRADER = 0x132, - TEXT_FARMER6 = 0x133, - TEXT_FARMER7 = 0x134, - TEXT_FARMER8 = 0x135, - TEXT_FARMER9 = 0x136, - TEXT_FARMER10 = 0x137, - TEXT_JERSEY10 = 0x138, - TEXT_JERSEY11 = 0x139, - TEXT_JERSEY12 = 0x13A, - TEXT_JERSEY13 = 0x13B, - TEXT_SKLJRN = 0x13C, - TEXT_BOOK4 = 0x13D, - TEXT_BOOK5 = 0x13E, - TEXT_BOOK6 = 0x13F, - TEXT_BOOK7 = 0x140, - TEXT_BOOK8 = 0x141, - TEXT_BOOK9 = 0x142, - TEXT_BOOKA = 0x143, - TEXT_BOOKB = 0x144, - TEXT_BOOKC = 0x145, - TEXT_OBOOKA = 0x146, - TEXT_OBOOKB = 0x147, - TEXT_OBOOKC = 0x148, - TEXT_MBOOKA = 0x149, - TEXT_MBOOKB = 0x14A, - TEXT_MBOOKC = 0x14B, - TEXT_RBOOKA = 0x14C, - TEXT_RBOOKB = 0x14D, - TEXT_RBOOKC = 0x14E, - TEXT_BBOOKA = 0x14F, - TEXT_BBOOKB = 0x150, - TEXT_BBOOKC = 0x151, + TEXT_BBONER = 0x107, + TEXT_BBLOODY = 0x108, + TEXT_BBLINDING = 0x109, + TEXT_BBLOODWAR = 0x10A, + TEXT_GRAVE1 = 0x10B, + TEXT_GRAVE2 = 0x10C, + TEXT_GRAVE3 = 0x10D, + TEXT_GRAVE4 = 0x10E, + TEXT_GRAVE5 = 0x10F, + TEXT_GRAVE6 = 0x110, + TEXT_GRAVE7 = 0x111, + TEXT_GRAVE8 = 0x112, + TEXT_GRAVE9 = 0x113, + TEXT_GRAVE10 = 0x114, + TEXT_FARMER1 = 0x115, + TEXT_FARMER2 = 0x116, + TEXT_FARMER3 = 0x117, + TEXT_FARMER4 = 0x118, + TEXT_FARMER5 = 0x119, + TEXT_GIRL1 = 0x11A, + TEXT_GIRL2 = 0x11B, + TEXT_GIRL3 = 0x11C, + TEXT_GIRL4 = 0x11D, + TEXT_DEFILER1 = 0x11E, + TEXT_DEFILER2 = 0x11F, + TEXT_DEFILER3 = 0x120, + TEXT_DEFILER4 = 0x121, + TEXT_DEFILER5 = 0x122, + TEXT_NAKRUL1 = 0x123, + TEXT_NAKRUL2 = 0x124, + TEXT_NAKRUL3 = 0x125, + TEXT_NAKRUL4 = 0x126, + TEXT_NAKRUL5 = 0x127, + TEXT_CORNSTN = 0x128, + TEXT_JERSEY1 = 0x129, + TEXT_JERSEY2 = 0x12A, + TEXT_JERSEY3 = 0x12B, + TEXT_JERSEY4 = 0x12C, + TEXT_JERSEY5 = 0x12D, + TEXT_JERSEY6 = 0x12E, + TEXT_JERSEY7 = 0x12F, + TEXT_JERSEY8 = 0x130, + TEXT_JERSEY9 = 0x131, + TEXT_TRADER = 0x132, + TEXT_FARMER6 = 0x133, + TEXT_FARMER7 = 0x134, + TEXT_FARMER8 = 0x135, + TEXT_FARMER9 = 0x136, + TEXT_FARMER10 = 0x137, + TEXT_JERSEY10 = 0x138, + TEXT_JERSEY11 = 0x139, + TEXT_JERSEY12 = 0x13A, + TEXT_JERSEY13 = 0x13B, + TEXT_SKLJRN = 0x13C, + TEXT_BOOK4 = 0x13D, + TEXT_BOOK5 = 0x13E, + TEXT_BOOK6 = 0x13F, + TEXT_BOOK7 = 0x140, + TEXT_BOOK8 = 0x141, + TEXT_BOOK9 = 0x142, + TEXT_BOOKA = 0x143, + TEXT_BOOKB = 0x144, + TEXT_BOOKC = 0x145, + TEXT_OBOOKA = 0x146, + TEXT_OBOOKB = 0x147, + TEXT_OBOOKC = 0x148, + TEXT_MBOOKA = 0x149, + TEXT_MBOOKB = 0x14A, + TEXT_MBOOKC = 0x14B, + TEXT_RBOOKA = 0x14C, + TEXT_RBOOKB = 0x14D, + TEXT_RBOOKC = 0x14E, + TEXT_BBOOKA = 0x14F, + TEXT_BBOOKB = 0x150, + TEXT_BBOOKC = 0x151, #endif } _speech_id; @@ -2303,7 +2303,7 @@ typedef enum placeflag { PLACE_UNIQUE = 4, } placeflag; - /* +/* First 5 bits store level 6th bit stores onlygood flag 7th bit stores uper15 flag - uper means unique percent, this flag is true for unique monsters and loot from them has 15% to become unique @@ -3094,33 +3094,33 @@ typedef enum _setlevels { } _setlevels; typedef enum quest_id { - Q_ROCK = 0x0, - Q_MUSHROOM = 0x1, - Q_GARBUD = 0x2, - Q_ZHAR = 0x3, - Q_VEIL = 0x4, - Q_DIABLO = 0x5, - Q_BUTCHER = 0x6, - Q_LTBANNER = 0x7, - Q_BLIND = 0x8, - Q_BLOOD = 0x9, - Q_ANVIL = 0xA, - Q_WARLORD = 0xB, - Q_SKELKING = 0xC, - Q_PWATER = 0xD, - Q_SCHAMB = 0xE, - Q_BETRAYER = 0xF, + Q_ROCK = 0x00, + Q_MUSHROOM = 0x01, + Q_GARBUD = 0x02, + Q_ZHAR = 0x03, + Q_VEIL = 0x04, + Q_DIABLO = 0x05, + Q_BUTCHER = 0x06, + Q_LTBANNER = 0x07, + Q_BLIND = 0x08, + Q_BLOOD = 0x09, + Q_ANVIL = 0x0A, + Q_WARLORD = 0x0B, + Q_SKELKING = 0x0C, + Q_PWATER = 0x0D, + Q_SCHAMB = 0x0E, + Q_BETRAYER = 0x0F, #ifdef HELLFIRE - Q_GRAVE = 0x10, - Q_FARMER = 0x11, - Q_GIRL = 0x12, - Q_TRADER = 0x13, - Q_DEFILER = 0x14, - Q_NAKRUL = 0x15, - Q_CORNSTN = 0x16, - Q_JERSEY = 0x17, + Q_GRAVE = 0x10, + Q_FARMER = 0x11, + Q_GIRL = 0x12, + Q_TRADER = 0x13, + Q_DEFILER = 0x14, + Q_NAKRUL = 0x15, + Q_CORNSTN = 0x16, + Q_JERSEY = 0x17, #endif - Q_INVALID = -1, + Q_INVALID = -1, } quest_id; typedef enum quest_state {