snake: version 0.5
git-svn-id: svn://kolibrios.org@1566 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5c5ccb819d
commit
54fadda10d
@ -1,12 +1,12 @@
|
||||
;;===First_menu_mode===========================================================================================================
|
||||
|
||||
First_menu:
|
||||
mcall 40,111b ; set events: standart
|
||||
mov [is_new_record], 0
|
||||
call Show_cursor
|
||||
|
||||
mov [snake_length_x2], 6
|
||||
mov word[snake_dots], 0x0303
|
||||
mov dword[snake_dots+2], 0x03050304
|
||||
mov [snake_napravlenie], 3
|
||||
mov [snake_napravlenie_next], 3
|
||||
mov [score], 0
|
||||
call Set_first_level_of_play_mode
|
||||
|
||||
.redraw:
|
||||
mcall 12,1
|
||||
@ -18,9 +18,10 @@ First_menu:
|
||||
add ecx, dword[window_height]
|
||||
mcall 0, , ,[window_style], ,window_title
|
||||
|
||||
call Draw_decorations
|
||||
call Draw_first_menu_picture
|
||||
call Draw_menu_strings
|
||||
call Draw_decorations
|
||||
call Draw_first_menu_picture
|
||||
call Draw_menu_strings
|
||||
call Draw_buttons
|
||||
|
||||
mcall 12,2
|
||||
|
||||
@ -38,7 +39,28 @@ First_menu:
|
||||
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...
|
||||
je Save_do_smth_else_and_exit ; if so, jump to quit...
|
||||
cmp eax, 0xD0 ; 'play' button?
|
||||
je Level_begin
|
||||
cmp eax, 0xD1 ; 'exit' button?
|
||||
je Save_do_smth_else_and_exit
|
||||
cmp eax, 0xD2 ; change play mode button?
|
||||
jne @f
|
||||
call Change_play_mode
|
||||
call Delete_buttons
|
||||
call Draw_buttons
|
||||
jmp .still ; jump to wait for another event
|
||||
@@:
|
||||
cmp eax, 0xD3 ; '+INC+' button?
|
||||
jne @f
|
||||
call Increase_geometry
|
||||
jmp .redraw ; jump to wait for another event
|
||||
@@:
|
||||
cmp eax, 0xD4 ; '-dec-' button?
|
||||
jne @f
|
||||
call Decrease_geometry
|
||||
jmp .redraw ; jump to wait for another event
|
||||
@@:
|
||||
|
||||
jmp .still ; jump to wait for another event
|
||||
|
||||
@ -47,12 +69,16 @@ First_menu:
|
||||
mcall 2 ; get keycode
|
||||
|
||||
cmp ah, 0x1B ; Escape
|
||||
je Exit
|
||||
je Save_do_smth_else_and_exit
|
||||
cmp ah, 0x0D ; Enter
|
||||
je Level_begin
|
||||
cmp ah, 0x20 ; Space
|
||||
je Level_begin
|
||||
|
||||
jne @f
|
||||
call Change_play_mode
|
||||
call Delete_buttons
|
||||
call Draw_buttons
|
||||
jmp .still ; jump to wait for another event
|
||||
@@:
|
||||
jmp .still ; jump to wait for another event
|
||||
|
||||
;;---First_menu_mode-----------------------------------------------------------------------------------------------------------
|
||||
@ -63,14 +89,14 @@ First_menu:
|
||||
Draw_first_menu_picture:
|
||||
;;===Draw_first_menu_picture================================================================================================
|
||||
|
||||
mov ax, 0*0x100+29
|
||||
mov cx, 1*0x100+6
|
||||
mov ax, 2*0x100+24
|
||||
mov cx, 1*0x100+5
|
||||
mov edx, [snake_picture_color]
|
||||
mov esi, picture_first_menu_snake
|
||||
call Draw_picture
|
||||
|
||||
mov ax, 9*0x100+11
|
||||
mov cx, 9*0x100+5
|
||||
mov ax, 3*0x100+11
|
||||
mov cx, 8*0x100+5
|
||||
mov edx, [version_picture_color]
|
||||
mov esi, picture_first_menu_version
|
||||
call Draw_picture
|
||||
@ -81,17 +107,17 @@ Draw_first_menu_picture:
|
||||
|
||||
|
||||
Draw_menu_strings:
|
||||
;;===Make_menu_strings=========================================================================================
|
||||
;;===Make_menu_strings======================================================================================================
|
||||
|
||||
mov ebx, [window_width]
|
||||
shr ebx, 1
|
||||
sub ebx, (press_esc_to_exit-press_to_start-1)*3+6
|
||||
sub ebx, press_to_start.size*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
|
||||
sub ebx, press_esc_to_exit.size*3+6
|
||||
shl ebx, 16
|
||||
add ebx, [top_strings]
|
||||
mcall , ,[navigation_strings_color],press_esc_to_exit
|
||||
@ -99,6 +125,176 @@ Draw_menu_strings:
|
||||
|
||||
ret
|
||||
|
||||
;;---Make_menu_strings-----------------------------------------------------------------------------------------
|
||||
|
||||
;;---Some_functions------------------------------------------------------------------------------------------------------------
|
||||
;;---Make_menu_strings------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Draw_buttons:
|
||||
;;===Draw_buttons===========================================================================================================
|
||||
|
||||
mov ebx, [button_x_left]
|
||||
shl ebx, 16
|
||||
mov bx, word[button_width_short]
|
||||
mov ecx, [button_y_top]
|
||||
shl ecx, 16
|
||||
add cx, word[button_height]
|
||||
mcall 8, , ,0x000000D0,[button_color] ; top left button
|
||||
shr ecx, 16
|
||||
mov bx, cx
|
||||
mov edx, [button_height]
|
||||
shr edx, 1
|
||||
sub edx, 3 ; ~half of font height
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mov edx, [button_width_short]
|
||||
shr edx, 1
|
||||
sub edx, string_button_play.size*3
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mcall 4, ,[button_text_color],string_button_play
|
||||
|
||||
mov ebx, [button_x_right]
|
||||
shl ebx, 16
|
||||
mov bx, word[button_width_short]
|
||||
mov ecx, [button_y_top]
|
||||
shl ecx, 16
|
||||
add cx, word[button_height]
|
||||
mcall 8, , ,0x000000D1, ; top right button
|
||||
shr ecx, 16
|
||||
mov bx, cx
|
||||
mov edx, [button_height]
|
||||
shr edx, 1
|
||||
sub edx, 3 ; ~half of font height
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mov edx, [button_width_short]
|
||||
shr edx, 1
|
||||
sub edx, string_button_exit.size*3
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mcall 4, ,[button_text_color],string_button_exit
|
||||
|
||||
mov ebx, [button_x_left]
|
||||
shl ebx, 16
|
||||
mov bx, word[button_width_long]
|
||||
mov ecx, [button_y_middle]
|
||||
shl ecx, 16
|
||||
add cx, word[button_height]
|
||||
mcall 8, , ,0x000000D2, ; middle button
|
||||
shr ecx, 16
|
||||
mov bx, cx
|
||||
mov edi, [button_height]
|
||||
shr edi, 1
|
||||
sub edi, 3 ; ~half of font height
|
||||
add bx, di
|
||||
ror ebx, 16
|
||||
mov edi, [button_width_long]
|
||||
shr edi, 1
|
||||
cmp [play_mode], 0
|
||||
jne @f
|
||||
sub edi, string_button_pm_classic.size*3
|
||||
mov edx, string_button_pm_classic
|
||||
jmp .skip
|
||||
@@:
|
||||
sub edi, string_button_pm_levels.size*3
|
||||
mov edx, string_button_pm_levels
|
||||
.skip:
|
||||
add bx, di
|
||||
ror ebx, 16
|
||||
mcall 4, ,[button_text_color],
|
||||
|
||||
mov ebx, [button_x_left]
|
||||
shl ebx, 16
|
||||
mov bx, word[button_width_short]
|
||||
mov ecx, [button_y_bottom]
|
||||
shl ecx, 16
|
||||
add cx, word[button_height]
|
||||
mcall 8, , ,0x000000D3, ; bottom left button
|
||||
shr ecx, 16
|
||||
mov bx, cx
|
||||
mov edx, [button_height]
|
||||
shr edx, 1
|
||||
sub edx, 3 ; ~half of font height
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mov edx, [button_width_short]
|
||||
shr edx, 1
|
||||
sub edx, string_button_inc.size*3
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mcall 4, ,[button_text_color],string_button_inc
|
||||
|
||||
mov ebx, [button_x_right]
|
||||
shl ebx, 16
|
||||
mov bx, word[button_width_short]
|
||||
mov ecx, [button_y_bottom]
|
||||
shl ecx, 16
|
||||
add cx, word[button_height]
|
||||
mcall 8, , ,0x000000D4,
|
||||
shr ecx, 16
|
||||
mov bx, cx
|
||||
mov edx, [button_height]
|
||||
shr edx, 1
|
||||
sub edx, 3 ; ~half of font height
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mov edx, [button_width_short]
|
||||
shr edx, 1
|
||||
sub edx, string_button_dec.size*3
|
||||
add bx, dx
|
||||
ror ebx, 16
|
||||
mcall 4, ,[button_text_color],string_button_dec
|
||||
|
||||
ret
|
||||
|
||||
;;---Draw_buttons----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Delete_buttons:
|
||||
;;===Delete_buttons========================================================================================================
|
||||
|
||||
mcall 8,,,0x800000D0
|
||||
mcall ,,,0x800000D1
|
||||
mcall ,,,0x800000D2
|
||||
mcall ,,,0x800000D3
|
||||
mcall ,,,0x800000D4
|
||||
|
||||
ret
|
||||
|
||||
;;---Delete_buttons--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Change_play_mode:
|
||||
;;===Change_play_mode======================================================================================================
|
||||
|
||||
cmp [play_mode], LEVELS_MODE
|
||||
jne @f
|
||||
mov [play_mode], CLASSIC_MODE
|
||||
mov [cur_level_number], 0
|
||||
ret
|
||||
@@:
|
||||
inc [play_mode]
|
||||
|
||||
call Set_first_level_of_play_mode
|
||||
|
||||
ret
|
||||
|
||||
;;---Change_play_mode------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Set_first_level_of_play_mode:
|
||||
;;===Set_first_level_of_play_mode==========================================================================================
|
||||
|
||||
cmp [play_mode], CLASSIC_MODE
|
||||
jne @f
|
||||
mov [cur_level_number], CLASSIC_MODE_FIRST_LEVEL
|
||||
@@:
|
||||
cmp [play_mode], LEVELS_MODE
|
||||
jne @f
|
||||
mov [cur_level_number], LEVELS_MODE_FIRST_LEVEL
|
||||
@@:
|
||||
|
||||
ret
|
||||
|
||||
;;---Set_first_level_of_play_mode-------------------------------------------------------------------------------------------
|
||||
|
||||
;;---Some_functions-------------------------------------------------------------------------------------------------------------
|
@ -2,11 +2,22 @@
|
||||
|
||||
Game_over:
|
||||
|
||||
call Show_cursor
|
||||
|
||||
mov ebx, [score]
|
||||
cmp ebx, [hi_score]
|
||||
|
||||
cmp [play_mode], CLASSIC_MODE
|
||||
jne @f
|
||||
cmp ebx, [hi_score_classic]
|
||||
jng .redraw
|
||||
|
||||
mov [is_new_record], 1
|
||||
jmp .done
|
||||
@@:
|
||||
cmp ebx, [hi_score_levels]
|
||||
jng .redraw
|
||||
mov [is_new_record], 1
|
||||
jmp .done
|
||||
.done:
|
||||
|
||||
mcall 40,100111b ; set events: standart + mouse
|
||||
|
||||
@ -38,8 +49,7 @@ Game_over:
|
||||
|
||||
|
||||
.mouse: ; mouse event received
|
||||
push dword edit1
|
||||
call [edit_box.mouse]
|
||||
invoke edit_box.mouse, edit1
|
||||
|
||||
jmp .still
|
||||
|
||||
@ -47,28 +57,21 @@ Game_over:
|
||||
.key: ; a key was pressed
|
||||
mcall 2 ; get keycode
|
||||
|
||||
cmp [is_new_record], 1
|
||||
jnz .key.skip
|
||||
|
||||
cmp [is_new_record], 1
|
||||
je .key.is_record
|
||||
|
||||
cmp ah, 0x1B ; Escape - go to menu
|
||||
jne .still
|
||||
jmp First_menu
|
||||
|
||||
.key.is_record:
|
||||
cmp ah, 0x0D ; Enter
|
||||
jnz @f
|
||||
call Score_and_name_store
|
||||
mov [is_new_record], 0
|
||||
mcall 40,111b ; set events: standart
|
||||
jmp First_menu
|
||||
|
||||
@@:
|
||||
push dword edit1
|
||||
call [edit_box.key]
|
||||
|
||||
invoke edit_box.key, edit1
|
||||
jmp .still
|
||||
.key.skip:
|
||||
|
||||
cmp ah, 0x1B ; Escape - go to menu
|
||||
jne .still
|
||||
|
||||
mcall 40,111b ; set events: standart
|
||||
jmp First_menu
|
||||
|
||||
|
||||
.button: ; a button was pressed
|
||||
@ -76,7 +79,7 @@ Game_over:
|
||||
shr eax, 8 ; we should do it to get the real button code
|
||||
|
||||
cmp eax, 1
|
||||
je Exit
|
||||
je Save_do_smth_else_and_exit
|
||||
|
||||
jmp .still
|
||||
|
||||
@ -88,10 +91,19 @@ Game_over:
|
||||
Draw_game_over_picture:
|
||||
;;===Draw_game_over_picture================================================================================================
|
||||
|
||||
mov ax, 0*0x100+29
|
||||
cmp [is_new_record], 1
|
||||
je @f
|
||||
mov ax, 1*0x100+26
|
||||
mov cx, 1*0x100+13
|
||||
mov edx, [game_over_picture_color]
|
||||
mov esi, picture_game_over
|
||||
jmp .done
|
||||
@@:
|
||||
mov ax, 5*0x100+17
|
||||
mov cx, 1*0x100+12
|
||||
mov edx, [you_win_picture_color]
|
||||
mov esi, picture_you_win
|
||||
.done:
|
||||
call Draw_picture
|
||||
|
||||
ret
|
||||
@ -107,37 +119,33 @@ Draw_game_over_strings:
|
||||
|
||||
mov ebx, [window_width]
|
||||
shr ebx, 1
|
||||
sub ebx, (string_enter_your_name-string_congratulations-1+8)*3+6
|
||||
sub ebx, string_congratulations.size*3+6*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
|
||||
sub ebx, string_enter_your_name.size*3+6*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
|
||||
sub ebx, string_apply_name_enter.size*3
|
||||
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
|
||||
add edx, string_congratulations.size*3-6*6-1
|
||||
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]
|
||||
add ebx, string_enter_your_name.size*3-6*6-3
|
||||
mov [edit1.left], ebx
|
||||
invoke edit_box.draw, edit1
|
||||
|
||||
ret
|
||||
|
||||
@ -153,8 +161,28 @@ 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]
|
||||
mov esi, hed
|
||||
|
||||
cmp [play_mode], CLASSIC_MODE
|
||||
jne @f
|
||||
mov edi, champion_name_classic
|
||||
jmp .done
|
||||
@@:
|
||||
mov edi, champion_name_levels
|
||||
.done:
|
||||
|
||||
mov ecx, CHAMPION_NAME_LENGTH
|
||||
rep movsb
|
||||
|
||||
mov eax, [score]
|
||||
|
||||
cmp [play_mode], CLASSIC_MODE
|
||||
jne @f
|
||||
mov [hi_score_classic], eax
|
||||
jmp .done2
|
||||
@@:
|
||||
mov [hi_score_levels], eax
|
||||
.done2:
|
||||
|
||||
ret
|
||||
|
||||
|
@ -2,31 +2,13 @@
|
||||
|
||||
Level_begin:
|
||||
|
||||
mov [score], 0
|
||||
mov [action], 0
|
||||
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
|
||||
|
||||
test eax, eax
|
||||
jz @f
|
||||
mov dword [hi_score], eax
|
||||
@@:
|
||||
|
||||
mov esi, start_map
|
||||
mov edi, field_map
|
||||
mov ecx, [gw_mul_gh]
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
|
||||
call Load_level
|
||||
call Get_eat
|
||||
|
||||
Level_body:
|
||||
;;===Level_body========================================================================================================
|
||||
|
||||
call Hide_cursor
|
||||
mcall 26, 9
|
||||
mov [time_before_waiting], eax
|
||||
mov eax, [time_wait_limit]
|
||||
@ -43,6 +25,7 @@ mcall 26, 9
|
||||
mcall 0, , ,[window_style], ,window_title
|
||||
|
||||
call Draw_decorations
|
||||
call Draw_stones
|
||||
call Draw_snake
|
||||
call Draw_eat
|
||||
call Draw_level_strings
|
||||
@ -82,6 +65,16 @@ mcall 26, 9
|
||||
jz .button ;
|
||||
|
||||
|
||||
.button: ; ¯à®æ¥¤ãà ®¡à ¡®ª¨ ª®¯®ª ¢ ¯à®£à ¬¬¥
|
||||
mcall 17 ; äãªæ¨ï 17: ¯®«ãç¨âì ®¬¥à ¦ ⮩ ª®¯ª¨
|
||||
|
||||
shr eax, 8 ; ᤢ¨£ ¥¬ ॣ¨áâà eax 8 ¡¨â ¢¯à ¢®, çâ®¡ë ¯®«ãç¨âì ®¬¥à ¦ ⮩ ª®¯ª¨
|
||||
cmp eax, 1
|
||||
je Save_do_smth_else_and_exit ; ¥á«¨ íâ® ¥ ª®¯ª 1 (§ १¥à¢¨à®¢ á¨á⥬®© ª ª ª®¯ª § ªàëâ¨ï ¯à®£à ¬¬ë), ¯à®¯ã᪠¥¬ 2 á«¥¤ãî騥 áâà®çª¨ ª®¤
|
||||
|
||||
jmp .still
|
||||
|
||||
|
||||
.key:
|
||||
mcall 2 ; get keycode
|
||||
|
||||
@ -101,135 +94,124 @@ mcall 26, 9
|
||||
jmp .still ; jump to wait for another event
|
||||
|
||||
|
||||
.button: ; ŻŕŽćĽ¤ăŕ ŽĄŕ ĄŽŞ¨ ŞŽŻŽŞ ˘ ŻŕŽŁŕ ŹŹĽ
|
||||
mcall 17 ; äăŞć¨ď 17: ŻŽŤăç¨âě ŽŹĽŕ Ś ⎊ ŞŽŻŞ¨
|
||||
|
||||
shr eax, 8 ; ᤢ¨Ł ĽŹ ༣¨áâŕ eax 8 Ą¨â ˘Żŕ ˘Ž, çâŽĄë ŻŽŤăç¨âě ŽŹĽŕ Ś ⎊ ŞŽŻŞ¨
|
||||
cmp eax, 1
|
||||
je Exit ; ĽáŤ¨ í⎠Ľ ŞŽŻŞ 1 (§ ༧Ľŕ˘¨ŕŽ˘ á¨á⼏ŽŠ Ş Ş ŞŽŻŞ § Şŕëâ¨ď ŻŕŽŁŕ ŹŹë), ŻŕŽŻă᪠ĽŹ 2 ፼¤ăî騼 áâŕŽçި ŞŽ¤
|
||||
|
||||
jmp .still
|
||||
|
||||
|
||||
.key.left:
|
||||
bts dword[action], 0
|
||||
bts [action], 0
|
||||
jc @f
|
||||
mov [time_to_wait], 0
|
||||
@@:
|
||||
mov [snake_napravlenie_next], LEFT
|
||||
mov [snake_direction_next], LEFT
|
||||
jmp .still
|
||||
|
||||
.key.down:
|
||||
bts dword[action], 0
|
||||
bts [action], 0
|
||||
jc @f
|
||||
mov [time_to_wait], 0
|
||||
@@:
|
||||
mov [snake_napravlenie_next], DOWN
|
||||
mov [snake_direction_next], DOWN
|
||||
jmp .still
|
||||
|
||||
.key.up:
|
||||
bts dword[action], 0
|
||||
bts [action], 0
|
||||
jc @f
|
||||
mov [time_to_wait], 0
|
||||
@@:
|
||||
mov [snake_napravlenie_next], UP
|
||||
mov [snake_direction_next], UP
|
||||
jmp .still
|
||||
|
||||
.key.right:
|
||||
bts dword[action], 0
|
||||
bts [action], 0
|
||||
jc @f
|
||||
mov [time_to_wait], 0
|
||||
@@:
|
||||
mov [snake_napravlenie_next], RIGHT
|
||||
mov [snake_direction_next], RIGHT
|
||||
jmp .still
|
||||
|
||||
|
||||
Game_step:
|
||||
|
||||
cmp [snake_napravlenie], LEFT ; are we moving to left?
|
||||
cmp [snake_direction], LEFT ; are we moving to left?
|
||||
jz .left
|
||||
cmp [snake_napravlenie], DOWN ; ... down?
|
||||
cmp [snake_direction], DOWN ; ... down?
|
||||
jz .down
|
||||
cmp [snake_napravlenie], UP ; ... up?
|
||||
cmp [snake_direction], UP ; ... up?
|
||||
jz .up
|
||||
jmp .right ; then right
|
||||
|
||||
.left:
|
||||
cmp [snake_napravlenie_next], RIGHT ; next step is to right?
|
||||
jz .with_rewerse
|
||||
jmp .without_rewerse
|
||||
cmp [snake_direction_next], RIGHT ; next step is to right?
|
||||
jz .with_reverse
|
||||
jmp .without_reverse
|
||||
|
||||
.down:
|
||||
cmp [snake_napravlenie_next], UP ; next step is to up?
|
||||
jz .with_rewerse
|
||||
jmp .without_rewerse
|
||||
cmp [snake_direction_next], UP ; next step is to up?
|
||||
jz .with_reverse
|
||||
jmp .without_reverse
|
||||
|
||||
.up:
|
||||
cmp [snake_napravlenie_next], DOWN ; next step is to bottom?
|
||||
jz .with_rewerse
|
||||
jmp .without_rewerse
|
||||
cmp [snake_direction_next], DOWN ; next step is to bottom?
|
||||
jz .with_reverse
|
||||
jmp .without_reverse
|
||||
|
||||
.right:
|
||||
cmp [snake_napravlenie_next], LEFT ; next step is to left?
|
||||
jz .with_rewerse
|
||||
jmp .without_rewerse
|
||||
cmp [snake_direction_next], LEFT ; next step is to left?
|
||||
jz .with_reverse
|
||||
jmp .without_reverse
|
||||
|
||||
|
||||
.with_rewerse:
|
||||
call Set_reverse_napravlenie
|
||||
.with_reverse:
|
||||
call Set_reverse_direction
|
||||
call Reverse
|
||||
|
||||
.without_rewerse:
|
||||
; mov [time_to_wait], 0
|
||||
.without_reverse:
|
||||
mov edx, snake_dots-2
|
||||
add edx, [snake_length_x2]
|
||||
|
||||
cmp [snake_napravlenie_next], LEFT
|
||||
cmp [snake_direction_next], LEFT
|
||||
je .to_left
|
||||
cmp [snake_napravlenie_next], DOWN
|
||||
cmp [snake_direction_next], DOWN
|
||||
je .to_down
|
||||
cmp [snake_napravlenie_next], UP
|
||||
cmp [snake_direction_next], UP
|
||||
je .to_up
|
||||
cmp [snake_napravlenie_next], RIGHT
|
||||
cmp [snake_direction_next], RIGHT
|
||||
je .to_right
|
||||
|
||||
.to_left:
|
||||
mov [snake_napravlenie], LEFT
|
||||
mov [snake_direction], LEFT
|
||||
mov ax, [edx]
|
||||
dec al
|
||||
cmp al, -1
|
||||
jne @f
|
||||
mov al, byte[g_w]
|
||||
mov al, GRID_WIDTH
|
||||
dec al
|
||||
@@:
|
||||
jmp Snake_move
|
||||
|
||||
.to_down:
|
||||
mov [snake_napravlenie], DOWN
|
||||
mov [snake_direction], DOWN
|
||||
mov ax, [edx]
|
||||
inc ah
|
||||
cmp ah, byte[g_h]
|
||||
cmp ah, GRID_HEIGHT
|
||||
jne @f
|
||||
mov ah, 0
|
||||
@@:
|
||||
jmp Snake_move
|
||||
|
||||
.to_up:
|
||||
mov [snake_napravlenie], UP
|
||||
mov [snake_direction], UP
|
||||
mov ax, [edx]
|
||||
dec ah
|
||||
cmp ah, -1
|
||||
jne @f
|
||||
mov ah, byte[g_h]
|
||||
mov ah, GRID_HEIGHT
|
||||
dec ah
|
||||
@@:
|
||||
jmp Snake_move
|
||||
|
||||
.to_right:
|
||||
mov [snake_napravlenie], RIGHT
|
||||
mov [snake_direction], RIGHT
|
||||
mov ax, [edx]
|
||||
inc al
|
||||
cmp al, byte[g_w]
|
||||
cmp al, GRID_WIDTH
|
||||
jne @f
|
||||
mov al, 0
|
||||
@@:
|
||||
@ -285,7 +267,7 @@ Draw_level_strings:
|
||||
|
||||
mov ebx, [window_width]
|
||||
shr ebx, 1
|
||||
sub ebx, (string_resume_space-string_pause_space-1)*3+6
|
||||
sub ebx, string_pause_space.size*3+6
|
||||
shl ebx, 16
|
||||
add ebx, [top_strings]
|
||||
mcall 4, ,[navigation_strings_color],string_pause_space ; Draw 'PAUSE - SPACE' string
|
||||
@ -298,6 +280,26 @@ Draw_level_strings:
|
||||
call Draw_hiscore_string
|
||||
call Draw_hiscore_number
|
||||
|
||||
cmp [play_mode], LEVELS_MODE
|
||||
jne @f
|
||||
|
||||
mov ebx, [window_width]
|
||||
shr ebx, 3
|
||||
sub ebx, 5
|
||||
shl ebx, 16
|
||||
add ebx, [bottom_bottom_strings]
|
||||
mcall 4, ,[level_string_color],string_level
|
||||
|
||||
mov edx, [window_width]
|
||||
shr edx, 3
|
||||
sub edx, 5+1
|
||||
add edx, string_level.size*6
|
||||
shl edx, 16
|
||||
add edx, [bottom_bottom_strings]
|
||||
mcall 47,0x00020000,[cur_level_number], ,[level_number_color],[background_color]
|
||||
|
||||
@@:
|
||||
|
||||
ret
|
||||
|
||||
;;---Draw_level_strings------------------------------------------------------------------------------------------------
|
||||
@ -368,7 +370,7 @@ Get_eat:
|
||||
.place_found:
|
||||
sub ebx, field_map
|
||||
mov eax, ebx
|
||||
mov bl, byte[g_w]
|
||||
mov bl, GRID_WIDTH
|
||||
div bl
|
||||
xchg al, ah
|
||||
|
||||
@ -395,8 +397,8 @@ Sdvig:
|
||||
;;---Sdvig-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Set_reverse_napravlenie:
|
||||
;;===Set_reverse_napravlenie===========================================================================================
|
||||
Set_reverse_direction:
|
||||
;;===Set_reverse_direction==================================================================================================
|
||||
|
||||
mov eax, snake_dots
|
||||
mov ebx, snake_dots+2
|
||||
@ -410,32 +412,32 @@ Set_reverse_napravlenie:
|
||||
cmp cl, 0
|
||||
jne .skip2
|
||||
|
||||
mov dl, byte[g_w]
|
||||
mov dl, GRID_WIDTH
|
||||
dec dl
|
||||
cmp ch, dl
|
||||
jne .Normal_y_ravny
|
||||
mov [snake_napravlenie_next], RIGHT
|
||||
mov [snake_direction_next], RIGHT
|
||||
ret
|
||||
|
||||
.skip2:
|
||||
mov dl, byte[g_w]
|
||||
mov dl, GRID_WIDTH
|
||||
dec dl
|
||||
cmp cl, dl
|
||||
jne .Normal_y_ravny
|
||||
cmp ch, 0
|
||||
jne .Normal_y_ravny
|
||||
mov [snake_napravlenie_next], LEFT
|
||||
mov [snake_direction_next], LEFT
|
||||
ret
|
||||
|
||||
.Normal_y_ravny:
|
||||
|
||||
cmp cl, ch
|
||||
jg .Napravlenie_to_right
|
||||
mov [snake_napravlenie_next], LEFT
|
||||
mov [snake_direction_next], LEFT
|
||||
ret
|
||||
|
||||
.Napravlenie_to_right:
|
||||
mov [snake_napravlenie_next], RIGHT
|
||||
mov [snake_direction_next], RIGHT
|
||||
ret
|
||||
|
||||
.X_ravny:
|
||||
@ -447,40 +449,40 @@ Set_reverse_napravlenie:
|
||||
cmp cl, 0
|
||||
jne .skip3
|
||||
|
||||
mov dl, byte[g_h]
|
||||
mov dl, GRID_HEIGHT
|
||||
dec dl
|
||||
cmp ch, dl
|
||||
jne .Normal_x_ravny
|
||||
mov [snake_napravlenie_next], DOWN
|
||||
mov [snake_direction_next], DOWN
|
||||
ret
|
||||
|
||||
.skip3:
|
||||
mov dl, byte[g_h]
|
||||
mov dl, GRID_HEIGHT
|
||||
dec dl
|
||||
cmp ch, dl
|
||||
jne .Normal_x_ravny
|
||||
cmp ch, 0
|
||||
jne .Normal_x_ravny
|
||||
mov [snake_napravlenie_next], UP
|
||||
mov [snake_direction_next], UP
|
||||
ret
|
||||
|
||||
.Normal_x_ravny:
|
||||
|
||||
cmp cl, ch ; !!!
|
||||
jg .Napravlenie_to_down ; 0 1 2 ...
|
||||
mov [snake_napravlenie_next], UP ; 1
|
||||
mov [snake_direction_next], UP ; 1
|
||||
ret ; 2
|
||||
; .
|
||||
.Napravlenie_to_down: ; .
|
||||
mov [snake_napravlenie_next], DOWN ; .
|
||||
mov [snake_direction_next], DOWN ; .
|
||||
|
||||
ret
|
||||
|
||||
;;---Set_reverse_napravlenie-------------------------------------------------------------------------------------------
|
||||
;;---Set_reverse_direction--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Snake_move:
|
||||
;;===Snake_move========================================================================================================
|
||||
;;===Snake_move=============================================================================================================
|
||||
;; in :
|
||||
;; ax = coord's of new head
|
||||
;; edx = snake_dots+[snake_length_x2]-2 (snake head)
|
||||
@ -493,8 +495,8 @@ Snake_move:
|
||||
|
||||
add [snake_length_x2], 2
|
||||
add [score], SCORE_EAT
|
||||
dec word[number_of_free_dots]
|
||||
cmp word[number_of_free_dots], 0
|
||||
dec [number_of_free_dots]
|
||||
cmp [number_of_free_dots], 0
|
||||
je Game_over
|
||||
mov ax, word[eat]
|
||||
mov cl, 1
|
||||
@ -539,6 +541,13 @@ Snake_move:
|
||||
dec [score]
|
||||
call Draw_score_number
|
||||
@@:
|
||||
|
||||
cmp [play_mode], LEVELS_MODE
|
||||
jne @f
|
||||
cmp [snake_length_x2], (EAT_TO_END_LEVEL+3)*2
|
||||
je Do_smth_between_levels
|
||||
@@:
|
||||
|
||||
mcall 26, 9
|
||||
mov [time_before_waiting], eax
|
||||
mov eax, [time_wait_limit]
|
||||
@ -547,4 +556,112 @@ Snake_move:
|
||||
|
||||
;;---Snake_move------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Do_smth_between_levels:
|
||||
;;===Do_smth_between_levels================================================================================================
|
||||
|
||||
inc [cur_level_number]
|
||||
cmp [cur_level_number], LAST_LEVEL_NUMBER+1
|
||||
jne @f
|
||||
mov [cur_level_number], LEVELS_MODE_FIRST_LEVEL
|
||||
@@:
|
||||
|
||||
call Draw_splash
|
||||
|
||||
@@:
|
||||
mcall 2
|
||||
cmp eax, 1
|
||||
jne @b
|
||||
|
||||
jmp Level_begin
|
||||
|
||||
;;---Do_smth_between_levels------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Draw_splash:
|
||||
;;===Draw_splash===========================================================================================================
|
||||
|
||||
mov al, 0
|
||||
mov cl, GRID_WIDTH-1
|
||||
mov edx, [splash_background_color]
|
||||
|
||||
.draw:
|
||||
mov bh, GRID_HEIGHT-1
|
||||
mov bl, al
|
||||
@@:
|
||||
call Draw_square
|
||||
sub bh, 2
|
||||
cmp bh, 0
|
||||
jg @b
|
||||
|
||||
inc al
|
||||
|
||||
mov bh, GRID_HEIGHT-2
|
||||
mov bl, cl
|
||||
@@:
|
||||
call Draw_square
|
||||
sub bh, 2
|
||||
cmp bh, 0
|
||||
jnl @b
|
||||
|
||||
dec cl
|
||||
cmp cl, 0
|
||||
jl @f
|
||||
|
||||
push eax ebx
|
||||
mcall 5,PAUSE_WHILE_DRAWING_SPLASH
|
||||
pop ebx eax
|
||||
|
||||
jmp .draw
|
||||
@@:
|
||||
|
||||
|
||||
|
||||
mov ax, 2*0x100+24
|
||||
mov cx, 1*0x100+5
|
||||
mov edx, [splash_level_string_color]
|
||||
mov esi, picture_level
|
||||
call Draw_picture
|
||||
|
||||
mov eax, [cur_level_number]
|
||||
mov dl, 10
|
||||
div dl
|
||||
push ax
|
||||
|
||||
mov esi, digits_font
|
||||
@@:
|
||||
test al, al
|
||||
jz @f
|
||||
add esi, 20
|
||||
dec al
|
||||
jmp @b
|
||||
@@:
|
||||
|
||||
mov ax, 9*0x100+4
|
||||
mov cx, 8*0x100+5
|
||||
mov edx, [splash_level_number_color]
|
||||
call Draw_picture
|
||||
|
||||
pop ax
|
||||
mov esi, digits_font
|
||||
@@:
|
||||
test ah, ah
|
||||
jz @f
|
||||
add esi, 20
|
||||
dec ah
|
||||
jmp @b
|
||||
@@:
|
||||
|
||||
mov ax, 15*0x100+4
|
||||
mov cx, 8*0x100+5
|
||||
mov edx, [splash_level_number_color]
|
||||
call Draw_picture
|
||||
|
||||
mcall 5,PAUSE_BETWEEN_LEVELS
|
||||
|
||||
ret
|
||||
|
||||
;;---Draw_splash-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
;;---Some_functions------------------------------------------------------------------------------------------------------------
|
@ -2,6 +2,7 @@
|
||||
|
||||
Pause_mode:
|
||||
|
||||
call Show_cursor
|
||||
mov [action], 0
|
||||
mov eax, [time_wait_limit]
|
||||
mov [time_to_wait], eax
|
||||
@ -37,7 +38,7 @@ Pause_mode:
|
||||
shr eax, 8 ; we should do it to get the real button code
|
||||
|
||||
cmp eax, 1
|
||||
je Exit
|
||||
je Save_do_smth_else_and_exit
|
||||
|
||||
jmp .still
|
||||
|
||||
@ -60,7 +61,7 @@ Pause_mode:
|
||||
Draw_pause_picture:
|
||||
;;===Draw_pause_picture========================================================================================================
|
||||
|
||||
mov ax, 0*0x100+29
|
||||
mov ax, 2*0x100+24
|
||||
mov cx, 4*0x100+6
|
||||
mov edx, [pause_picture_color]
|
||||
mov esi, picture_pause
|
||||
@ -76,7 +77,7 @@ Draw_pause_strings:
|
||||
|
||||
mov ebx, [window_width]
|
||||
shr ebx, 1
|
||||
sub ebx, (string_menu_esc-string_resume_space-1)*3+6
|
||||
sub ebx, string_resume_space.size*3+6
|
||||
shl ebx, 16
|
||||
add ebx, dword[bottom_middle_strings]
|
||||
mcall 4, ,[navigation_strings_color],string_resume_space ; Show 'RESUME - SPACE' string
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,9 @@
|
||||
[Preferences]
|
||||
Speed=80
|
||||
; SLOW == 0 <= Speed <= 100 == FAST
|
||||
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
|
||||
; See [Theme_*] sections below for available themes
|
||||
; Name of any theme must be shorter than 30 chars
|
||||
;;---Common_preferences-------------------------------------------------
|
||||
|
||||
@ -31,13 +27,16 @@ Decorations = 2
|
||||
Background_color = 0,0,0
|
||||
Decorations_color = 170,170,0
|
||||
Snake_color = 17,17,255
|
||||
Snake_head_color = 17,17,255
|
||||
Snake_head_color = 107,107,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
|
||||
; ... if you end game without new record
|
||||
You_win_picture_color = 255,255,17
|
||||
; ... if you end game with new record
|
||||
Navigation_string_color = 255,119,119
|
||||
; color of 'PRESS * to *' and like this strings
|
||||
Game_over_string_color = 255,153,0
|
||||
@ -46,34 +45,60 @@ 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
|
||||
; color of "SCORE : " string at the left bottom screen part
|
||||
Score_string_color = 255,255,255
|
||||
; color of digits after "SCORE : "
|
||||
Level_string_color = 255,255,255
|
||||
; color of "LEVEL : " string at the left bottom screen part
|
||||
Level_number_color = 255,255,255
|
||||
; color of digits after "LEVEL : "
|
||||
Hiscore_number_color = 255,255,255
|
||||
Hiscore_string_color = 255,255,255
|
||||
Champion_string_color = 255,255,255
|
||||
Champion_name_color = 255,255,255
|
||||
Edit_box_selection_color= 0,176,0
|
||||
Button_color = 221,221,221
|
||||
; color of buttons 'play', 'exit' etc at start menu
|
||||
Button_text_color = 0,0,0
|
||||
; color of the text on these buttons
|
||||
Stone_color = 95,135,0
|
||||
Splash_background_color = 170,170,0
|
||||
; background color for "LEVEL ??" label between levels
|
||||
Splash_level_string_color= 0,0,0
|
||||
; color of "LEVEL" label
|
||||
Splash_level_number_color= 0,0,0
|
||||
; color of two level number digits on splash between levels
|
||||
|
||||
[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_color = 225,125,225
|
||||
Snake_head_color = 255,125,55
|
||||
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
|
||||
You_win_picture_color = 55,255,155
|
||||
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
|
||||
Game_over_hiscore_color = 205,75,75
|
||||
Eat_color = 225,225,25
|
||||
Score_number_color = 100,100,255
|
||||
Score_string_color = 100,100,255
|
||||
Level_string_color = 100,100,255
|
||||
Level_number_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
|
||||
Button_color = 221,221,221
|
||||
Button_text_color = 0,0,0
|
||||
Stone_color = 105,185,255
|
||||
Splash_background_color = 185,255,185
|
||||
Splash_level_string_color= 165,165,255
|
||||
Splash_level_number_color= 255,165,165
|
||||
|
||||
[Theme_ultra_white]
|
||||
Decorations = 10
|
||||
@ -85,17 +110,26 @@ 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
|
||||
You_win_picture_color = 105,105,105
|
||||
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
|
||||
Level_string_color = 255,255,255
|
||||
Level_number_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
|
||||
Button_color = 221,221,221
|
||||
Button_text_color = 0,0,0
|
||||
Stone_color = 145,145,145
|
||||
Splash_background_color = 205,205,205
|
||||
Splash_level_string_color= 255,255,255
|
||||
Splash_level_number_color= 255,255,255
|
||||
|
||||
[Theme_ultra_black]
|
||||
Decorations = 6
|
||||
@ -107,25 +141,35 @@ 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
|
||||
You_win_picture_color = 255,255,255
|
||||
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
|
||||
Level_string_color = 0,0,0
|
||||
Level_number_color = 0,0,0
|
||||
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
|
||||
Button_color = 221,221,221
|
||||
Button_text_color = 0,0,0
|
||||
Stone_color = 145,145,145
|
||||
Splash_background_color = 30,30,30
|
||||
Splash_level_string_color= 255,255,255
|
||||
Splash_level_number_color= 255,255,255
|
||||
|
||||
[Theme_your_theme_here]
|
||||
[Theme_your_theme_name]
|
||||
|
||||
;;---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=
|
||||
;;===Reserved_Section===================================================
|
||||
[Reserved]
|
||||
Square_side_length=19
|
||||
Champion_name_classic=
|
||||
Hiscore_classic=777
|
||||
Champion_name_levels=
|
||||
Hiscore_levels=222
|
Loading…
Reference in New Issue
Block a user