2010-07-15 14:37:55 +02:00
|
|
|
;;===Game_over_mode============================================================================================================
|
|
|
|
|
|
|
|
Game_over:
|
|
|
|
|
2010-10-24 21:11:32 +02:00
|
|
|
cmp [play_mode], LEVELS_MODE
|
|
|
|
jne @f
|
|
|
|
dec [lives]
|
|
|
|
jz @f
|
|
|
|
call Draw_splash
|
|
|
|
jmp Level_begin
|
|
|
|
@@:
|
|
|
|
|
|
|
|
mov byte[window_title+5], 0
|
|
|
|
mcall 71,1,window_title
|
|
|
|
mcall 66,1,0 ; set ascii mode for keyboard
|
2010-08-14 15:58:36 +02:00
|
|
|
call Show_cursor
|
|
|
|
|
2010-07-15 14:37:55 +02:00
|
|
|
mov ebx, [score]
|
2010-08-14 15:58:36 +02:00
|
|
|
|
|
|
|
cmp [play_mode], CLASSIC_MODE
|
|
|
|
jne @f
|
|
|
|
cmp ebx, [hi_score_classic]
|
|
|
|
jng .redraw
|
|
|
|
mov [is_new_record], 1
|
|
|
|
jmp .done
|
|
|
|
@@:
|
|
|
|
cmp ebx, [hi_score_levels]
|
2010-07-19 16:59:30 +02:00
|
|
|
jng .redraw
|
2010-07-15 14:37:55 +02:00
|
|
|
mov [is_new_record], 1
|
2010-08-14 15:58:36 +02:00
|
|
|
jmp .done
|
|
|
|
.done:
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
mcall 40,100111b ; set events: standart + mouse
|
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
.redraw:
|
2010-10-24 21:11:32 +02:00
|
|
|
call Set_geometry
|
2010-07-15 14:37:55 +02:00
|
|
|
mcall 12,1
|
2010-07-19 16:59:30 +02:00
|
|
|
mcall 0, , ,[window_style], ,window_title
|
2011-08-18 19:30:58 +02:00
|
|
|
test [proc_info.wnd_state], 0x04 ; is rolled up?
|
|
|
|
jnz @f
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
call Draw_decorations
|
|
|
|
call Draw_game_over_picture
|
2010-07-19 16:59:30 +02:00
|
|
|
call Draw_game_over_strings ; edit_box is here
|
2010-07-15 14:37:55 +02:00
|
|
|
mcall 12,2
|
2011-08-18 19:30:58 +02:00
|
|
|
@@:
|
2010-07-19 16:59:30 +02:00
|
|
|
.still:
|
2010-07-15 14:37:55 +02:00
|
|
|
mcall 10 ; wait for event
|
|
|
|
; ok, what an event?
|
|
|
|
dec al ; has the window been moved or resized?
|
2010-07-19 16:59:30 +02:00
|
|
|
jz .redraw
|
2010-07-15 14:37:55 +02:00
|
|
|
dec al ; was a key pressed?
|
2010-07-19 16:59:30 +02:00
|
|
|
jz .key
|
2010-07-15 14:37:55 +02:00
|
|
|
dec al ; was a button pressed?
|
2010-07-19 16:59:30 +02:00
|
|
|
jz .button
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
.mouse: ; mouse event received
|
2010-08-14 15:58:36 +02:00
|
|
|
invoke edit_box.mouse, edit1
|
2010-07-15 14:37:55 +02:00
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
jmp .still
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
.key: ; a key was pressed
|
2010-07-15 14:37:55 +02:00
|
|
|
mcall 2 ; get keycode
|
|
|
|
|
2010-08-14 15:58:36 +02:00
|
|
|
cmp [is_new_record], 1
|
|
|
|
je .key.is_record
|
|
|
|
|
|
|
|
cmp ah, 0x1B ; Escape - go to menu
|
|
|
|
jne .still
|
|
|
|
jmp First_menu
|
|
|
|
|
|
|
|
.key.is_record:
|
2010-07-15 14:37:55 +02:00
|
|
|
cmp ah, 0x0D ; Enter
|
|
|
|
jnz @f
|
|
|
|
call Score_and_name_store
|
|
|
|
jmp First_menu
|
|
|
|
@@:
|
2010-08-14 15:58:36 +02:00
|
|
|
invoke edit_box.key, edit1
|
2010-07-19 16:59:30 +02:00
|
|
|
jmp .still
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
.button: ; a button was pressed
|
2010-07-15 14:37:55 +02:00
|
|
|
mcall 17 ; get button number
|
|
|
|
shr eax, 8 ; we should do it to get the real button code
|
|
|
|
|
|
|
|
cmp eax, 1
|
2010-08-14 15:58:36 +02:00
|
|
|
je Save_do_smth_else_and_exit
|
2010-07-15 14:37:55 +02:00
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
jmp .still
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
;;---Game_over_mode------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
;;===Some_functions============================================================================================================
|
|
|
|
|
|
|
|
Draw_game_over_picture:
|
|
|
|
;;===Draw_game_over_picture================================================================================================
|
|
|
|
|
2010-08-14 15:58:36 +02:00
|
|
|
cmp [is_new_record], 1
|
|
|
|
je @f
|
|
|
|
mov ax, 1*0x100+26
|
2010-07-19 16:59:30 +02:00
|
|
|
mov cx, 1*0x100+13
|
2010-07-15 14:37:55 +02:00
|
|
|
mov edx, [game_over_picture_color]
|
2010-07-19 16:59:30 +02:00
|
|
|
mov esi, picture_game_over
|
2010-08-14 15:58:36 +02:00
|
|
|
jmp .done
|
|
|
|
@@:
|
2011-01-20 12:49:34 +01:00
|
|
|
mov ax, 1*0x100+26
|
2010-08-14 15:58:36 +02:00
|
|
|
mov cx, 1*0x100+12
|
|
|
|
mov edx, [you_win_picture_color]
|
|
|
|
mov esi, picture_you_win
|
|
|
|
.done:
|
2010-07-15 14:37:55 +02:00
|
|
|
call Draw_picture
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
;;---Draw_game_over_picture------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
Draw_game_over_strings:
|
|
|
|
;;===Draw_game_over_strings================================================================================================
|
2010-07-19 16:59:30 +02:00
|
|
|
|
2010-07-15 14:37:55 +02:00
|
|
|
cmp [is_new_record], 1
|
|
|
|
jnz @f
|
|
|
|
|
2010-07-19 16:59:30 +02:00
|
|
|
mov ebx, [window_width]
|
|
|
|
shr ebx, 1
|
2010-08-14 15:58:36 +02:00
|
|
|
sub ebx, string_congratulations.size*3+6*6
|
2010-07-19 16:59:30 +02:00
|
|
|
shl ebx, 16
|
|
|
|
add ebx, [bottom_top_strings]
|
|
|
|
mcall 4, ,[game_over_strings_color],string_congratulations
|
|
|
|
mov ebx, [window_width]
|
|
|
|
shr ebx, 1
|
2010-08-14 15:58:36 +02:00
|
|
|
sub ebx, string_enter_your_name.size*3+6*6
|
2010-07-19 16:59:30 +02:00
|
|
|
shl ebx, 16
|
|
|
|
add ebx, [bottom_bottom_strings]
|
|
|
|
mcall , , ,string_enter_your_name
|
|
|
|
mov ebx, [window_width]
|
|
|
|
shr ebx, 1
|
2010-08-14 15:58:36 +02:00
|
|
|
sub ebx, string_apply_name_enter.size*3
|
2010-07-19 16:59:30 +02:00
|
|
|
shl ebx, 16
|
|
|
|
add ebx, [top_strings]
|
|
|
|
mcall , ,[navigation_strings_color],string_apply_name_enter
|
|
|
|
mov edx, [window_width]
|
|
|
|
shr edx, 1
|
2010-08-14 15:58:36 +02:00
|
|
|
add edx, string_congratulations.size*3-6*6-1
|
2010-07-19 16:59:30 +02:00
|
|
|
shl edx, 16
|
|
|
|
add edx, dword[bottom_top_strings]
|
|
|
|
mcall 47,0x00070000,[score], ,[game_over_hiscore_color]
|
|
|
|
mov ebx, [window_width]
|
|
|
|
shr ebx, 1
|
2010-08-14 15:58:36 +02:00
|
|
|
add ebx, string_enter_your_name.size*3-6*6-3
|
|
|
|
mov [edit1.left], ebx
|
|
|
|
invoke edit_box.draw, edit1
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
ret
|
2010-07-19 16:59:30 +02:00
|
|
|
|
2010-07-15 14:37:55 +02:00
|
|
|
@@:
|
2010-07-19 16:59:30 +02:00
|
|
|
|
2010-07-15 14:37:55 +02:00
|
|
|
call Draw_menu_esc
|
|
|
|
|
|
|
|
ret
|
2010-07-19 16:59:30 +02:00
|
|
|
|
2010-07-15 14:37:55 +02:00
|
|
|
;;---Draw_game_over_strings------------------------------------------------------------------------------------------------
|
2010-07-19 16:59:30 +02:00
|
|
|
|
|
|
|
|
2010-07-15 14:37:55 +02:00
|
|
|
Score_and_name_store:
|
|
|
|
;;===Name_store============================================================================================================
|
|
|
|
|
2010-08-14 15:58:36 +02:00
|
|
|
mov esi, hed
|
|
|
|
|
|
|
|
cmp [play_mode], CLASSIC_MODE
|
|
|
|
jne @f
|
|
|
|
mov edi, champion_name_classic
|
|
|
|
jmp .done
|
|
|
|
@@:
|
|
|
|
mov edi, champion_name_levels
|
|
|
|
.done:
|
|
|
|
|
|
|
|
mov ecx, CHAMPION_NAME_LENGTH
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
mov eax, [score]
|
|
|
|
|
|
|
|
cmp [play_mode], CLASSIC_MODE
|
|
|
|
jne @f
|
|
|
|
mov [hi_score_classic], eax
|
|
|
|
jmp .done2
|
|
|
|
@@:
|
|
|
|
mov [hi_score_levels], eax
|
|
|
|
.done2:
|
2010-07-15 14:37:55 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
;;---Name_store------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2011-08-18 19:30:58 +02:00
|
|
|
;;---Some_functions------------------------------------------------------------------------------------------------------------
|