mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
update clang-tidy diagnostics
This commit is contained in:
parent
532727b15c
commit
d20b81d104
5 changed files with 22 additions and 22 deletions
|
@ -22,7 +22,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
|
||||||
if(NOT CLANG_TIDY_EXE)
|
if(NOT CLANG_TIDY_EXE)
|
||||||
message(STATUS "clang-tidy not found, analysis disabled")
|
message(STATUS "clang-tidy not found, analysis disabled")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-clang-analyzer-alpha.*,-hicpp-no-assembler,-google-readability-todo,-performance-type-promotion-in-math-fn,-misc-unused-parameters,-cert-msc30-c,-cert-msc50-cpp,-hicpp-signed-bitwise")
|
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-clang-analyzer-alpha.*,-hicpp-no-assembler,-google-readability-todo,-misc-unused-parameters,-hicpp-signed-bitwise,-hicpp-multiway-paths-covered")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -218,8 +218,8 @@ SYMBOL_EXPORT void RegisterSpritesheet(struct Game* game, struct Character* char
|
||||||
|
|
||||||
s->duration = strtodnull(al_get_config_value(config, "animation", "duration"), 16.66);
|
s->duration = strtodnull(al_get_config_value(config, "animation", "duration"), 16.66);
|
||||||
|
|
||||||
s->width = strtodnull(al_get_config_value(config, "animation", "width"), 0);
|
s->width = strtolnull(al_get_config_value(config, "animation", "width"), 0);
|
||||||
s->height = strtodnull(al_get_config_value(config, "animation", "height"), 0);
|
s->height = strtolnull(al_get_config_value(config, "animation", "height"), 0);
|
||||||
|
|
||||||
s->repeats = strtolnull(al_get_config_value(config, "animation", "repeats"), -1);
|
s->repeats = strtolnull(al_get_config_value(config, "animation", "repeats"), -1);
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ SYMBOL_EXPORT bool IsOnCharacter(struct Game* game, struct Character* character,
|
||||||
if (test && pixelperfect) {
|
if (test && pixelperfect) {
|
||||||
al_invert_transform(&transform);
|
al_invert_transform(&transform);
|
||||||
al_transform_coordinates(&transform, &x, &y);
|
al_transform_coordinates(&transform, &x, &y);
|
||||||
ALLEGRO_COLOR color = al_get_pixel(character->frame->bitmap, x - character->spritesheet->frames[character->pos].x, y - character->spritesheet->frames[character->pos].y);
|
ALLEGRO_COLOR color = al_get_pixel(character->frame->bitmap, (int)x - character->spritesheet->frames[character->pos].x, (int)y - character->spritesheet->frames[character->pos].y);
|
||||||
return (color.a > 0.0);
|
return (color.a > 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,11 +210,11 @@ SYMBOL_INTERNAL void DrawConsole(struct Game* game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_INTERNAL void Console_Load(struct Game* game) {
|
SYMBOL_INTERNAL void Console_Load(struct Game* game) {
|
||||||
game->_priv.font_console = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"), game->_priv.clip_rect.h * 0.025, 0);
|
game->_priv.font_console = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"), (int)(game->_priv.clip_rect.h * 0.025), 0);
|
||||||
if (game->_priv.clip_rect.h * 0.025 >= 16) {
|
if (game->_priv.clip_rect.h * 0.025 >= 16) {
|
||||||
game->_priv.font_bsod = al_load_ttf_font(GetDataFilePath(game, "fonts/PerfectDOSVGA437.ttf"), 16 * ((game->_priv.clip_rect.h > 1080) ? 2 : 1), 0);
|
game->_priv.font_bsod = al_load_ttf_font(GetDataFilePath(game, "fonts/PerfectDOSVGA437.ttf"), 16 * ((game->_priv.clip_rect.h > 1080) ? 2 : 1), 0);
|
||||||
} else {
|
} else {
|
||||||
game->_priv.font_bsod = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"), game->_priv.clip_rect.h * 0.025, 0);
|
game->_priv.font_bsod = al_load_ttf_font(GetDataFilePath(game, "fonts/DejaVuSansMono.ttf"), (int)(game->_priv.clip_rect.h * 0.025), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ static void DrawQueue(struct Game* game, struct TM_Action* queue, int clipX, int
|
||||||
al_draw_textf(game->_priv.font_console, al_map_rgb(255, 255, 255), pos, clipY - (50 / 1800.0) * game->_priv.clip_rect.h, ALLEGRO_ALIGN_LEFT, "%s", (char*)pom->arguments->next->next->value);
|
al_draw_textf(game->_priv.font_console, al_map_rgb(255, 255, 255), pos, clipY - (50 / 1800.0) * game->_priv.clip_rect.h, ALLEGRO_ALIGN_LEFT, "%s", (char*)pom->arguments->next->next->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += width + (20 / 3200.0) * game->_priv.clip_rect.w;
|
pos += width + (int)((20 / 3200.0) * game->_priv.clip_rect.w);
|
||||||
pom = pom->next;
|
pom = pom->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,8 +511,8 @@ static void DrawTimeline(struct Game* game, struct Timeline* timeline, int pos)
|
||||||
|
|
||||||
al_draw_textf(game->_priv.font_console, al_map_rgb(255, 255, 255), game->_priv.clip_rect.x + game->_priv.clip_rect.w / 2.0, game->_priv.clip_rect.y + game->_priv.clip_rect.h - (340 / 1800.0) * game->_priv.clip_rect.h * (pos + 1) + (10 / 1800.0) * game->_priv.clip_rect.h, ALLEGRO_ALIGN_CENTER, "Timeline: %s", timeline->name);
|
al_draw_textf(game->_priv.font_console, al_map_rgb(255, 255, 255), game->_priv.clip_rect.x + game->_priv.clip_rect.w / 2.0, game->_priv.clip_rect.y + game->_priv.clip_rect.h - (340 / 1800.0) * game->_priv.clip_rect.h * (pos + 1) + (10 / 1800.0) * game->_priv.clip_rect.h, ALLEGRO_ALIGN_CENTER, "Timeline: %s", timeline->name);
|
||||||
|
|
||||||
DrawQueue(game, timeline->queue, game->_priv.clip_rect.x + (25 / 3200.0) * game->_priv.clip_rect.w, game->_priv.clip_rect.y + game->_priv.clip_rect.h - (220 / 1800.0) * game->_priv.clip_rect.h - (340 / 1800.0) * game->_priv.clip_rect.h * pos);
|
DrawQueue(game, timeline->queue, game->_priv.clip_rect.x + (int)((25 / 3200.0) * game->_priv.clip_rect.w), game->_priv.clip_rect.y + game->_priv.clip_rect.h - (int)((220 / 1800.0) * game->_priv.clip_rect.h) - (int)((340 / 1800.0) * game->_priv.clip_rect.h * pos));
|
||||||
DrawQueue(game, timeline->background, game->_priv.clip_rect.x + (25 / 3200.0) * game->_priv.clip_rect.w, game->_priv.clip_rect.y + game->_priv.clip_rect.h - (100 / 1800.0) * game->_priv.clip_rect.h - (340 / 1800.0) * game->_priv.clip_rect.h * pos);
|
DrawQueue(game, timeline->background, (int)(game->_priv.clip_rect.x + (25 / 3200.0) * game->_priv.clip_rect.w), game->_priv.clip_rect.y + game->_priv.clip_rect.h - (int)((100 / 1800.0) * game->_priv.clip_rect.h) - (int)((340 / 1800.0) * game->_priv.clip_rect.h * pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_INTERNAL void DrawTimelines(struct Game* game) {
|
SYMBOL_INTERNAL void DrawTimelines(struct Game* game) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ SYMBOL_EXPORT double Lerp(double left, double right, double pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_EXPORT int Sign(double val) {
|
SYMBOL_EXPORT int Sign(double val) {
|
||||||
return val / fabs(val);
|
return (int)(val / fabs(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_EXPORT double Fract(double val) {
|
SYMBOL_EXPORT double Fract(double val) {
|
||||||
|
|
24
src/utils.c
24
src/utils.c
|
@ -152,10 +152,10 @@ SYMBOL_EXPORT void ScaleBitmap(ALLEGRO_BITMAP* source, int width, int height) {
|
||||||
|
|
||||||
for (y = 0; y < height; y++) {
|
for (y = 0; y < height; y++) {
|
||||||
float pixy = ((float)y / height) * ((float)al_get_bitmap_height(source) - 1);
|
float pixy = ((float)y / height) * ((float)al_get_bitmap_height(source) - 1);
|
||||||
float pixy_f = floor(pixy);
|
int pixy_f = (int)floorf(pixy);
|
||||||
for (x = 0; x < width; x++) {
|
for (x = 0; x < width; x++) {
|
||||||
float pixx = ((float)x / width) * ((float)al_get_bitmap_width(source) - 1);
|
float pixx = ((float)x / width) * ((float)al_get_bitmap_width(source) - 1);
|
||||||
float pixx_f = floor(pixx);
|
int pixx_f = (int)floorf(pixx);
|
||||||
|
|
||||||
ALLEGRO_COLOR a = al_get_pixel(source, pixx_f, pixy_f);
|
ALLEGRO_COLOR a = al_get_pixel(source, pixx_f, pixy_f);
|
||||||
ALLEGRO_COLOR b = al_get_pixel(source, pixx_f + 1, pixy_f);
|
ALLEGRO_COLOR b = al_get_pixel(source, pixx_f + 1, pixy_f);
|
||||||
|
@ -223,7 +223,7 @@ __attribute__((__format__(__printf__, 6, 0))) SYMBOL_EXPORT void FatalErrorWithC
|
||||||
al_rest(0.6);
|
al_rest(0.6);
|
||||||
|
|
||||||
const int offsetx = al_get_display_width(game->display) / 2;
|
const int offsetx = al_get_display_width(game->display) / 2;
|
||||||
const int offsety = al_get_display_height(game->display) * 0.30;
|
const int offsety = (int)(al_get_display_height(game->display) * 0.30);
|
||||||
const int fonth = al_get_font_line_height(game->_priv.font_bsod);
|
const int fonth = al_get_font_line_height(game->_priv.font_bsod);
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
@ -418,10 +418,10 @@ SYMBOL_EXPORT void SetupViewport(struct Game* game, struct Viewport config) {
|
||||||
|
|
||||||
if ((game->viewport.width == 0) || (game->viewport.height == 0)) {
|
if ((game->viewport.width == 0) || (game->viewport.height == 0)) {
|
||||||
game->viewport.height = al_get_display_height(game->display);
|
game->viewport.height = al_get_display_height(game->display);
|
||||||
game->viewport.width = game->viewport.aspect * game->viewport.height;
|
game->viewport.width = (int)(game->viewport.aspect * game->viewport.height);
|
||||||
if (game->viewport.width > al_get_display_width(game->display)) {
|
if (game->viewport.width > al_get_display_width(game->display)) {
|
||||||
game->viewport.width = al_get_display_width(game->display);
|
game->viewport.width = al_get_display_width(game->display);
|
||||||
game->viewport.height = game->viewport.width / game->viewport.aspect;
|
game->viewport.height = (int)(game->viewport.width / game->viewport.aspect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
game->viewport.aspect = game->viewport.width / (float)game->viewport.height;
|
game->viewport.aspect = game->viewport.width / (float)game->viewport.height;
|
||||||
|
@ -436,8 +436,8 @@ SYMBOL_EXPORT void SetupViewport(struct Game* game, struct Viewport config) {
|
||||||
resolution = al_get_display_width(game->display) / (float)game->viewport.width;
|
resolution = al_get_display_width(game->display) / (float)game->viewport.width;
|
||||||
}
|
}
|
||||||
if (game->viewport.integer_scaling) {
|
if (game->viewport.integer_scaling) {
|
||||||
resolution = floor(resolution);
|
resolution = floorf(resolution);
|
||||||
if (floor(resolution) == 0) {
|
if (floorf(resolution) == 0) {
|
||||||
resolution = 1;
|
resolution = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,8 +448,8 @@ SYMBOL_EXPORT void SetupViewport(struct Game* game, struct Viewport config) {
|
||||||
resolution = 1;
|
resolution = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clipWidth = game->viewport.width * resolution;
|
int clipWidth = (int)(game->viewport.width * resolution);
|
||||||
int clipHeight = game->viewport.height * resolution;
|
int clipHeight = (int)(game->viewport.height * resolution);
|
||||||
if (strtol(GetConfigOptionDefault(game, "SuperDerpy", "letterbox", "1"), NULL, 10)) {
|
if (strtol(GetConfigOptionDefault(game, "SuperDerpy", "letterbox", "1"), NULL, 10)) {
|
||||||
int clipX = (al_get_display_width(game->display) - clipWidth) / 2;
|
int clipX = (al_get_display_width(game->display) - clipWidth) / 2;
|
||||||
int clipY = (al_get_display_height(game->display) - clipHeight) / 2;
|
int clipY = (al_get_display_height(game->display) - clipHeight) / 2;
|
||||||
|
@ -475,8 +475,8 @@ SYMBOL_EXPORT void WindowCoordsToViewport(struct Game* game, int* x, int* y) {
|
||||||
al_get_clipping_rectangle(&clipX, &clipY, &clipWidth, &clipHeight);
|
al_get_clipping_rectangle(&clipX, &clipY, &clipWidth, &clipHeight);
|
||||||
*x -= clipX;
|
*x -= clipX;
|
||||||
*y -= clipY;
|
*y -= clipY;
|
||||||
*x /= clipWidth / (float)game->viewport.width;
|
*x /= (int)(clipWidth / (float)game->viewport.width);
|
||||||
*y /= clipHeight / (float)game->viewport.height;
|
*y /= (int)(clipHeight / (float)game->viewport.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_EXPORT ALLEGRO_BITMAP* GetFramebuffer(struct Game* game) {
|
SYMBOL_EXPORT ALLEGRO_BITMAP* GetFramebuffer(struct Game* game) {
|
||||||
|
@ -525,7 +525,7 @@ SYMBOL_EXPORT char* PunchNumber(struct Game* game, char* text, char ch, int numb
|
||||||
while (tmp != txt) {
|
while (tmp != txt) {
|
||||||
tmp--;
|
tmp--;
|
||||||
if (*tmp == ch) {
|
if (*tmp == ch) {
|
||||||
*tmp = '0' + (int)floor(number / (float)num) % 10;
|
*tmp = '0' + (int)floorf(number / (float)num) % 10;
|
||||||
num *= 10;
|
num *= 10;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue