Subversion Repositories Kolibri OS

Rev

Rev 5263 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5259 mario79 1
;---------------------------------------------------------------------
5257 mario79 2
main_menu_start:
3
	mov	[main_menu_pointer],0
5259 mario79 4
;--------------------------------------
5257 mario79 5
.red:
5259 mario79 6
	mov	[menu_text_pointers],main_menu_text_pointers
7
	mov	[text_step_Y],SPRITE_SIZE_Y
5264 mario79 8
	mov	[use_separate_draw_text],1
5259 mario79 9
	call	draw_menu_window
10
	call	draw_new_pointer
5257 mario79 11
;---------------------------------------------------------------------
12
.still:
13
	mcall	10
14
 
15
	cmp	eax,1
16
	je	.red
17
 
18
	cmp	eax,2
19
	je	.key
20
 
21
	cmp	eax,3
22
	je	.button
23
 
24
	jmp	.still
25
;---------------------------------------------------------------------
26
.key:
27
	mcall	2
28
	cmp	[extended_key],1
29
	je	.extended_key
30
 
31
	test	al,al
32
	jnz	.still
33
 
5259 mario79 34
	cmp	ah,0xE0
35
	jne	@f
36
 
37
	mov	[extended_key],1
38
	jmp	.still
39
;--------------------------------------
40
@@:
5257 mario79 41
	cmp	ah,72	; arrow up
42
	je	.arrow_up
43
 
44
	cmp	ah,80	; arrow down
45
	je	.arrow_down
46
 
47
	cmp	ah,17	; w - arrow up
48
	je	.arrow_up
49
 
50
	cmp	ah,31	; s - arrow down
51
	je	.arrow_down
52
 
53
	cmp	ah,57	; space
54
	je	.enter_to_point
55
 
56
	cmp	ah,28	; enter
57
	je	.enter_to_point
58
 
59
	jmp	.still
60
;---------------------------------------------------------------------
61
.extended_key:
62
	mov	[extended_key],0
63
	cmp	ah,72	; arrow up
64
	je	.arrow_up
65
 
66
	cmp	ah,80	; arrow down
67
	je	.arrow_down
68
 
69
	jmp	.still
70
;---------------------------------------------------------------------
71
.arrow_up:
72
	cmp	[main_menu_pointer],0
73
	je	.still
74
 
5263 mario79 75
	call	snd_kick_action
5257 mario79 76
	call	clear_old_pointer
77
	dec	[main_menu_pointer]
78
	call	draw_new_pointer
79
	jmp	.still
80
;---------------------------------------------------------------------
81
.arrow_down:
82
	cmp	[main_menu_pointer],4
83
	je	.still
84
 
5263 mario79 85
	call	snd_kick_action
5257 mario79 86
	call	clear_old_pointer
87
	inc	[main_menu_pointer]
88
	call	draw_new_pointer
89
	jmp	.still
90
;---------------------------------------------------------------------
91
.enter_to_point:
5259 mario79 92
	cmp	[main_menu_pointer],0	; game
5257 mario79 93
	je	start_level_0
94
 
5259 mario79 95
	cmp	[main_menu_pointer],1	; settings
96
	je	settings_menu_start
97
 
98
	cmp	[main_menu_pointer],2	; credits
99
	je	menu_credits
100
 
101
	cmp	[main_menu_pointer],3	; help
102
	je	menu_help
103
 
104
	cmp	[main_menu_pointer],4	; exit
5257 mario79 105
	je	button.exit
106
 
107
	jmp	.still
108
;---------------------------------------------------------------------
109
.button:
110
	mcall	17
111
 
112
	cmp	ah,1
113
	jne	.still
114
 
115
	jmp	button.exit
116
;---------------------------------------------------------------------
117
clear_old_pointer:
118
	movzx	ecx,byte [main_menu_pointer]
119
	imul	ecx,SPRITE_SIZE_Y
5264 mario79 120
	add	ecx,SPRITE_SIZE_Y*3 - 16
5257 mario79 121
	shl	ecx,16
122
	mov	cx,SPRITE_SIZE_Y
123
	mcall	13,,,0
124
	ret
125
;---------------------------------------------------------------------
126
draw_new_pointer:
127
;	movzx	ecx,byte [main_menu_pointer]
128
;	imul	ecx,SPRITE_SIZE_Y
129
;	add	ecx,SPRITE_SIZE_Y*2
130
;	shl	ecx,16
131
;	mov	cx,SPRITE_SIZE_Y
132
;	mcall	13,,,0xff0000
5259 mario79 133
 
