2010-07-15 16:37:55 +04:00
|
|
|
;;===First_menu_mode===========================================================================================================
|
|
|
|
|
|
|
|
First_menu:
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
.redraw:
|
2010-07-15 16:37:55 +04:00
|
|
|
mcall 12,1
|
2010-07-19 18:59:30 +04:00
|
|
|
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
|
2010-07-15 16:37:55 +04:00
|
|
|
|
|
|
|
call Draw_decorations
|
|
|
|
call Draw_first_menu_picture
|
|
|
|
call Draw_menu_strings
|
|
|
|
|
|
|
|
mcall 12,2
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
.still:
|
2010-07-15 16:37:55 +04:00
|
|
|
mcall 10 ; wait for event
|
|
|
|
; ok, what an event?
|
|
|
|
dec al ; has the window been moved or resized?
|
2010-07-19 18:59:30 +04:00
|
|
|
jz .redraw ;
|
2010-07-15 16:37:55 +04:00
|
|
|
dec al ; was a key pressed?
|
2010-07-19 18:59:30 +04:00
|
|
|
jz .key ;
|
2010-07-15 16:37:55 +04:00
|
|
|
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
.button: ; a button was pressed
|
2010-07-15 16:37:55 +04:00
|
|
|
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...
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
jmp .still ; jump to wait for another event
|
2010-07-15 16:37:55 +04:00
|
|
|
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
.key: ; a key was pressed
|
2010-07-15 16:37:55 +04:00
|
|
|
mcall 2 ; get keycode
|
|
|
|
|
|
|
|
cmp ah, 0x1B ; Escape
|
|
|
|
je Exit
|
|
|
|
cmp ah, 0x0D ; Enter
|
|
|
|
je Level_begin
|
|
|
|
cmp ah, 0x20 ; Space
|
|
|
|
je Level_begin
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
jmp .still ; jump to wait for another event
|
2010-07-15 16:37:55 +04:00
|
|
|
|
|
|
|
;;---First_menu_mode-----------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
;;===Some_functions============================================================================================================
|
|
|
|
|
|
|
|
Draw_first_menu_picture:
|
|
|
|
;;===Draw_first_menu_picture================================================================================================
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
mov ax, 0*0x100+29
|
|
|
|
mov cx, 1*0x100+6
|
2010-07-15 16:37:55 +04:00
|
|
|
mov edx, [snake_picture_color]
|
2010-07-19 18:59:30 +04:00
|
|
|
mov esi, picture_first_menu_snake
|
2010-07-15 16:37:55 +04:00
|
|
|
call Draw_picture
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
mov ax, 9*0x100+11
|
|
|
|
mov cx, 9*0x100+5
|
2010-07-15 16:37:55 +04:00
|
|
|
mov edx, [version_picture_color]
|
2010-07-19 18:59:30 +04:00
|
|
|
mov esi, picture_first_menu_version
|
2010-07-15 16:37:55 +04:00
|
|
|
call Draw_picture
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
Draw_menu_strings:
|
|
|
|
;;===Make_menu_strings=========================================================================================
|
|
|
|
|
2010-07-19 18:59:30 +04:00
|
|
|
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
|
2010-07-15 16:37:55 +04:00
|
|
|
; mcall ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
;;---Make_menu_strings-----------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
;;---Some_functions------------------------------------------------------------------------------------------------------------
|