Subversion Repositories Kolibri OS

Rev

Rev 1522 | Rev 1677 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1522 Rev 1566
Line 1... Line 1...
1
;;===First_menu_mode===========================================================================================================
1
;;===First_menu_mode===========================================================================================================
Line 2... Line 2...
2
 
2
 
-
 
3
First_menu:
-
 
4
      mcall     40,111b                         ; set events: standart
-
 
5
    mov  [is_new_record],   0
Line 3... Line -...
3
First_menu:
-
 
4
 
6
      call      Show_cursor
5
    mov [snake_length_x2],  6
-
 
6
    mov word[snake_dots],   0x0303
-
 
7
    mov dword[snake_dots+2],    0x03050304
7
 
Line 8... Line 8...
8
    mov [snake_napravlenie],    3
8
    mov  [score],   0
9
    mov [snake_napravlenie_next],   3
9
      call      Set_first_level_of_play_mode
10
 
10
 
11
  .redraw:
11
  .redraw:
Line 19... Line 19...
19
      mcall     0, , ,[window_style], ,window_title
19
      mcall     0, , ,[window_style], ,window_title
Line 20... Line 20...
20
 
20
 
21
    call    Draw_decorations
21
      call      Draw_decorations
22
    call    Draw_first_menu_picture
22
      call      Draw_first_menu_picture
-
 
23
      call      Draw_menu_strings
Line 23... Line 24...
23
    call    Draw_menu_strings
24
      call      Draw_buttons
Line 24... Line 25...
24
 
25
 
25
      mcall     12,2
26
      mcall     12,2
Line 36... Line 37...
36
  .button:                                      ; a button was pressed
37
  .button:                                      ; a button was pressed
37
      mcall     17                              ; get button number
38
      mcall     17                              ; get button number
38
    shr  eax, 8                                 ; we should do it to get the real button code
39
    shr  eax, 8                                 ; we should do it to get the real button code
Line 39... Line 40...
39
 
40
 
40
    cmp  eax, 1                                 ; is it close button?
41
    cmp  eax, 1                                 ; is it close button?
-
 
42
     je  Save_do_smth_else_and_exit             ; if so, jump to quit...
-
 
43
    cmp  eax, 0xD0                              ; 'play' button?
-
 
44
     je  Level_begin
-
 
45
    cmp  eax, 0xD1                              ; 'exit' button?
-
 
46
     je  Save_do_smth_else_and_exit
-
 
47
    cmp  eax, 0xD2                              ; change play mode button?
-
 
48
     jne @f
-
 
49
      call      Change_play_mode
-
 
50
      call      Delete_buttons
-
 
51
      call      Draw_buttons
-
 
52
     jmp .still                                 ; jump to wait for another event
-
 
53
  @@:
-
 
54
    cmp  eax, 0xD3                              ; '+INC+' button?
-
 
55
     jne @f
-
 
56
      call      Increase_geometry
-
 
57
     jmp .redraw                                ; jump to wait for another event
-
 
58
  @@:
-
 
59
    cmp  eax, 0xD4                              ; '-dec-' button?
-
 
60
     jne @f
-
 
61
      call      Decrease_geometry
-
 
62
     jmp .redraw                                ; jump to wait for another event
Line 41... Line 63...
41
     je  Exit                                   ; if so, jump to quit...
63
  @@:
Line 42... Line 64...
42
 
64
 
43
     jmp .still                                 ; jump to wait for another event
65
     jmp .still                                 ; jump to wait for another event
Line 44... Line 66...
44
 
66
 
45
 
67
 
46
  .key:                                         ; a key was pressed
68
  .key:                                         ; a key was pressed
47
      mcall     2                               ; get keycode
69
      mcall     2                               ; get keycode
48
 
70
 
-
 
71
    cmp  ah, 0x1B                               ; Escape
-
 
72
     je  Save_do_smth_else_and_exit
49
    cmp  ah, 0x1B                               ; Escape
73
    cmp  ah, 0x0D                               ; Enter
-
 
74
     je  Level_begin
-
 
75
    cmp  ah, 0x20                               ; Space
50
     je  Exit
76
     jne @f
51
    cmp  ah, 0x0D                               ; Enter
77
      call      Change_play_mode
Line 52... Line 78...
52
     je  Level_begin
78
      call      Delete_buttons
Line 53... Line 79...
53
    cmp  ah, 0x20                               ; Space
79
      call      Draw_buttons
Line 54... Line 80...
54
     je  Level_begin
80
     jmp .still                                 ; jump to wait for another event
55
 
81
  @@:
Line 56... Line 82...
56
     jmp .still                                 ; jump to wait for another event
82
     jmp .still                                 ; jump to wait for another event
57
 
83
 
58
;;---First_menu_mode-----------------------------------------------------------------------------------------------------------
84
;;---First_menu_mode-----------------------------------------------------------------------------------------------------------
59
 
85
 
60
 
86
 
