From 0077b41b331a3e055bdaf62a512c4742bd634b37 Mon Sep 17 00:00:00 2001 From: turbocat Date: Fri, 6 Aug 2021 18:40:39 +0000 Subject: [PATCH] Wolf3D: - Added automatic adjustment to the screen git-svn-id: svn://kolibrios.org@9124 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/games/wolf3d/kolibri.cpp | 34 ++++++++++++++++++++++++++++++++ contrib/games/wolf3d/wl_main.cpp | 3 +++ 2 files changed, 37 insertions(+) diff --git a/contrib/games/wolf3d/kolibri.cpp b/contrib/games/wolf3d/kolibri.cpp index 499367e127..6e15b1e22b 100644 --- a/contrib/games/wolf3d/kolibri.cpp +++ b/contrib/games/wolf3d/kolibri.cpp @@ -113,6 +113,7 @@ ksys_pos_t _ksys_screen_size() "int $0x40" :"=a"(size_tmp) :"a"(14) + :"memory" ); size.x = size_tmp.y; size.y = size_tmp.x; @@ -206,6 +207,39 @@ void setcwd(char* path){ asm_inline( "int $0x40" ::"a"(30), "b"(1), "c"(path) + :"memory" ); } +extern unsigned screenWidth; +extern unsigned screenHeight; +void kolibri_set_win_max(void){ + unsigned multip1, multip2; + ksys_pos_t screen_size = _ksys_screen_size(); + + screen_size.y++; + screen_size.x++; + + multip1 = (screen_size.y)/240; + multip2 = (screen_size.y)/200; + + do{ + screenWidth = 320 * multip1; + screenHeight = 240 * multip1; + + if(screenWidth<=screen_size.x){ + break; + } + + screenWidth = 320 * multip2; + screenHeight = 200 * multip2; + + if(screenWidth<=screen_size.y){ + break; + } + + multip1--; + multip2--; + + }while(multip1>0 && multip2>0); +} diff --git a/contrib/games/wolf3d/wl_main.cpp b/contrib/games/wolf3d/wl_main.cpp index 2e828ee3bd..f38f7276eb 100755 --- a/contrib/games/wolf3d/wl_main.cpp +++ b/contrib/games/wolf3d/wl_main.cpp @@ -1965,10 +1965,13 @@ void CheckParameters(int argc, char *argv[]) ========================== */ +extern void kolibri_set_win_max(void); + int main (int argc, char *argv[]) { #ifdef _KOLIBRI setcwd(dirname(argv[0])); + kolibri_set_win_max(); #endif #if defined(_arch_dreamcast)