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