From 8835a95cf8cd80cb811eceb0ad3de801a2054167 Mon Sep 17 00:00:00 2001 From: turbocat Date: Fri, 6 Aug 2021 01:39:17 +0000 Subject: [PATCH] Wolf3D: - Fixed in-game time. - Fixed incorrect implementation of SDL_Delay. - Achieved maximum smoothness. git-svn-id: svn://kolibrios.org@9123 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/games/wolf3d/SDL/uSDL.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/contrib/games/wolf3d/SDL/uSDL.c b/contrib/games/wolf3d/SDL/uSDL.c index 67180dc424..106758fb9c 100644 --- a/contrib/games/wolf3d/SDL/uSDL.c +++ b/contrib/games/wolf3d/SDL/uSDL.c @@ -17,13 +17,12 @@ unsigned uSDL_GetTicks(void){ :"a"(26),"b"(9) :"memory" ); - return (__curtime-__starttime); + return (__curtime-__starttime)*10; } -void uSDL_Delay(unsigned time){ - __asm__ __volatile__( - "int $0x40" - ::"a"(5), "b"(time/3) - :"memory" - ); -} +void uSDL_Delay(unsigned ms){ + unsigned start = uSDL_GetTicks(); + do{ + __asm__("int $0x40" :: "a"(68),"b"(1)); + }while (uSDL_GetTicks()-start < ms); +}