From 1acc7cf7c81715cddbf9b732c809d2a5c69560ae Mon Sep 17 00:00:00 2001 From: esquizo Date: Tue, 19 May 2026 14:17:02 -0300 Subject: libphysics: movido o phxmakeblkmap() para o tick fixo --- libphysics/tick.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'libphysics/tick.c') diff --git a/libphysics/tick.c b/libphysics/tick.c index 40b3a2c..f31930a 100644 --- a/libphysics/tick.c +++ b/libphysics/tick.c @@ -19,20 +19,14 @@ void phxtick(float delta) { static float time; - static int count = 0; time += delta; if(time >= PHX_TICK_TIME) { - phxmakeblkmap(); while(time >= PHX_TICK_TIME) { - if(count++ > 4) { - phxmakeblkmap(); - count = 0; - } - tick(); time -= PHX_TICK_TIME; } + for(int i = 0; i < phxbodypoolsize; i++) { Body *b = phxbodypool + i; if(!b->active) @@ -47,6 +41,13 @@ phxtick(float delta) void tick(void) { + static int count = 0; + + if(!count) { + phxmakeblkmap(); + } + count = (count + 1) % 4; + for(int i = 0; i < phxbodypoolsize; i++) { Body *b = phxbodypool + i; if(!b->active) -- cgit v1.2.3