From de0b3a38b8c418df338cdd77933f8ee184442c8b Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 20 Jul 2021 02:39:54 +0200 Subject: [PATCH] Apply code style --- Source/quests.cpp | 2 +- Source/scrollrt.cpp | 44 ++++++++++++++++++++++---------------------- Source/setmaps.cpp | 6 +++--- Source/sha.cpp | 6 +++--- Source/sound.cpp | 2 +- Source/spells.cpp | 2 +- Source/stores.cpp | 2 +- Source/sync.cpp | 2 +- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Source/quests.cpp b/Source/quests.cpp index dad7fd67b..15a483010 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -246,7 +246,7 @@ void DrawBlood(int x, int y) } } -static void PrintQLString(const Surface &out, int x, int line, const char *str) +void PrintQLString(const Surface &out, int x, int line, const char *str) { int width = GetLineWidth(str); int sx = x + std::max((257 - width) / 2, 0); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index e37be5f79..8e435a5f6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -242,7 +242,7 @@ const char *const PlayerModeNames[] = { "quitting" }; -static void BlitCursor(BYTE *dst, std::uint32_t dstPitch, BYTE *src, std::uint32_t srcPitch) +void BlitCursor(BYTE *dst, std::uint32_t dstPitch, BYTE *src, std::uint32_t srcPitch) { for (std::uint32_t i = 0; i < sgdwCursHgt; ++i, src += srcPitch, dst += dstPitch) { memcpy(dst, src, sgdwCursWdt); @@ -252,7 +252,7 @@ static void BlitCursor(BYTE *dst, std::uint32_t dstPitch, BYTE *src, std::uint32 /** * @brief Remove the cursor from the buffer */ -static void UndrawCursor(const Surface &out) +void UndrawCursor(const Surface &out) { if (sgdwCursWdt == 0) { return; @@ -267,7 +267,7 @@ static void UndrawCursor(const Surface &out) sgdwCursWdt = 0; } -static bool ShouldShowCursor() +bool ShouldShowCursor() { return !(sgbControllerActive && !IsMovingMouseCursorWithController() && pcurs != CURSOR_TELEPORT && !invflag && (!chrflag || Players[MyPlayerId]._pStatPts <= 0)); } @@ -275,7 +275,7 @@ static bool ShouldShowCursor() /** * @brief Save the content behind the cursor to a temporary buffer, then draw the cursor. */ -static void DrawCursor(const Surface &out) +void DrawCursor(const Surface &out) { if (pcurs <= CURSOR_NONE || cursW == 0 || cursH == 0 || !ShouldShowCursor()) { return; @@ -369,7 +369,7 @@ void DrawMissile(const Surface &out, int x, int y, int sx, int sy, bool pre) * @param my Output buffer coordinate * @param m Id of monster */ -static void DrawMonster(const Surface &out, int x, int y, int mx, int my, const MonsterStruct &monster) +void DrawMonster(const Surface &out, int x, int y, int mx, int my, const MonsterStruct &monster) { if (monster.AnimInfo.pCelSprite == nullptr) { Log("Draw Monster \"{}\": NULL Cel Buffer", monster.mName); @@ -415,7 +415,7 @@ static void DrawMonster(const Surface &out, int x, int y, int mx, int my, const /** * @brief Helper for rendering a specific player icon (Mana Shield or Reflect) */ -static void DrawPlayerIconHelper(const Surface &out, int pnum, missile_graphic_id missileGraphicId, int x, int y, bool lighting) +void DrawPlayerIconHelper(const Surface &out, int pnum, missile_graphic_id missileGraphicId, int x, int y, bool lighting) { x += CalculateWidth2(Players[pnum].AnimInfo.pCelSprite->Width()) - MissileSpriteData[missileGraphicId].mAnimWidth2[0]; @@ -445,7 +445,7 @@ static void DrawPlayerIconHelper(const Surface &out, int pnum, missile_graphic_i * @param sy Output buffer coordinate * @param lighting Should lighting be applied */ -static void DrawPlayerIcons(const Surface &out, int pnum, int x, int y, bool lighting) +void DrawPlayerIcons(const Surface &out, int pnum, int x, int y, bool lighting) { auto &player = Players[pnum]; if (player.pManaShield) @@ -466,7 +466,7 @@ static void DrawPlayerIcons(const Surface &out, int pnum, int x, int y, bool lig * @param nCel frame * @param nWidth width */ -static void DrawPlayer(const Surface &out, int pnum, int x, int y, int px, int py) +void DrawPlayer(const Surface &out, int pnum, int x, int y, int px, int py) { if ((dFlags[x][y] & BFLAG_LIT) == 0 && !Players[MyPlayerId]._pInfraFlag && leveltype != DTYPE_TOWN) { return; @@ -557,7 +557,7 @@ void DrawDeadPlayer(const Surface &out, int x, int y, int sx, int sy) * @param oy Output buffer coordinate * @param pre Is the sprite in the background */ -static void DrawObject(const Surface &out, int x, int y, int ox, int oy, bool pre) +void DrawObject(const Surface &out, int x, int y, int ox, int oy, bool pre) { int8_t bv = dObject[x][y]; if (bv == 0 || LightTableIndex >= LightsMax) @@ -616,7 +616,7 @@ static void DrawDungeon(const Surface & /*out*/, int /*sx*/, int /*sy*/, int /*d * @param sx Target buffer coordinate * @param sy Target buffer coordinate */ -static void DrawCell(const Surface &out, int x, int y, int sx, int sy) +void DrawCell(const Surface &out, int x, int y, int sx, int sy) { MICROS *pMap = &dpiece_defs_map_2[x][y]; level_piece_id = dPiece[x][y]; @@ -646,7 +646,7 @@ static void DrawCell(const Surface &out, int x, int y, int sx, int sy) * @param sx Target buffer coordinate * @param sy Target buffer coordinate */ -static void DrawFloor(const Surface &out, int x, int y, int sx, int sy) +void DrawFloor(const Surface &out, int x, int y, int sx, int sy) { cel_transparency_active = false; LightTableIndex = dLight[x][y]; @@ -672,7 +672,7 @@ static void DrawFloor(const Surface &out, int x, int y, int sx, int sy) * @param sy Output buffer coordinate * @param pre Is the sprite in the background */ -static void DrawItem(const Surface &out, int x, int y, int sx, int sy, bool pre) +void DrawItem(const Surface &out, int x, int y, int sx, int sy, bool pre) { int8_t bItem = dItem[x][y]; @@ -715,7 +715,7 @@ static void DrawItem(const Surface &out, int x, int y, int sx, int sy, bool pre) * @param sx Output buffer coordinate * @param sy Output buffer coordinate */ -static void DrawMonsterHelper(const Surface &out, int x, int y, int oy, int sx, int sy) +void DrawMonsterHelper(const Surface &out, int x, int y, int oy, int sx, int sy) { int mi = dMonster[x][y + oy]; mi = mi > 0 ? mi - 1 : -(mi + 1); @@ -772,7 +772,7 @@ static void DrawMonsterHelper(const Surface &out, int x, int y, int oy, int sx, * @param sx Output buffer coordinate * @param sy Output buffer coordinate */ -static void DrawPlayerHelper(const Surface &out, int x, int y, int sx, int sy) +void DrawPlayerHelper(const Surface &out, int x, int y, int sx, int sy) { int8_t p = dPlayer[x][y]; p = p > 0 ? p - 1 : -(p + 1); @@ -801,7 +801,7 @@ static void DrawPlayerHelper(const Surface &out, int x, int y, int sx, int sy) * @param dx Target buffer coordinate * @param dy Target buffer coordinate */ -static void DrawDungeon(const Surface &out, int sx, int sy, int dx, int dy) +void DrawDungeon(const Surface &out, int sx, int sy, int dx, int dy) { assert(sx >= 0 && sx < MAXDUNX); assert(sy >= 0 && sy < MAXDUNY); @@ -915,7 +915,7 @@ static void DrawDungeon(const Surface &out, int sx, int sy, int dx, int dy) * @param rows Number of rows * @param columns Tile in a row */ -static void DrawFloor(const Surface &out, int x, int y, int sx, int sy, int rows, int columns) +void DrawFloor(const Surface &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++) { @@ -964,7 +964,7 @@ static void DrawFloor(const Surface &out, int x, int y, int sx, int sy, int rows * @param rows Number of rows * @param columns Tile in a row */ -static void DrawTileContent(const Surface &out, int x, int y, int sx, int sy, int rows, int columns) +void DrawTileContent(const Surface &out, int x, int y, int sx, int sy, int rows, int columns) { // Keep evaluating until MicroTiles can't affect screen rows += MicroTileLen; @@ -1012,7 +1012,7 @@ static void DrawTileContent(const Surface &out, int x, int y, int sx, int sy, in /** * @brief Scale up the top left part of the buffer 2x. */ -static void Zoom(const Surface &out) +void Zoom(const Surface &out) { int viewportWidth = out.w(); int viewportOffsetX = 0; @@ -1077,7 +1077,7 @@ int tileRows; * @param x Center of view in dPiece coordinate * @param y Center of view in dPiece coordinate */ -static void DrawGame(const Surface &fullOut, int x, int y) +void DrawGame(const Surface &fullOut, int x, int y) { // Limit rendering to the view area const Surface &out = zoomflag @@ -1251,7 +1251,7 @@ void DrawView(const Surface &out, int startX, int startY) /** * @brief Display the current average FPS over 1 sec */ -static void DrawFPS(const Surface &out) +void DrawFPS(const Surface &out) { char string[12]; @@ -1278,7 +1278,7 @@ static void DrawFPS(const Surface &out) * @param dwWdt Back buffer coordinate * @param dwHgt Back buffer coordinate */ -static void DoBlitScreen(Sint16 dwX, Sint16 dwY, Uint16 dwWdt, Uint16 dwHgt) +void DoBlitScreen(Sint16 dwX, Sint16 dwY, Uint16 dwWdt, Uint16 dwHgt) { // In SDL1 SDL_Rect x and y are Sint16. Cast explicitly to avoid a compiler warning. using CoordType = decltype(SDL_Rect {}.x); @@ -1301,7 +1301,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 drawDesc, bool drawHp, bool drawMana, bool drawSbar, bool drawBtn) +void DrawMain(int dwHgt, bool drawDesc, bool drawHp, bool drawMana, bool drawSbar, bool drawBtn) { if (!gbActive || RenderDirectlyToOutputSurface) { return; diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 4321604ed..3f04aa015 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -112,7 +112,7 @@ void AddVileObjs() ObjectAtPosition({ 35, 36 }).InitializeLoadedObject({ { 7, 11 }, { 6, 7 } }, 3); } -void DRLG_SetMapTrans(const char *path) +void SetmapTransparancy(const char *path) { auto dunData = LoadFileInMem(path); @@ -185,7 +185,7 @@ void LoadSetMap() LoadL1Dungeon("Levels\\L1Data\\Lv1MazeB.DUN", 20, 50); LoadPalette("Levels\\L1Data\\L1_5.pal"); AddL1Objs(0, 0, MAXDUNX, MAXDUNY); - DRLG_SetMapTrans("Levels\\L1Data\\Lv1MazeA.DUN"); + SetmapTransparancy("Levels\\L1Data\\Lv1MazeA.DUN"); break; case SL_POISONWATER: if (Quests[Q_PWATER]._qactive == QUEST_INIT) @@ -206,7 +206,7 @@ void LoadSetMap() LoadPalette("Levels\\L1Data\\L1_2.pal"); AddL1Objs(0, 0, MAXDUNX, MAXDUNY); AddVileObjs(); - DRLG_SetMapTrans("Levels\\L1Data\\Vile1.DUN"); + SetmapTransparancy("Levels\\L1Data\\Vile1.DUN"); InitNoTriggers(); break; case SL_NONE: diff --git a/Source/sha.cpp b/Source/sha.cpp index d72a5c43a..d0cd0c30d 100644 --- a/Source/sha.cpp +++ b/Source/sha.cpp @@ -35,7 +35,7 @@ uint32_t SHA1CircularShift(uint32_t bits, uint32_t word) return (word << bits) | (word >> (32 - bits)); } -static void SHA1Init(SHA1Context *context) +void SHA1Init(SHA1Context *context) { context->count[0] = 0; context->count[1] = 0; @@ -46,7 +46,7 @@ static void SHA1Init(SHA1Context *context) context->state[4] = 0xC3D2E1F0; } -static void SHA1ProcessMessageBlock(SHA1Context *context) +void SHA1ProcessMessageBlock(SHA1Context *context) { std::uint32_t w[80]; @@ -107,7 +107,7 @@ static void SHA1ProcessMessageBlock(SHA1Context *context) context->state[4] += e; } -static void SHA1Input(SHA1Context *context, const char *messageArray, std::uint32_t len) +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]) diff --git a/Source/sound.cpp b/Source/sound.cpp index 05d7e8308..404cb7215 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -120,7 +120,7 @@ const char *const MusicTracks[NUM_MUSIC] = { "Music\\Dintro.wav", }; -static int CapVolume(int volume) +int CapVolume(int volume) { return clamp(volume, VOLUME_MIN, VOLUME_MAX); } diff --git a/Source/spells.cpp b/Source/spells.cpp index ff66e3914..4906024af 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -61,7 +61,7 @@ void ClearReadiedSpell(PlayerStruct &player) } } -static void PlacePlayer(int pnum) +void PlacePlayer(int pnum) { auto &player = Players[pnum]; Point newPosition = {}; diff --git a/Source/stores.cpp b/Source/stores.cpp index 3c260103d..4791de4ab 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2161,7 +2161,7 @@ int TakeGold(PlayerStruct &player, int cost, bool skipMaxPiles) return cost; } -static void DrawSelector(const Surface &out, const Rectangle &rect, const char *text, uint16_t flags) +void DrawSelector(const Surface &out, const Rectangle &rect, const char *text, uint16_t flags) { int lineWidth = GetLineWidth(text); diff --git a/Source/sync.cpp b/Source/sync.cpp index 02eed98c7..bbac98740 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -150,7 +150,7 @@ void SyncPlrInv(TSyncHeader *pHdr) } } -static void SyncMonster(int pnum, const TSyncMonster *p) +void SyncMonster(int pnum, const TSyncMonster *p) { int ndx = p->_mndx;