snake: version 0.3
git-svn-id: svn://kolibrios.org@1522 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
55e0141343
commit
afa8518204
@ -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
|
||||
|
@ -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
|
||||
@ -102,15 +102,42 @@ 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
|
||||
|
||||
@ -126,7 +153,6 @@ 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]
|
||||
|
||||
|
@ -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,62 +90,58 @@ 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
|
||||
jmp .still ; 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
|
||||
|
||||
|
||||
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:
|
||||
@ -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,15 +283,20 @@ 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
|
||||
|
||||
mcall 4,225*65536+BOTTOM_MIDDLE_STRINGS,[navigation_strings_color],string_pause_space ; Draw 'PAUSE - SPACE' string
|
||||
call Draw_hiscore_string
|
||||
call Draw_hiscore_number
|
||||
|
||||
ret
|
||||
|
||||
@ -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
|
||||
@ -503,9 +527,6 @@ Snake_move:
|
||||
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------------------------------------------------------------------------------------------------------------
|
@ -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
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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=
|
Loading…
Reference in New Issue
Block a user