From af254601d6b9dbc32f0b12d53b8f80eb0cfdcd76 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 25 Jun 2021 03:10:55 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Apply=20clang-tidy=20to=20?= =?UTF-8?q?engine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/engine.h | 3 +-- Source/engine/animationinfo.cpp | 4 ++-- Source/engine/load_file.hpp | 2 +- Source/engine/render/cel_render.cpp | 4 ++-- Source/engine/render/dun_render.cpp | 12 ++++++------ 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Source/engine.h b/Source/engine.h index d4009aa5d..9b5fbb018 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -44,7 +44,6 @@ namespace devilution { - struct CelOutputBuffer { // 8-bit palletized surface. SDL_Surface *surface; @@ -223,7 +222,7 @@ struct CelOutputBuffer { void DrawHorizontalLine(const CelOutputBuffer &out, Point from, int width, std::uint8_t colorIndex); /** Same as DrawHorizontalLine but without bounds clipping. */ -void UnsafeDrawHorizontalLine(const CelOutputBuffer &out, Point from, int height, std::uint8_t colorIndex); +void UnsafeDrawHorizontalLine(const CelOutputBuffer &out, Point from, int width, std::uint8_t colorIndex); /** * @brief Draw a vertical line segment in the target buffer (top to bottom) diff --git a/Source/engine/animationinfo.cpp b/Source/engine/animationinfo.cpp index 950a6fd29..340296627 100644 --- a/Source/engine/animationinfo.cpp +++ b/Source/engine/animationinfo.cpp @@ -86,7 +86,7 @@ void AnimationInfo::SetNewAnimation(CelSprite *pCelSprite, int numberOfFrames, i DelayLen = delayLen; TicksSinceSequenceStarted = 0; RelevantFramesForDistributing = 0; - TickModifier = 0.0f; + TickModifier = 0.0F; if (numSkippedFrames != 0 || flags != AnimationDistributionFlags::None) { // Animation Frames that will be adjusted for the skipped Frames/game ticks @@ -164,7 +164,7 @@ void AnimationInfo::ChangeAnimationData(CelSprite *pCelSprite, int numberOfFrame DelayLen = delayLen; TicksSinceSequenceStarted = 0; RelevantFramesForDistributing = 0; - TickModifier = 0.0f; + TickModifier = 0.0F; } this->pCelSprite = pCelSprite; DelayLen = delayLen; diff --git a/Source/engine/load_file.hpp b/Source/engine/load_file.hpp index 084951c5d..47381c391 100644 --- a/Source/engine/load_file.hpp +++ b/Source/engine/load_file.hpp @@ -10,7 +10,7 @@ namespace devilution { size_t GetFileSize(const char *pszName); -void LoadFileData(const char *pszName, byte *buffer, size_t bufferSize); +void LoadFileData(const char *pszName, byte *buffer, size_t fileLen); template void LoadFileInMem(const char *path, T *data, std::size_t count = 0) diff --git a/Source/engine/render/cel_render.cpp b/Source/engine/render/cel_render.cpp index 24c22c9e4..2f4c43412 100644 --- a/Source/engine/render/cel_render.cpp +++ b/Source/engine/render/cel_render.cpp @@ -572,7 +572,7 @@ void CelBlitLightTransSafeTo(const CelOutputBuffer &out, Point position, const b * @param nWidth Width of sprite * @param tbl Palette translation table */ -void CelBlitLightBlendedSafeTo(const CelOutputBuffer &out, Point position, const byte *pRLEBytes, int nDataSize, int nWidth, uint8_t *tbl) +void CelBlitLightBlendedSafeTo(const CelOutputBuffer &out, Point position, const byte *pRLEBytes, int nDataSize, int nWidth, const uint8_t *tbl) { assert(pRLEBytes != nullptr); if (tbl == nullptr) @@ -710,7 +710,7 @@ std::pair MeasureSolidHorizontalBounds(const CelSprite &cel, int frame { int nDataSize; const byte *src = CelGetFrameClipped(cel.Data(), frame, &nDataSize); - auto end = &src[nDataSize]; + const auto *end = &src[nDataSize]; const int celWidth = cel.Width(frame); int xBegin = celWidth; diff --git a/Source/engine/render/dun_render.cpp b/Source/engine/render/dun_render.cpp index 38a08d150..2d48195a0 100644 --- a/Source/engine/render/dun_render.cpp +++ b/Source/engine/render/dun_render.cpp @@ -135,7 +135,7 @@ int GetTileDebugColor(TileType tile) #endif // DEBUG_RENDER_COLOR /** Fully transparent variant of WallMask. */ -const std::uint32_t WallMask_FullyTrasparent[TILE_HEIGHT] = { +const std::uint32_t WallMaskFullyTrasparent[TILE_HEIGHT] = { 0x00000000, 0x00000000, 0x00000000, @@ -170,7 +170,7 @@ const std::uint32_t WallMask_FullyTrasparent[TILE_HEIGHT] = { 0x00000000 }; /** Transparent variant of RightMask. */ -const std::uint32_t RightMask_Transparent[TILE_HEIGHT] = { +const std::uint32_t RightMaskTransparent[TILE_HEIGHT] = { 0xC0000000, 0xF0000000, 0xFC000000, @@ -205,7 +205,7 @@ const std::uint32_t RightMask_Transparent[TILE_HEIGHT] = { 0xFFFFFFFF }; /** Transparent variant of LeftMask. */ -const std::uint32_t LeftMask_Transparent[TILE_HEIGHT] = { +const std::uint32_t LeftMaskTransparent[TILE_HEIGHT] = { 0x00000003, 0x0000000F, 0x0000003F, @@ -1253,14 +1253,14 @@ const std::uint32_t *GetMask(TileType tile) if (cel_transparency_active) { if (arch_draw_type == 0) { if (sgOptions.Graphics.bBlendedTransparancy) // Use a fully transparent mask - return &WallMask_FullyTrasparent[TILE_HEIGHT - 1]; + return &WallMaskFullyTrasparent[TILE_HEIGHT - 1]; return &WallMask[TILE_HEIGHT - 1]; } if (arch_draw_type == 1 && tile != TileType::LeftTriangle) { const auto c = block_lvid[level_piece_id]; if (c == 1 || c == 3) { if (sgOptions.Graphics.bBlendedTransparancy) // Use a fully transparent mask - return &LeftMask_Transparent[TILE_HEIGHT - 1]; + return &LeftMaskTransparent[TILE_HEIGHT - 1]; return &LeftMask[TILE_HEIGHT - 1]; } } @@ -1268,7 +1268,7 @@ const std::uint32_t *GetMask(TileType tile) const auto c = block_lvid[level_piece_id]; if (c == 2 || c == 3) { if (sgOptions.Graphics.bBlendedTransparancy) // Use a fully transparent mask - return &RightMask_Transparent[TILE_HEIGHT - 1]; + return &RightMaskTransparent[TILE_HEIGHT - 1]; return &RightMask[TILE_HEIGHT - 1]; } }