diff --git a/Source/doom.cpp b/Source/doom.cpp index 0f94f3e9f..19637babe 100644 --- a/Source/doom.cpp +++ b/Source/doom.cpp @@ -30,7 +30,7 @@ int doom_get_frame_from_time() return DoomQuestState / 1200; } -static bool doom_load_graphics() +static bool DoomLoadGraphics() { DoomCel = LoadCel("Items\\Map\\MapZtown.CEL", 640); return true; @@ -39,7 +39,7 @@ static bool doom_load_graphics() void doom_init() { DoomQuestTime = doom_get_frame_from_time() == 31 ? 31 : 0; - if (doom_load_graphics()) { + if (DoomLoadGraphics()) { DoomFlag = true; } else { doom_close(); diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index b84d6b8fd..6332c36b6 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -520,7 +520,7 @@ void DRLG_InitL5Vals() } } -static void DRLG_PlaceDoor(int x, int y) +static void DrlgPlaceDoor(int x, int y) { if ((L5dflags[x][y] & DLRG_PROTECTED) == 0) { BYTE df = L5dflags[x][y] & 0x7F; @@ -867,7 +867,7 @@ void drlg_l1_crypt_lavafloor() } } -static void DRLG_L1Shadows() +static void DrlgL1Shadows() { uint8_t sd[2][2]; @@ -925,7 +925,7 @@ static void DRLG_L1Shadows() } } -static int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, bool setview, int noquad, int ldir) +static int DrlgPlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, int cy, bool setview, int noquad, int ldir) { int sx; int sy; @@ -1036,7 +1036,7 @@ static int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, in return 3; } -static void DRLG_L1Floor() +static void DrlgL1Floor() { for (int j = 0; j < DMAXY; j++) { for (int i = 0; i < DMAXX; i++) { @@ -1096,12 +1096,12 @@ void DRLG_LPass3(int lv) } } -static void DRLG_L1Pass3() +static void DrlgL1Pass3() { DRLG_LPass3(22 - 1); } -static void DRLG_LoadL1SP() +static void DrlgLoadL1Sp() { L5setloadflag = false; if (QuestStatus(Q_BUTCHER)) { @@ -1118,7 +1118,7 @@ static void DRLG_LoadL1SP() } } -static void DRLG_FreeL1SP() +static void DrlgFreeL1Sp() { L5pSetPiece = nullptr; } @@ -1137,7 +1137,7 @@ void DRLG_Init_Globals() memset(dLight, c, sizeof(dLight)); } -static void DRLG_InitL1Vals() +static void DrlgInitL1Vals() { int pc; @@ -1219,16 +1219,16 @@ void LoadL1Dungeon(const char *path, int vx, int vy) } } - DRLG_L1Floor(); + DrlgL1Floor(); ViewX = vx; ViewY = vy; - DRLG_L1Pass3(); + DrlgL1Pass3(); DRLG_Init_Globals(); if (currlevel < 17) - DRLG_InitL1Vals(); + DrlgInitL1Vals(); SetMapMonsters(dunData.get(), { 0, 0 }); SetMapObjects(dunData.get(), 0, 0); @@ -1268,7 +1268,7 @@ void LoadPreL1Dungeon(const char *path) } } - DRLG_L1Floor(); + DrlgL1Floor(); for (int j = 0; j < DMAXY; j++) { for (int i = 0; i < DMAXX; i++) { @@ -1702,7 +1702,7 @@ static void L5AddWall() } } -static void DRLG_L5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool leftflag, bool rightflag) +static void DrlgL5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool leftflag, bool rightflag) { if (topflag) { dungeon[sx + 2][sy] = 12; @@ -1758,7 +1758,7 @@ static void DRLG_L5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool dungeon[sx + 7][sy + 7] = 15; } -static void DRLG_L5GHall(int x1, int y1, int x2, int y2) +static void DrlgL5GHall(int x1, int y1, int x2, int y2) { if (y1 == y2) { for (int i = x1; i < x2; i++) { @@ -1950,7 +1950,7 @@ void drlg_l1_crypt_rndset(const BYTE *miniset, int rndper) } } -static void DRLG_L5Subs() +static void DrlgL5Subs() { for (int y = 0; y < DMAXY; y++) { for (int x = 0; x < DMAXX; x++) { @@ -1989,7 +1989,7 @@ static void DRLG_L5Subs() } } -static void DRLG_L5SetRoom(int rx1, int ry1) +static void DrlgL5SetRoom(int rx1, int ry1) { int width = SDL_SwapLE16(L5pSetPiece[0]); int height = SDL_SwapLE16(L5pSetPiece[1]); @@ -2017,49 +2017,49 @@ static void DRLG_L5SetRoom(int rx1, int ry1) static void L5FillChambers() { if (HR1) - DRLG_L5GChamber(0, 14, false, false, false, true); + DrlgL5GChamber(0, 14, false, false, false, true); if (HR2) { if (HR1 && !HR3) - DRLG_L5GChamber(14, 14, false, false, true, false); + DrlgL5GChamber(14, 14, false, false, true, false); if (!HR1 && HR3) - DRLG_L5GChamber(14, 14, false, false, false, true); + DrlgL5GChamber(14, 14, false, false, false, true); if (HR1 && HR3) - DRLG_L5GChamber(14, 14, false, false, true, true); + DrlgL5GChamber(14, 14, false, false, true, true); if (!HR1 && !HR3) - DRLG_L5GChamber(14, 14, false, false, false, false); + DrlgL5GChamber(14, 14, false, false, false, false); } if (HR3) - DRLG_L5GChamber(28, 14, false, false, true, false); + DrlgL5GChamber(28, 14, false, false, true, false); if (HR1 && HR2) - DRLG_L5GHall(12, 18, 14, 18); + DrlgL5GHall(12, 18, 14, 18); if (HR2 && HR3) - DRLG_L5GHall(26, 18, 28, 18); + DrlgL5GHall(26, 18, 28, 18); if (HR1 && !HR2 && HR3) - DRLG_L5GHall(12, 18, 28, 18); + DrlgL5GHall(12, 18, 28, 18); if (VR1) - DRLG_L5GChamber(14, 0, false, true, false, false); + DrlgL5GChamber(14, 0, false, true, false, false); if (VR2) { if (VR1 && !VR3) - DRLG_L5GChamber(14, 14, true, false, false, false); + DrlgL5GChamber(14, 14, true, false, false, false); if (!VR1 && VR3) - DRLG_L5GChamber(14, 14, false, true, false, false); + DrlgL5GChamber(14, 14, false, true, false, false); if (VR1 && VR3) - DRLG_L5GChamber(14, 14, true, true, false, false); + DrlgL5GChamber(14, 14, true, true, false, false); if (!VR1 && !VR3) - DRLG_L5GChamber(14, 14, false, false, false, false); + DrlgL5GChamber(14, 14, false, false, false, false); } if (VR3) - DRLG_L5GChamber(14, 28, true, false, false, false); + DrlgL5GChamber(14, 28, true, false, false, false); if (VR1 && VR2) - DRLG_L5GHall(18, 12, 18, 14); + DrlgL5GHall(18, 12, 18, 14); if (VR2 && VR3) - DRLG_L5GHall(18, 26, 18, 28); + DrlgL5GHall(18, 26, 18, 28); if (VR1 && !VR2 && VR3) - DRLG_L5GHall(18, 12, 18, 28); + DrlgL5GHall(18, 12, 18, 28); if (currlevel == 24) { if (VR1 || VR2 || VR3) { @@ -2193,13 +2193,13 @@ static void L5FillChambers() switch (c) { case 0: - DRLG_L5SetRoom(16, 2); + DrlgL5SetRoom(16, 2); break; case 1: - DRLG_L5SetRoom(16, 16); + DrlgL5SetRoom(16, 16); break; case 2: - DRLG_L5SetRoom(16, 30); + DrlgL5SetRoom(16, 30); break; } } else { @@ -2221,13 +2221,13 @@ static void L5FillChambers() switch (c) { case 0: - DRLG_L5SetRoom(2, 16); + DrlgL5SetRoom(2, 16); break; case 1: - DRLG_L5SetRoom(16, 16); + DrlgL5SetRoom(16, 16); break; case 2: - DRLG_L5SetRoom(30, 16); + DrlgL5SetRoom(30, 16); break; } } @@ -2288,7 +2288,7 @@ void drlg_l1_set_corner_room(int rx1, int ry1) } } -static void DRLG_L5FTVR(int i, int j, int x, int y, int d) +static void DrlgL5Ftvr(int i, int j, int x, int y, int d) { if (dTransVal[x][y] != 0 || dungeon[i][j] != 13) { if (d == 1) { @@ -2322,17 +2322,17 @@ static void DRLG_L5FTVR(int i, int j, int x, int y, int d) dTransVal[x + 1][y] = TransVal; dTransVal[x][y + 1] = TransVal; dTransVal[x + 1][y + 1] = TransVal; - DRLG_L5FTVR(i + 1, j, x + 2, y, 1); - DRLG_L5FTVR(i - 1, j, x - 2, y, 2); - DRLG_L5FTVR(i, j + 1, x, y + 2, 3); - DRLG_L5FTVR(i, j - 1, x, y - 2, 4); - DRLG_L5FTVR(i - 1, j - 1, x - 2, y - 2, 5); - DRLG_L5FTVR(i + 1, j - 1, x + 2, y - 2, 6); - DRLG_L5FTVR(i - 1, j + 1, x - 2, y + 2, 7); - DRLG_L5FTVR(i + 1, j + 1, x + 2, y + 2, 8); + DrlgL5Ftvr(i + 1, j, x + 2, y, 1); + DrlgL5Ftvr(i - 1, j, x - 2, y, 2); + DrlgL5Ftvr(i, j + 1, x, y + 2, 3); + DrlgL5Ftvr(i, j - 1, x, y - 2, 4); + DrlgL5Ftvr(i - 1, j - 1, x - 2, y - 2, 5); + DrlgL5Ftvr(i + 1, j - 1, x + 2, y - 2, 6); + DrlgL5Ftvr(i - 1, j + 1, x - 2, y + 2, 7); + DrlgL5Ftvr(i + 1, j + 1, x + 2, y + 2, 8); } -static void DRLG_L5FloodTVal() +static void DrlgL5FloodTVal() { int yy = 16; @@ -2341,7 +2341,7 @@ static void DRLG_L5FloodTVal() for (int i = 0; i < DMAXX; i++) { if (dungeon[i][j] == 13 && dTransVal[xx][yy] == 0) { - DRLG_L5FTVR(i, j, xx, yy, 0); + DrlgL5Ftvr(i, j, xx, yy, 0); TransVal++; } xx += 2; @@ -2350,7 +2350,7 @@ static void DRLG_L5FloodTVal() } } -static void DRLG_L5TransFix() +static void DrlgL5TransFix() { int yy = 16; @@ -2387,7 +2387,7 @@ static void DRLG_L5TransFix() } } -static void DRLG_L5DirtFix() +static void DrlgL5DirtFix() { if (currlevel < 21) { for (int j = 0; j < DMAXY - 1; j++) { @@ -2425,7 +2425,7 @@ static void DRLG_L5DirtFix() } } -static void DRLG_L5CornerFix() +static void DrlgL5CornerFix() { for (int j = 1; j < DMAXY - 1; j++) { for (int i = 1; i < DMAXX - 1; i++) { @@ -2440,7 +2440,7 @@ static void DRLG_L5CornerFix() } } -static void DRLG_L5(lvl_entry entry) +static void DrlgL5(lvl_entry entry) { int minarea = 761; switch (currlevel) { @@ -2469,26 +2469,26 @@ static void DRLG_L5(lvl_entry entry) L5tileFix(); L5AddWall(); L5ClearFlags(); - DRLG_L5FloodTVal(); + DrlgL5FloodTVal(); doneflag = true; if (QuestStatus(Q_PWATER)) { if (entry == ENTRY_MAIN) { - if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(PWATERIN, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; } else { - if (DRLG_PlaceMiniSet(PWATERIN, 1, 1, 0, 0, false, -1, 0) < 0) + if (DrlgPlaceMiniSet(PWATERIN, 1, 1, 0, 0, false, -1, 0) < 0) doneflag = false; ViewY--; } } if (QuestStatus(Q_LTBANNER)) { if (entry == ENTRY_MAIN) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; } else { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) + if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) doneflag = false; if (entry == ENTRY_PREV) { ViewX = 2 * setpc_x + 20; @@ -2500,49 +2500,49 @@ static void DRLG_L5(lvl_entry entry) } else if (entry == ENTRY_MAIN) { if (currlevel < 21) { if (!plr[myplr].pOriginalCathedral) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; - if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; - else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + else if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; } } else if (currlevel == 21) { - if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, false, -1, 6) < 0) + if (DrlgPlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, false, -1, 6) < 0) doneflag = false; - if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + if (DrlgPlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; ViewY++; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; if (currlevel != 24) { - if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + if (DrlgPlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; } ViewY++; } } else if (!plr[myplr].pOriginalCathedral && entry == ENTRY_PREV) { if (currlevel < 21) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) + if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) doneflag = false; - if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) + if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) doneflag = false; ViewY--; } else if (currlevel == 21) { - if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, false, -1, 6) < 0) + if (DrlgPlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, false, -1, 6) < 0) doneflag = false; - if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) + if (DrlgPlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) doneflag = false; ViewY += 3; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; if (currlevel != 24) { - if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) + if (DrlgPlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) doneflag = false; } ViewY += 3; @@ -2550,27 +2550,27 @@ static void DRLG_L5(lvl_entry entry) } else { if (currlevel < 21) { if (!plr[myplr].pOriginalCathedral) { - if (DRLG_PlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) + if (DrlgPlaceMiniSet(STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) doneflag = false; - if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) + if (DrlgPlaceMiniSet(L5STAIRSUP, 1, 1, 0, 0, false, -1, 0) < 0) doneflag = false; - else if (DRLG_PlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) + else if (DrlgPlaceMiniSet(STAIRSDOWN, 1, 1, 0, 0, true, -1, 1) < 0) doneflag = false; ViewY--; } } else if (currlevel == 21) { - if (DRLG_PlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, true, -1, 6) < 0) + if (DrlgPlaceMiniSet(L5STAIRSTOWN, 1, 1, 0, 0, true, -1, 6) < 0) doneflag = false; - if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + if (DrlgPlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; } else { - if (DRLG_PlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1, 0) < 0) + if (DrlgPlaceMiniSet(L5STAIRSUPHF, 1, 1, 0, 0, true, -1, 0) < 0) doneflag = false; if (currlevel != 24) { - if (DRLG_PlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) + if (DrlgPlaceMiniSet(L5STAIRSDOWN, 1, 1, 0, 0, false, -1, 1) < 0) doneflag = false; } } @@ -2588,19 +2588,19 @@ static void DRLG_L5(lvl_entry entry) } } - DRLG_L5TransFix(); - DRLG_L5DirtFix(); - DRLG_L5CornerFix(); + DrlgL5TransFix(); + DrlgL5DirtFix(); + DrlgL5CornerFix(); for (int j = 0; j < DMAXY; j++) { for (int i = 0; i < DMAXX; i++) { if ((L5dflags[i][j] & ~DLRG_PROTECTED) != 0) - DRLG_PlaceDoor(i, j); + DrlgPlaceDoor(i, j); } } if (currlevel < 21) { - DRLG_L5Subs(); + DrlgL5Subs(); } else { drlg_l1_crypt_pattern1(10); drlg_l1_crypt_rndset(CryptPattern1, 95); @@ -2650,9 +2650,9 @@ static void DRLG_L5(lvl_entry entry) } if (currlevel < 21) { - DRLG_L1Shadows(); - DRLG_PlaceMiniSet(LAMPS, 5, 10, 0, 0, false, -1, 4); - DRLG_L1Floor(); + DrlgL1Shadows(); + DrlgPlaceMiniSet(LAMPS, 5, 10, 0, 0, false, -1, 4); + DrlgL1Floor(); } for (int j = 0; j < DMAXY; j++) { @@ -2684,13 +2684,13 @@ void CreateL5Dungeon(uint32_t rseed, lvl_entry entry) DRLG_InitTrans(); DRLG_InitSetPC(); - DRLG_LoadL1SP(); - DRLG_L5(entry); - DRLG_L1Pass3(); - DRLG_FreeL1SP(); + DrlgLoadL1Sp(); + DrlgL5(entry); + DrlgL1Pass3(); + DrlgFreeL1Sp(); if (currlevel < 17) - DRLG_InitL1Vals(); + DrlgInitL1Vals(); else DRLG_InitL5Vals(); diff --git a/Source/dthread.cpp b/Source/dthread.cpp index 8f537214e..998ccd3af 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -19,7 +19,7 @@ event_emul *sghWorkToDoEvent; /* rdata */ static SDL_Thread *sghThread = nullptr; -static unsigned int dthread_handler(void * /*data*/) +static unsigned int DthreadHandler(void * /*data*/) { const char *error_buf; TMegaPkt *pkt; @@ -111,7 +111,7 @@ void dthread_start() dthread_running = true; - sghThread = CreateThread(dthread_handler, &glpDThreadId); + sghThread = CreateThread(DthreadHandler, &glpDThreadId); if (sghThread == nullptr) { error_buf = SDL_GetError(); app_fatal("dthread2:\n%s", error_buf); diff --git a/Source/dx.cpp b/Source/dx.cpp index c502b7714..d3414dc92 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -62,7 +62,7 @@ bool CanRenderDirectlyToOutputSurface() } // namespace -static void dx_create_back_buffer() +static void CreateBackBuffer() { if (CanRenderDirectlyToOutputSurface()) { Log("{}", "Will render directly to the SDL output surface"); @@ -93,7 +93,7 @@ static void dx_create_back_buffer() pal_surface_palette_version = 1; } -static void dx_create_primary_surface() +static void CreatePrimarySurface() { #ifndef USE_SDL1 if (renderer != nullptr) { @@ -118,11 +118,11 @@ void dx_init() SDL_ShowWindow(ghMainWnd); #endif - dx_create_primary_surface(); + CreatePrimarySurface(); palette_init(); - dx_create_back_buffer(); + CreateBackBuffer(); } -static void lock_buf_priv() +static void LockBufPriv() { sgMemCrit.Enter(); if (sgdwLockCount != 0) { @@ -138,10 +138,10 @@ void lock_buf(int idx) // NOLINT(misc-unused-parameters) #ifdef _DEBUG ++locktbl[idx]; #endif - lock_buf_priv(); + LockBufPriv(); } -static void unlock_buf_priv() +static void UnlockBufPriv() { if (sgdwLockCount == 0) app_fatal("draw main unlock error"); @@ -157,7 +157,7 @@ void unlock_buf(int idx) // NOLINT(misc-unused-parameters) app_fatal("Draw lock underflow: 0x%x", idx); --locktbl[idx]; #endif - unlock_buf_priv(); + UnlockBufPriv(); } CelOutputBuffer GlobalBackBuffer() diff --git a/Source/effects.cpp b/Source/effects.cpp index cc2ef9b76..fa9a29414 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1090,7 +1090,7 @@ void stream_stop() } } -static void stream_play(TSFX *pSFX, int lVolume, int lPan) +static void StreamPlay(TSFX *pSFX, int lVolume, int lPan) { assert(pSFX); assert(pSFX->bFlags & sfx_STREAM); @@ -1106,7 +1106,7 @@ static void stream_play(TSFX *pSFX, int lVolume, int lPan) } } -static void stream_update() +static void StreamUpdate() { if (sgpStreamSFX != nullptr && !sgpStreamSFX->pSnd->isPlaying()) { stream_stop(); @@ -1161,7 +1161,7 @@ bool calc_snd_position(Point soundPosition, int *plVolume, int *plPan) return true; } -static void PlaySFX_priv(TSFX *pSFX, bool loc, Point position) +static void PlaySfxPriv(TSFX *pSFX, bool loc, Point position) { if (plr[myplr].pLvlLoad != 0 && gbIsMultiplayer) { return; @@ -1181,7 +1181,7 @@ static void PlaySFX_priv(TSFX *pSFX, bool loc, Point position) } if ((pSFX->bFlags & sfx_STREAM) != 0) { - stream_play(pSFX, lVolume, lPan); + StreamPlay(pSFX, lVolume, lPan); return; } @@ -1253,7 +1253,7 @@ void PlaySFX(_sfx_id psfx) { psfx = RndSFX(psfx); - PlaySFX_priv(&sgSFX[psfx], false, { 0, 0 }); + PlaySfxPriv(&sgSFX[psfx], false, { 0, 0 }); } void PlaySfxLoc(_sfx_id psfx, Point position, bool randomizeByCategory) @@ -1268,7 +1268,7 @@ void PlaySfxLoc(_sfx_id psfx, Point position, bool randomizeByCategory) pSnd->start_tc = 0; } - PlaySFX_priv(&sgSFX[psfx], true, position); + PlaySfxPriv(&sgSFX[psfx], true, position); } void sound_stop() @@ -1287,7 +1287,7 @@ void sound_update() return; } - stream_update(); + StreamUpdate(); } void effects_cleanup_sfx() @@ -1298,7 +1298,7 @@ void effects_cleanup_sfx() sfx.pSnd = nullptr; } -static void priv_sound_init(BYTE bLoadMask) +static void PrivSoundInit(BYTE bLoadMask) { DWORD i; @@ -1355,12 +1355,12 @@ void sound_init() } } - priv_sound_init(mask); + PrivSoundInit(mask); } void ui_sound_init() { - priv_sound_init(sfx_UI); + PrivSoundInit(sfx_UI); } void effects_play_sound(const char *snd_file) diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 45ae26a44..b296842bc 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -22,22 +22,22 @@ namespace devilution { namespace { // Forward-declare menu handlers, used by the global menu structs below. -void gamemenu_previous(bool bActivate); -void gamemenu_new_game(bool bActivate); -void gamemenu_restart_town(bool bActivate); -void gamemenu_options(bool bActivate); -void gamemenu_music_volume(bool bActivate); -void gamemenu_sound_volume(bool bActivate); -void gamemenu_gamma(bool bActivate); -void gamemenu_speed(bool bActivate); +void GamemenuPrevious(bool bActivate); +void GamemenuNewGame(bool bActivate); +void GamemenuRestartTown(bool bActivate); +void GamemenuOptions(bool bActivate); +void GamemenuMusicVolume(bool bActivate); +void GamemenuSoundVolume(bool bActivate); +void GamemenuGamma(bool bActivate); +void GamemenuSpeed(bool bActivate); /** Contains the game menu items of the single player menu. */ TMenuItem sgSingleMenu[] = { // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED, N_("Save Game"), &gamemenu_save_game }, - { GMENU_ENABLED, N_("Options"), &gamemenu_options }, - { GMENU_ENABLED, N_("New Game"), &gamemenu_new_game }, + { GMENU_ENABLED, N_("Options"), &GamemenuOptions }, + { GMENU_ENABLED, N_("New Game"), &GamemenuNewGame }, { GMENU_ENABLED, N_("Load Game"), &gamemenu_load_game }, { GMENU_ENABLED, N_("Quit Game"), &gamemenu_quit_game }, { GMENU_ENABLED, nullptr, nullptr } @@ -47,9 +47,9 @@ TMenuItem sgSingleMenu[] = { TMenuItem sgMultiMenu[] = { // clang-format off // dwFlags, pszStr, fnMenu - { GMENU_ENABLED, N_("Options"), &gamemenu_options }, - { GMENU_ENABLED, N_("New Game"), &gamemenu_new_game }, - { GMENU_ENABLED, N_("Restart In Town"), &gamemenu_restart_town }, + { GMENU_ENABLED, N_("Options"), &GamemenuOptions }, + { GMENU_ENABLED, N_("New Game"), &GamemenuNewGame }, + { GMENU_ENABLED, N_("Restart In Town"), &GamemenuRestartTown }, { GMENU_ENABLED, N_("Quit Game"), &gamemenu_quit_game }, { GMENU_ENABLED, nullptr, nullptr }, // clang-format on @@ -57,11 +57,11 @@ TMenuItem sgMultiMenu[] = { TMenuItem sgOptionsMenu[] = { // clang-format off // dwFlags, pszStr, fnMenu - { GMENU_ENABLED | GMENU_SLIDER, nullptr, &gamemenu_music_volume }, - { GMENU_ENABLED | GMENU_SLIDER, nullptr, &gamemenu_sound_volume }, - { GMENU_ENABLED | GMENU_SLIDER, N_("Gamma"), &gamemenu_gamma }, - { GMENU_ENABLED | GMENU_SLIDER, N_("Speed"), &gamemenu_speed }, - { GMENU_ENABLED , N_("Previous Menu"), &gamemenu_previous }, + { GMENU_ENABLED | GMENU_SLIDER, nullptr, &GamemenuMusicVolume }, + { GMENU_ENABLED | GMENU_SLIDER, nullptr, &GamemenuSoundVolume }, + { GMENU_ENABLED | GMENU_SLIDER, N_("Gamma"), &GamemenuGamma }, + { GMENU_ENABLED | GMENU_SLIDER, N_("Speed"), &GamemenuSpeed }, + { GMENU_ENABLED , N_("Previous Menu"), &GamemenuPrevious }, { GMENU_ENABLED , nullptr, nullptr }, // clang-format on }; @@ -76,7 +76,7 @@ const char *const SoundToggleNames[] = { N_("Sound Disabled"), }; -void gamemenu_update_single() +void GamemenuUpdateSingle() { gmenu_enable(&sgSingleMenu[3], gbValidSaveFile); @@ -85,17 +85,17 @@ void gamemenu_update_single() gmenu_enable(&sgSingleMenu[0], enable); } -void gamemenu_update_multi() +void GamemenuUpdateMulti() { gmenu_enable(&sgMultiMenu[2], deathflag); } -void gamemenu_previous(bool /*bActivate*/) +void GamemenuPrevious(bool /*bActivate*/) { gamemenu_on(); } -void gamemenu_new_game(bool /*bActivate*/) +void GamemenuNewGame(bool /*bActivate*/) { for (auto &player : plr) { player._pmode = PM_QUIT; @@ -110,12 +110,12 @@ void gamemenu_new_game(bool /*bActivate*/) gamemenu_off(); } -void gamemenu_restart_town(bool /*bActivate*/) +void GamemenuRestartTown(bool /*bActivate*/) { NetSendCmd(true, CMD_RETOWN); } -void gamemenu_sound_music_toggle(const char *const *names, TMenuItem *menu_item, int volume) +void GamemenuSoundMusicToggle(const char *const *names, TMenuItem *menu_item, int volume) { #ifndef NOSOUND if (gbSndInited) { @@ -131,28 +131,28 @@ void gamemenu_sound_music_toggle(const char *const *names, TMenuItem *menu_item, menu_item->pszStr = names[1]; } -int gamemenu_slider_music_sound(TMenuItem *menu_item) +int GamemenuSliderMusicSound(TMenuItem *menu_item) { return gmenu_slider_get(menu_item, VOLUME_MIN, VOLUME_MAX); } -void gamemenu_get_music() +void GamemenuGetMusic() { - gamemenu_sound_music_toggle(MusicToggleNames, sgOptionsMenu, sound_get_or_set_music_volume(1)); + GamemenuSoundMusicToggle(MusicToggleNames, sgOptionsMenu, sound_get_or_set_music_volume(1)); } -void gamemenu_get_sound() +void GamemenuGetSound() { - gamemenu_sound_music_toggle(SoundToggleNames, &sgOptionsMenu[1], sound_get_or_set_sound_volume(1)); + GamemenuSoundMusicToggle(SoundToggleNames, &sgOptionsMenu[1], sound_get_or_set_sound_volume(1)); } -void gamemenu_get_gamma() +void GamemenuGetGamma() { gmenu_slider_steps(&sgOptionsMenu[2], 15); gmenu_slider_set(&sgOptionsMenu[2], 30, 100, UpdateGamma(0)); } -void gamemenu_get_speed() +void GamemenuGetSpeed() { if (gbIsMultiplayer) { sgOptionsMenu[3].dwFlags &= ~(GMENU_ENABLED | GMENU_SLIDER); @@ -174,21 +174,21 @@ void gamemenu_get_speed() gmenu_slider_set(&sgOptionsMenu[3], 20, 50, sgGameInitInfo.nTickRate); } -int gamemenu_slider_gamma() +int GamemenuSliderGamma() { return gmenu_slider_get(&sgOptionsMenu[2], 30, 100); } -void gamemenu_options(bool /*bActivate*/) +void GamemenuOptions(bool /*bActivate*/) { - gamemenu_get_music(); - gamemenu_get_sound(); - gamemenu_get_gamma(); - gamemenu_get_speed(); + GamemenuGetMusic(); + GamemenuGetSound(); + GamemenuGetGamma(); + GamemenuGetSpeed(); gmenu_set_items(sgOptionsMenu, nullptr); } -void gamemenu_music_volume(bool bActivate) +void GamemenuMusicVolume(bool bActivate) { int volume; @@ -212,7 +212,7 @@ void gamemenu_music_volume(bool bActivate) music_start(lt); } } else { - volume = gamemenu_slider_music_sound(&sgOptionsMenu[0]); + volume = GamemenuSliderMusicSound(&sgOptionsMenu[0]); sound_get_or_set_music_volume(volume); if (volume == VOLUME_MIN) { if (gbMusicOn) { @@ -233,10 +233,10 @@ void gamemenu_music_volume(bool bActivate) } } #endif - gamemenu_get_music(); + GamemenuGetMusic(); } -void gamemenu_sound_volume(bool bActivate) +void GamemenuSoundVolume(bool bActivate) { #ifndef NOSOUND int volume; @@ -250,7 +250,7 @@ void gamemenu_sound_volume(bool bActivate) sound_get_or_set_sound_volume(VOLUME_MAX); } } else { - volume = gamemenu_slider_music_sound(&sgOptionsMenu[1]); + volume = GamemenuSliderMusicSound(&sgOptionsMenu[1]); sound_get_or_set_sound_volume(volume); if (volume == VOLUME_MIN) { if (gbSoundOn) { @@ -262,11 +262,11 @@ void gamemenu_sound_volume(bool bActivate) } } PlaySFX(IS_TITLEMOV); - gamemenu_get_sound(); + GamemenuGetSound(); #endif } -void gamemenu_gamma(bool bActivate) +void GamemenuGamma(bool bActivate) { int gamma; if (bActivate) { @@ -276,14 +276,14 @@ void gamemenu_gamma(bool bActivate) else gamma = 30; } else { - gamma = gamemenu_slider_gamma(); + gamma = GamemenuSliderGamma(); } UpdateGamma(gamma); - gamemenu_get_gamma(); + GamemenuGetGamma(); } -void gamemenu_speed(bool bActivate) +void GamemenuSpeed(bool bActivate) { if (bActivate) { if (sgGameInitInfo.nTickRate != 20) @@ -303,7 +303,7 @@ void gamemenu_speed(bool bActivate) void gamemenu_quit_game(bool bActivate) { - gamemenu_new_game(bActivate); + GamemenuNewGame(bActivate); gbRunGameResult = false; } @@ -360,9 +360,9 @@ void gamemenu_save_game(bool /*bActivate*/) void gamemenu_on() { if (!gbIsMultiplayer) { - gmenu_set_items(sgSingleMenu, gamemenu_update_single); + gmenu_set_items(sgSingleMenu, GamemenuUpdateSingle); } else { - gmenu_set_items(sgMultiMenu, gamemenu_update_multi); + gmenu_set_items(sgMultiMenu, GamemenuUpdateMulti); } PressEscKey(); } diff --git a/Source/init.cpp b/Source/init.cpp index 18a1dcdbc..c4118bfa3 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -53,7 +53,7 @@ HANDLE devilutionx_mpq; namespace { -HANDLE init_test_access(const std::vector &paths, const char *mpq_name) +HANDLE LoadMPQ(const std::vector &paths, const char *mpq_name) { HANDLE archive; std::string mpq_abspath; @@ -174,14 +174,14 @@ void init_archives() LogVerbose("MPQ search paths:{}", message); } - diabdat_mpq = init_test_access(paths, "DIABDAT.MPQ"); + diabdat_mpq = LoadMPQ(paths, "DIABDAT.MPQ"); if (diabdat_mpq == nullptr) { // DIABDAT.MPQ is uppercase on the original CD and the GOG version. - diabdat_mpq = init_test_access(paths, "diabdat.mpq"); + diabdat_mpq = LoadMPQ(paths, "diabdat.mpq"); } if (diabdat_mpq == nullptr) { - spawn_mpq = init_test_access(paths, "spawn.mpq"); + spawn_mpq = LoadMPQ(paths, "spawn.mpq"); if (spawn_mpq != nullptr) gbIsSpawn = true; } @@ -190,31 +190,31 @@ void init_archives() InsertCDDlg(); SFileCloseFileThreadSafe(fh); - patch_rt_mpq = init_test_access(paths, "patch_rt.mpq"); + patch_rt_mpq = LoadMPQ(paths, "patch_rt.mpq"); if (patch_rt_mpq == nullptr) - patch_rt_mpq = init_test_access(paths, "patch_sh.mpq"); + patch_rt_mpq = LoadMPQ(paths, "patch_sh.mpq"); - hellfire_mpq = init_test_access(paths, "hellfire.mpq"); + hellfire_mpq = LoadMPQ(paths, "hellfire.mpq"); if (hellfire_mpq != nullptr) gbIsHellfire = true; - hfmonk_mpq = init_test_access(paths, "hfmonk.mpq"); - hfbard_mpq = init_test_access(paths, "hfbard.mpq"); + hfmonk_mpq = LoadMPQ(paths, "hfmonk.mpq"); + hfbard_mpq = LoadMPQ(paths, "hfbard.mpq"); if (hfbard_mpq != nullptr) gbBard = true; - hfbarb_mpq = init_test_access(paths, "hfbarb.mpq"); + hfbarb_mpq = LoadMPQ(paths, "hfbarb.mpq"); if (hfbarb_mpq != nullptr) gbBarbarian = true; - hfmusic_mpq = init_test_access(paths, "hfmusic.mpq"); - hfvoice_mpq = init_test_access(paths, "hfvoice.mpq"); - hfopt1_mpq = init_test_access(paths, "hfopt1.mpq"); - hfopt2_mpq = init_test_access(paths, "hfopt2.mpq"); + hfmusic_mpq = LoadMPQ(paths, "hfmusic.mpq"); + hfvoice_mpq = LoadMPQ(paths, "hfvoice.mpq"); + hfopt1_mpq = LoadMPQ(paths, "hfopt1.mpq"); + hfopt2_mpq = LoadMPQ(paths, "hfopt2.mpq"); if (gbIsHellfire && (hfmonk_mpq == nullptr || hfmusic_mpq == nullptr || hfvoice_mpq == nullptr)) { UiErrorOkDialog(_("Some Hellfire MPQs are missing"), _("Not all Hellfire MPQs were found.\nPlease copy all the hf*.mpq files.")); app_fatal(nullptr); } - devilutionx_mpq = init_test_access(paths, "devilutionx.mpq"); + devilutionx_mpq = LoadMPQ(paths, "devilutionx.mpq"); } void init_create_window() diff --git a/Source/items.cpp b/Source/items.cpp index 056c9765c..005e70495 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1460,7 +1460,7 @@ void GetBookSpell(int i, int lvl) items[i]._iCurs = ICURS_BOOK_GREY; } -static bool control_WriteStringToBuffer(const char *str) +static bool StringInPanel(const char *str) { return GetLineWidth(str, GameFontSmall, 0) < 125; } @@ -1500,7 +1500,7 @@ void GetStaffPower(int i, int lvl, int bs, bool onlygood) items[i]._iPrePower = PL_Prefix[preidx].PLPower; } } - if (!control_WriteStringToBuffer(items[i]._iIName)) { + if (!StringInPanel(items[i]._iIName)) { strcpy(items[i]._iIName, _(AllItemsList[items[i].IDidx].iSName)); char istr[128]; if (preidx != -1) { @@ -1549,7 +1549,7 @@ void GetStaffSpell(int i, int lvl, bool onlygood) } char istr[68]; - if (!control_WriteStringToBuffer(istr)) + if (!StringInPanel(istr)) strcpy(istr, fmt::format(_("{:s} of {:s}"), items[i]._iName, _(spelldata[bs].sNameText)).c_str()); strcpy(istr, fmt::format(_("Staff of {:s}"), _(spelldata[bs].sNameText)).c_str()); strcpy(items[i]._iName, istr); @@ -2149,7 +2149,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, affix_item_type flgs, bool only items[i]._iSufPower = PL_Suffix[sufidx].PLPower; } } - if (!control_WriteStringToBuffer(items[i]._iIName)) { + if (!StringInPanel(items[i]._iIName)) { int aii = items[i].IDidx; if (AllItemsList[aii].iSName != nullptr) strcpy(items[i]._iIName, _(AllItemsList[aii].iSName)); diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index 4fab5ba98..20c9e5ed9 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -38,7 +38,7 @@ void mainmenu_refresh_music() } while (menu_music_track_id == TMUSIC_TOWN || menu_music_track_id == TMUSIC_L1); } -static bool mainmenu_init_menu(_selhero_selections type) +static bool MainmenuInitMenu(_selhero_selections type) { bool success; @@ -54,19 +54,19 @@ static bool mainmenu_init_menu(_selhero_selections type) return success; } -static bool mainmenu_single_player() +static bool MainmenuSinglePlayer() { gbIsMultiplayer = false; - return mainmenu_init_menu(SELHERO_NEW_DUNGEON); + return MainmenuInitMenu(SELHERO_NEW_DUNGEON); } -static bool mainmenu_multi_player() +static bool MainmenuMultiPlayer() { gbIsMultiplayer = true; - return mainmenu_init_menu(SELHERO_CONNECT); + return MainmenuInitMenu(SELHERO_CONNECT); } -static void mainmenu_play_intro() +static void MainmenuPlayIntro() { music_stop(); if (gbIsHellfire) @@ -126,11 +126,11 @@ void mainmenu_loop() case MAINMENU_NONE: break; case MAINMENU_SINGLE_PLAYER: - if (!mainmenu_single_player()) + if (!MainmenuSinglePlayer()) done = true; break; case MAINMENU_MULTIPLAYER: - if (!mainmenu_multi_player()) + if (!MainmenuMultiPlayer()) done = true; break; case MAINMENU_ATTRACT_MODE: @@ -138,7 +138,7 @@ void mainmenu_loop() if (gbIsSpawn && !gbIsHellfire) done = false; else if (gbActive) - mainmenu_play_intro(); + MainmenuPlayIntro(); break; case MAINMENU_SHOW_CREDITS: UiCreditsDialog(); diff --git a/Source/missiles.cpp b/Source/missiles.cpp index fdc2b1fd0..5c2e2b86c 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -1198,7 +1198,7 @@ void AddHiveExplosion(int mi, Point /*src*/, Point /*dst*/, int midir, int8_t mi missile[mi]._miDelFlag = true; } -static bool missiles_found_target(int mi, Point *position, int rad) +static bool MissilesFoundTarget(int mi, Point *position, int rad) { rad = std::min(rad, 19); @@ -1227,7 +1227,7 @@ void AddFireRune(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy*/ if (LineClearMissile(src, dst)) { if (id >= 0) UseMana(id, SPL_RUNEFIRE); - if (missiles_found_target(mi, &dst, 10)) { + if (MissilesFoundTarget(mi, &dst, 10)) { missile[mi]._miVar1 = MIS_HIVEEXP; missile[mi]._miDelFlag = false; missile[mi]._mlid = AddLight(dst, 8); @@ -1244,7 +1244,7 @@ void AddLightningRune(int mi, Point src, Point dst, int /*midir*/, int8_t /*mien if (LineClearMissile(src, dst)) { if (id >= 0) UseMana(id, SPL_RUNELIGHT); - if (missiles_found_target(mi, &dst, 10)) { + if (MissilesFoundTarget(mi, &dst, 10)) { missile[mi]._miVar1 = MIS_LIGHTBALL; missile[mi]._miDelFlag = false; missile[mi]._mlid = AddLight(dst, 8); @@ -1261,7 +1261,7 @@ void AddGreatLightningRune(int mi, Point src, Point dst, int /*midir*/, int8_t / if (LineClearMissile(src, dst)) { if (id >= 0) UseMana(id, SPL_RUNENOVA); - if (missiles_found_target(mi, &dst, 10)) { + if (MissilesFoundTarget(mi, &dst, 10)) { missile[mi]._miVar1 = MIS_NOVA; missile[mi]._miDelFlag = false; missile[mi]._mlid = AddLight(dst, 8); @@ -1278,7 +1278,7 @@ void AddImmolationRune(int mi, Point src, Point dst, int /*midir*/, int8_t /*mie if (LineClearMissile(src, dst)) { if (id >= 0) UseMana(id, SPL_RUNEIMMOLAT); - if (missiles_found_target(mi, &dst, 10)) { + if (MissilesFoundTarget(mi, &dst, 10)) { missile[mi]._miVar1 = MIS_IMMOLATION; missile[mi]._miDelFlag = false; missile[mi]._mlid = AddLight(dst, 8); @@ -1295,7 +1295,7 @@ void AddStoneRune(int mi, Point src, Point dst, int /*midir*/, int8_t /*mienemy* if (LineClearMissile(src, dst)) { if (id >= 0) UseMana(id, SPL_RUNESTONE); - if (missiles_found_target(mi, &dst, 10)) { + if (MissilesFoundTarget(mi, &dst, 10)) { missile[mi]._miVar1 = MIS_STONE; missile[mi]._miDelFlag = false; missile[mi]._mlid = AddLight(dst, 8); @@ -3620,7 +3620,7 @@ void MI_Reflect(int i) PutMissile(i); } -static void MI_Ring(int i, int type) +static void MissileRing(int i, int type) { int b = CrawlNum[3]; missile[i]._miDelFlag = true; @@ -3652,12 +3652,12 @@ static void MI_Ring(int i, int type) void MI_FireRing(int i) { - MI_Ring(i, MIS_FIREWALL); + MissileRing(i, MIS_FIREWALL); } void MI_LightningRing(int i) { - MI_Ring(i, MIS_LIGHTWALL); + MissileRing(i, MIS_LIGHTWALL); } void MI_Search(int i) diff --git a/Source/nthread.cpp b/Source/nthread.cpp index 3feb861c1..63e35773d 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -109,7 +109,7 @@ bool nthread_recv_turns(bool *pfSendAsync) return true; } -static unsigned int nthread_handler(void * /*data*/) +static unsigned int NthreadHandler(void * /*data*/) { int delta; bool received; @@ -184,7 +184,7 @@ void nthread_start(bool set_turn_upper_bit) sgbThreadIsRunning = false; sgMemCrit.Enter(); nthread_should_run = true; - sghThread = CreateThread(nthread_handler, &glpNThreadId); + sghThread = CreateThread(NthreadHandler, &glpNThreadId); if (sghThread == nullptr) { err = SDL_GetError(); app_fatal("nthread2:\n%s", err); diff --git a/Source/objects.cpp b/Source/objects.cpp index 2539d7f53..f0e10f7c0 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -2351,7 +2351,7 @@ void RedoPlayerVision() * @param doorPos Map tile where the door is in its closed position * @return true if the door is free to be closed, false if anything is blocking it */ -static inline bool isDoorClear(const Point &doorPosition) +static inline bool IsDoorClear(const Point &doorPosition) { return dDead[doorPosition.x][doorPosition.y] == 0 && dMonster[doorPosition.x][doorPosition.y] == 0 @@ -2402,7 +2402,7 @@ void OperateL1RDoor(int pnum, int oi, bool sendflag) if (!deltaload) PlaySfxLoc(IS_CRCLOS, door.position); } - if (!deltaload && isDoorClear(door.position)) { + if (!deltaload && IsDoorClear(door.position)) { if (pnum == myplr && sendflag) NetSendCmdParam1(true, CMD_CLOSEDOOR, oi); door._oVar4 = 0; @@ -2483,7 +2483,7 @@ void OperateL1LDoor(int pnum, int oi, bool sendflag) if (!deltaload) PlaySfxLoc(IS_CRCLOS, door.position); } - if (isDoorClear(door.position)) { + if (IsDoorClear(door.position)) { if (pnum == myplr && sendflag) NetSendCmdParam1(true, CMD_CLOSEDOOR, oi); door._oVar4 = 0; @@ -2545,7 +2545,7 @@ void OperateL2RDoor(int pnum, int oi, bool sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, door.position); - if (isDoorClear(door.position)) { + if (IsDoorClear(door.position)) { if (pnum == myplr && sendflag) NetSendCmdParam1(true, CMD_CLOSEDOOR, oi); door._oVar4 = 0; @@ -2588,7 +2588,7 @@ void OperateL2LDoor(int pnum, int oi, bool sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, door.position); - if (isDoorClear(door.position)) { + if (IsDoorClear(door.position)) { if (pnum == myplr && sendflag) NetSendCmdParam1(true, CMD_CLOSEDOOR, oi); door._oVar4 = 0; @@ -2630,7 +2630,7 @@ void OperateL3RDoor(int pnum, int oi, bool sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, door.position); - if (isDoorClear(door.position)) { + if (IsDoorClear(door.position)) { if (pnum == myplr && sendflag) NetSendCmdParam1(true, CMD_CLOSEDOOR, oi); door._oVar4 = 0; @@ -2671,7 +2671,7 @@ void OperateL3LDoor(int pnum, int oi, bool sendflag) if (!deltaload) PlaySfxLoc(IS_DOORCLOS, door.position); - if (isDoorClear(door.position)) { + if (IsDoorClear(door.position)) { if (pnum == myplr && sendflag) NetSendCmdParam1(true, CMD_CLOSEDOOR, oi); door._oVar4 = 0; diff --git a/Source/player.cpp b/Source/player.cpp index 48dd1dbee..9f3017450 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -41,7 +41,7 @@ struct DirectionSettings { void (*walkModeHandler)(int, const DirectionSettings &); }; -void PM_ChangeLightOff(PlayerStruct &player) +void PmChangeLightOff(PlayerStruct &player) { if (player._plid == NO_LIGHT) return; @@ -79,7 +79,7 @@ void WalkDownwards(int pnum, const DirectionSettings & /*walkParams*/) dPlayer[player.position.tile.x][player.position.tile.y] = pnum + 1; // BUGFIX: missing `if (leveltype != DTYPE_TOWN) {` for call to ChangeLightXY and PM_ChangeLightOff. ChangeLightXY(player._plid, player.position.tile); - PM_ChangeLightOff(player); + PmChangeLightOff(player); } void WalkSides(int pnum, const DirectionSettings &walkParams) @@ -96,7 +96,7 @@ void WalkSides(int pnum, const DirectionSettings &walkParams) if (leveltype != DTYPE_TOWN) { ChangeLightXY(player._plid, nextPosition); - PM_ChangeLightOff(player); + PmChangeLightOff(player); } player.position.temp = player.position.future; @@ -1415,7 +1415,7 @@ void PM_ChangeOffset(int pnum) ScrollInfo.offset += { px, py }; } - PM_ChangeLightOff(player); + PmChangeLightOff(player); } void StartAttack(int pnum, Direction d) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 476289662..b60036e95 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -550,7 +550,7 @@ static void DrawObject(const CelOutputBuffer &out, int x, int y, int ox, int oy, } } -static void scrollrt_draw_dungeon(const CelOutputBuffer & /*out*/, int /*sx*/, int /*sy*/, int /*dx*/, int /*dy*/); +static void DrawDungeon(const CelOutputBuffer & /*out*/, int /*sx*/, int /*sy*/, int /*dx*/, int /*dy*/); /** * @brief Render a cell @@ -560,7 +560,7 @@ static void scrollrt_draw_dungeon(const CelOutputBuffer & /*out*/, int /*sx*/, i * @param sx Target buffer coordinate * @param sy Target buffer coordinate */ -static void drawCell(const CelOutputBuffer &out, int x, int y, int sx, int sy) +static void DrawCell(const CelOutputBuffer &out, int x, int y, int sx, int sy) { MICROS *pMap = &dpiece_defs_map_2[x][y]; level_piece_id = dPiece[x][y]; @@ -590,7 +590,7 @@ static void drawCell(const CelOutputBuffer &out, int x, int y, int sx, int sy) * @param sx Target buffer coordinate * @param sy Target buffer coordinate */ -static void drawFloor(const CelOutputBuffer &out, int x, int y, int sx, int sy) +static void DrawFloor(const CelOutputBuffer &out, int x, int y, int sx, int sy) { cel_transparency_active = false; light_table_index = dLight[x][y]; @@ -745,7 +745,7 @@ static void DrawPlayerHelper(const CelOutputBuffer &out, int x, int y, int sx, i * @param dx Target buffer coordinate * @param dy Target buffer coordinate */ -static void scrollrt_draw_dungeon(const CelOutputBuffer &out, int sx, int sy, int dx, int dy) +static void DrawDungeon(const CelOutputBuffer &out, int sx, int sy, int dx, int dy) { assert((DWORD)sx < MAXDUNX); assert((DWORD)sy < MAXDUNY); @@ -756,7 +756,7 @@ static void scrollrt_draw_dungeon(const CelOutputBuffer &out, int sx, int sy, in light_table_index = dLight[sx][sy]; - drawCell(out, sx, sy, dx, dy); + DrawCell(out, sx, sy, dx, dy); int8_t bFlag = dFlags[sx][sy]; int8_t bDead = dDead[sx][sy]; @@ -858,7 +858,7 @@ static void scrollrt_draw_dungeon(const CelOutputBuffer &out, int sx, int sy, in * @param rows Number of rows * @param columns Tile in a row */ -static void scrollrt_drawFloor(const CelOutputBuffer &out, int x, int y, int sx, int sy, int rows, int columns) +static void DrawFloor(const CelOutputBuffer &out, int x, int y, int sx, int sy, int rows, int columns) { for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { @@ -866,7 +866,7 @@ static void scrollrt_drawFloor(const CelOutputBuffer &out, int x, int y, int sx, level_piece_id = dPiece[x][y]; if (level_piece_id != 0) { if (!nSolidTable[level_piece_id]) - drawFloor(out, x, y, sx, sy); + DrawFloor(out, x, y, sx, sy); } else { world_draw_black_tile(out, sx, sy); } @@ -907,7 +907,7 @@ static void scrollrt_drawFloor(const CelOutputBuffer &out, int x, int y, int sx, * @param rows Number of rows * @param columns Tile in a row */ -static void scrollrt_draw(const CelOutputBuffer &out, int x, int y, int sx, int sy, int rows, int columns) +static void DrawTileContent(const CelOutputBuffer &out, int x, int y, int sx, int sy, int rows, int columns) { // Keep evaluating until MicroTiles can't affect screen rows += MicroTileLen; @@ -923,12 +923,12 @@ static void scrollrt_draw(const CelOutputBuffer &out, int x, int y, int sx, int // sprite screen position rather than tile position. if (IsWall(x, y) && (IsWall(x + 1, y) || (x > 0 && IsWall(x - 1, y)))) { // Part of a wall aligned on the x-axis if (IsWalkable(x + 1, y - 1) && IsWalkable(x, y - 1)) { // Has walkable area behind it - scrollrt_draw_dungeon(out, x + 1, y - 1, sx + TILE_WIDTH, sy); + DrawDungeon(out, x + 1, y - 1, sx + TILE_WIDTH, sy); } } } if (dPiece[x][y] != 0) { - scrollrt_draw_dungeon(out, x, y, sx, sy); + DrawDungeon(out, x, y, sx, sy); } } ShiftGrid(&x, &y, 1, 0); @@ -1246,8 +1246,8 @@ static void DrawGame(const CelOutputBuffer &full_out, int x, int y) break; } - scrollrt_drawFloor(out, x, y, sx, sy, rows, columns); - scrollrt_draw(out, x, y, sx, sy, rows, columns); + DrawFloor(out, x, y, sx, sy, rows, columns); + DrawTileContent(out, x, y, sx, sy, rows, columns); if (!zoomflag) { Zoom(full_out.subregionY(0, gnViewportHeight)); diff --git a/Source/sync.cpp b/Source/sync.cpp index b01c9e391..dccd9f8f9 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -19,7 +19,7 @@ uint16_t sgwLRU[MAXMONSTERS]; int sgnSyncItem; int sgnSyncPInv; -void sync_one_monster() +void SyncOneMonster() { for (int i = 0; i < nummonsters; i++) { int m = monstactive[i]; @@ -32,7 +32,7 @@ void sync_one_monster() } } -void sync_monster_pos(TSyncMonster *p, int ndx) +void SyncMonsterPos(TSyncMonster *p, int ndx) { p->_mndx = ndx; p->_mx = monster[ndx].position.tile.x; @@ -44,7 +44,7 @@ void sync_monster_pos(TSyncMonster *p, int ndx) sgwLRU[ndx] = monster[ndx]._msquelch == 0 ? 0xFFFF : 0xFFFE; } -bool sync_monster_active(TSyncMonster *p) +bool SyncMonsterActive(TSyncMonster *p) { int ndx = -1; uint32_t lru = 0xFFFFFFFF; @@ -61,11 +61,11 @@ bool sync_monster_active(TSyncMonster *p) return false; } - sync_monster_pos(p, ndx); + SyncMonsterPos(p, ndx); return true; } -bool sync_monster_active2(TSyncMonster *p) +bool SyncMonsterActive2(TSyncMonster *p) { int ndx = -1; uint32_t lru = 0xFFFE; @@ -86,7 +86,7 @@ bool sync_monster_active2(TSyncMonster *p) return false; } - sync_monster_pos(p, ndx); + SyncMonsterPos(p, ndx); return true; } @@ -172,15 +172,15 @@ uint32_t sync_all_monsters(const byte *pbBuf, uint32_t dwMaxLen) pHdr->wLen = 0; SyncPlrInv(pHdr); assert(dwMaxLen <= 0xffff); - sync_one_monster(); + SyncOneMonster(); for (i = 0; i < nummonsters && dwMaxLen >= sizeof(TSyncMonster); i++) { sync = false; if (i < 2) { - sync = sync_monster_active2((TSyncMonster *)pbBuf); + sync = SyncMonsterActive2((TSyncMonster *)pbBuf); } if (!sync) { - sync = sync_monster_active((TSyncMonster *)pbBuf); + sync = SyncMonsterActive((TSyncMonster *)pbBuf); } if (!sync) { break; @@ -193,7 +193,7 @@ uint32_t sync_all_monsters(const byte *pbBuf, uint32_t dwMaxLen) return dwMaxLen; } -static void sync_monster(int pnum, const TSyncMonster *p) +static void SyncMonster(int pnum, const TSyncMonster *p) { int ndx = p->_mndx; @@ -261,7 +261,7 @@ uint32_t sync_update(int pnum, const byte *pbBuf) for (wLen = pHdr->wLen; wLen >= sizeof(TSyncMonster); wLen -= sizeof(TSyncMonster)) { if (currlevel == pHdr->bLevel) { - sync_monster(pnum, (TSyncMonster *)pbBuf); + SyncMonster(pnum, (TSyncMonster *)pbBuf); } delta_sync_monster((TSyncMonster *)pbBuf, pHdr->bLevel); pbBuf += sizeof(TSyncMonster);