From afa85182048575957b3375f13e08eb854fda6d5d Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Mon, 19 Jul 2010 14:59:30 +0000 Subject: [PATCH] snake: version 0.3 git-svn-id: svn://kolibrios.org@1522 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/games/snake/trunk/first_menu.asm | 50 +- programs/games/snake/trunk/game_over.asm | 104 +-- programs/games/snake/trunk/level.asm | 219 +++--- programs/games/snake/trunk/pause.asm | 37 +- programs/games/snake/trunk/snake.asm | 811 +++++++++++++++------- programs/games/snake/trunk/snake.ini | 157 +++-- 6 files changed, 911 insertions(+), 467 deletions(-) diff --git a/programs/games/snake/trunk/first_menu.asm b/programs/games/snake/trunk/first_menu.asm index b6e391f9e5..d27540136c 100644 --- a/programs/games/snake/trunk/first_menu.asm +++ b/programs/games/snake/trunk/first_menu.asm @@ -8,9 +8,15 @@ First_menu: mov [snake_napravlenie], 3 mov [snake_napravlenie_next], 3 -Redraw_window: + .redraw: mcall 12,1 - mcall 0,200*65536+WINDOW_WIDTH,326*65536+WINDOW_HEIGHT,[window_style], ,window_title + mov ebx, [wp_x] + shl ebx, 16 + add ebx, dword[window_width] + mov ecx, [wp_y] + shl ecx, 16 + add ecx, dword[window_height] + mcall 0, , ,[window_style], ,window_title call Draw_decorations call Draw_first_menu_picture @@ -18,26 +24,26 @@ Redraw_window: mcall 12,2 -Wait_for_event: + .still: mcall 10 ; wait for event ; ok, what an event? dec al ; has the window been moved or resized? - jz Redraw_window ; + jz .redraw ; dec al ; was a key pressed? - jz Is_key ; + jz .key ; -Is_button: ; a button was pressed + .button: ; a button was pressed mcall 17 ; get button number shr eax, 8 ; we should do it to get the real button code cmp eax, 1 ; is it close button? je Exit ; if so, jump to quit... - jmp Wait_for_event ; jump to wait for another event + jmp .still ; jump to wait for another event -Is_key: ; a key was pressed + .key: ; a key was pressed mcall 2 ; get keycode cmp ah, 0x1B ; Escape @@ -47,7 +53,7 @@ Is_key: ; a key was pressed cmp ah, 0x20 ; Space je Level_begin - jmp Wait_for_event ; jump to wait for another event + jmp .still ; jump to wait for another event ;;---First_menu_mode----------------------------------------------------------------------------------------------------------- @@ -57,16 +63,16 @@ Is_key: ; a key was pressed Draw_first_menu_picture: ;;===Draw_first_menu_picture================================================================================================ - mov al, 5 - mov bh, 0 - mov ecx, picture_first_menu_snake + mov ax, 0*0x100+29 + mov cx, 1*0x100+6 mov edx, [snake_picture_color] + mov esi, picture_first_menu_snake call Draw_picture - mov al, 4 - mov bh, 7 - mov ecx, picture_first_menu_version + mov ax, 9*0x100+11 + mov cx, 9*0x100+5 mov edx, [version_picture_color] + mov esi, picture_first_menu_version call Draw_picture ret @@ -77,8 +83,18 @@ Draw_first_menu_picture: Draw_menu_strings: ;;===Make_menu_strings========================================================================================= - mcall 4,153*65536+BOTTOM_MIDDLE_STRINGS,[navigation_strings_color],press_to_start - mcall ,213*65536+TOP_STRINGS,[navigation_strings_color],press_esc_to_exit + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (press_esc_to_exit-press_to_start-1)*3+6 + shl ebx, 16 + add ebx, dword[bottom_middle_strings] + mcall 4, ,[navigation_strings_color],press_to_start + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (string_congratulations-press_esc_to_exit-1)*3+6 + shl ebx, 16 + add ebx, [top_strings] + mcall , ,[navigation_strings_color],press_esc_to_exit ; mcall ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options ret diff --git a/programs/games/snake/trunk/game_over.asm b/programs/games/snake/trunk/game_over.asm index ef27bed2f5..d34de85bbe 100644 --- a/programs/games/snake/trunk/game_over.asm +++ b/programs/games/snake/trunk/game_over.asm @@ -4,51 +4,51 @@ Game_over: mov ebx, [score] cmp ebx, [hi_score] - jng Game_over_Redraw + jng .redraw mov [is_new_record], 1 mcall 40,100111b ; set events: standart + mouse -Game_over_Redraw: + .redraw: mcall 12,1 - mcall 0,200*65536+WINDOW_WIDTH,326*65536+WINDOW_HEIGHT,[window_style], ,window_title - - cmp [is_new_record], 1 - jnz @f - push dword edit1 - call [edit_box.draw] - @@: + mov ebx, [wp_x] + shl ebx, 16 + add ebx, dword[window_width] + mov ecx, [wp_y] + shl ecx, 16 + add ecx, dword[window_height] + mcall 0, , ,[window_style], ,window_title call Draw_decorations call Draw_game_over_picture - call Draw_game_over_strings + call Draw_game_over_strings ; edit_box is here mcall 12,2 -Game_over_Wait_for_event: + .still: mcall 10 ; wait for event ; ok, what an event? dec al ; has the window been moved or resized? - jz Game_over_Redraw + jz .redraw dec al ; was a key pressed? - jz Game_over_key + jz .key dec al ; was a button pressed? - jz Game_over_button + jz .button -Game_over_mouse: ; mouse event received + .mouse: ; mouse event received push dword edit1 call [edit_box.mouse] - jmp Game_over_Wait_for_event + jmp .still -Game_over_key: ; a key was pressed + .key: ; a key was pressed mcall 2 ; get keycode cmp [is_new_record], 1 - jnz .skip + jnz .key.skip cmp ah, 0x0D ; Enter jnz @f @@ -61,24 +61,24 @@ Game_over_key: ; a key was pressed push dword edit1 call [edit_box.key] - jmp Game_over_Wait_for_event - .skip: + jmp .still + .key.skip: cmp ah, 0x1B ; Escape - go to menu - jne Game_over_Wait_for_event + jne .still mcall 40,111b ; set events: standart jmp First_menu -Game_over_button: ; a button was pressed + .button: ; a button was pressed mcall 17 ; get button number shr eax, 8 ; we should do it to get the real button code cmp eax, 1 je Exit - jmp Game_over_Wait_for_event + jmp .still ;;---Game_over_mode------------------------------------------------------------------------------------------------------------ @@ -88,10 +88,10 @@ Game_over_button: ; a button was pressed Draw_game_over_picture: ;;===Draw_game_over_picture================================================================================================ - mov al, 11 - mov bh, 0 - mov ecx, picture_game_over + mov ax, 0*0x100+29 + mov cx, 1*0x100+13 mov edx, [game_over_picture_color] + mov esi, picture_game_over call Draw_picture ret @@ -101,31 +101,57 @@ Draw_game_over_picture: Draw_game_over_strings: ;;===Draw_game_over_strings================================================================================================ - - - + cmp [is_new_record], 1 jnz @f - mcall 4,40*65536+BOTTOM_TOP_STRINGS,[game_over_strings_color],string_congratulations - mcall ,244*65536+BOTTOM_BOTTOM_STRINGS, ,string_enter_your_name - mcall ,210*65536+TOP_STRINGS,[navigation_strings_color],string_apply_name_enter - mcall 47,0x00070000,[score],(399)*65536+BOTTOM_TOP_STRINGS,[game_over_hiscore_color] + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (string_enter_your_name-string_congratulations-1+8)*3+6 + shl ebx, 16 + add ebx, [bottom_top_strings] + mcall 4, ,[game_over_strings_color],string_congratulations + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (strings_end-string_enter_your_name-1+8)*3+6 +; add ebx, (strings_end-string_enter_your_name)*6 + shl ebx, 16 + add ebx, [bottom_bottom_strings] + mcall , , ,string_enter_your_name + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (press_to_start-string_apply_name_enter-1)*3+6 + shl ebx, 16 + add ebx, [top_strings] + mcall , ,[navigation_strings_color],string_apply_name_enter + mov edx, [window_width] + shr edx, 1 + sub edx, (string_enter_your_name-string_congratulations-1+8)*3+7 + add edx, (string_enter_your_name-string_congratulations)*6 + shl edx, 16 + add edx, dword[bottom_top_strings] + mcall 47,0x00070000,[score], ,[game_over_hiscore_color] + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (strings_end-string_enter_your_name-1+8)*3+9 + add ebx, (strings_end-string_enter_your_name)*6 + mov [edit1+0x04], ebx + push dword edit1 + call [edit_box.draw] ret - + @@: - + call Draw_menu_esc ret - + ;;---Draw_game_over_strings------------------------------------------------------------------------------------------------ - - + + Score_and_name_store: ;;===Name_store============================================================================================================ - invoke ini.set_str, cur_dir_path, aScore, aChampion_name, hed, 15 invoke ini.set_int, cur_dir_path, aScore, aHiscore, [score] diff --git a/programs/games/snake/trunk/level.asm b/programs/games/snake/trunk/level.asm index 8969114d43..5945c61e95 100644 --- a/programs/games/snake/trunk/level.asm +++ b/programs/games/snake/trunk/level.asm @@ -4,7 +4,9 @@ Level_begin: mov [score], 0 mov [action], 0 - mov [number_of_free_dots], GRID_WIDTH*GRID_HEIGHT-3 + mov eax, [gw_mul_gh] + sub eax, 3 + mov [number_of_free_dots], ax invoke ini.get_str, cur_dir_path, aScore, aChampion_name, champion_name, 15, champion_name invoke ini.get_int, cur_dir_path, aScore, aHiscore, 0 @@ -16,9 +18,12 @@ Level_begin: mov esi, start_map mov edi, field_map - mov ecx, GRID_WIDTH*GRID_HEIGHT/4 + mov ecx, [gw_mul_gh] + shr ecx, 2 rep movsd + call Get_eat + Level_body: ;;===Level_body======================================================================================================== @@ -27,9 +32,15 @@ mcall 26, 9 mov eax, [time_wait_limit] mov [time_to_wait], eax - Redraw: + .redraw: mcall 12,1 - mcall 0,200*65536+WINDOW_WIDTH,326*65536+WINDOW_HEIGHT,[window_style], ,window_title + mov ebx, [wp_x] + shl ebx, 16 + add ebx, dword[window_width] + mov ecx, [wp_y] + shl ecx, 16 + add ecx, dword[window_height] + mcall 0, , ,[window_style], ,window_title call Draw_decorations call Draw_snake @@ -38,7 +49,7 @@ mcall 26, 9 mcall 12,2 - Waiting: + .still: mcall 26, 9 push eax sub eax, [time_before_waiting] @@ -59,19 +70,19 @@ mcall 26, 9 mov [time_before_waiting], eax mov eax, [time_wait_limit] mov [time_to_wait], eax - jmp Waiting + jmp .still @@: - Message: ; ok, what an event? + .message: ; ok, what an event? dec al ; has the window been moved or resized? - jz Redraw ; + jz .redraw ; dec al ; was a key pressed? - jz Key ; + jz .key ; dec al ; was a button pressed? - jz Button ; + jz .button ; - Key: + .key: mcall 2 ; get keycode cmp ah, 0x1B ; Escape @@ -79,64 +90,60 @@ mcall 26, 9 cmp ah, 0x20 ; Space je Pause_mode cmp ah, 0xB0 ; Left - je .left + je .key.left cmp ah, 0xB1 ; Down - je .down + je .key.down cmp ah, 0xB2 ; Up - je .up + je .key.up cmp ah, 0xB3 ; Right - je .right + je .key.right - jmp Waiting ; jump to wait for another event - - - .left: - cmp [action], 0 - jne @f - mov [time_to_wait], 0 - @@: - mov [action], 1 - mov [snake_napravlenie_next], 0 - jmp Waiting - - .down: - cmp [action], 0 - jne @f - mov [time_to_wait], 0 - @@: - mov [action], 1 - mov [snake_napravlenie_next], 1 - jmp Waiting - - .up: - cmp [action], 0 - jne @f - mov [time_to_wait], 0 - @@: - mov [action], 1 - mov [snake_napravlenie_next], 2 - jmp Waiting - - .right: - cmp [action], 0 - jne @f - mov [time_to_wait], 0 - @@: - mov [action], 1 - mov [snake_napravlenie_next], 3 - jmp Waiting - + jmp .still ; jump to wait for another event - Button: ; процедура обрабоки кнопок в программе + + .button: ; процедура обрабоки кнопок в программе mcall 17 ; функция 17: получить номер нажатой кнопки shr eax, 8 ; сдвигаем регистр eax на 8 бит вправо, чтобы получить номер нажатой кнопки cmp eax, 1 je Exit ; если это не кнопка 1 (зарезервирована системой как кнопка закрытия программы), пропускаем 2 следующие строчки кода - jmp Waiting - - + jmp .still + + + .key.left: + bts dword[action], 0 + jc @f + mov [time_to_wait], 0 + @@: + mov [snake_napravlenie_next], LEFT + jmp .still + + .key.down: + bts dword[action], 0 + jc @f + mov [time_to_wait], 0 + @@: + mov [snake_napravlenie_next], DOWN + jmp .still + + .key.up: + bts dword[action], 0 + jc @f + mov [time_to_wait], 0 + @@: + mov [snake_napravlenie_next], UP + jmp .still + + .key.right: + bts dword[action], 0 + jc @f + mov [time_to_wait], 0 + @@: + mov [snake_napravlenie_next], RIGHT + jmp .still + + Game_step: cmp [snake_napravlenie], LEFT ; are we moving to left? @@ -192,7 +199,8 @@ mcall 26, 9 dec al cmp al, -1 jne @f - mov al, GRID_WIDTH-1 + mov al, byte[g_w] + dec al @@: jmp Snake_move @@ -200,7 +208,7 @@ mcall 26, 9 mov [snake_napravlenie], DOWN mov ax, [edx] inc ah - cmp ah, GRID_HEIGHT + cmp ah, byte[g_h] jne @f mov ah, 0 @@: @@ -212,7 +220,8 @@ mcall 26, 9 dec ah cmp ah, -1 jne @f - mov ah, GRID_HEIGHT-1 + mov ah, byte[g_h] + dec ah @@: jmp Snake_move @@ -220,7 +229,7 @@ mcall 26, 9 mov [snake_napravlenie], RIGHT mov ax, [edx] inc al - cmp al, GRID_WIDTH + cmp al, byte[g_w] jne @f mov al, 0 @@: @@ -274,16 +283,21 @@ Draw_head_prehead: Draw_level_strings: ;;===Draw_level_strings================================================================================================ - call Draw_menu_esc + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (string_resume_space-string_pause_space-1)*3+6 + shl ebx, 16 + add ebx, [top_strings] + mcall 4, ,[navigation_strings_color],string_pause_space ; Draw 'PAUSE - SPACE' string + +; call Draw_menu_esc call Draw_score_string call Draw_score_number ; Draw score (number) - call Draw_hiscore_string - call Draw_hiscore_number call Draw_champion_string call Draw_champion_name + call Draw_hiscore_string + call Draw_hiscore_number - mcall 4,225*65536+BOTTOM_MIDDLE_STRINGS,[navigation_strings_color],string_pause_space ; Draw 'PAUSE - SPACE' string - ret ;;---Draw_level_strings------------------------------------------------------------------------------------------------ @@ -299,16 +313,13 @@ Reverse: add edi, [snake_length_x2] @@: - mov ax, [edi] xchg ax, [esi] mov [edi], ax - dec cx add esi, 2 sub edi, 2 - - test cx, cx + dec cx jnz @b ret @@ -357,7 +368,7 @@ Get_eat: .place_found: sub ebx, field_map mov eax, ebx - mov bl, GRID_WIDTH + mov bl, byte[g_w] div bl xchg al, ah @@ -391,69 +402,77 @@ Set_reverse_napravlenie: mov ebx, snake_dots+2 mov cl, [eax] ; The last dot x_coord - mov dl, [ebx] ; The pre_last dot x_coord + mov ch, [ebx] ; The pre_last dot x_coord - cmp cl, dl + cmp cl, ch je .X_ravny cmp cl, 0 jne .skip2 - cmp dl, 23 + mov dl, byte[g_w] + dec dl + cmp ch, dl jne .Normal_y_ravny - mov [snake_napravlenie_next], 3 + mov [snake_napravlenie_next], RIGHT ret .skip2: - cmp cl, 23 + mov dl, byte[g_w] + dec dl + cmp cl, dl jne .Normal_y_ravny - cmp dl, 0 + cmp ch, 0 jne .Normal_y_ravny - mov [snake_napravlenie_next], 0 + mov [snake_napravlenie_next], LEFT ret .Normal_y_ravny: - cmp cl, dl + cmp cl, ch jg .Napravlenie_to_right - mov [snake_napravlenie_next], 0 + mov [snake_napravlenie_next], LEFT ret .Napravlenie_to_right: - mov [snake_napravlenie_next], 3 + mov [snake_napravlenie_next], RIGHT ret .X_ravny: inc eax inc ebx mov cl, [eax] - mov dl, [ebx] + mov ch, [ebx] cmp cl, 0 jne .skip3 - cmp dl, 10 + mov dl, byte[g_h] + dec dl + cmp ch, dl jne .Normal_x_ravny - mov [snake_napravlenie_next], 1 + mov [snake_napravlenie_next], DOWN ret .skip3: - cmp cl, 10 + mov dl, byte[g_h] + dec dl + cmp ch, dl jne .Normal_x_ravny - cmp dl, 0 + cmp ch, 0 jne .Normal_x_ravny - mov [snake_napravlenie_next], 2 + mov [snake_napravlenie_next], UP ret .Normal_x_ravny: - cmp cl, dl ; !!! + cmp cl, ch ; !!! jg .Napravlenie_to_down ; 0 1 2 ... - mov [snake_napravlenie_next], 2 ; 1 + mov [snake_napravlenie_next], UP ; 1 ret ; 2 ; . .Napravlenie_to_down: ; . - mov [snake_napravlenie_next], 1 ; . + mov [snake_napravlenie_next], DOWN ; . ret @@ -489,8 +508,13 @@ Snake_move: .eat_and_new_head_are_different: - mov ecx, snake_dots-4 - add ecx, [snake_length_x2] + push ax + + mov ax, word[snake_dots] + mov cl, 0 + call Draw_on_map + + pop ax call Get_from_map test bl, bl @@ -502,10 +526,7 @@ Snake_move: mov bx, word[snake_dots] mov edx, [background_color] call Draw_square - - mov ax, word[snake_dots] - mov cl, 0 - call Draw_on_map + call Sdvig call Draw_head_prehead @@ -522,8 +543,8 @@ Snake_move: mov [time_before_waiting], eax mov eax, [time_wait_limit] mov [time_to_wait], eax - jmp Waiting + jmp Level_body.still - ;;---Snake_move-------------------------------------------------------------------------------------------------------- + ;;---Snake_move------------------------------------------------------------------------------------------------------------ ;;---Some_functions------------------------------------------------------------------------------------------------------------ \ No newline at end of file diff --git a/programs/games/snake/trunk/pause.asm b/programs/games/snake/trunk/pause.asm index 0952beb17c..9acae1555d 100644 --- a/programs/games/snake/trunk/pause.asm +++ b/programs/games/snake/trunk/pause.asm @@ -6,9 +6,15 @@ Pause_mode: mov eax, [time_wait_limit] mov [time_to_wait], eax -Pause_Redraw_window: + .redraw: mcall 12,1 - mcall 0,200*65536+WINDOW_WIDTH,326*65536+WINDOW_HEIGHT,[window_style], ,window_title + mov ebx, [wp_x] + shl ebx, 16 + add ebx, dword[window_width] + mov ecx, [wp_y] + shl ecx, 16 + add ecx, dword[window_height] + mcall 0, , ,[window_style], ,window_title call Draw_decorations call Draw_pause_picture @@ -17,26 +23,26 @@ Pause_Redraw_window: mcall 12,2 -Pause_Wait_for_event: + .still: mcall 10 ; wait for event ; ok, what an event? dec al ; has the window been moved or resized? - jz Pause_Redraw_window + jz .redraw dec al ; was a key pressed? - jz Pause_Is_key + jz .key -Pause_Is_button: ; a button was pressed + .button: ; a button was pressed mcall 17 ; get button number shr eax, 8 ; we should do it to get the real button code cmp eax, 1 je Exit - jmp Pause_Wait_for_event + jmp .still -Pause_Is_key: ; a key was pressed + .key: ; a key was pressed mcall 2 ; get keycode cmp ah, 0x1B ; Escape - go to menu @@ -44,7 +50,7 @@ Pause_Is_key: ; a key was pressed cmp ah, 0x20 ; Space - resume game je Level_body - jmp Pause_Wait_for_event + jmp .still ;;---Pause_mode---------------------------------------------------------------------------------------------------------------- @@ -54,10 +60,10 @@ Pause_Is_key: ; a key was pressed Draw_pause_picture: ;;===Draw_pause_picture======================================================================================================== - mov al, 6 - mov bh, 2 - mov ecx, picture_pause + mov ax, 0*0x100+29 + mov cx, 4*0x100+6 mov edx, [pause_picture_color] + mov esi, picture_pause call Draw_picture ret @@ -68,7 +74,12 @@ Draw_pause_picture: Draw_pause_strings: ;;===Draw_pause_strings================================================================================================ - mcall 4,219*65536+BOTTOM_MIDDLE_STRINGS,[navigation_strings_color],string_resume_space ; Show 'RESUME - SPACE' string + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (string_menu_esc-string_resume_space-1)*3+6 + shl ebx, 16 + add ebx, dword[bottom_middle_strings] + mcall 4, ,[navigation_strings_color],string_resume_space ; Show 'RESUME - SPACE' string call Draw_menu_esc ; Show 'MENU - ESC' string diff --git a/programs/games/snake/trunk/snake.asm b/programs/games/snake/trunk/snake.asm index 825288472c..0171dca80b 100644 --- a/programs/games/snake/trunk/snake.asm +++ b/programs/games/snake/trunk/snake.asm @@ -16,20 +16,6 @@ include '../../../develop/libraries/box_lib/trunk/box_lib.mac' ;;===Define_chapter============================================================================================================ -WINDOW_WIDTH equ 550 -WINDOW_HEIGHT equ 320 -GRID_STEP equ 20 -GRID_BEGIN_X equ 31 -GRID_BEGIN_Y equ 31 -GRID_WIDTH equ 24 -GRID_HEIGHT equ 11 -GRID_ENDS_WIDTH equ 13 - -BOTTOM_TOP_STRINGS equ 270 -BOTTOM_MIDDLE_STRINGS equ 276 -BOTTOM_BOTTOM_STRINGS equ 282 -TOP_STRINGS equ 5 - SCORE_EAT equ 100 LEFT equ 0 @@ -59,47 +45,52 @@ align 4 invoke ini.get_int, cur_dir_path, aPreferences, aSpeed, 80 neg eax add [time_wait_limit], eax - invoke ini.get_int, cur_dir_path, aPreferences, aDecorations, 2 - mov [decorations], al + invoke ini.get_int, cur_dir_path, aPreferences, aSquare_side_length, 19 + mov [square_side_length], eax + invoke ini.get_int, cur_dir_path, aPreferences, aSpace_between_squares, 1 + mov [space_between_squares], eax + invoke ini.get_str, cur_dir_path, aPreferences, aTheme, aTheme_name, 31, aTheme_name - invoke ini.get_color, cur_dir_path, aColors, aBackground_color, 0x000000 + invoke ini.get_int, cur_dir_path, aTheme_name, aDecorations, 2 + mov [decorations], al + invoke ini.get_color, cur_dir_path, aTheme_name, aBackground_color, 0x000000 or [background_color], eax or [window_style], eax - invoke ini.get_color, cur_dir_path, aColors, aDecorations_color, 0x00aaaa00 + invoke ini.get_color, cur_dir_path, aTheme_name, aDecorations_color, 0x00aaaa00 or [decorations_color], eax - invoke ini.get_color, cur_dir_path, aColors, aSnake_color, 0x1111ff + invoke ini.get_color, cur_dir_path, aTheme_name, aSnake_color, 0x1111ff or [snake_color], eax - invoke ini.get_color, cur_dir_path, aColors, aSnake_head_color, 0x1111ff + invoke ini.get_color, cur_dir_path, aTheme_name, aSnake_head_color, 0x1111ff or [snake_head_color], eax - invoke ini.get_color, cur_dir_path, aColors, aSnake_picture_color, 0x4488ff + invoke ini.get_color, cur_dir_path, aTheme_name, aSnake_picture_color, 0x4488ff or [snake_picture_color], eax - invoke ini.get_color, cur_dir_path, aColors, aVersion_picture_color, 0x55ff55 + invoke ini.get_color, cur_dir_path, aTheme_name, aVersion_picture_color, 0x55ff55 or [version_picture_color], eax - invoke ini.get_color, cur_dir_path, aColors, aPause_picture_color, 0x11ff11 + invoke ini.get_color, cur_dir_path, aTheme_name, aPause_picture_color, 0x11ff11 or [pause_picture_color], eax - invoke ini.get_color, cur_dir_path, aColors, aGame_over_picture_color, 0xff1111 + invoke ini.get_color, cur_dir_path, aTheme_name, aGame_over_picture_color, 0xff1111 or [game_over_picture_color], eax - invoke ini.get_color, cur_dir_path, aColors, aEat_color, 0xffff11 + invoke ini.get_color, cur_dir_path, aTheme_name, aEat_color, 0xffff11 or [eat_color], eax - invoke ini.get_color, cur_dir_path, aColors, aNavigation_strings_color, 0x80ff7777 + invoke ini.get_color, cur_dir_path, aTheme_name, aNavigation_strings_color, 0x80ff7777 or [navigation_strings_color], eax - invoke ini.get_color, cur_dir_path, aColors, aGame_over_strings_color, 0x80ff9900 + invoke ini.get_color, cur_dir_path, aTheme_name, aGame_over_strings_color, 0x80ff9900 or [game_over_strings_color], eax - invoke ini.get_color, cur_dir_path, aColors, aScore_string_color, 0x80ffffff + invoke ini.get_color, cur_dir_path, aTheme_name, aScore_string_color, 0x80ffffff or [score_string_color], eax - invoke ini.get_color, cur_dir_path, aColors, aHiscore_string_color, 0x80ffffff + invoke ini.get_color, cur_dir_path, aTheme_name, aHiscore_string_color, 0x80ffffff or [hiscore_string_color], eax - invoke ini.get_color, cur_dir_path, aColors, aChampion_string_color, 0x80ffffff + invoke ini.get_color, cur_dir_path, aTheme_name, aChampion_string_color, 0x80ffffff or [champion_string_color], eax - invoke ini.get_color, cur_dir_path, aColors, aGame_over_hiscore_color, 0x80ffdd44 + invoke ini.get_color, cur_dir_path, aTheme_name, aGame_over_hiscore_color, 0x80ffdd44 or [game_over_hiscore_color], eax - invoke ini.get_color, cur_dir_path, aColors, aScore_number_color, 0xffffff + invoke ini.get_color, cur_dir_path, aTheme_name, aScore_number_color, 0xffffff or [score_number_color], eax - invoke ini.get_color, cur_dir_path, aColors, aHiscore_number_color, 0x00ffffff + invoke ini.get_color, cur_dir_path, aTheme_name, aHiscore_number_color, 0x00ffffff or [hiscore_number_color], eax - invoke ini.get_color, cur_dir_path, aColors, aChampion_name_color, 0x80ffffff + invoke ini.get_color, cur_dir_path, aTheme_name, aChampion_name_color, 0x80ffffff or [champion_name_color], eax - invoke ini.get_color, cur_dir_path, aColors, aEdit_box_selection_color, 0x00aa00 + invoke ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00 or [edit1+0x10], eax mov eax, [background_color] @@ -109,6 +100,8 @@ align 4 mov eax, [game_over_hiscore_color] mov [edit1+0x1C], eax + call Set_geometry + include 'first_menu.asm' ; First menu body and functions include 'level.asm' ; Level body and functions (game process) include 'pause.asm' ; Pause body and functions @@ -117,63 +110,204 @@ include 'game_over.asm' ; Game_over body and functions ;;===Some_functions============================================================================================================ Exit: - ;;===Exit============================================================================================================== + ;;===Exit================================================================================================================== or eax, -1 int 0x40 - ;;---Exit-------------------------------------------------------------------------------------------------------------- - - + ;;---Exit------------------------------------------------------------------------------------------------------------------ + + +Set_geometry: + ;;===Set_geometry========================================================================================================== + + mov eax, [space_between_squares] + add eax, [square_side_length] + mov [g_s], eax + + mov eax, [g_s] + shr eax, 1 + mov ebx, eax + shr ebx, 1 + add eax, ebx + mov [g_e], eax + + mov eax, [g_s] + add eax, [g_e] + mov [gbxm1], eax + + mov eax, [g_e] + add eax, 25 + mov [gbym1], eax + + mov eax, [g_w] + mul word[g_h] + mov [gw_mul_gh], eax + + mov edx, [g_w] + mov eax, [g_s] + mul dx + mov [gw_mul_gs], eax + + mov edx, [g_h] + mov eax, [g_s] + mul dx + mov [gh_mul_gs], eax + + mov eax, [gbxm1] + add eax, [gw_mul_gs] + mov [gbxm1_plus_gw_mul_gs], eax + + mov eax, [gbym1] + add eax, [gh_mul_gs] + mov [gbym1_plus_gh_mul_gs], eax + + mov eax, [g_s] + shl eax, 16 + add eax, [g_s] + mov [gs_shl16_gs], eax + + mov eax, [gbxm1] + shl eax, 16 + add eax, [gbxm1] + mov [gbxm1_shl16_gbxm1], eax + + mov eax, [gbym1] + shl eax, 16 + add eax, [gbym1] + mov [gbym1_shl16_gbym1], eax + + + mov eax, [gw_mul_gs] + add eax, [gbxm1] + add eax, [gbxm1] + add eax, 5*2 ; skin width + mov [window_width], eax + + mov eax, [gh_mul_gs] + add eax, [gbym1] + add eax, [g_e] + add eax, 30 + add eax, 22+5 ; skin height + mov [window_height], eax + + mcall 48, 5 + mov dx, ax + shr eax, 16 + sub dx, ax + cmp dx, word[window_width] ; does window fit to work area width? + jnl @f + dec [square_side_length] +; dps 'snake: Window does not fit to screen.' +; newline +; dps 'Square_side_length was decreased.' +; newline +; dps 'Check you config file! (snake.ini)' +; newline + jmp Set_geometry + @@: + + mov cx, bx + shr ebx, 16 + sub cx, bx + cmp cx, word[window_height] ; does window fit to work area height? + jnl @f + dec [square_side_length] +; dps 'snake: Window does not fit to screen.' +; newline +; dps 'Square_side_length was decreased.' +; newline +; dps 'Check you config file! (snake.ini)' +; newline + jmp Set_geometry + @@: + + sub dx, word[window_width] + shr dx, 1 + mov word[wp_x], dx + sub cx, word[window_height] + shr cx, 1 + mov dx, cx + shr cx, 1 + add cx, dx + mov word[wp_y], cx + + mov [top_strings], 8 + mov eax, [window_height] + sub eax, 50 + mov [bottom_top_strings], eax + add eax, 6 + mov [bottom_middle_strings], eax + add eax, 6 + mov [bottom_bottom_strings], eax + + sub eax, 4 + mov [edit1+0x08], eax + + ret + + ;;---Set_geometry------------------------------------------------------------------------------------------------------ + + Draw_decorations: ;;===Draw_decorations================================================================================================== - cmp [decorations], 1 - je grid_lines - cmp [decorations], 2 - je grid_lines_with_ends - cmp [decorations], 3 - je grid_lines_with_corners - cmp [decorations], 4 - je grid_dots - cmp [decorations], 5 - je borders_lines - cmp [decorations], 6 - je borders_lines_with_ends - cmp [decorations], 7 - je borders_dots - cmp [decorations], 8 - je corners_dots - cmp [decorations], 9 - je corners_inner - cmp [decorations], 10 - je corners_outer - cmp [decorations], 11 - je corners_crosses + mov al, [decorations] + dec al + jz grid_lines + dec al + jz grid_lines_with_ends + dec al + jz grid_lines_with_corners + dec al + jz grid_dots + dec al + jz borders_lines + dec al + jz borders_lines_with_corners + dec al + jz borders_dots + dec al + jz corners_dots + dec al + jz corners_inner + dec al + jz corners_outer + dec al + jz corners_crosses ret grid_lines: mov eax, 38 - mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1) - mov ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP) +;mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1) + mov ebx, [gbxm1_shl16_gbxm1] +;mov ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP) + mov ecx, [gbym1_shl16_gbym1] + add ecx, [gh_mul_gs] mov edx, [decorations_color] + mov esi, [g_w] + add esi, 1 @@: mcall - add ebx, GRID_STEP*65536+GRID_STEP - cmp ebx, (GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP) - jng @b + add ebx, [gs_shl16_gs] + dec esi + jnz @b - mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP) - mov ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1) +;mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP) + mov ebx, [gbxm1_shl16_gbxm1] + add ebx, [gw_mul_gs] + mov ecx, [gbym1_shl16_gbym1] + mov esi, [g_h] + add esi, 1 @@: mcall - add ecx, GRID_STEP*65536+GRID_STEP - cmp ecx, (GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP) - jng @b + add ecx, [gs_shl16_gs] + dec esi + jnz @b ret @@ -181,24 +315,36 @@ Draw_decorations: grid_lines_with_ends: mov eax, 38 - mov ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1) - mov ecx, (GRID_BEGIN_Y-1-GRID_ENDS_WIDTH)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP+GRID_ENDS_WIDTH) + mov ebx, [gbxm1_shl16_gbxm1] + mov ecx, [gbym1] + sub ecx, [g_e] + shl ecx, 16 + add ecx, [gbym1_plus_gh_mul_gs] + add ecx, [g_e] mov edx, [decorations_color] + mov esi, [g_w] + add esi, 1 @@: mcall - add ebx, GRID_STEP*65536+GRID_STEP - cmp ebx, (GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP) - jng @b + add ebx, [gs_shl16_gs] + dec esi + jnz @b - mov ebx, (GRID_BEGIN_X-1-GRID_ENDS_WIDTH)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP+GRID_ENDS_WIDTH) - mov ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1) + mov ebx, [gbxm1] + sub ebx, [g_e] + shl ebx, 16 + add ebx, [gbxm1_plus_gw_mul_gs] + add ebx, [g_e] + mov ecx, [gbym1_shl16_gbym1] + mov esi, [g_h] + add esi, 1 @@: mcall - add ecx, GRID_STEP*65536+GRID_STEP - cmp ecx, (GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP) - jng @b + add ecx, [gs_shl16_gs] + dec esi + jnz @b ret @@ -214,19 +360,19 @@ Draw_decorations: grid_dots: mov eax, 1 - mov ebx, GRID_BEGIN_X-1 - mov ecx, GRID_BEGIN_Y-1 + mov ebx, [gbxm1] + mov ecx, [gbym1] mov edx, [decorations_color] @@: mcall - add ebx, GRID_STEP - cmp ebx, GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1 + add ebx, [g_s] + cmp ebx, [gbxm1_plus_gw_mul_gs] jng @b - add ecx, GRID_STEP - cmp ecx, GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1 + add ecx, [g_s] + cmp ecx, [gbym1_plus_gh_mul_gs] jg @f - mov ebx, GRID_BEGIN_X-1 + mov ebx, [gbxm1] jmp @b @@: @@ -235,15 +381,32 @@ Draw_decorations: borders_lines: - mcall 38,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1),17*65536+263,[decorations_color] - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1), , - mcall ,17*65536+523,(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1) - mcall ,17*65536+523,(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1) + mov eax, 38 + mov ebx, [gbxm1_shl16_gbxm1] + mov ecx, [gbym1_shl16_gbym1] + add ecx, [gh_mul_gs] + mov edx, [decorations_color] + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + shl ebx, 16 + add ebx, [gbxm1_plus_gw_mul_gs] + mcall + + mov ebx, [gbxm1_shl16_gbxm1] + add ebx, [gw_mul_gs] + mov ecx, [gbym1_shl16_gbym1] + mcall + + mov ecx, [gbym1_plus_gh_mul_gs] + shl ecx, 16 + add ecx, [gbym1_plus_gh_mul_gs] + mcall ret - borders_lines_with_ends: + borders_lines_with_corners: call borders_lines call corners_outer @@ -254,37 +417,37 @@ Draw_decorations: borders_dots: mov eax, 1 - mov ebx, GRID_BEGIN_X-1 - mov ecx, GRID_BEGIN_Y-1 + mov ebx, [gbxm1] + mov ecx, [gbym1] mov edx, [decorations_color] @@: mcall - add ebx, GRID_STEP - cmp ebx, GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP + add ebx, [g_s] + cmp ebx, [gbxm1_plus_gw_mul_gs] jng @b - mov ebx, GRID_BEGIN_X-1 - mov ecx, GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP + mov ebx, [gbxm1] + mov ecx, [gbym1_plus_gh_mul_gs] @@: mcall - add ebx, GRID_STEP - cmp ebx, GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP + add ebx, [g_s] + cmp ebx, [gbxm1_plus_gw_mul_gs] jng @b - mov ebx, GRID_BEGIN_X-1 - mov ecx, GRID_BEGIN_Y-1 + mov ebx, [gbxm1] + mov ecx, [gbym1] @@: mcall - add ecx, GRID_STEP - cmp ecx, GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP + add ecx, [g_s] + cmp ecx, [gbym1_plus_gh_mul_gs] jng @b - mov ebx, GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP - mov ecx, GRID_BEGIN_Y-1 + mov ebx, [gbxm1_plus_gw_mul_gs] + mov ecx, [gbym1] @@: mcall - add ecx, GRID_STEP - cmp ecx, GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP + add ecx, [g_s] + cmp ecx, [gbym1_plus_gh_mul_gs] jng @b ret @@ -292,38 +455,126 @@ Draw_decorations: corners_dots: - mcall 13,(GRID_BEGIN_X-2)*65536+2,(GRID_BEGIN_Y-2)*65536+2,[decorations_color] - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+2,(GRID_BEGIN_Y-2)*65536+2, - mcall 13,(GRID_BEGIN_X-2)*65536+2,(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+2, - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+2,(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+2, + mov eax, 13 + mov ebx, [gbxm1] + dec ebx + shl ebx, 16 + add ebx, 2 + mov ecx, [gbym1] + dec ecx + shl ecx, 16 + add ecx, 2 + mov edx, [decorations_color] + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + shl ebx, 16 + add ebx, 2 + mcall + + mov ebx, [gbxm1] + dec ebx + shl ebx, 16 + add ebx, 2 + mov ecx, [gbym1_plus_gh_mul_gs] + shl ecx, 16 + add ecx, 2 + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + shl ebx, 16 + add ebx, 2 + mcall ret corners_inner: - mcall 38,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_ENDS_WIDTH),(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1),[decorations_color] - mcall ,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_ENDS_WIDTH),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-GRID_ENDS_WIDTH-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1),(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-GRID_ENDS_WIDTH-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1), - mcall ,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1),(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_ENDS_WIDTH), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1),(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_ENDS_WIDTH), - mcall ,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-GRID_ENDS_WIDTH-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-GRID_ENDS_WIDTH-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1), + mov eax, 38 + mov ebx, [gbxm1_shl16_gbxm1] + add ebx, [g_e] + mov ecx, [gbym1_shl16_gbym1] + mov edx, [decorations_color] + mcall + + mov ecx, [gbym1_plus_gh_mul_gs] + shl ecx, 16 + add ecx, [gbym1_plus_gh_mul_gs] + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + sub ebx, [g_e] + shl ebx, 16 + add ebx, [gbxm1_plus_gw_mul_gs] + mcall + + mov ecx, [gbym1_shl16_gbym1] + mcall + + mov ebx, [gbxm1_shl16_gbxm1] + mov ecx, [gbym1_shl16_gbym1] + add ecx, [g_e] + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + shl ebx, 16 + add ebx, [gbxm1_plus_gw_mul_gs] + mcall + + mov ecx, [gbym1_plus_gh_mul_gs] + sub ecx, [g_e] + shl ecx, 16 + add ecx, [gbym1_plus_gh_mul_gs] + mcall + + mov ebx, [gbxm1_shl16_gbxm1] + mcall ret corners_outer: - mcall 38,(GRID_BEGIN_X-1-GRID_ENDS_WIDTH)*65536+(GRID_BEGIN_X-1),(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1),[decorations_color] - mcall ,(GRID_BEGIN_X-1-GRID_ENDS_WIDTH)*65536+(GRID_BEGIN_X-1),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1+GRID_ENDS_WIDTH),(GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1+GRID_ENDS_WIDTH),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1), - mcall ,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1),(GRID_BEGIN_Y-1-GRID_ENDS_WIDTH)*65536+(GRID_BEGIN_Y-1), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1),(GRID_BEGIN_Y-1-GRID_ENDS_WIDTH)*65536+(GRID_BEGIN_Y-1), - mcall ,(GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1+GRID_ENDS_WIDTH), - mcall ,(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1)*65536+(GRID_BEGIN_X+GRID_WIDTH*GRID_STEP-1),(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1)*65536+(GRID_BEGIN_Y+GRID_HEIGHT*GRID_STEP-1+GRID_ENDS_WIDTH), + mov eax, 38 + mov ebx, [gbxm1_shl16_gbxm1] + sub ebx, [g_e] + mov ecx, [gbym1_shl16_gbym1] + mov edx, [decorations_color] + mcall + + mov ecx, [gbym1_plus_gh_mul_gs] + shl ecx, 16 + add ecx, [gbym1_plus_gh_mul_gs] + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + shl ebx, 16 + add ebx, [gbxm1_plus_gw_mul_gs] + add ebx, [g_e] + mcall + + mov ecx, [gbym1_shl16_gbym1] + mcall + + mov ebx, [gbxm1_shl16_gbxm1] + mov ecx, [gbym1_shl16_gbym1] + sub ecx, [g_e] + mcall + + mov ebx, [gbxm1_plus_gw_mul_gs] + shl ebx, 16 + add ebx, [gbxm1_plus_gw_mul_gs] + mcall + + mov ecx, [gbym1_plus_gh_mul_gs] + shl ecx, 16 + add ecx, [gbym1_plus_gh_mul_gs] + add ecx, [g_e] + mcall + + mov ebx, [gbxm1_shl16_gbxm1] + mcall ret @@ -347,19 +598,23 @@ Draw_square: mov cl, bh - mov al, 20 + mov al, byte[g_s] mul bl mov bx, ax - add bx, 31 + add bx, word[gbxm1] + inc bx shl ebx, 16 - add ebx, 19 + add ebx, [g_s] + dec ebx - mov al, 20 + mov al, byte[g_s] mul cl mov cx, ax - add cx, 31 + add cx, word[gbym1] + inc cx shl ecx, 16 - add ecx, 19 + add ecx, [g_s] + dec ecx mcall 13 @@ -371,7 +626,12 @@ Draw_square: Draw_menu_esc: ;;===Draw_menu_esc===================================================================================================== - mcall 4,234*65536+TOP_STRINGS,[navigation_strings_color],string_menu_esc + mov ebx, [window_width] + shr ebx, 1 + sub ebx, (string_apply_name_enter-string_menu_esc-1)*3+6 + shl ebx, 16 + add ebx, dword[top_strings] + mcall 4, ,[navigation_strings_color],string_menu_esc ret @@ -380,8 +640,13 @@ Draw_menu_esc: Draw_score_string: ;;===Draw_score_string================================================================================================= - - mcall 4,56*65536+BOTTOM_TOP_STRINGS,[score_string_color],string_score + + mov ebx, [window_width] + shr ebx, 3 + sub ebx, 5 + shl ebx, 16 + add ebx, dword[bottom_top_strings] + mcall 4, ,[score_string_color],string_score ret @@ -390,8 +655,14 @@ Draw_score_string: Draw_score_number: ;;===Draw_score_number================================================================================================= - - mcall 47,0x00070000,[score],104*65536+BOTTOM_TOP_STRINGS,[score_number_color],[background_color] + + mov edx, [window_width] + shr edx, 3 + sub edx, 6 + add edx, (string_hi_score-string_score)*6 + shl edx, 16 + add edx, dword[bottom_top_strings] + mcall 47,0x00070000,[score], ,[score_number_color],[background_color] ret @@ -401,7 +672,14 @@ Draw_score_number: Draw_hiscore_string: ;;===Draw_hiscore_string=============================================================================================== - mcall 4,376*65536+BOTTOM_TOP_STRINGS,[hiscore_string_color],string_hi_score + mov ebx, [window_width] + shr ebx, 3 + neg ebx + add ebx, [window_width] + sub ebx, (string_player-string_hi_score)*6+7*6+5 + shl ebx, 16 + add ebx, dword[bottom_top_strings] + mcall 4, ,[hiscore_string_color],string_hi_score ret @@ -411,7 +689,14 @@ Draw_hiscore_string: Draw_hiscore_number: ;;===Draw_hiscore_number=============================================================================================== - mcall 47,0x00070000,[hi_score],442*65536+BOTTOM_TOP_STRINGS,[hiscore_number_color] + mov edx, [window_width] + shr edx, 3 + neg edx + add edx, [window_width] + sub edx, 7*6+6 + shl edx, 16 + add edx, dword[bottom_top_strings] + mcall 47,0x00070000,[hi_score], ,[hiscore_number_color] ret @@ -421,7 +706,14 @@ Draw_hiscore_number: Draw_champion_string: ;;===Draw_champion_string============================================================================================== - mcall 4,376*65536+BOTTOM_BOTTOM_STRINGS,[champion_string_color],string_champion + mov ebx, [window_width] + shr ebx, 3 + neg ebx + add ebx, [window_width] + sub ebx, (string_level-string_champion)*6+7*6+5 + shl ebx, 16 + add ebx, dword[bottom_bottom_strings] + mcall 4, ,[champion_string_color],string_champion ret @@ -431,7 +723,15 @@ Draw_champion_string: Draw_champion_name: ;;===Draw_champion_name================================================================================================ - mcall 4,442*65536+BOTTOM_BOTTOM_STRINGS,[champion_name_color],champion_name + mov ebx, [window_width] + shr ebx, 3 + neg ebx + add ebx, [window_width] + sub ebx, (press_to_start-champion_name)*6+7*6+6 + add ebx, (press_to_start-champion_name)*6 + shl ebx, 16 + add ebx, dword[bottom_bottom_strings] + mcall 4, ,[champion_name_color],champion_name ret @@ -441,36 +741,36 @@ Draw_champion_name: Draw_picture: ;;===Draw_picture====================================================================================================== ;; in : - ;; al = picture height (in squares) - ;; bh = number of top square - ;; ecx = pointer to picture data + ;; ax = number of left square *0x100+ picture width (in squares) + ;; cx = number of top square *0x100+ picture height (in squares) ;; edx = picture color + ;; esi = pointer to picture data ;; + add al, ah + add cl, ch + mov bh, ch + .draw: - xor bl, bl + mov bl, ah .loop: - cmp byte[ecx], 0 + cmp byte[esi], 0 jz @f - push eax ebx ecx + push eax ebx ecx esi call Draw_square - pop ecx ebx eax + pop esi ecx ebx eax @@: - inc ecx + inc esi inc bl - cmp bl, GRID_WIDTH + cmp bl, al jne .loop - dec al - test al, al - jnz @f - ret - @@: inc bh - jmp .draw - + cmp bh, cl + jne .draw + ret ;;---Draw_picture------------------------------------------------------------------------------------------------------ @@ -487,7 +787,7 @@ Draw_on_map: xor bx, bx mov bl, al shr ax, 8 - mov dx, 24 + mov dx, word[g_w] mul dx add ax, bx mov edi, field_map @@ -505,7 +805,7 @@ Get_from_map: ;; al = x coord ;; ah = y coord ;; out : - ;; al = value on map + ;; bl = value on map ;; push eax @@ -514,7 +814,7 @@ Get_from_map: xor bx, bx mov bl, al shr ax, 8 - mov dx, 24 + mov dx, word[g_w] mul dx add ax, bx mov edi, field_map @@ -538,20 +838,29 @@ window_style dd 0x34000000 time_before_waiting dd 0x0 time_to_wait dd 0x0 time_wait_limit dd 101 -decorations db 0x0 -number_of_free_dots dw 0x0 -field_map db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ - 0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 string_score db 'SCORE :',0 string_hi_score db 'HI-SCORE :',0 @@ -562,70 +871,74 @@ string_pause_space db 'PAUSE - ',0x27,'SPACE',0x27,0 string_resume_space db 'RESUME - ',0x27,'SPACE',0x27,0 string_menu_esc db 'MENU - ',0x27,'ESC',0x27,0 string_apply_name_enter db 'APPLY NAME - ',0x27,'ENTER',0x27,0 - -champion_name db 'dunkaist',0x20,0x20,0x20,0x20,0x20,0x20,0x20,0 - -press_to_start db '...PRESS ',0x27,'SPACE',0x27,' OR ',0x27,'ENTER',0x27,' TO START...',0 +press_to_start db 'PRESS ',0x27,'SPACE',0x27,' OR ',0x27,'ENTER',0x27,' TO START',0 press_esc_to_exit db 'PRESS ',0x27,'ESC',0x27,' TO EXIT',0 ;press_F2_to_options db 'PRESS ',0x27,'F2',0x27,' TO OPTIONS',0 -snake_dots db 3,3, 4,3, 5,3, 522 dup (0) ; 264 dots +string_congratulations db ' Congratulations!!! New hi-score is :',0 +string_enter_your_name db 'You are the champion! Enter your name :',0 +strings_end: + +snake_dots db 3,3, 4,3, 5,3, 865 dup (0) snake_napravlenie db 3 snake_napravlenie_next db 3 snake_length_x2 dd 6 -eat db 0,0 - score dd 0 hi_score dd 777 is_new_record db 0 action db 0 -string_congratulations db 'Congratulations!!! You are the champion!! New hi-score is :',0 -string_enter_your_name db 'Enter your name, please :',0 +picture_first_men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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 background_color dd 0x000000 decorations_color dd 0x00000000 @@ -667,15 +980,14 @@ import box_lib,\ bFirstDraw db 0 -aScore db 'Score',0 -aHiscore db 'Hiscore',0 -aChampion_name db 'Champion_name',0 - aPreferences db 'Preferences',0 aSpeed db 'Speed',0 -aDecorations db 'Decorations',0 +aSquare_side_length db 'Square_side_length',0 +aSpace_between_squares db 'Space_between_squares',0 +aTheme db 'Theme',0 -aColors db 'Colors',0 +aTheme_name db 32 dup (0) +aDecorations db 'Decorations',0 aBackground_color db 'Background_color',0 aDecorations_color db 'Decorations_color',0 aSnake_color db 'Snake_color',0 @@ -696,18 +1008,51 @@ aHiscore_number_color db 'Hiscore_number_color',0 aChampion_name_color db 'Champion_name_color',0 aEdit_box_selection_color db 'Edit_box_selection_color',0 -edit1 edit_box 100,397,278,0x000000,0x000000,0x000000,0x000000,0x80000000,15,hed,mouse_dd,ed_focus,hed_end-hed-1,hed_end-hed-1 +aScore db 'Score',0 +aHiscore db 'Hiscore',0 +aChampion_name db 'Champion_name',0 + +edit1 edit_box 65,397,0x0,0x000000,0x000000,0x000000,0x000000,0x80000000,15,hed,mouse_dd,ed_focus,hed_end-hed-1,hed_end-hed-1 hed db '',0 +;;---Variables------------------------------------------------------------------------------------------------------------- +i_end: hed_end: rb 256 - mouse_dd rd 1 -i_end: +decorations rb 1 +number_of_free_dots rw 1 + +eat rb 1 + +square_side_length rd 1 +space_between_squares rd 1 +g_s rd 1 + +window_width rd 1 +window_height rd 1 +wp_x rd 1 +wp_y rd 1 + +gw_mul_gh rd 1 +gw_mul_gs rd 1 +gh_mul_gs rd 1 +gbxm1_plus_gw_mul_gs rd 1 +gbym1_plus_gh_mul_gs rd 1 +gs_shl16_gs rd 1 +gbxm1_shl16_gbxm1 rd 1 +gbym1_shl16_gbym1 rd 1 + +bottom_top_strings rd 1 +bottom_middle_strings rd 1 +bottom_bottom_strings rd 1 +top_strings rd 1 + +champion_name rb 16 + cur_dir_path rb 4096 @PARAMS rb 4096 -;;---Variables------------------------------------------------------------------------------------------------------------- rb 4096 stacktop: diff --git a/programs/games/snake/trunk/snake.ini b/programs/games/snake/trunk/snake.ini index 2845d25fdd..1e8f93aff6 100644 --- a/programs/games/snake/trunk/snake.ini +++ b/programs/games/snake/trunk/snake.ini @@ -1,34 +1,49 @@ +;;===Common_preferences================================================= [Preferences] Speed=80 ; SLOW == 0 <= Speed <= 100 == FAST -Decorations=2 +Square_side_length=19 +; in pixels +; recommended minimum is 8 (strings don't overlap) +; for nice look at low Square_side_length try Theme_ultra_black +Theme=Theme_standard +; Theme name to use +; See [Theme_*] below for available themes +; Name of any theme must be shorter than 30 chars +;;---Common_preferences------------------------------------------------- + +;;===Visual_themes====================================================== +[Theme_standard] +; all these keys are optional +Decorations = 2 ; 0 = nothing ; 1 = grid_lines ; 2 = grid_lines_with_ends ; 3 = grid_lines_with_corners ; 4 = grid_dots ; 5 = borders_lines -; 6 = borders_lines_with_ends +; 6 = borders_lines_with_corners ; 7 = borders_dots ; 8 = corners_dots ; 9 = corners_inner ; 10 = corners_outer ; 11 = corners_crosses - -[Colors] - -; Standard color scheme Background_color = 0,0,0 Decorations_color = 170,170,0 Snake_color = 17,17,255 Snake_head_color = 17,17,255 +; by default Snake_head_color is equal to Snake_color, so the snake has no head Snake_picture_color = 68,136,255 +; color of big 'SNAKE' label at start menu Version_picture_color = 85,255,85 Pause_picture_color = 17,255,17 Game_over_picture_color = 255,17,17 Navigation_string_color = 255,119,119 +; color of 'PRESS * to *' and like this strings Game_over_string_color = 255,153,0 +; color of strings on game_over screen Game_over_hiscore_color = 255,221,68 +; color of new hiscore and champion name on game_over screen Eat_color = 255,255,17 Score_number_color = 255,255,255 Score_string_color = 255,255,255 @@ -38,69 +53,79 @@ Champion_string_color = 255,255,255 Champion_name_color = 255,255,255 Edit_box_selection_color= 0,176,0 -; Light scheme -;Background_color = 245,245,245 -;Decorations_color = 55,55,55 -;Snake_color = 215,115,215 -;Snake_head_color = 215,115,215 -;Snake_picture_color = 105,155,205 -;Version_picture_color = 155,255,0 -;Pause_picture_color = 75,255,75 -;Game_over_picture_color = 225,125,105 -;Navigation_string_color = 205,105,105 -;Game_over_string_color = 205,105,105 -;Game_over_hiscore_color = 205,85,85 -;Eat_color = 255,255,55 -;Score_number_color = 100,100,255 -;Score_string_color = 100,100,255 -;Hiscore_number_color = 100,100,255 -;Hiscore_string_color = 100,100,255 -;Champion_string_color = 100,100,255 -;Champion_name_color = 100,100,255 -;Edit_box_selection_color= 0,176,0 +[Theme_light] +Decorations = 2 +Background_color = 245,245,245 +Decorations_color = 55,55,55 +Snake_color = 215,115,215 +Snake_head_color = 215,115,215 +Snake_picture_color = 105,155,205 +Version_picture_color = 155,255,0 +Pause_picture_color = 75,255,75 +Game_over_picture_color = 225,125,105 +Navigation_string_color = 205,105,105 +Game_over_string_color = 205,105,105 +Game_over_hiscore_color = 205,85,85 +Eat_color = 255,255,55 +Score_number_color = 100,100,255 +Score_string_color = 100,100,255 +Hiscore_number_color = 100,100,255 +Hiscore_string_color = 100,100,255 +Champion_string_color = 100,100,255 +Champion_name_color = 100,100,255 +Edit_box_selection_color= 0,176,0 -; Ultra white scheme -;Background_color = 255,255,255 -;Decorations_color = 0,0,0 -;Snake_color = 30,30,30 -;Snake_head_color = 30,30,30 -;Snake_picture_color = 30,30,30 -;Version_picture_color = 70,70,70 -;Pause_picture_color = 30,30,30 -;Game_over_picture_color = 30,30,30 -;Navigation_string_color = 255,255,255 -;Game_over_string_color = 30,30,30 -;Game_over_hiscore_color = 0,0,0 -;Eat_color = 0,255,0 -;Score_number_color = 0,0,0 -;Score_string_color = 255,255,255 -;Hiscore_number_color = 0,0,0 -;Hiscore_string_color = 255,255,255 -;Champion_string_color = 255,255,255 -;Champion_name_color = 255,255,255 -;Edit_box_selection_color= 176,176,176 +[Theme_ultra_white] +Decorations = 10 +Background_color = 255,255,255 +Decorations_color = 0,0,0 +Snake_color = 30,30,30 +Snake_head_color = 30,30,30 +Snake_picture_color = 30,30,30 +Version_picture_color = 70,70,70 +Pause_picture_color = 30,30,30 +Game_over_picture_color = 30,30,30 +Navigation_string_color = 255,255,255 +Game_over_string_color = 30,30,30 +Game_over_hiscore_color = 0,0,0 +Eat_color = 0,255,0 +Score_number_color = 0,0,0 +Score_string_color = 255,255,255 +Hiscore_number_color = 0,0,0 +Hiscore_string_color = 255,255,255 +Champion_string_color = 255,255,255 +Champion_name_color = 255,255,255 +Edit_box_selection_color= 176,176,176 -; Ultra black scheme -;Background_color = 0,0,0 -;Decorations_color = 255,255,255 -;Snake_color = 255,255,255 -;Snake_head_color = 255,255,255 -;Snake_picture_color = 255,255,255 -;Version_picture_color = 225,225,225 -;Pause_picture_color = 225,225,225 -;Game_over_picture_color = 225,225,225 -;Navigation_string_color = 0,0,0 -;Game_over_string_color = 225,225,225 -;Game_over_hiscore_color = 225,225,225 -;Eat_color = 255,0,0 -;Score_number_color = 255,255,255 -;Score_string_color = 255,255,255 -;Hiscore_number_color = 255,255,255 -;Hiscore_string_color = 255,255,255 -;Champion_string_color = 0,0,0 -;Champion_name_color = 0,0,0 -;Edit_box_selection_color= 100,100,100 +[Theme_ultra_black] +Decorations = 6 +Background_color = 0,0,0 +Decorations_color = 255,255,255 +Snake_color = 255,255,255 +Snake_head_color = 255,255,255 +Snake_picture_color = 255,255,255 +Version_picture_color = 225,225,225 +Pause_picture_color = 225,225,225 +Game_over_picture_color = 225,225,225 +Navigation_string_color = 0,0,0 +Game_over_string_color = 225,225,225 +Game_over_hiscore_color = 225,225,225 +Eat_color = 255,0,0 +Score_number_color = 255,255,255 +Score_string_color = 255,255,255 +Hiscore_number_color = 255,255,255 +Hiscore_string_color = 255,255,255 +Champion_string_color = 0,0,0 +Champion_name_color = 0,0,0 +Edit_box_selection_color= 100,100,100 +[Theme_your_theme_here] + +;;---Visual_themes------------------------------------------------------ + +; !!! DON'T WRITE ANYTHING AFTER THIS LINE: 'Score' SECTION IS WRITABLE AND YOU WILL LOST THIS DATA !!! + +;;===Section_of_results================================================= [Score] Hiscore=777 Champion_name= \ No newline at end of file