[nostalgia/core] Remove implicit sign conversions
This commit is contained in:
parent
d2ec3b8350
commit
b9c2f3631d
@ -5,6 +5,8 @@ add_library(
|
|||||||
media.cpp
|
media.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_options(NostalgiaCore PRIVATE -Wsign-conversion)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
NostalgiaCore PUBLIC
|
NostalgiaCore PUBLIC
|
||||||
OxFS
|
OxFS
|
||||||
|
@ -142,9 +142,9 @@ static char charMap[128] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Color32 toColor32(Color16 nc) noexcept {
|
Color32 toColor32(Color16 nc) noexcept {
|
||||||
Color32 r = ((nc & 0b0000000000011111) >> 0) * 8;
|
Color32 r = static_cast<Color32>(((nc & 0b0000000000011111) >> 0) * 8);
|
||||||
Color32 g = ((nc & 0b0000001111100000) >> 5) * 8;
|
Color32 g = static_cast<Color32>(((nc & 0b0000001111100000) >> 5) * 8);
|
||||||
Color32 b = ((nc & 0b0111110000000000) >> 10) * 8;
|
Color32 b = static_cast<Color32>(((nc & 0b0111110000000000) >> 10) * 8);
|
||||||
Color32 a = 255;
|
Color32 a = 255;
|
||||||
return a | (b << 8) | (g << 16) | (r << 24);
|
return a | (b << 8) | (g << 16) | (r << 24);
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ uint8_t blue32(Color16 c) noexcept {
|
|||||||
|
|
||||||
void puts(Context *ctx, int column, int row, const char *str) {
|
void puts(Context *ctx, int column, int row, const char *str) {
|
||||||
for (int i = 0; str[i]; i++) {
|
for (int i = 0; str[i]; i++) {
|
||||||
setTile(ctx, 0, column + i, row, charMap[static_cast<int>(str[i])]);
|
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<int>(str[i])]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ struct SdlImplData {
|
|||||||
SDL_Renderer *renderer = nullptr;
|
SDL_Renderer *renderer = nullptr;
|
||||||
std::array<SDL_Texture*, 4> bgTextures;
|
std::array<SDL_Texture*, 4> bgTextures;
|
||||||
std::array<TileMap, 4> bgTileMaps;
|
std::array<TileMap, 4> bgTileMaps;
|
||||||
uint64_t prevFpsCheckTime = 0;
|
int64_t prevFpsCheckTime = 0;
|
||||||
uint64_t draws = 0;
|
uint64_t draws = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ ox::Error loadTileSheet(Context *ctx,
|
|||||||
}
|
}
|
||||||
oxReturnError(readMC<NostalgiaPalette>(ctx, palettePath).get(&palette));
|
oxReturnError(readMC<NostalgiaPalette>(ctx, palettePath).get(&palette));
|
||||||
|
|
||||||
const auto bytesPerTile = tilesheet.bpp == 8 ? 64 : 32;
|
const unsigned bytesPerTile = tilesheet.bpp == 8 ? 64 : 32;
|
||||||
const auto tiles = tilesheet.tiles.size() / bytesPerTile;
|
const auto tiles = tilesheet.tiles.size() / bytesPerTile;
|
||||||
const int width = 8;
|
const int width = 8;
|
||||||
const int height = 8 * tiles;
|
const int height = 8 * tiles;
|
||||||
@ -126,11 +126,12 @@ ox::Error loadTileSheet(Context *ctx,
|
|||||||
SDL_FreeSurface(surface);
|
SDL_FreeSurface(surface);
|
||||||
SDL_FreePalette(sdlPalette);
|
SDL_FreePalette(sdlPalette);
|
||||||
|
|
||||||
|
auto sectionIdx = static_cast<unsigned>(section);
|
||||||
if (tss == TileSheetSpace::Background) {
|
if (tss == TileSheetSpace::Background) {
|
||||||
if (id->bgTextures[section]) {
|
if (id->bgTextures[sectionIdx]) {
|
||||||
SDL_DestroyTexture(id->bgTextures[section]);
|
SDL_DestroyTexture(id->bgTextures[sectionIdx]);
|
||||||
}
|
}
|
||||||
id->bgTextures[section] = texture;
|
id->bgTextures[sectionIdx] = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user