Subversion Repositories Kolibri OS

Rev

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