Browse Source

♻️ Apply clang-tidy to engine

pull/1907/head
Anders Jenbo 5 years ago
parent
commit
af254601d6
  1. 3
      Source/engine.h
  2. 4
      Source/engine/animationinfo.cpp
  3. 2
      Source/engine/load_file.hpp
  4. 4
      Source/engine/render/cel_render.cpp
  5. 12
      Source/engine/render/dun_render.cpp

3
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)

4
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;

2
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 <typename T>
void LoadFileInMem(const char *path, T *data, std::size_t count = 0)

4
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<int, int> 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;

12
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];
}
}

Loading…
Cancel
Save