Line 61... Line 87...
61
;;===Some_functions============================================================================================================
87
;;===Some_functions============================================================================================================
62
 
88
 
63
Draw_first_menu_picture:
89
Draw_first_menu_picture:
64
    ;;===Draw_first_menu_picture================================================================================================
90
    ;;===Draw_first_menu_picture================================================================================================
65
 
91
 
Line 66... Line 92...
66
    mov  ax,  0*0x100+29
92
    mov  ax,  2*0x100+24
Line 67... Line 93...
67
    mov  cx,  1*0x100+6
93
    mov  cx,  1*0x100+5
Line 68... Line 94...
68
    mov  edx, [snake_picture_color]
94
    mov  edx, [snake_picture_color]
69
    mov  esi, picture_first_menu_snake
95
    mov  esi, picture_first_menu_snake
Line 70... Line 96...
70
      call      Draw_picture
96
      call      Draw_picture
71
 
97
 
72
    mov  ax,  9*0x100+11
98
    mov  ax,  3*0x100+11
73
    mov  cx,  9*0x100+5
99
    mov  cx,  8*0x100+5
74
    mov  edx, [version_picture_color]
100
    mov  edx, [version_picture_color]
75
    mov  esi, picture_first_menu_version
101
    mov  esi, picture_first_menu_version
76
      call      Draw_picture
102
      call      Draw_picture
77
 
103
 
78
    ret
104
    ret
79
            
105
            
80
    ;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------
106
    ;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------
81
 
107
 
82
 
108
 
Line 83... Line 109...
83
Draw_menu_strings:
109
Draw_menu_strings:
Line 84... Line 110...
84
    ;;===Make_menu_strings=========================================================================================
110
    ;;===Make_menu_strings======================================================================================================
-
 
111
 
-
 
112
    mov  ebx, [window_width]
-
 
113
    shr  ebx, 1
-
 
114
    sub  ebx, press_to_start.size*3+6
-
 
115
    shl  ebx, 16
-
 
116
    add  ebx, dword[bottom_middle_strings]
-
 
117
      mcall     4, ,[navigation_strings_color],press_to_start
-
 
118
    mov  ebx, [window_width]
-
 
119
    shr  ebx, 1
-
 
120
    sub  ebx, press_esc_to_exit.size*3+6
-
 
121
    shl  ebx, 16
-
 
122
    add  ebx, [top_strings]
-
 
123
      mcall     , ,[navigation_strings_color],press_esc_to_exit
-
 
124
;      mcall     ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options
-
 
125
 
-
 
126
    ret
-
 
127
 
-
 
128
    ;;---Make_menu_strings------------------------------------------------------------------------------------------------------
-
 
129
 
-
 
130
 
-
 
131
Draw_buttons:
-
 
132
    ;;===Draw_buttons===========================================================================================================
-
 
133
 
-
 
134
    mov  ebx, [button_x_left]
-
 
135
    shl  ebx, 16
-
 
136
    mov  bx,  word[button_width_short]
-
 
137
    mov  ecx, [button_y_top]
-
 
138
    shl  ecx, 16
-
 
139
    add  cx,  word[button_height]
-
 
140
      mcall     8, , ,0x000000D0,[button_color]                             ; top left button
-
 
141
    shr  ecx, 16
-
 
142
    mov  bx,  cx
-
 
143
    mov  edx, [button_height]
-
 
144
    shr  edx, 1
-
 
145
    sub  edx, 3                                                             ; ~half of font height
-
 
146
    add  bx,  dx
-
 
147
    ror  ebx, 16
-
 
148
    mov  edx, [button_width_short]
-
 
149
    shr  edx, 1
-
 
150
    sub  edx, string_button_play.size*3
-
 
151
    add  bx,  dx
-
 
152
    ror  ebx, 16
-
 
153
      mcall     4, ,[button_text_color],string_button_play
-
 
154
 
-
 
155
    mov  ebx, [button_x_right]
-
 
156
    shl  ebx, 16
-
 
157
    mov  bx,  word[button_width_short]
-
 
158
    mov  ecx, [button_y_top]
-
 
159
    shl  ecx, 16
-
 
160
    add  cx,  word[button_height]
-
 
161
      mcall     8, , ,0x000000D1,                                           ; top right button
-
 
162
    shr  ecx, 16
-
 
163
    mov  bx,  cx
-
 
164
    mov  edx, [button_height]
-
 
165
    shr  edx, 1
-
 
166
    sub  edx, 3                                                             ; ~half of font height
-
 
167
    add  bx,  dx
-
 
168
    ror  ebx, 16
-
 
169
    mov  edx, [button_width_short]
-
 
170
    shr  edx, 1
-
 
171
    sub  edx, string_button_exit.size*3
-
 
172
    add  bx,  dx
-
 
173
    ror  ebx, 16
-
 
174
      mcall     4, ,[button_text_color],string_button_exit
-
 
175
 
-
 
176
    mov  ebx, [button_x_left]
-
 
177
    shl  ebx, 16
