From 3aca586cd367a6e9f667c200c242f94366d63980 Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Tue, 26 Mar 2024 14:40:36 +0800 Subject: [PATCH] Be more standard C compliant & compile on Windows --- JacksEscape.vcxproj | 2 ++ JacksEscape.vcxproj.filters | 6 ++++++ app_debug.c | 3 ++- player.c | 4 ++-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/JacksEscape.vcxproj b/JacksEscape.vcxproj index 7ca42be..6716c5d 100644 --- a/JacksEscape.vcxproj +++ b/JacksEscape.vcxproj @@ -142,6 +142,7 @@ + @@ -163,6 +164,7 @@ + diff --git a/JacksEscape.vcxproj.filters b/JacksEscape.vcxproj.filters index 49e2e00..d4fcbf9 100644 --- a/JacksEscape.vcxproj.filters +++ b/JacksEscape.vcxproj.filters @@ -66,6 +66,9 @@ 头文件 + + Util + @@ -122,5 +125,8 @@ 源文件 + + Util + \ No newline at end of file diff --git a/app_debug.c b/app_debug.c index 0b4e6b7..d8683ae 100644 --- a/app_debug.c +++ b/app_debug.c @@ -11,7 +11,8 @@ void app_DebugText(App *app, vector_Vector *vec_string) { vector_Clear(vec_string); - char buf[256] = {}; + char buf[256]; + memset(buf, 0, sizeof(0)); Component_Player *player = app->player->player; if (!player) { diff --git a/player.c b/player.c index 129f294..17273eb 100644 --- a/player.c +++ b/player.c @@ -67,7 +67,7 @@ void player_Advance(System_Player *sys, Duration deltaTime) { // Particles static Duration emitCooldown = {.microseconds = 150000}; - static TimePoint lastEmit = {}; + static TimePoint lastEmit = {.microseconds = 0}; if (time_Since(lastEmit).microseconds > emitCooldown.microseconds) { lastEmit = time_Now(); Vec2 to_pos = vec2_Add(p->super->position->position, vec2(0, -p->super->hitbox->box.size.y)); @@ -79,7 +79,7 @@ void player_Advance(System_Player *sys, Duration deltaTime) { } // Particles when dashing if (time_Since(p->lastDash).microseconds < dashLength.microseconds && dabs(p->super->position->velocity.x) > EPS) { - static TimePoint lastDashEmit = {}; + static TimePoint lastDashEmit = {.microseconds = 0}; static Duration cooldown = {.microseconds = 8000}; if (time_Since(lastDashEmit).microseconds > cooldown.microseconds) { lastDashEmit = time_Now();