From 41ce17015f3d33fb5ea5240dd193039c9a71662a Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Thu, 18 Aug 2011 17:30:58 +0000 Subject: [PATCH] snake: correct rolled_up window state handling git-svn-id: svn://kolibrios.org@2061 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/snake/trunk/first_menu.asm | 7 ++++--- programs/games/snake/trunk/game_over.asm | 7 ++++--- programs/games/snake/trunk/level.asm | 7 ++++--- programs/games/snake/trunk/pause.asm | 8 ++++---- programs/games/snake/trunk/snake.asm | 21 ++++++++++++++++++--- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/programs/games/snake/trunk/first_menu.asm b/programs/games/snake/trunk/first_menu.asm index 6c31991515..fad538aff8 100644 --- a/programs/games/snake/trunk/first_menu.asm +++ b/programs/games/snake/trunk/first_menu.asm @@ -19,14 +19,15 @@ First_menu: call Set_geometry mcall 12,1 mcall 0, , ,[window_style], ,window_title + test [proc_info.wnd_state], 0x04 ; is rolled up? + jnz @f call Draw_decorations call Draw_first_menu_picture call Draw_menu_strings call Draw_buttons - + @@: mcall 12,2 - .still: mcall 10 ; wait for event ; ok, what an event? @@ -309,4 +310,4 @@ Set_first_level_of_play_mode: ;;---Set_first_level_of_play_mode------------------------------------------------------------------------------------------- -;;---Some_functions------------------------------------------------------------------------------------------------------------- \ No newline at end of file +;;---Some_functions------------------------------------------------------------------------------------------------------------- diff --git a/programs/games/snake/trunk/game_over.asm b/programs/games/snake/trunk/game_over.asm index 2f3f597327..a48b692d15 100644 --- a/programs/games/snake/trunk/game_over.asm +++ b/programs/games/snake/trunk/game_over.asm @@ -36,13 +36,14 @@ Game_over: call Set_geometry mcall 12,1 mcall 0, , ,[window_style], ,window_title + test [proc_info.wnd_state], 0x04 ; is rolled up? + jnz @f call Draw_decorations call Draw_game_over_picture call Draw_game_over_strings ; edit_box is here - mcall 12,2 - + @@: .still: mcall 10 ; wait for event ; ok, what an event? @@ -194,4 +195,4 @@ Score_and_name_store: ;;---Name_store------------------------------------------------------------------------------------------------------------ -;;---Some_functions------------------------------------------------------------------------------------------------------------ \ No newline at end of file +;;---Some_functions------------------------------------------------------------------------------------------------------------ diff --git a/programs/games/snake/trunk/level.asm b/programs/games/snake/trunk/level.asm index 33fd6a0534..b439459de1 100644 --- a/programs/games/snake/trunk/level.asm +++ b/programs/games/snake/trunk/level.asm @@ -19,13 +19,14 @@ mcall 26, 9 call Set_geometry mcall 12,1 mcall 0, , ,[window_style], ,window_title - + test [proc_info.wnd_state], 0x04 ; is rolled up? + jnz Pause_mode + call Draw_decorations call Draw_stones call Draw_snake call Draw_eat call Draw_level_strings - mcall 12,2 .still: @@ -844,4 +845,4 @@ Draw_lives_in_head: ;;---Draw_lives_in_head---------------------------------------------------------------------------------------------------- -;;---Some_functions------------------------------------------------------------------------------------------------------------ \ No newline at end of file +;;---Some_functions------------------------------------------------------------------------------------------------------------ diff --git a/programs/games/snake/trunk/pause.asm b/programs/games/snake/trunk/pause.asm index f61b6a98bd..2b88c212bd 100644 --- a/programs/games/snake/trunk/pause.asm +++ b/programs/games/snake/trunk/pause.asm @@ -12,14 +12,14 @@ Pause_mode: call Set_geometry mcall 12,1 mcall 0, , ,[window_style], ,window_title + test [proc_info.wnd_state], 0x04 ; is rolled up? + jnz @f call Draw_decorations call Draw_pause_picture call Draw_pause_strings - mcall 12,2 - - + @@: .still: mcall 10 ; wait for event ; ok, what an event? @@ -95,4 +95,4 @@ Draw_pause_strings: ;;---Draw_pause_strings------------------------------------------------------------------------------------------------ -;;---Some_functions------------------------------------------------------------------------------------------------------------ \ No newline at end of file +;;---Some_functions------------------------------------------------------------------------------------------------------------ diff --git a/programs/games/snake/trunk/snake.asm b/programs/games/snake/trunk/snake.asm index 240384857a..c341e07677 100644 --- a/programs/games/snake/trunk/snake.asm +++ b/programs/games/snake/trunk/snake.asm @@ -12,7 +12,7 @@ include '../../../macros.inc' include '../../../system/launch/trunk/mem.inc' include '../../../develop/libraries/libs-dev/.test/dll.inc' include '../../../develop/libraries/box_lib/trunk/box_lib.mac' -include '../../../system/board/trunk/debug.inc' +;include '../../../system/board/trunk/debug.inc' ;;===Define_chapter============================================================================================================ @@ -188,7 +188,7 @@ align 4 mov eax, WINDOW_MODE_WINDOWED call Set_window_mode - mcall 0,0,0,0x51000000 ; create empty window. Set_geometry will set all parameters + mcall 0,0,0,[window_style_windowed] ; create empty window. Set_geometry will set all parameters call Set_geometry.by_hotkey mcall 71,1,window_title @@ -249,6 +249,14 @@ Set_geometry: jnz .by_hotkey mcall 9,proc_info,-1 + test [proc_info.wnd_state], 0x04 ; is rolled up? + jz @f + mov eax, [proc_info.box.width] + mov [window_width], eax + mov eax, [proc_info.box.height] + mov [window_height], eax + jmp .quit + @@: mov eax, [proc_info.box.width] cmp eax, [window_width] jne @f @@ -328,7 +336,14 @@ Set_geometry: .by_hotkey: mcall 9,proc_info,-1 mov [resized_by_hotkey], 0 - + test [proc_info.wnd_state], 0x04 ; is rolled up? + jz @f + mov eax, [proc_info.box.width] + mov [window_width], eax + mov eax, [proc_info.box.height] + mov [window_height], eax + jmp .quit + @@: mov eax, [square_side_length] inc eax ; space between squares mov [g_s], eax