134
	movzx	edx,byte [main_menu_pointer]
135
	imul	edx,SPRITE_SIZE_Y
5264 mario79 136
	add	edx,SPRITE_SIZE_Y*3 - 16
5259 mario79 137
	add	edx,SPRITE_SIZE_X*2 shl 16
5257 mario79 138
 
139
	mov	eax,[npc_miku_icons]
140
	mov	ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*12
141
	call	copy_base_8bpp
142
 
143
	xor	ebp,ebp
144
	mcall	65,buffer_area,,,32
145
	ret
146
;---------------------------------------------------------------------
5259 mario79 147
draw_menu_window:
5257 mario79 148
	mcall	12,1
149
	mcall	48,4
150
	mov	ecx,100 shl 16 + 644
151
	add	cx,ax
152
	mcall	0,<100,649>,,0x74AABBCC,,title
153
 
154
	call	clear_screen
155
 
156
	mov	eax,4
157
	mov	ebx,SPRITE_SIZE_X*3 shl 16 + SPRITE_SIZE_Y*3
158
	mov	ecx,0x90ffffff
5259 mario79 159
	mov	esi,[menu_text_pointers]
5257 mario79 160
;--------------------------------------
161
@@:
162
	mov	edx,[esi]
163
	test	edx,edx
164
	jz	.end
165
 
5264 mario79 166
	cmp	[use_separate_draw_text],1
167
	je	.use_separate_draw_text
168
 
5257 mario79 169
	mcall
5264 mario79 170
	jmp	.continue
171
;--------------------------------------
172
.use_separate_draw_text:
173
	call	draw_font
174
;--------------------------------------
175
.continue:
5259 mario79 176
	add	ebx,[text_step_Y]
5257 mario79 177
	add	esi,4
178
	jmp	@b
179
;--------------------------------------
180
.end:
181
 
182
	mcall	12,2
183
	ret
184
;---------------------------------------------------------------------
185
clear_screen:
186
	xor	edx,edx
187
	mcall	13,<0,SPRITE_SIZE_X*LEVEL_MAP_SIZE_X>,<0,SPRITE_SIZE_Y*LEVEL_MAP_SIZE_Y>
188
	ret
5259 mario79 189
;---------------------------------------------------------------------
190
menu_credits:
5263 mario79 191
	call	snd_kick_action
5259 mario79 192
	mov	[menu_text_pointers],menu_credits_text_pointers
193
	jmp	menu_help.1
194
;---------------------------------------------------------------------
195
menu_help:
5263 mario79 196
	call	snd_kick_action
5259 mario79 197
	mov	[menu_text_pointers],menu_help_text_pointers
198
;--------------------------------------
5264 mario79 199
.1:
5259 mario79 200
	mov	[text_step_Y],20
201
;--------------------------------------
202
.red:
5264 mario79 203
	mov	[use_separate_draw_text],0
5259 mario79 204
	call	draw_menu_window
205
;---------------------------------------------------------------------
206
.still:
207
	mcall	10
208
 
209
	cmp	eax,1
210
	je	.red
211
 
212
	cmp	eax,2
213
	je	.key
214
 
215
	cmp	eax,3
216
	je	.button
217
 
218
	jmp	.still
219
;---------------------------------------------------------------------
220
.key:
221
	mcall	2
222
	cmp	[extended_key],1
223
	je	.extended_key
224
 
225
	test	al,al
226
	jnz	.still
227
 
228
	cmp	ah,0xE0
229
	jne	@f
230
 
231
	mov	[extended_key],1
232
	jmp	.still
233
;--------------------------------------
234
@@:
235
	cmp	ah,57	; space
236
	je	main_menu_start.red
237
 
238
	cmp	ah,28	; enter
239
	je	main_menu_start.red
240
 
241
	jmp	.still
242
;---------------------------------------------------------------------
243
.extended_key:
244
	mov	[extended_key],0
245
 
246
	jmp	.still
247
;---------------------------------------------------------------------
248
.button:
249
	mcall	17
250
 
251
	cmp	ah,1
252
	jne	.still
253
 
254
	jmp	button.exit
255
;---------------------------------------------------------------------
256
settings_menu_start:
5263 mario79 257
	call	snd_kick_action
5259 mario79 258
	mov	al,[main_menu_pointer]
