diff options
| author | KiritoDv <36680385+KiritoDv@users.noreply.github.com> | 2025-05-16 02:44:40 +0000 |
|---|---|---|
| committer | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2025-05-16 02:44:40 +0000 |
| commit | b53a5dbcfa24ef2aa4860b6d9512709976686de8 (patch) | |
| tree | 441f2bb9c0bc8f955eb9289d19b13beab5c239c5 /src/main.c | |
| parent | bdf5ca8d603ae56ac275bebf9fde58ae72484d76 (diff) | |
clang formatclang-format
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/src/main.c b/src/main.c index 7b7e05cda..8220fc7f9 100644 --- a/src/main.c +++ b/src/main.c @@ -118,7 +118,7 @@ u8 gControllerBits; CollisionGrid gCollisionGrid[1024]; u16 gNumActors; u16 gMatrixObjectCount; -s32 gTickLogic; // Tick game physics at 60fps +s32 gTickLogic; // Tick game physics at 60fps s32 gTickVisuals; // Tick animations at 30fps s32 gTickGame; f32 D_80150118; @@ -641,8 +641,8 @@ void calculate_updaterate(void) { static u32 remainder = 0; static u32 logicAccumulator = 0; static u32 visualsAccumulator = 0; - static u32 frameCounter = 0; // For tracking frames for logic updates - u32 now = SDL_GetTicks(); // Replaces osGetTime() + static u32 frameCounter = 0; // For tracking frames for logic updates + u32 now = SDL_GetTicks(); // Replaces osGetTime() u32 frameRate = 0; s32 total; @@ -666,9 +666,9 @@ void calculate_updaterate(void) { // Avoid division by zero if (total > 0) { // Calculate approximate frame rate (milliseconds per frame) - frameRate = 1000 / total; // Frame rate in frames per second + frameRate = 1000 / total; // Frame rate in frames per second } else { - frameRate = targetFPS; // Fallback to target FPS + frameRate = targetFPS; // Fallback to target FPS } // Default both to no updates @@ -676,25 +676,25 @@ void calculate_updaterate(void) { gTickVisuals = 0; // Calculate the update rates based on target FPS - s32 logicUpdateInterval = 1000 / 60; // Time in ms between logic updates + s32 logicUpdateInterval = 1000 / 60; // Time in ms between logic updates s32 visualsUpdateInterval = 1000 / 30; // 30 FPS for visuals - // Accumulate time for logic updates + // Accumulate time for logic updates logicAccumulator += total; if (logicAccumulator >= logicUpdateInterval) { - logicAccumulator -= logicUpdateInterval; // Subtract full interval + logicAccumulator -= logicUpdateInterval; // Subtract full interval if (targetFPS < 60) { gTickLogic = 2; } else { - gTickLogic = 1; // Perform logic update + gTickLogic = 1; // Perform logic update } } // Visual updates (based on 30 FPS equivalent) - visualsAccumulator += total; // Increment for each frame - if (visualsAccumulator >= visualsUpdateInterval) { // Check if it's time to update visuals + visualsAccumulator += total; // Increment for each frame + if (visualsAccumulator >= visualsUpdateInterval) { // Check if it's time to update visuals visualsAccumulator -= visualsUpdateInterval; - gTickVisuals = 1; // Perform visual update + gTickVisuals = 1; // Perform visual update } } @@ -703,28 +703,26 @@ void display_debug_info(void) { if (!gEnableDebugMode) { D_800DC514 = false; } else if (D_800DC514) { - if ((gControllerOne->buttonPressed & R_TRIG) && - (gControllerOne->button & A_BUTTON) && + if ((gControllerOne->buttonPressed & R_TRIG) && (gControllerOne->button & A_BUTTON) && (gControllerOne->button & B_BUTTON)) { D_800DC514 = false; } rotY = camera1->rot[1]; gDebugPathCount = D_800DC5EC->pathCounter; - if (rotY < 0x2000) { - func_80057A50(40, 100, "SOUTH ", gDebugPathCount); - } else if (rotY < 0x6000) { - func_80057A50(40, 100, "EAST ", gDebugPathCount); - } else if (rotY < 0xA000) { - func_80057A50(40, 100, "NORTH ", gDebugPathCount); - } else if (rotY < 0xE000) { - func_80057A50(40, 100, "WEST ", gDebugPathCount); - } else { - func_80057A50(40, 100, "SOUTH ", gDebugPathCount); - } + if (rotY < 0x2000) { + func_80057A50(40, 100, "SOUTH ", gDebugPathCount); + } else if (rotY < 0x6000) { + func_80057A50(40, 100, "EAST ", gDebugPathCount); + } else if (rotY < 0xA000) { + func_80057A50(40, 100, "NORTH ", gDebugPathCount); + } else if (rotY < 0xE000) { + func_80057A50(40, 100, "WEST ", gDebugPathCount); + } else { + func_80057A50(40, 100, "SOUTH ", gDebugPathCount); + } - } else if ((gControllerOne->buttonPressed & L_TRIG) && - (gControllerOne->button & A_BUTTON) && + } else if ((gControllerOne->buttonPressed & L_TRIG) && (gControllerOne->button & A_BUTTON) && (gControllerOne->button & B_BUTTON)) { D_800DC514 = true; } @@ -734,13 +732,11 @@ void display_debug_info(void) { } else { if (gEnableResourceMeters) { resource_display(); - if (!(gControllerOne->button & L_TRIG) && - (gControllerOne->button & R_TRIG) && - (gControllerOne->buttonPressed & B_BUTTON)) { + if (!(gControllerOne->button & L_TRIG) && (gControllerOne->button & R_TRIG) && + (gControllerOne->buttonPressed & B_BUTTON)) { gEnableResourceMeters = 0; } - } else if (!(gControllerOne->button & L_TRIG) && - (gControllerOne->button & R_TRIG) && + } else if (!(gControllerOne->button & L_TRIG) && (gControllerOne->button & R_TRIG) && (gControllerOne->buttonPressed & B_BUTTON)) { gEnableResourceMeters = 1; } @@ -765,7 +761,7 @@ void process_game_tick(void) { return; } - switch(gActiveScreenMode) { + switch (gActiveScreenMode) { case SCREEN_MODE_1P: func_80028F70(); break; @@ -847,7 +843,7 @@ void race_logic_loop(void) { select_framebuffer(); } - switch(gActiveScreenMode) { + switch (gActiveScreenMode) { case SCREEN_MODE_1P: render_screens(RENDER_SCREEN_MODE_1P_PLAYER_ONE, 0, 0); break; @@ -1278,9 +1274,9 @@ void thread5_iteration(void) { FB_CreateFramebuffers(); read_controllers(); game_state_handler(); - - //call_render_hook(); - + + // call_render_hook(); + end_master_display_list(); display_and_vsync(); } |
