From 17d4c8cb4baeb5416dbd97cf4fcb13a6f4ff72b5 Mon Sep 17 00:00:00 2001 From: Ryzee119 Date: Mon, 22 Jan 2024 21:32:55 +1030 Subject: [PATCH] Fix compilation warnings --- src/ck_game.c | 2 +- src/ck_play.c | 3 +++ src/ck_us_2.c | 6 +++--- src/id_rf.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ck_game.c b/src/ck_game.c index 0973a9f..cddd9ea 100644 --- a/src/ck_game.c +++ b/src/ck_game.c @@ -364,7 +364,7 @@ bool CK_LoadGame(FS_File fp, bool fromMenu) { int i; uint16_t cmplen, bufsize; - int16_t prevFuses; + int16_t prevFuses = 0; CK_object *objprev, *objnext, *moreObj; uint8_t *buf; diff --git a/src/ck_play.c b/src/ck_play.c index 0c9fdc9..f9f66ae 100644 --- a/src/ck_play.c +++ b/src/ck_play.c @@ -2051,7 +2051,10 @@ void CK_NormalCamera(CK_object *obj) int16_t dx, ax; ax = ck6_smashScreenOfs[ck6_smashScreenDistance] + obj->clipRects.unitY2; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" deltaY += (dx - ax); // Undefined behaviour here + #pragma GCC diagnostic pop } else #endif diff --git a/src/ck_us_2.c b/src/ck_us_2.c index daad326..5fe6a8b 100644 --- a/src/ck_us_2.c +++ b/src/ck_us_2.c @@ -830,7 +830,7 @@ bool CK_US_JoyConfMenuProc(US_CardMsg msg, US_CardItem *item) { IN_JoyConfItem which_control; int value; - char str[8], *spos; + char str[8+1], *spos; int print_x, print_y; static const int8_t deadzone_values[] = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, -1}; @@ -1051,8 +1051,8 @@ void USL_PlayPaddleWar(void) int16_t ball_y, keen_x, comp_x, bounce_point, ball_real_x, ball_real_y; int16_t old_keen_x, old_comp_x, old_ball_x, old_ball_y; int16_t keen_score = 0, comp_score = 0; - int16_t speedup_delay, ball_x_speed; - int32_t start_delay; + int16_t speedup_delay = 10, ball_x_speed; + int32_t start_delay = 70; uint32_t lasttime, timediff; IN_ControlFrame status; int16_t ball_y_speed, ball_x; diff --git a/src/id_rf.c b/src/id_rf.c index 1b630a9..3ddcac2 100644 --- a/src/id_rf.c +++ b/src/id_rf.c @@ -267,7 +267,7 @@ void RF_MarkTileGraphics() // WARNING: As in the original codebase, the given variable is NOT initialized. // This may lead to undefined behaviors in calls to RFL_MarkTileWithSound, // although they aren't reproduced in vanilla Keen 6 in practice. - int i; + int i = 0; for (int tileY = 0; tileY < rf_mapHeightTiles; ++tileY) { for (int tileX = 0; tileX < rf_mapWidthTiles; ++tileX)