Rev 1518 | Rev 1566 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1518 | Rev 1522 | ||
---|---|---|---|
1 | ;;===First_menu_mode=========================================================================================================== |
1 | ;;===First_menu_mode=========================================================================================================== |
2 | 2 | ||
3 | First_menu: |
3 | First_menu: |
4 | 4 | ||
5 | mov [snake_length_x2], 6 |
5 | mov [snake_length_x2], 6 |
6 | mov word[snake_dots], 0x0303 |
6 | mov word[snake_dots], 0x0303 |
7 | mov dword[snake_dots+2], 0x03050304 |
7 | mov dword[snake_dots+2], 0x03050304 |
8 | mov [snake_napravlenie], 3 |
8 | mov [snake_napravlenie], 3 |
9 | mov [snake_napravlenie_next], 3 |
9 | mov [snake_napravlenie_next], 3 |
10 | 10 | ||
11 | Redraw_window: |
11 | .redraw: |
- | 12 | mcall 12,1 |
|
- | 13 | mov ebx, [wp_x] |
|
- | 14 | shl ebx, 16 |
|
- | 15 | add ebx, dword[window_width] |
|
- | 16 | mov ecx, [wp_y] |
|
- | 17 | shl ecx, 16 |
|
12 | mcall 12,1 |
18 | add ecx, dword[window_height] |
13 | mcall 0,200*65536+WINDOW_WIDTH,326*65536+WINDOW_HEIGHT,[window_style], ,window_title |
19 | mcall 0, , ,[window_style], ,window_title |
14 | 20 | ||
15 | call Draw_decorations |
21 | call Draw_decorations |
16 | call Draw_first_menu_picture |
22 | call Draw_first_menu_picture |
17 | call Draw_menu_strings |
23 | call Draw_menu_strings |
18 | 24 | ||
19 | mcall 12,2 |
25 | mcall 12,2 |
20 | 26 | ||
21 | Wait_for_event: |
27 | .still: |
22 | mcall 10 ; wait for event |
28 | mcall 10 ; wait for event |
23 | ; ok, what an event? |
29 | ; ok, what an event? |
24 | dec al ; has the window been moved or resized? |
30 | dec al ; has the window been moved or resized? |
25 | jz Redraw_window ; |
31 | jz .redraw ; |
26 | dec al ; was a key pressed? |
32 | dec al ; was a key pressed? |
27 | jz Is_key ; |
33 | jz .key ; |
28 | 34 | ||
29 | 35 | ||
30 | Is_button: ; a button was pressed |
36 | .button: ; a button was pressed |
31 | mcall 17 ; get button number |
37 | mcall 17 ; get button number |
32 | shr eax, 8 ; we should do it to get the real button code |
38 | shr eax, 8 ; we should do it to get the real button code |
33 | 39 | ||
34 | cmp eax, 1 ; is it close button? |
40 | cmp eax, 1 ; is it close button? |
35 | je Exit ; if so, jump to quit... |
41 | je Exit ; if so, jump to quit... |
36 | 42 | ||
37 | jmp Wait_for_event ; jump to wait for another event |
43 | jmp .still ; jump to wait for another event |
38 | 44 | ||
39 | 45 | ||
40 | Is_key: ; a key was pressed |
46 | .key: ; a key was pressed |
41 | mcall 2 ; get keycode |
47 | mcall 2 ; get keycode |
42 | 48 | ||
43 | cmp ah, 0x1B ; Escape |
49 | cmp ah, 0x1B ; Escape |
44 | je Exit |
50 | je Exit |
45 | cmp ah, 0x0D ; Enter |
51 | cmp ah, 0x0D ; Enter |
46 | je Level_begin |
52 | je Level_begin |
47 | cmp ah, 0x20 ; Space |
53 | cmp ah, 0x20 ; Space |
48 | je Level_begin |
54 | je Level_begin |
49 | 55 | ||
50 | jmp Wait_for_event ; jump to wait for another event |
56 | jmp .still ; jump to wait for another event |
51 | 57 | ||
52 | ;;---First_menu_mode----------------------------------------------------------------------------------------------------------- |
58 | ;;---First_menu_mode----------------------------------------------------------------------------------------------------------- |
53 | 59 | ||
54 | 60 | ||
55 | ;;===Some_functions============================================================================================================ |
61 | ;;===Some_functions============================================================================================================ |
56 | 62 | ||
57 | Draw_first_menu_picture: |
63 | Draw_first_menu_picture: |
58 | ;;===Draw_first_menu_picture================================================================================================ |
64 | ;;===Draw_first_menu_picture================================================================================================ |
59 | 65 | ||
60 | mov al, 5 |
66 | mov ax, 0*0x100+29 |
61 | mov bh, 0 |
- | |
62 | mov ecx, picture_first_menu_snake |
67 | mov cx, 1*0x100+6 |
- | 68 | mov edx, [snake_picture_color] |
|
63 | mov edx, [snake_picture_color] |
69 | mov esi, picture_first_menu_snake |
64 | call Draw_picture |
70 | call Draw_picture |
65 | 71 | ||
66 | mov al, 4 |
- | |
67 | mov bh, 7 |
72 | mov ax, 9*0x100+11 |
- | 73 | mov cx, 9*0x100+5 |
|
68 | mov ecx, picture_first_menu_version |
74 | mov edx, [version_picture_color] |
69 | mov edx, [version_picture_color] |
75 | mov esi, picture_first_menu_version |
70 | call Draw_picture |
76 | call Draw_picture |
71 | 77 | ||
72 | ret |
78 | ret |
73 | 79 | ||
74 | ;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------ |
80 | ;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------ |
75 | 81 | ||
76 | 82 | ||
77 | Draw_menu_strings: |
83 | Draw_menu_strings: |
78 | ;;===Make_menu_strings========================================================================================= |
84 | ;;===Make_menu_strings========================================================================================= |
- | 85 | ||
- | 86 | mov ebx, [window_width] |
|
- | 87 | shr ebx, 1 |
|
- | 88 | sub ebx, (press_esc_to_exit-press_to_start-1)*3+6 |
|
- | 89 | shl ebx, 16 |
|
79 | 90 | add ebx, dword[bottom_middle_strings] |
|
- | 91 | mcall 4, ,[navigation_strings_color],press_to_start |
|
- | 92 | mov ebx, [window_width] |
|
- | 93 | shr ebx, 1 |
|
- | 94 | sub ebx, (string_congratulations-press_esc_to_exit-1)*3+6 |
|
- | 95 | shl ebx, 16 |
|
80 | mcall 4,153*65536+BOTTOM_MIDDLE_STRINGS,[navigation_strings_color],press_to_start |
96 | add ebx, [top_strings] |
81 | mcall ,213*65536+TOP_STRINGS,[navigation_strings_color],press_esc_to_exit |
97 | mcall , ,[navigation_strings_color],press_esc_to_exit |
82 | ; mcall ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options |
98 | ; mcall ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options |
83 | 99 | ||
84 | ret |
100 | ret |
85 | 101 | ||
86 | ;;---Make_menu_strings----------------------------------------------------------------------------------------- |
102 | ;;---Make_menu_strings----------------------------------------------------------------------------------------- |
87 | 103 | ||
88 | ;;---Some_functions------------------------------------------------------------------------------------------------------------ |
104 | ;;---Some_functions------------------------------------------------------------------------------------------------------------ |