Be more standard C compliant & compile on Windows

This commit is contained in:
Edgaru089 2024-03-26 14:40:36 +08:00
parent c421b76f4c
commit 3aca586cd3
4 changed files with 12 additions and 3 deletions

View File

@ -142,6 +142,7 @@
<ClInclude Include="util\assert.h" />
<ClInclude Include="util\minmax.h" />
<ClInclude Include="util\queue.h" />
<ClInclude Include="util\rand.h" />
<ClInclude Include="util\tree.h" />
<ClInclude Include="util\tree_internal.h" />
<ClInclude Include="util\vector.h" />
@ -163,6 +164,7 @@
<ClCompile Include="render_util.cpp" />
<ClCompile Include="types.c" />
<ClCompile Include="util\queue.c" />
<ClCompile Include="util\rand.c" />
<ClCompile Include="util\tree.c" />
<ClCompile Include="util\vector.c" />
</ItemGroup>

View File

@ -66,6 +66,9 @@
<ClInclude Include="types.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="util\rand.h">
<Filter>Util</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="util\queue.c">
@ -122,5 +125,8 @@
<ClCompile Include="render_util.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="util\rand.c">
<Filter>Util</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -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) {

View File

@ -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();