259
	mov	[settings_menu_pointer],al
260
	xor	al,al
261
	mov	[main_menu_pointer],al
262
;--------------------------------------
263
.red:
264
	mov	[menu_text_pointers],settings_menu_text_pointers
265
	mov	[text_step_Y],SPRITE_SIZE_Y
266
	call	prepare_settings_text
5264 mario79 267
	mov	[use_separate_draw_text],1
5259 mario79 268
	call	draw_menu_window
269
	call	draw_new_pointer
270
;---------------------------------------------------------------------
271
.still:
272
	mcall	10
273
 
274
	cmp	eax,1
275
	je	.red
276
 
277
	cmp	eax,2
278
	je	.key
279
 
280
	cmp	eax,3
281
	je	.button
282
 
283
	jmp	.still
284
;---------------------------------------------------------------------
285
.key:
286
	mcall	2
287
	cmp	[extended_key],1
288
	je	.extended_key
289
 
290
	test	al,al
291
	jnz	.still
292
 
293
	cmp	ah,0xE0
294
	jne	@f
295
 
296
	mov	[extended_key],1
297
	jmp	.still
298
;--------------------------------------
299
@@:
300
	cmp	ah,72	; arrow up
301
	je	.arrow_up
302
 
303
	cmp	ah,80	; arrow down
304
	je	.arrow_down
305
 
306
	cmp	ah,17	; w - arrow up
307
	je	.arrow_up
308
 
309
	cmp	ah,31	; s - arrow down
310
	je	.arrow_down
311
 
312
	cmp	ah,57	; space
313
	je	.enter_to_point
314
 
315
	cmp	ah,28	; enter
316
	je	.enter_to_point
317
 
318
	jmp	.still
319
;---------------------------------------------------------------------
320
.extended_key:
321
	mov	[extended_key],0
322
	cmp	ah,72	; arrow up
323
	je	.arrow_up
324
 
325
	cmp	ah,80	; arrow down
326
	je	.arrow_down
327
 
328
	jmp	.still
329
;---------------------------------------------------------------------
330
.arrow_up:
331
	cmp	[main_menu_pointer],0
332
	je	.still
333
 
5263 mario79 334
	call	snd_kick_action
5259 mario79 335
	call	clear_old_pointer
336
	dec	[main_menu_pointer]
337
	call	draw_new_pointer
338
	jmp	.still
339
;---------------------------------------------------------------------
340
.arrow_down:
341
	cmp	[main_menu_pointer],2
342
	je	.still
343
 
5263 mario79 344
	call	snd_kick_action
5259 mario79 345
	call	clear_old_pointer
346
	inc	[main_menu_pointer]
347
	call	draw_new_pointer
348
	jmp	.still
349
;---------------------------------------------------------------------
350
.enter_to_point:
351
	cmp	[main_menu_pointer],0	; sounds
352
	jne	@f
353
 
354
	inc	[sounds_flag]
355
	and	[sounds_flag],1b
356
	jmp	.red
357
;--------------------------------------
358
@@:
359
	cmp	[main_menu_pointer],1	; music
360
	jne	@f
361
 
362
	inc	[music_flag]
363
	and	[music_flag],1b
364
	jmp	.red
365
;--------------------------------------
366
@@:
367
	cmp	[main_menu_pointer],2	; exit
368
	jne	.still
369
 
5263 mario79 370
	call	snd_kick_action
5259 mario79 371
	mov	al,[settings_menu_pointer]
372
	mov	[main_menu_pointer],al
373
 
374
	jmp	main_menu_start.red
375
;---------------------------------------------------------------------
376
.button:
377
	mcall	17
378
 
379
	cmp	ah,1
380
	jne	.still
381
 
382
	jmp	button.exit
383
;---------------------------------------------------------------------
384
prepare_settings_text:
385
	mov	eax,[text_on_label]
386
	cmp	[sounds_flag],1
387
	je	@f
388
 
389
	mov	eax,[text_off_label]
390
;--------------------------------------
391
@@:
392
	mov	[menu_settings_sound_label+7],eax
393
;--------------------------------------
394
	mov	eax,[text_on_label]
395
	cmp	[music_flag],1
396
	je	@f
397
 
398
	mov	eax,[text_off_label]
399
;--------------------------------------
400
@@:
401
	mov	[menu_settings_music_label+7],eax
402
	ret
5257 mario79 403
;---------------------------------------------------------------------