From ecea12fc158fa755445a55369223a38dee269b2f Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 3 Jul 2021 23:53:23 +0200 Subject: [PATCH] Clang-tidy: ParameterCase --- Source/drlg_l2.cpp | 44 +++++++++++++++--------------- Source/dx.cpp | 32 +++++++++++----------- Source/dx.h | 4 +-- Source/effects.cpp | 4 +-- Source/effects.h | 2 +- Source/gamemenu.cpp | 18 ++++++------- Source/gendung.cpp | 20 +++++++------- Source/init.cpp | 16 +++++------ Source/items.cpp | 34 ++++++++++++------------ Source/lighting.cpp | 8 +++--- Source/monster.cpp | 65 ++++++++++++++++++++++----------------------- Source/monster.h | 4 +-- Source/movie.cpp | 4 +-- Source/mpqapi.cpp | 54 ++++++++++++++++++------------------- Source/msg.cpp | 4 +-- Source/nthread.cpp | 16 +++++------ Source/objects.cpp | 8 +++--- Source/path.cpp | 8 +++--- Source/pfile.cpp | 44 +++++++++++++++--------------- Source/pfile.h | 12 ++++----- Source/player.cpp | 10 +++---- Source/scrollrt.cpp | 24 ++++++++--------- Source/sha.cpp | 18 ++++++------- Source/sha.h | 4 +-- 24 files changed, 228 insertions(+), 229 deletions(-) diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 7724d4c42..12ce8867f 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -1873,7 +1873,7 @@ static void DrlgL2SetRoom(int rx1, int ry1) } } -static void DefineRoom(int nX1, int nY1, int nX2, int nY2, bool ForceHW) +static void DefineRoom(int nX1, int nY1, int nX2, int nY2, bool forceHW) { predungeon[nX1][nY1] = 67; predungeon[nX1][nY2] = 69; @@ -1886,7 +1886,7 @@ static void DefineRoom(int nX1, int nY1, int nX2, int nY2, bool ForceHW) RoomList[nRoomCnt].nRoomy1 = nY1; RoomList[nRoomCnt].nRoomy2 = nY2; - if (ForceHW) { + if (forceHW) { for (int i = nX1; i < nX2; i++) { /// BUGFIX: Should loop j between nY1 and nY2 instead of always using nY1. while (i < nY2) { @@ -1945,11 +1945,11 @@ static void PlaceHallExt(int nX, int nY) * @param nY2 Upper Y boundary of the area to draw into. * @param nRDest The room number of the parent room this call was invoked for. Zero for empty * @param nHDir The direction of the hall from nRDest to this room. - * @param ForceHW If set, nH and nW are used for room size instead of random values. - * @param nH Height of the room, if ForceHW is set. - * @param nW Width of the room, if ForceHW is set. + * @param forceHW If set, nH and nW are used for room size instead of random values. + * @param nH Height of the room, if forceHW is set. + * @param nW Width of the room, if forceHW is set. */ -static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, bool ForceHW, int nH, int nW) +static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir, bool forceHW, int nH, int nW) { if (nRoomCnt >= 80) { return; @@ -1974,7 +1974,7 @@ static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir nRh = GenerateRnd(nAh - Room_Min) + Room_Min; } - if (ForceHW) { + if (forceHW) { nRw = nW; nRh = nH; } @@ -2016,9 +2016,9 @@ static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir if (nRy2 <= 1) { nRy2 = 1; } - DefineRoom(nRx1, nRy1, nRx2, nRy2, ForceHW); + DefineRoom(nRx1, nRy1, nRx2, nRy2, forceHW); - if (ForceHW) { + if (forceHW) { nSx1 = nRx1 + 2; nSy1 = nRy1 + 2; nSx2 = nRx2; @@ -2678,37 +2678,37 @@ static bool DL2FillVoids() static bool CreateDungeon() { - int ForceW = 0; - int ForceH = 0; - bool ForceHW = false; + int forceW = 0; + int forceH = 0; + bool forceHW = false; switch (currlevel) { case 5: if (quests[Q_BLOOD]._qactive != QUEST_NOTAVAIL) { - ForceHW = true; - ForceH = 20; - ForceW = 14; + forceHW = true; + forceH = 20; + forceW = 14; } break; case 6: if (quests[Q_SCHAMB]._qactive != QUEST_NOTAVAIL) { - ForceHW = true; - ForceW = 10; - ForceH = 10; + forceHW = true; + forceW = 10; + forceH = 10; } break; case 7: if (quests[Q_BLIND]._qactive != QUEST_NOTAVAIL) { - ForceHW = true; - ForceW = 15; - ForceH = 15; + forceHW = true; + forceW = 15; + forceH = 15; } break; case 8: break; } - CreateRoom(2, 2, DMAXX - 1, DMAXY - 1, 0, 0, ForceHW, ForceH, ForceW); + CreateRoom(2, 2, DMAXX - 1, DMAXY - 1, 0, 0, forceHW, forceH, forceW); while (!HallList.empty()) { ConnectHall(HallList.front()); diff --git a/Source/dx.cpp b/Source/dx.cpp index b96171170..658f27393 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -224,50 +224,50 @@ void InitPalette() } } -void BltFast(SDL_Rect *src_rect, SDL_Rect *dst_rect) +void BltFast(SDL_Rect *srcRect, SDL_Rect *dstRect) { if (RenderDirectlyToOutputSurface) return; - Blit(pal_surface, src_rect, dst_rect); + Blit(pal_surface, srcRect, dstRect); } -void Blit(SDL_Surface *src, SDL_Rect *src_rect, SDL_Rect *dst_rect) +void Blit(SDL_Surface *src, SDL_Rect *srcRect, SDL_Rect *dstRect) { SDL_Surface *dst = GetOutputSurface(); #ifndef USE_SDL1 - if (SDL_BlitSurface(src, src_rect, dst, dst_rect) < 0) + if (SDL_BlitSurface(src, srcRect, dst, dstRect) < 0) ErrSdl(); #else if (!OutputRequiresScaling()) { - if (SDL_BlitSurface(src, src_rect, dst, dst_rect) < 0) + if (SDL_BlitSurface(src, srcRect, dst, dstRect) < 0) ErrSdl(); return; } - SDL_Rect scaled_dst_rect; - if (dst_rect != NULL) { - scaled_dst_rect = *dst_rect; - ScaleOutputRect(&scaled_dst_rect); - dst_rect = &scaled_dst_rect; + SDL_Rect scaledDstRect; + if (dstRect != NULL) { + scaledDstRect = *dstRect; + ScaleOutputRect(&scaledDstRect); + dstRect = &scaledDstRect; } // Same pixel format: We can call BlitScaled directly. if (SDLBackport_PixelFormatFormatEq(src->format, dst->format)) { - if (SDL_BlitScaled(src, src_rect, dst, dst_rect) < 0) + if (SDL_BlitScaled(src, srcRect, dst, dstRect) < 0) ErrSdl(); return; } // If the surface has a color key, we must stretch first and can then call BlitSurface. if (SDL_HasColorKey(src)) { - SDL_Surface *stretched = SDL_CreateRGBSurface(SDL_SWSURFACE, dst_rect->w, dst_rect->h, src->format->BitsPerPixel, + SDL_Surface *stretched = SDL_CreateRGBSurface(SDL_SWSURFACE, dstRect->w, dstRect->h, src->format->BitsPerPixel, src->format->Rmask, src->format->Gmask, src->format->BitsPerPixel, src->format->Amask); SDL_SetColorKey(stretched, SDL_SRCCOLORKEY, src->format->colorkey); if (src->format->palette != NULL) SDL_SetPalette(stretched, SDL_LOGPAL, src->format->palette->colors, 0, src->format->palette->ncolors); - SDL_Rect stretched_rect = { 0, 0, dst_rect->w, dst_rect->h }; - if (SDL_SoftStretch(src, src_rect, stretched, &stretched_rect) < 0 - || SDL_BlitSurface(stretched, &stretched_rect, dst, dst_rect) < 0) { + SDL_Rect stretched_rect = { 0, 0, dstRect->w, dstRect->h }; + if (SDL_SoftStretch(src, srcRect, stretched, &stretched_rect) < 0 + || SDL_BlitSurface(stretched, &stretched_rect, dst, dstRect) < 0) { SDL_FreeSurface(stretched); ErrSdl(); } @@ -278,7 +278,7 @@ void Blit(SDL_Surface *src, SDL_Rect *src_rect, SDL_Rect *dst_rect) // A surface with a non-output pixel format but without a color key needs scaling. // We can convert the format and then call BlitScaled. SDL_Surface *converted = SDL_ConvertSurface(src, dst->format, 0); - if (SDL_BlitScaled(converted, src_rect, dst, dst_rect) < 0) { + if (SDL_BlitScaled(converted, srcRect, dst, dstRect) < 0) { SDL_FreeSurface(converted); ErrSdl(); } diff --git a/Source/dx.h b/Source/dx.h index 54211be0c..4f39cd174 100644 --- a/Source/dx.h +++ b/Source/dx.h @@ -20,8 +20,8 @@ void unlock_buf(int idx); void dx_cleanup(); void dx_reinit(); void InitPalette(); -void BltFast(SDL_Rect *src_rect, SDL_Rect *dst_rect); -void Blit(SDL_Surface *src, SDL_Rect *src_rect, SDL_Rect *dst_rect); +void BltFast(SDL_Rect *srcRect, SDL_Rect *dstRect); +void Blit(SDL_Surface *src, SDL_Rect *srcRect, SDL_Rect *dstRect); void RenderPresent(); void PaletteGetEntries(DWORD dwNumEntries, SDL_Color *lpEntries); diff --git a/Source/effects.cpp b/Source/effects.cpp index fa9a29414..1f4af812e 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1363,14 +1363,14 @@ void ui_sound_init() PrivSoundInit(sfx_UI); } -void effects_play_sound(const char *snd_file) +void effects_play_sound(const char *sndFile) { if (!gbSndInited || !gbSoundOn) { return; } for (auto &sfx : sgSFX) { - if (strcasecmp(sfx.pszName, snd_file) == 0 && sfx.pSnd != nullptr) { + if (strcasecmp(sfx.pszName, sndFile) == 0 && sfx.pSnd != nullptr) { if (!sfx.pSnd->isPlaying()) snd_play_snd(sfx.pSnd.get(), 0, 0); diff --git a/Source/effects.h b/Source/effects.h index bb7f7a855..8a9b83271 100644 --- a/Source/effects.h +++ b/Source/effects.h @@ -1185,7 +1185,7 @@ void sound_update(); void effects_cleanup_sfx(); void sound_init(); void ui_sound_init(); -void effects_play_sound(const char *snd_file); +void effects_play_sound(const char *sndFile); #ifndef NOSOUND bool calc_snd_position(Point soundPosition, int *plVolume, int *plPan); diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index b296842bc..a455e0458 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -115,25 +115,25 @@ void GamemenuRestartTown(bool /*bActivate*/) NetSendCmd(true, CMD_RETOWN); } -void GamemenuSoundMusicToggle(const char *const *names, TMenuItem *menu_item, int volume) +void GamemenuSoundMusicToggle(const char *const *names, TMenuItem *menuItem, int volume) { #ifndef NOSOUND if (gbSndInited) { - menu_item->dwFlags |= GMENU_ENABLED | GMENU_SLIDER; - menu_item->pszStr = names[0]; - gmenu_slider_steps(menu_item, VOLUME_STEPS); - gmenu_slider_set(menu_item, VOLUME_MIN, VOLUME_MAX, volume); + menuItem->dwFlags |= GMENU_ENABLED | GMENU_SLIDER; + menuItem->pszStr = names[0]; + gmenu_slider_steps(menuItem, VOLUME_STEPS); + gmenu_slider_set(menuItem, VOLUME_MIN, VOLUME_MAX, volume); return; } #endif - menu_item->dwFlags &= ~(GMENU_ENABLED | GMENU_SLIDER); - menu_item->pszStr = names[1]; + menuItem->dwFlags &= ~(GMENU_ENABLED | GMENU_SLIDER); + menuItem->pszStr = names[1]; } -int GamemenuSliderMusicSound(TMenuItem *menu_item) +int GamemenuSliderMusicSound(TMenuItem *menuItem) { - return gmenu_slider_get(menu_item, VOLUME_MIN, VOLUME_MAX); + return gmenu_slider_get(menuItem, VOLUME_MIN, VOLUME_MAX); } void GamemenuGetMusic() diff --git a/Source/gendung.cpp b/Source/gendung.cpp index c5649addf..ff38232af 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -221,24 +221,24 @@ void DRLG_CopyTrans(int sx, int sy, int dx, int dy) dTransVal[dx][dy] = dTransVal[sx][sy]; } -void DRLG_ListTrans(int num, BYTE *List) +void DRLG_ListTrans(int num, BYTE *list) { for (int i = 0; i < num; i++) { - uint8_t x1 = *List++; - uint8_t y1 = *List++; - uint8_t x2 = *List++; - uint8_t y2 = *List++; + uint8_t x1 = *list++; + uint8_t y1 = *list++; + uint8_t x2 = *list++; + uint8_t y2 = *list++; DRLG_RectTrans(x1, y1, x2, y2); } } -void DRLG_AreaTrans(int num, BYTE *List) +void DRLG_AreaTrans(int num, BYTE *list) { for (int i = 0; i < num; i++) { - uint8_t x1 = *List++; - uint8_t y1 = *List++; - uint8_t x2 = *List++; - uint8_t y2 = *List++; + uint8_t x1 = *list++; + uint8_t y1 = *list++; + uint8_t x2 = *list++; + uint8_t y2 = *list++; DRLG_RectTrans(x1, y1, x2, y2); TransVal--; } diff --git a/Source/init.cpp b/Source/init.cpp index c4118bfa3..9b8a15d11 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -53,14 +53,14 @@ HANDLE devilutionx_mpq; namespace { -HANDLE LoadMPQ(const std::vector &paths, const char *mpq_name) +HANDLE LoadMPQ(const std::vector &paths, const char *mpqName) { HANDLE archive; std::string mpq_abspath; for (const auto &path : paths) { - mpq_abspath = path + mpq_name; + mpq_abspath = path + mpqName; if (SFileOpenArchive(mpq_abspath.c_str(), 0, MPQ_OPEN_READ_ONLY, &archive)) { - LogVerbose(" Found: {} in {}", mpq_name, path); + LogVerbose(" Found: {} in {}", mpqName, path); SFileSetBasePath(path.c_str()); return archive; } @@ -69,7 +69,7 @@ HANDLE LoadMPQ(const std::vector &paths, const char *mpq_name) } } if (SErrGetLastError() == STORM_ERROR_FILE_NOT_FOUND) { - LogVerbose("Missing: {}", mpq_name); + LogVerbose("Missing: {}", mpqName); } return nullptr; @@ -228,9 +228,9 @@ void init_create_window() #endif } -void MainWndProc(uint32_t Msg) +void MainWndProc(uint32_t msg) { - switch (Msg) { + switch (msg) { case DVL_WM_PAINT: force_redraw = 255; break; @@ -240,12 +240,12 @@ void MainWndProc(uint32_t Msg) } } -WNDPROC SetWindowProc(WNDPROC NewProc) +WNDPROC SetWindowProc(WNDPROC newProc) { WNDPROC OldProc; OldProc = CurrentProc; - CurrentProc = NewProc; + CurrentProc = newProc; return OldProc; } diff --git a/Source/items.cpp b/Source/items.cpp index 8e77566a5..83b90cc1a 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -553,7 +553,7 @@ void InitItems() uitemflag = false; } -void CalcPlrItemVals(int playerId, bool Loadgfx) +void CalcPlrItemVals(int playerId, bool loadgfx) { auto &player = plr[playerId]; @@ -888,7 +888,7 @@ void CalcPlrItemVals(int playerId, bool Loadgfx) player._pIAC += player._pLevel * 2; } - if (player._pgfxnum != g && Loadgfx) { + if (player._pgfxnum != g && loadgfx) { player._pgfxnum = g; ResetPlayerGFX(player); SetPlrAnims(player); @@ -1016,13 +1016,13 @@ void CalcPlrBookVals(PlayerStruct &player) } } -void CalcPlrInv(int playerId, bool Loadgfx) +void CalcPlrInv(int playerId, bool loadgfx) { auto &player = plr[playerId]; CalcPlrItemMin(player); CalcSelfItems(player); - CalcPlrItemVals(playerId, Loadgfx); + CalcPlrItemVals(playerId, loadgfx); CalcPlrItemMin(player); if (playerId == myplr) { CalcPlrBookVals(player); @@ -1568,18 +1568,18 @@ void GetStaffSpell(int i, int lvl, bool onlygood) GetStaffPower(i, lvl, bs, onlygood); } -void GetOilType(int i, int max_lvl) +void GetOilType(int i, int maxLvl) { int cnt = 2; char rnd[32] = { 5, 6 }; if (!gbIsMultiplayer) { - if (max_lvl == 0) - max_lvl = 1; + if (maxLvl == 0) + maxLvl = 1; cnt = 0; for (size_t j = 0; j < sizeof(OilLevels) / sizeof(OilLevels[0]); j++) { - if (OilLevels[j] <= max_lvl) { + if (OilLevels[j] <= maxLvl) { rnd[cnt] = j; cnt++; } @@ -2686,7 +2686,7 @@ void RecreateItem(int ii, int idx, uint16_t icreateinfo, int iseed, int ivalue, gbIsHellfire = tmpIsHellfire; } -void RecreateEar(int ii, uint16_t ic, int iseed, int Id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff) +void RecreateEar(int ii, uint16_t ic, int iseed, int id, int dur, int mdur, int ch, int mch, int ivalue, int ibuff) { SetPlrHandItem(&items[ii], IDI_EAR); tempstr[0] = (ic >> 8) & 0x7F; @@ -2695,7 +2695,7 @@ void RecreateEar(int ii, uint16_t ic, int iseed, int Id, int dur, int mdur, int tempstr[3] = (iseed >> 16) & 0x7F; tempstr[4] = (iseed >> 8) & 0x7F; tempstr[5] = iseed & 0x7F; - tempstr[6] = Id & 0x7F; + tempstr[6] = id & 0x7F; tempstr[7] = dur & 0x7F; tempstr[8] = mdur & 0x7F; tempstr[9] = ch & 0x7F; @@ -2885,10 +2885,10 @@ void SpawnTheodore(Point position) SpawnRewardItem(IDI_THEODORE, position); } -void RespawnItem(ItemStruct *item, bool FlipFlag) +void RespawnItem(ItemStruct *item, bool flipFlag) { int it = ItemCAnimTbl[item->_iCurs]; - item->SetNewAnimation(FlipFlag); + item->SetNewAnimation(flipFlag); item->_iRequest = false; if (item->_iCurs == ICURS_MAGIC_ROCK) { @@ -3202,9 +3202,9 @@ void DoOil(int pnum, int cii) } } -void PrintItemOil(char IDidx) +void PrintItemOil(char iDidx) { - switch (IDidx) { + switch (iDidx) { case IMISC_OILACC: strcpy(tempstr, _("increases a weapon's")); AddPanelString(tempstr); @@ -3855,11 +3855,11 @@ void PrintItemDur(ItemStruct *x) PrintItemInfo(x); } -void UseItem(int p, item_misc_id Mid, spell_id spl) +void UseItem(int p, item_misc_id mid, spell_id spl) { auto &player = plr[p]; - switch (Mid) { + switch (mid) { case IMISC_HEAL: case IMISC_FOOD: { int j = player._pMaxHP >> 8; @@ -4010,7 +4010,7 @@ void UseItem(int p, item_misc_id Mid, spell_id spl) case IMISC_OILPERM: case IMISC_OILHARD: case IMISC_OILIMP: - player._pOilType = Mid; + player._pOilType = mid; if (p != myplr) { return; } diff --git a/Source/lighting.cpp b/Source/lighting.cpp index e5b4f2085..f8cc8b685 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -491,7 +491,7 @@ char GetLight(int x, int y) return dLight[x][y]; } -void DoLighting(Point position, int nRadius, int Lnum) +void DoLighting(Point position, int nRadius, int lnum) { int xoff = 0; int yoff = 0; @@ -500,9 +500,9 @@ void DoLighting(Point position, int nRadius, int Lnum) int block_x = 0; int block_y = 0; - if (Lnum >= 0) { - xoff = LightList[Lnum].position.offset.x; - yoff = LightList[Lnum].position.offset.y; + if (lnum >= 0) { + xoff = LightList[lnum].position.offset.x; + yoff = LightList[lnum].position.offset.y; if (xoff < 0) { xoff += 8; position -= { 1, 0 }; diff --git a/Source/monster.cpp b/Source/monster.cpp index 338b6314d..be954bf20 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1238,11 +1238,11 @@ void DeleteMonster(int i) monstactive[i] = monstactive[nummonsters]; } -int AddMonster(Point position, Direction dir, int mtype, bool InMap) +int AddMonster(Point position, Direction dir, int mtype, bool inMap) { if (nummonsters < MAXMONSTERS) { int i = monstactive[nummonsters++]; - if (InMap) + if (inMap) dMonster[position.x][position.y] = i + 1; InitMonster(i, dir, mtype, position); return i; @@ -1419,7 +1419,7 @@ void M_StartSpStand(int i, Direction md) monster[i]._mdir = md; } -void M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, Direction EndDir) +void M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, Direction endDir) { int fx = xadd + monster[i].position.tile.x; int fy = yadd + monster[i].position.tile.y; @@ -1431,13 +1431,13 @@ void M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, Direction EndDir monster[i].position.velocity = { xvel, yvel }; monster[i]._mVar1 = xadd; monster[i]._mVar2 = yadd; - monster[i]._mVar3 = EndDir; - monster[i]._mdir = EndDir; - NewMonsterAnim(i, &monster[i].MType->Anims[MA_WALK], EndDir, AnimationDistributionFlags::ProcessAnimationPending, -1); + monster[i]._mVar3 = endDir; + monster[i]._mdir = endDir; + NewMonsterAnim(i, &monster[i].MType->Anims[MA_WALK], endDir, AnimationDistributionFlags::ProcessAnimationPending, -1); monster[i].position.offset2 = { 0, 0 }; } -void M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, Direction EndDir) +void M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, Direction endDir) { int fx = xadd + monster[i].position.tile.x; int fy = yadd + monster[i].position.tile.y; @@ -1454,13 +1454,13 @@ void M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int y monster[i].position.offset = { xoff, yoff }; monster[i]._mmode = MM_WALK2; monster[i].position.velocity = { xvel, yvel }; - monster[i]._mVar3 = EndDir; - monster[i]._mdir = EndDir; - NewMonsterAnim(i, &monster[i].MType->Anims[MA_WALK], EndDir, AnimationDistributionFlags::ProcessAnimationPending, -1); + monster[i]._mVar3 = endDir; + monster[i]._mdir = endDir; + NewMonsterAnim(i, &monster[i].MType->Anims[MA_WALK], endDir, AnimationDistributionFlags::ProcessAnimationPending, -1); monster[i].position.offset2 = { 16 * xoff, 16 * yoff }; } -void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, Direction EndDir) +void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, Direction endDir) { int fx = xadd + monster[i].position.tile.x; int fy = yadd + monster[i].position.tile.y; @@ -1481,9 +1481,9 @@ void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int y monster[i].position.velocity = { xvel, yvel }; monster[i]._mVar1 = fx; monster[i]._mVar2 = fy; - monster[i]._mVar3 = EndDir; - monster[i]._mdir = EndDir; - NewMonsterAnim(i, &monster[i].MType->Anims[MA_WALK], EndDir, AnimationDistributionFlags::ProcessAnimationPending, -1); + monster[i]._mVar3 = endDir; + monster[i]._mdir = endDir; + NewMonsterAnim(i, &monster[i].MType->Anims[MA_WALK], endDir, AnimationDistributionFlags::ProcessAnimationPending, -1); monster[i].position.offset2 = { 16 * xoff, 16 * yoff }; } @@ -1498,12 +1498,12 @@ void M_StartAttack(int i) monster[i]._mdir = md; } -void M_StartRAttack(int i, missile_id missile_type, int dam) +void M_StartRAttack(int i, missile_id missileType, int dam) { Direction md = M_GetDir(i); NewMonsterAnim(i, &monster[i].MType->Anims[MA_ATTACK], md, AnimationDistributionFlags::ProcessAnimationPending); monster[i]._mmode = MM_RATTACK; - monster[i]._mVar1 = missile_type; + monster[i]._mVar1 = missileType; monster[i]._mVar2 = dam; monster[i].position.offset = { 0, 0 }; monster[i].position.future = monster[i].position.tile; @@ -1511,7 +1511,7 @@ void M_StartRAttack(int i, missile_id missile_type, int dam) monster[i]._mdir = md; } -void M_StartRSpAttack(int i, missile_id missile_type, int dam) +void M_StartRSpAttack(int i, missile_id missileType, int dam) { Direction md = M_GetDir(i); int distributeFramesBeforeFrame = 0; @@ -1519,7 +1519,7 @@ void M_StartRSpAttack(int i, missile_id missile_type, int dam) distributeFramesBeforeFrame = monster[i].MData->mAFNum2; NewMonsterAnim(i, &monster[i].MType->Anims[MA_SPECIAL], md, AnimationDistributionFlags::ProcessAnimationPending, 0, distributeFramesBeforeFrame); monster[i]._mmode = MM_RSPATTACK; - monster[i]._mVar1 = missile_type; + monster[i]._mVar1 = missileType; monster[i]._mVar2 = 0; monster[i]._mVar3 = dam; monster[i].position.offset = { 0, 0 }; @@ -2012,13 +2012,13 @@ void M_TryM2MHit(int i, int mid, int hper, int mind, int maxd) } } -void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) +void M_TryH2HHit(int i, int pnum, int hit, int minDam, int maxDam) { assurance((DWORD)i < MAXMONSTERS, i); assurance(monster[i].MType != nullptr, i); if ((monster[i]._mFlags & MFLAG_TARGETS_MONSTER) != 0) { - M_TryM2MHit(i, pnum, Hit, MinDam, MaxDam); + M_TryM2MHit(i, pnum, hit, minDam, maxDam); return; } if (plr[pnum]._pHitPoints >> 6 <= 0 || plr[pnum]._pInvincible || (plr[pnum]._pSpellFlags & 1) != 0) @@ -2036,8 +2036,7 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) ac += 40; if ((plr[pnum].pDamAcFlags & ISPLHF_ACUNDEAD) != 0 && monster[i].MData->mMonstClass == MC_UNDEAD) ac += 20; - int hit = Hit - + 2 * (monster[i].mLevel - plr[pnum]._pLevel) + hit += 2 * (monster[i].mLevel - plr[pnum]._pLevel) + 30 - ac - plr[pnum]._pDexterity / 5; @@ -2068,7 +2067,7 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) StartPlrBlock(pnum, dir); if (pnum == myplr && plr[pnum].wReflections > 0) { plr[pnum].wReflections--; - int dam = GenerateRnd((MaxDam - MinDam + 1) << 6) + (MinDam << 6); + int dam = GenerateRnd((maxDam - minDam + 1) << 6) + (minDam << 6); dam += plr[pnum]._pIGetHit << 6; if (dam < 64) dam = 64; @@ -2110,7 +2109,7 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) } } } - int dam = (MinDam << 6) + GenerateRnd((MaxDam - MinDam + 1) << 6); + int dam = (minDam << 6) + GenerateRnd((maxDam - minDam + 1) << 6); dam += (plr[pnum]._pIGetHit << 6); if (dam < 64) dam = 64; @@ -3366,7 +3365,7 @@ void MAI_GoatMc(int i) MAI_Round(i, true); } -void MAI_Ranged(int i, missile_id missile_type, bool special) +void MAI_Ranged(int i, missile_id missileType, bool special) { assurance((DWORD)i < MAXMONSTERS, i); @@ -3393,9 +3392,9 @@ void MAI_Ranged(int i, missile_id missile_type, bool special) if (Monst->_mmode == MM_STAND) { if (LineClearMissile(Monst->position.tile, { fx, fy })) { if (special) - M_StartRSpAttack(i, missile_type, 4); + M_StartRSpAttack(i, missileType, 4); else - M_StartRAttack(i, missile_type, 4); + M_StartRAttack(i, missileType, 4); } else { Monst->AnimInfo.pCelSprite = &*Monst->MType->Anims[MA_STAND].CelSpritesForDirections[md]; } @@ -3583,7 +3582,7 @@ void MAI_Garg(int i) MAI_Round(i, false); } -void MAI_RoundRanged(int i, missile_id missile_type, bool checkdoors, int dam, int lessmissiles) +void MAI_RoundRanged(int i, missile_id missileType, bool checkdoors, int dam, int lessmissiles) { assurance((DWORD)i < MAXMONSTERS, i); MonsterStruct *Monst = &monster[i]; @@ -3611,7 +3610,7 @@ void MAI_RoundRanged(int i, missile_id missile_type, bool checkdoors, int dam, i Monst->_mgoal = MGOAL_NORMAL; } else if (v < (500 * (Monst->_mint + 1) >> lessmissiles) && (LineClearMissile(Monst->position.tile, { fx, fy }))) { - M_StartRSpAttack(i, missile_type, dam); + M_StartRSpAttack(i, missileType, dam); } else { M_RoundWalk(i, md, &Monst->_mgoalvar2); } @@ -3623,7 +3622,7 @@ void MAI_RoundRanged(int i, missile_id missile_type, bool checkdoors, int dam, i if (((dist >= 3 && v < ((500 * (Monst->_mint + 2)) >> lessmissiles)) || v < ((500 * (Monst->_mint + 1)) >> lessmissiles)) && LineClearMissile(Monst->position.tile, { fx, fy })) { - M_StartRSpAttack(i, missile_type, dam); + M_StartRSpAttack(i, missileType, dam); } else if (dist >= 2) { v = GenerateRnd(100); if (v < 1000 * (Monst->_mint + 5) @@ -4561,7 +4560,7 @@ bool LineClearMissile(Point startPoint, Point endPoint) return LineClear(PosOkMissile, 0, startPoint, endPoint); } -bool LineClear(bool (*Clear)(int, Point), int entity, Point startPoint, Point endPoint) +bool LineClear(bool (*clear)(int, Point), int entity, Point startPoint, Point endPoint) { Point position = startPoint; @@ -4597,7 +4596,7 @@ bool LineClear(bool (*Clear)(int, Point), int entity, Point startPoint, Point en position.y += yincD; } position.x++; - done = position != startPoint && !Clear(entity, position); + done = position != startPoint && !clear(entity, position); } } else { if (dy < 0) { @@ -4629,7 +4628,7 @@ bool LineClear(bool (*Clear)(int, Point), int entity, Point startPoint, Point en position.x += xincD; } position.y++; - done = position != startPoint && !Clear(entity, position); + done = position != startPoint && !clear(entity, position); } } return position == endPoint; diff --git a/Source/monster.h b/Source/monster.h index a7ba86a01..4ae4d5762 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -255,7 +255,7 @@ void MAI_Fallen(int i); void MAI_Cleaver(int i); void MAI_Round(int i, bool special); void MAI_GoatMc(int i); -void MAI_Ranged(int i, missile_id missile_type, bool special); +void MAI_Ranged(int i, missile_id missileType, bool special); void MAI_GoatBow(int i); void MAI_Succ(int i); void MAI_Lich(int i); @@ -267,7 +267,7 @@ void MAI_Firebat(int i); void MAI_Torchant(int i); void MAI_Scav(int i); void MAI_Garg(int i); -void MAI_RoundRanged(int i, missile_id missile_type, bool checkdoors, int dam, int lessmissiles); +void MAI_RoundRanged(int i, missile_id missileType, bool checkdoors, int dam, int lessmissiles); void MAI_Magma(int i); void MAI_Storm(int i); void MAI_BoneDemon(int i); diff --git a/Source/movie.cpp b/Source/movie.cpp index 2292bbd91..09d69dc58 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -26,7 +26,7 @@ bool loop_movie; * @param pszMovie The file name of the video * @param user_can_close Set to false to make the video unskippable. */ -void play_movie(const char *pszMovie, bool user_can_close) +void play_movie(const char *pszMovie, bool userCanClose) { movie_playing = true; @@ -44,7 +44,7 @@ void play_movie(const char *pszMovie, bool user_can_close) case DVL_WM_KEYDOWN: case DVL_WM_LBUTTONDOWN: case DVL_WM_RBUTTONDOWN: - if (user_can_close || (Msg.message == DVL_WM_KEYDOWN && Msg.wParam == DVL_VK_ESCAPE)) + if (userCanClose || (Msg.message == DVL_WM_KEYDOWN && Msg.wParam == DVL_VK_ESCAPE)) movie_playing = false; break; case DVL_WM_QUIT: diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 4f0ea29fa..09b7c0d5a 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -223,7 +223,7 @@ struct Archive { return true; } - bool Close(bool clear_tables = true) + bool Close(bool clearTables = true) { if (!stream.IsOpen()) return true; @@ -242,7 +242,7 @@ struct Archive { result = ResizeFile(name.c_str(), size); } name.clear(); - if (clear_tables) { + if (clearTables) { delete[] sgpHashTbl; sgpHashTbl = nullptr; delete[] sgpBlockTbl; @@ -350,7 +350,7 @@ bool ReadMPQHeader(Archive *archive, _FILEHEADER *hdr) return true; } -_BLOCKENTRY *NewBlock(int *block_index) +_BLOCKENTRY *NewBlock(int *blockIndex) { _BLOCKENTRY *blockEntry = cur_archive.sgpBlockTbl; @@ -364,8 +364,8 @@ _BLOCKENTRY *NewBlock(int *block_index) if (blockEntry->sizefile != 0) continue; - if (block_index != nullptr) - *block_index = i; + if (blockIndex != nullptr) + *blockIndex = i; return blockEntry; } @@ -373,7 +373,7 @@ _BLOCKENTRY *NewBlock(int *block_index) app_fatal("Out of free block entries"); } -void AllocBlock(uint32_t block_offset, uint32_t block_size) +void AllocBlock(uint32_t blockOffset, uint32_t blockSize) { _BLOCKENTRY *block; int i; @@ -382,37 +382,37 @@ void AllocBlock(uint32_t block_offset, uint32_t block_size) i = INDEX_ENTRIES; while (i-- != 0) { if (block->offset != 0 && block->flags == 0 && block->sizefile == 0) { - if (block->offset + block->sizealloc == block_offset) { - block_offset = block->offset; - block_size += block->sizealloc; + if (block->offset + block->sizealloc == blockOffset) { + blockOffset = block->offset; + blockSize += block->sizealloc; memset(block, 0, sizeof(_BLOCKENTRY)); - AllocBlock(block_offset, block_size); + AllocBlock(blockOffset, blockSize); return; } - if (block_offset + block_size == block->offset) { - block_size += block->sizealloc; + if (blockOffset + blockSize == block->offset) { + blockSize += block->sizealloc; memset(block, 0, sizeof(_BLOCKENTRY)); - AllocBlock(block_offset, block_size); + AllocBlock(blockOffset, blockSize); return; } } block++; } - if (block_offset + block_size > cur_archive.size) { + if (blockOffset + blockSize > cur_archive.size) { app_fatal("MPQ free list error"); } - if (block_offset + block_size == cur_archive.size) { - cur_archive.size = block_offset; + if (blockOffset + blockSize == cur_archive.size) { + cur_archive.size = blockOffset; } else { block = NewBlock(nullptr); - block->offset = block_offset; - block->sizealloc = block_size; + block->offset = blockOffset; + block->sizealloc = blockSize; block->sizefile = 0; block->flags = 0; } } -int FindFreeBlock(uint32_t size, uint32_t *block_size) +int FindFreeBlock(uint32_t size, uint32_t *blockSize) { int result; @@ -428,7 +428,7 @@ int FindFreeBlock(uint32_t size, uint32_t *block_size) continue; result = pBlockTbl->offset; - *block_size = size; + *blockSize = size; pBlockTbl->offset += size; pBlockTbl->sizealloc -= size; @@ -438,21 +438,21 @@ int FindFreeBlock(uint32_t size, uint32_t *block_size) return result; } - *block_size = size; + *blockSize = size; result = cur_archive.size; cur_archive.size += size; return result; } -int GetHashIndex(int index, uint32_t hash_a, uint32_t hash_b) +int GetHashIndex(int index, uint32_t hashA, uint32_t hashB) { int i = INDEX_ENTRIES; for (int idx = index & 0x7FF; cur_archive.sgpHashTbl[idx].block != -1; idx = (idx + 1) & 0x7FF) { if (i-- == 0) break; - if (cur_archive.sgpHashTbl[idx].hashcheck[0] != hash_a) + if (cur_archive.sgpHashTbl[idx].hashcheck[0] != hashA) continue; - if (cur_archive.sgpHashTbl[idx].hashcheck[1] != hash_b) + if (cur_archive.sgpHashTbl[idx].hashcheck[1] != hashB) continue; if (cur_archive.sgpHashTbl[idx].block == -2) continue; @@ -468,7 +468,7 @@ int FetchHandle(const char *pszName) return GetHashIndex(Hash(pszName, 0), Hash(pszName, 1), Hash(pszName, 2)); } -_BLOCKENTRY *AddFile(const char *pszName, _BLOCKENTRY *pBlk, int block_index) +_BLOCKENTRY *AddFile(const char *pszName, _BLOCKENTRY *pBlk, int blockIndex) { uint32_t h1 = Hash(pszName, 0); uint32_t h2 = Hash(pszName, 1); @@ -489,12 +489,12 @@ _BLOCKENTRY *AddFile(const char *pszName, _BLOCKENTRY *pBlk, int block_index) app_fatal("Out of hash space"); if (pBlk == nullptr) - pBlk = NewBlock(&block_index); + pBlk = NewBlock(&blockIndex); cur_archive.sgpHashTbl[hIdx].hashcheck[0] = h2; cur_archive.sgpHashTbl[hIdx].hashcheck[1] = h3; cur_archive.sgpHashTbl[hIdx].lcid = 0; - cur_archive.sgpHashTbl[hIdx].block = block_index; + cur_archive.sgpHashTbl[hIdx].block = blockIndex; return pBlk; } diff --git a/Source/msg.cpp b/Source/msg.cpp index 4c939f439..18f6ceb30 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -300,10 +300,10 @@ DWORD CompressData(byte *buffer, byte *end) return pkSize + 1; } -void DeltaImportData(BYTE cmd, DWORD recv_offset) +void DeltaImportData(BYTE cmd, DWORD recvOffset) { if (sgRecvBuf[0] != byte { 0 }) - PkwareDecompress(&sgRecvBuf[1], recv_offset, sizeof(sgRecvBuf) - 1); + PkwareDecompress(&sgRecvBuf[1], recvOffset, sizeof(sgRecvBuf) - 1); byte *src = &sgRecvBuf[1]; if (cmd == CMD_DLEVEL_JUNK) { diff --git a/Source/nthread.cpp b/Source/nthread.cpp index 63e35773d..b59f81d35 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -49,7 +49,7 @@ void nthread_terminate_game(const char *pszFcn) } } -uint32_t nthread_send_and_recv_turn(uint32_t cur_turn, int turn_delta) +uint32_t nthread_send_and_recv_turn(uint32_t curTurn, int turnDelta) { uint32_t curTurnsInTransit; if (!SNetGetTurnsInTransit(&curTurnsInTransit)) { @@ -58,7 +58,7 @@ uint32_t nthread_send_and_recv_turn(uint32_t cur_turn, int turn_delta) } while (curTurnsInTransit++ < gdwTurnsInTransit) { - int turn_tmp = turn_upper_bit | (cur_turn & 0x7FFFFFFF); + int turn_tmp = turn_upper_bit | (curTurn & 0x7FFFFFFF); turn_upper_bit = 0; int turn = turn_tmp; @@ -67,11 +67,11 @@ uint32_t nthread_send_and_recv_turn(uint32_t cur_turn, int turn_delta) return 0; } - cur_turn += turn_delta; - if (cur_turn >= 0x7FFFFFFF) - cur_turn &= 0xFFFF; + curTurn += turnDelta; + if (curTurn >= 0x7FFFFFFF) + curTurn &= 0xFFFF; } - return cur_turn; + return curTurn; } bool nthread_recv_turns(bool *pfSendAsync) @@ -140,7 +140,7 @@ void nthread_set_turn_upper_bit() turn_upper_bit = 0x80000000; } -void nthread_start(bool set_turn_upper_bit) +void nthread_start(bool setTurnUpperBit) { const char *err; DWORD largestMsgSize; @@ -150,7 +150,7 @@ void nthread_start(bool set_turn_upper_bit) sgbPacketCountdown = 1; sgbSyncCountdown = 1; sgbTicsOutOfSync = true; - if (set_turn_upper_bit) + if (setTurnUpperBit) nthread_set_turn_upper_bit(); else turn_upper_bit = 0; diff --git a/Source/objects.cpp b/Source/objects.cpp index f0e10f7c0..9b9c4e7ec 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4677,13 +4677,13 @@ bool objectIsDisabled(int i) return false; } -void OperateObject(int pnum, int i, bool TeleFlag) +void OperateObject(int pnum, int i, bool teleFlag) { bool sendmsg = pnum == myplr; switch (object[i]._otype) { case OBJ_L1LDOOR: case OBJ_L1RDOOR: - if (TeleFlag) { + if (teleFlag) { if (object[i]._otype == OBJ_L1LDOOR) OperateL1LDoor(pnum, i, true); if (object[i]._otype == OBJ_L1RDOOR) @@ -4695,7 +4695,7 @@ void OperateObject(int pnum, int i, bool TeleFlag) break; case OBJ_L2LDOOR: case OBJ_L2RDOOR: - if (TeleFlag) { + if (teleFlag) { if (object[i]._otype == OBJ_L2LDOOR) OperateL2LDoor(pnum, i, true); if (object[i]._otype == OBJ_L2RDOOR) @@ -4707,7 +4707,7 @@ void OperateObject(int pnum, int i, bool TeleFlag) break; case OBJ_L3LDOOR: case OBJ_L3RDOOR: - if (TeleFlag) { + if (teleFlag) { if (object[i]._otype == OBJ_L3LDOOR) OperateL3LDoor(pnum, i, true); if (object[i]._otype == OBJ_L3RDOOR) diff --git a/Source/path.cpp b/Source/path.cpp index 40926fbd2..7da24056b 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -51,7 +51,7 @@ int8_t path_directions[9] = { 5, 1, 6, 2, 0, 3, 8, 4, 7 }; * check that each step is a valid position. Store the step directions (see * path_directions) in path, which must have room for 24 steps */ -int FindPath(bool (*PosOk)(int, Point), int PosOkArg, int sx, int sy, int dx, int dy, int8_t path[MAX_PATH_LENGTH]) +int FindPath(bool (*posOk)(int, Point), int posOkArg, int sx, int sy, int dx, int dy, int8_t path[MAX_PATH_LENGTH]) { // clear all nodes, create root nodes for the visited/frontier linked lists gdwCurNodes = 0; @@ -87,7 +87,7 @@ int FindPath(bool (*PosOk)(int, Point), int PosOkArg, int sx, int sy, int dx, in return 0; } // ran out of nodes, abort! - if (!path_get_path(PosOk, PosOkArg, next_node, dx, dy)) + if (!path_get_path(posOk, posOkArg, next_node, dx, dy)) return 0; } // frontier is empty, no path! @@ -177,12 +177,12 @@ bool path_solid_pieces(PATHNODE *pPath, int dx, int dy) * * @return false if we ran out of preallocated nodes to use, else true */ -bool path_get_path(bool (*PosOk)(int, Point), int PosOkArg, PATHNODE *pPath, int x, int y) +bool path_get_path(bool (*posOk)(int, Point), int posOkArg, PATHNODE *pPath, int x, int y) { for (int i = 0; i < 8; i++) { int dx = pPath->position.x + pathxdir[i]; int dy = pPath->position.y + pathydir[i]; - bool ok = PosOk(PosOkArg, { dx, dy }); + bool ok = posOk(posOkArg, { dx, dy }); if ((ok && path_solid_pieces(pPath, dx, dy)) || (!ok && dx == x && dy == y)) { if (!path_parent_path(pPath, dx, dy, x, y)) return false; diff --git a/Source/pfile.cpp b/Source/pfile.cpp index efe53ba4e..22e2acaff 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -34,7 +34,7 @@ namespace { /** List of character names for the character selection screen. */ char hero_names[MAX_CHARACTERS][PLR_NAME_LEN]; -std::string GetSavePath(uint32_t save_num) +std::string GetSavePath(uint32_t saveNum) { std::string path = paths::PrefPath(); const char *ext = ".sv"; @@ -56,7 +56,7 @@ std::string GetSavePath(uint32_t save_num) } char save_num_str[21]; - snprintf(save_num_str, sizeof(save_num_str) / sizeof(char), "%i", save_num); + snprintf(save_num_str, sizeof(save_num_str) / sizeof(char), "%i", saveNum); path.append(save_num_str); path.append(ext); return path; @@ -178,16 +178,16 @@ void EncodeHero(const PkPlayerStruct *pack) mpqapi_write_file("hero", packed.get(), packedLen); } -bool OpenArchive(uint32_t save_num) +bool OpenArchive(uint32_t saveNum) { - return OpenMPQ(GetSavePath(save_num).c_str()); + return OpenMPQ(GetSavePath(saveNum).c_str()); } -HANDLE OpenSaveArchive(uint32_t save_num) +HANDLE OpenSaveArchive(uint32_t saveNum) { HANDLE archive; - if (SFileOpenArchive(GetSavePath(save_num).c_str(), 0, 0, &archive)) + if (SFileOpenArchive(GetSavePath(saveNum).c_str(), 0, 0, &archive)) return archive; return nullptr; } @@ -265,9 +265,9 @@ const char *pfile_get_password() return gbIsMultiplayer ? PASSWORD_MULTI : PASSWORD_SINGLE; } -PFileScopedArchiveWriter::PFileScopedArchiveWriter(bool clear_tables) +PFileScopedArchiveWriter::PFileScopedArchiveWriter(bool clearTables) : save_num_(GetSaveNumberFromName(plr[myplr]._pName)) - , clear_tables_(clear_tables) + , clear_tables_(clearTables) { if (!OpenArchive(save_num_)) app_fatal("%s", _("Failed to open player archive for writing.")); @@ -278,10 +278,10 @@ PFileScopedArchiveWriter::~PFileScopedArchiveWriter() mpqapi_flush_and_close(clear_tables_); } -void pfile_write_hero(bool write_game_data, bool clear_tables) +void pfile_write_hero(bool writeGameData, bool clearTables) { - PFileScopedArchiveWriter scoped_writer(clear_tables); - if (write_game_data) { + PFileScopedArchiveWriter scoped_writer(clearTables); + if (writeGameData) { SaveGameData(); RenameTempToPerm(); } @@ -294,7 +294,7 @@ void pfile_write_hero(bool write_game_data, bool clear_tables) } } -bool pfile_ui_set_hero_infos(bool (*ui_add_hero_info)(_uiheroinfo *)) +bool pfile_ui_set_hero_infos(bool (*uiAddHeroInfo)(_uiheroinfo *)) { memset(hero_names, 0, sizeof(hero_names)); @@ -317,7 +317,7 @@ bool pfile_ui_set_hero_infos(bool (*ui_add_hero_info)(_uiheroinfo *)) CalcPlrInv(0, false); Game2UiPlayer(plr[0], &uihero, hasSaveGame); - ui_add_hero_info(&uihero); + uiAddHeroInfo(&uihero); } CloseArchive(&archive); } @@ -326,12 +326,12 @@ bool pfile_ui_set_hero_infos(bool (*ui_add_hero_info)(_uiheroinfo *)) return true; } -void pfile_ui_set_class_stats(unsigned int player_class_nr, _uidefaultstats *class_stats) +void pfile_ui_set_class_stats(unsigned int playerClass, _uidefaultstats *classStats) { - class_stats->strength = StrengthTbl[player_class_nr]; - class_stats->magic = MagicTbl[player_class_nr]; - class_stats->dexterity = DexterityTbl[player_class_nr]; - class_stats->vitality = VitalityTbl[player_class_nr]; + classStats->strength = StrengthTbl[playerClass]; + classStats->magic = MagicTbl[playerClass]; + classStats->dexterity = DexterityTbl[playerClass]; + classStats->vitality = VitalityTbl[playerClass]; } bool pfile_ui_save_create(_uiheroinfo *heroinfo) @@ -369,9 +369,9 @@ bool pfile_ui_save_create(_uiheroinfo *heroinfo) return true; } -bool pfile_delete_save(_uiheroinfo *hero_info) +bool pfile_delete_save(_uiheroinfo *heroInfo) { - uint32_t save_num = GetSaveNumberFromName(hero_info->name); + uint32_t save_num = GetSaveNumberFromName(heroInfo->name); if (save_num < MAX_CHARACTERS) { hero_names[save_num][0] = '\0'; RemoveFile(GetSavePath(save_num).c_str()); @@ -473,7 +473,7 @@ std::unique_ptr pfile_read(const char *pszName, size_t *pdwLen) return buf; } -void pfile_update(bool force_save) +void pfile_update(bool forceSave) { static Uint32 save_prev_tc; @@ -481,7 +481,7 @@ void pfile_update(bool force_save) return; Uint32 tick = SDL_GetTicks(); - if (!force_save && tick - save_prev_tc <= 60000) + if (!forceSave && tick - save_prev_tc <= 60000) return; save_prev_tc = tick; diff --git a/Source/pfile.h b/Source/pfile.h index bd7225829..8bfe2da8c 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -17,7 +17,7 @@ extern bool gbValidSaveFile; class PFileScopedArchiveWriter { public: // Opens the player save file for writing - PFileScopedArchiveWriter(bool clear_tables = !gbIsMultiplayer); + PFileScopedArchiveWriter(bool clearTables = !gbIsMultiplayer); // Finishes writing and closes the player save file. ~PFileScopedArchiveWriter(); @@ -28,17 +28,17 @@ private: }; const char *pfile_get_password(); -void pfile_write_hero(bool write_game_data = false, bool clear_tables = !gbIsMultiplayer); -bool pfile_ui_set_hero_infos(bool (*ui_add_hero_info)(_uiheroinfo *)); -void pfile_ui_set_class_stats(unsigned int player_class_nr, _uidefaultstats *class_stats); +void pfile_write_hero(bool writeGameData = false, bool clearTables = !gbIsMultiplayer); +bool pfile_ui_set_hero_infos(bool (*uiAddHeroInfo)(_uiheroinfo *)); +void pfile_ui_set_class_stats(unsigned int playerClass, _uidefaultstats *classStats); bool pfile_ui_save_create(_uiheroinfo *heroinfo); -bool pfile_delete_save(_uiheroinfo *hero_info); +bool pfile_delete_save(_uiheroinfo *heroInfo); void pfile_read_player_from_save(char name[16], int playerId); bool LevelFileExists(); void GetTempLevelNames(char *szTemp); void GetPermLevelNames(char *szPerm); void pfile_remove_temp_files(); std::unique_ptr pfile_read(const char *pszName, size_t *pdwLen); -void pfile_update(bool force_save); +void pfile_update(bool forceSave); } // namespace devilution diff --git a/Source/player.cpp b/Source/player.cpp index 9f3017450..358ecc11c 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1172,7 +1172,7 @@ void AddPlrMonstExper(int lvl, int exp, char pmask) } } -void InitPlayer(int pnum, bool FirstTime) +void InitPlayer(int pnum, bool firstTime) { DWORD i; @@ -1182,7 +1182,7 @@ void InitPlayer(int pnum, bool FirstTime) auto &player = plr[pnum]; auto &myPlayer = plr[myplr]; - if (FirstTime) { + if (firstTime) { player._pRSplType = RSPLTYPE_INVALID; player._pRSpell = SPL_INVALID; if (pnum == myplr) @@ -1221,7 +1221,7 @@ void InitPlayer(int pnum, bool FirstTime) player._pdir = DIR_S; if (pnum == myplr) { - if (!FirstTime || currlevel != 0) { + if (!firstTime || currlevel != 0) { player.position.tile = { ViewX, ViewY }; } } else { @@ -1259,13 +1259,13 @@ void InitPlayer(int pnum, bool FirstTime) } #ifdef _DEBUG - if (debug_mode_dollar_sign && FirstTime) { + if (debug_mode_dollar_sign && firstTime) { player._pMemSpells |= 1 << (SPL_TELEPORT - 1); if (myPlayer._pSplLvl[SPL_TELEPORT] == 0) { myPlayer._pSplLvl[SPL_TELEPORT] = 1; } } - if (debug_mode_key_inverted_v && FirstTime) { + if (debug_mode_key_inverted_v && firstTime) { player._pMemSpells = SPL_INVALID; } #endif diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index eb35d8fff..196ec03f8 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1153,12 +1153,12 @@ void CalcViewportGeometry() * @param x Center of view in dPiece coordinate * @param y Center of view in dPiece coordinate */ -static void DrawGame(const Surface &full_out, int x, int y) +static void DrawGame(const Surface &fullOut, int x, int y) { // Limit rendering to the view area const Surface &out = zoomflag - ? full_out.subregionY(0, gnViewportHeight) - : full_out.subregionY(0, (gnViewportHeight + 1) / 2); + ? fullOut.subregionY(0, gnViewportHeight) + : fullOut.subregionY(0, (gnViewportHeight + 1) / 2); // Adjust by player offset and tile grid alignment auto &myPlayer = plr[myplr]; @@ -1250,16 +1250,16 @@ static void DrawGame(const Surface &full_out, int x, int y) DrawTileContent(out, x, y, sx, sy, rows, columns); if (!zoomflag) { - Zoom(full_out.subregionY(0, gnViewportHeight)); + Zoom(fullOut.subregionY(0, gnViewportHeight)); } } // DevilutionX extension. extern void DrawControllerModifierHints(const Surface &out); -void DrawView(const Surface &out, int StartX, int StartY) +void DrawView(const Surface &out, int startX, int startY) { - DrawGame(out, StartX, StartY); + DrawGame(out, startX, startY); if (AutomapActive) { DrawAutomap(out.subregionY(0, gnViewportHeight)); } @@ -1479,7 +1479,7 @@ static void DoBlitScreen(Sint16 dwX, Sint16 dwY, Uint16 dwWdt, Uint16 dwHgt) * @param draw_sbar Render belt * @param draw_btn Render panel buttons */ -static void DrawMain(int dwHgt, bool draw_desc, bool draw_hp, bool draw_mana, bool draw_sbar, bool draw_btn) +static void DrawMain(int dwHgt, bool drawDesc, bool drawHp, bool drawMana, bool drawSbar, bool drawBtn) { if (!gbActive || RenderDirectlyToOutputSurface) { return; @@ -1491,20 +1491,20 @@ static void DrawMain(int dwHgt, bool draw_desc, bool draw_hp, bool draw_mana, bo DoBlitScreen(0, 0, gnScreenWidth, dwHgt); } if (dwHgt < gnScreenHeight) { - if (draw_sbar) { + if (drawSbar) { DoBlitScreen(PANEL_LEFT + 204, PANEL_TOP + 5, 232, 28); } - if (draw_desc) { + if (drawDesc) { DoBlitScreen(PANEL_LEFT + 176, PANEL_TOP + 46, 288, 60); } - if (draw_mana) { + if (drawMana) { DoBlitScreen(PANEL_LEFT + 460, PANEL_TOP, 88, 72); DoBlitScreen(PANEL_LEFT + 564, PANEL_TOP + 64, 56, 56); } - if (draw_hp) { + if (drawHp) { DoBlitScreen(PANEL_LEFT + 96, PANEL_TOP, 88, 72); } - if (draw_btn) { + if (drawBtn) { DoBlitScreen(PANEL_LEFT + 8, PANEL_TOP + 5, 72, 119); DoBlitScreen(PANEL_LEFT + 556, PANEL_TOP + 5, 72, 48); if (gbIsMultiplayer) { diff --git a/Source/sha.cpp b/Source/sha.cpp index a3fc5077c..f5f0107b1 100644 --- a/Source/sha.cpp +++ b/Source/sha.cpp @@ -109,7 +109,7 @@ static void SHA1ProcessMessageBlock(SHA1Context *context) context->state[4] += E; } -static void SHA1Input(SHA1Context *context, const char *message_array, std::uint32_t len) +static void SHA1Input(SHA1Context *context, const char *messageArray, std::uint32_t len) { std::uint32_t count = context->count[0] + 8 * len; if (count < context->count[0]) @@ -119,9 +119,9 @@ static void SHA1Input(SHA1Context *context, const char *message_array, std::uint context->count[1] += len >> 29; for (int i = len; i >= 64; i -= 64) { - memcpy(context->buffer, message_array, sizeof(context->buffer)); + memcpy(context->buffer, messageArray, sizeof(context->buffer)); SHA1ProcessMessageBlock(context); - message_array += 64; + messageArray += 64; } } @@ -130,13 +130,13 @@ void SHA1Clear() memset(sgSHA1, 0, sizeof(sgSHA1)); } -void SHA1Result(int n, char Message_Digest[SHA1HashSize]) +void SHA1Result(int n, char messageDigest[SHA1HashSize]) { std::uint32_t *Message_Digest_Block; int i; - Message_Digest_Block = (std::uint32_t *)Message_Digest; - if (Message_Digest != nullptr) { + Message_Digest_Block = (std::uint32_t *)messageDigest; + if (messageDigest != nullptr) { for (i = 0; i < 5; i++) { *Message_Digest_Block = SDL_SwapLE32(sgSHA1[n].state[i]); Message_Digest_Block++; @@ -144,11 +144,11 @@ void SHA1Result(int n, char Message_Digest[SHA1HashSize]) } } -void SHA1Calculate(int n, const char *data, char Message_Digest[SHA1HashSize]) +void SHA1Calculate(int n, const char *data, char messageDigest[SHA1HashSize]) { SHA1Input(&sgSHA1[n], data, 64); - if (Message_Digest != nullptr) - SHA1Result(n, Message_Digest); + if (messageDigest != nullptr) + SHA1Result(n, messageDigest); } void SHA1Reset(int n) diff --git a/Source/sha.h b/Source/sha.h index e1fa4fb0c..1a1a9e558 100644 --- a/Source/sha.h +++ b/Source/sha.h @@ -18,8 +18,8 @@ struct SHA1Context { }; void SHA1Clear(); -void SHA1Result(int n, char Message_Digest[SHA1HashSize]); -void SHA1Calculate(int n, const char *data, char Message_Digest[SHA1HashSize]); +void SHA1Result(int n, char messageDigest[SHA1HashSize]); +void SHA1Calculate(int n, const char *data, char messageDigest[SHA1HashSize]); void SHA1Reset(int n); } // namespace devilution