-
 
178
    mov  bx,  word[button_width_long]
-
 
179
    mov  ecx, [button_y_middle]
-
 
180
    shl  ecx, 16
-
 
181
    add  cx,  word[button_height]
-
 
182
      mcall     8, , ,0x000000D2,                                           ; middle button
-
 
183
    shr  ecx, 16
-
 
184
    mov  bx,  cx
-
 
185
    mov  edi, [button_height]
-
 
186
    shr  edi, 1
-
 
187
    sub  edi, 3                                                             ; ~half of font height
-
 
188
    add  bx,  di
-
 
189
    ror  ebx, 16
-
 
190
    mov  edi, [button_width_long]
-
 
191
    shr  edi, 1
-
 
192
    cmp  [play_mode],   0
-
 
193
     jne @f
-
 
194
    sub  edi, string_button_pm_classic.size*3
-
 
195
    mov  edx, string_button_pm_classic
-
 
196
     jmp .skip
-
 
197
  @@:
-
 
198
    sub  edi, string_button_pm_levels.size*3
-
 
199
    mov  edx, string_button_pm_levels
-
 
200
  .skip:
-
 
201
    add  bx,  di
-
 
202
    ror  ebx, 16
-
 
203
      mcall     4, ,[button_text_color],
-
 
204
 
-
 
205
    mov  ebx, [button_x_left]
-
 
206
    shl  ebx, 16
-
 
207
    mov  bx,  word[button_width_short]
-
 
208
    mov  ecx, [button_y_bottom]
-
 
209
    shl  ecx, 16
-
 
210
    add  cx,  word[button_height]
-
 
211
      mcall     8, , ,0x000000D3,                                           ; bottom left button
-
 
212
    shr  ecx, 16
-
 
213
    mov  bx,  cx
-
 
214
    mov  edx, [button_height]
-
 
215
    shr  edx, 1
-
 
216
    sub  edx, 3                                                             ; ~half of font height
-
 
217
    add  bx,  dx
-
 
218
    ror  ebx, 16
-
 
219
    mov  edx, [button_width_short]
-
 
220
    shr  edx, 1
-
 
221
    sub  edx, string_button_inc.size*3
-
 
222
    add  bx,  dx
-
 
223
    ror  ebx, 16
-
 
224
      mcall     4, ,[button_text_color],string_button_inc
-
 
225
 
-
 
226
    mov  ebx, [button_x_right]
-
 
227
    shl  ebx, 16
-
 
228
    mov  bx,  word[button_width_short]
-
 
229
    mov  ecx, [button_y_bottom]
-
 
230
    shl  ecx, 16
-
 
231
    add  cx,  word[button_height]
-
 
232
      mcall     8, , ,0x000000D4,
-
 
233
    shr  ecx, 16
-
 
234
    mov  bx,  cx
-
 
235
    mov  edx, [button_height]
-
 
236
    shr  edx, 1
-
 
237
    sub  edx, 3                                                             ; ~half of font height
-
 
238
    add  bx,  dx
-
 
239
    ror  ebx, 16
-
 
240
    mov  edx, [button_width_short]
-
 
241
    shr  edx, 1
-
 
242
    sub  edx, string_button_dec.size*3
-
 
243
    add  bx,  dx
-
 
244
    ror  ebx, 16
-
 
245
      mcall     4, ,[button_text_color],string_button_dec
-
 
246
 
-
 
247
    ret
-
 
248
 
-
 
249
    ;;---Draw_buttons----------------------------------------------------------------------------------------------------------
-
 
250
 
-
 
251
 
-
 
252
Delete_buttons:
-
 
253
    ;;===Delete_buttons========================================================================================================
-
 
254
 
-
 
255
      mcall     8,,,0x800000D0
-
 
256
      mcall      ,,,0x800000D1
-
 
257
      mcall      ,,,0x800000D2
-
 
258
      mcall      ,,,0x800000D3
-
 
259
      mcall      ,,,0x800000D4
-
 
260
 
-
 
261
    ret
-
 
262
 
-
 
263
    ;;---Delete_buttons--------------------------------------------------------------------------------------------------------
-
 
264
 
-
 
265
 
-
 
266
Change_play_mode:
-
 
267
    ;;===Change_play_mode======================================================================================================
-
 
268
 
-
 
269
    cmp  [play_mode],   LEVELS_MODE
-
 
270
     jne @f
-
 
271
    mov  [play_mode],   CLASSIC_MODE
-
 
272
    mov  [cur_level_number],   0
-
 
273
    ret
-
 
274
  @@:
-
 
275
    inc  [play_mode]
-
 
276
 
-
 
277
      call      Set_first_level_of_play_mode
-
 
278
 
-
 
279
    ret
-
 
280
 
Line 85... Line -...
85
 
-
 
86
    mov  ebx, [window_width]
281
    ;;---Change_play_mode------------------------------------------------------------------------------------------------------
-
 
282
 
87
    shr  ebx, 1
283