Subversion Repositories Kolibri OS

Rev

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
;;===Game_over_mode============================================================================================================
2
 
3
Game_over:
4
 
5
    mov  ebx, [score]
6
    cmp  ebx, [hi_score]
1522 dunkaist 7
     jng .redraw
1518 dunkaist 8
 
9
    mov  [is_new_record], 1
10
 
11
      mcall     40,100111b                      ; set events: standart + mouse
12
 
1522 dunkaist 13
  .redraw:
1518 dunkaist 14
      mcall     12,1
1522 dunkaist 15
    mov  ebx, [wp_x]
16
    shl  ebx, 16
17
    add  ebx, dword[window_width]
18
    mov  ecx, [wp_y]
19
    shl  ecx, 16
20
    add  ecx, dword[window_height]
21
      mcall     0, , ,[window_style], ,window_title
1518 dunkaist 22
 
23
      call      Draw_decorations
24
      call      Draw_game_over_picture
1522 dunkaist 25
      call      Draw_game_over_strings          ; edit_box is here
1518 dunkaist 26
 
27
      mcall     12,2
28
 
1522 dunkaist 29
  .still:
1518 dunkaist 30
      mcall     10                              ; wait for event
31
                                                ; ok, what an event?
32
    dec  al                                     ; has the window been moved or resized?
1522 dunkaist 33
     jz  .redraw
1518 dunkaist 34
    dec  al                                     ; was a key pressed?
1522 dunkaist 35
     jz  .key
1518 dunkaist 36
    dec  al                                     ; was a button pressed?
1522 dunkaist 37
     jz  .button
1518 dunkaist 38
 
39
 
1522 dunkaist 40
  .mouse:                                       ; mouse event received
1518 dunkaist 41
    push dword edit1
42
      call      [edit_box.mouse]
43
 
1522 dunkaist 44
     jmp .still
1518 dunkaist 45
 
46
 
1522 dunkaist 47
  .key:                                         ; a key was pressed
1518 dunkaist 48
      mcall     2                               ; get keycode
49
 
50
    cmp  [is_new_record], 1
1522 dunkaist 51
     jnz .key.skip
1518 dunkaist 52
 
53
    cmp  ah,  0x0D                              ; Enter
54
     jnz @f
55
      call      Score_and_name_store
56
    mov  [is_new_record],   0
57
      mcall     40,111b                         ; set events: standart
58
     jmp First_menu
59
 
60
  @@:
61
    push    dword edit1
62
    call    [edit_box.key]
63
 
1522 dunkaist 64
     jmp .still
65
  .key.skip:
1518 dunkaist 66
 
67
    cmp  ah,  0x1B                              ; Escape - go to menu
1522 dunkaist 68
     jne  .still
1518 dunkaist 69
 
70
      mcall     40,111b                         ; set events: standart
71
     jmp First_menu
72
 
73
 
1522 dunkaist 74
  .button:                                      ; a button was pressed
1518 dunkaist 75
      mcall     17                              ; get button number
76
    shr  eax, 8                                 ; we should do it to get the real button code
77
 
78
    cmp  eax, 1
79
     je  Exit
80
 
1522 dunkaist 81
     jmp .still
1518 dunkaist 82
 
83
;;---Game_over_mode------------------------------------------------------------------------------------------------------------
84
 
85
 
86
;;===Some_functions============================================================================================================
87
 
88
Draw_game_over_picture:
89
    ;;===Draw_game_over_picture================================================================================================
90
 
1522 dunkaist 91
    mov  ax,  0*0x100+29
92
    mov  cx,  1*0x100+13
1518 dunkaist 93
    mov  edx, [game_over_picture_color]
1522 dunkaist 94
    mov  esi, picture_game_over
1518 dunkaist 95
      call      Draw_picture
96
 
97
    ret
98
 
99
    ;;---Draw_game_over_picture------------------------------------------------------------------------------------------------
100
 
101
 
102
Draw_game_over_strings:
103
    ;;===Draw_game_over_strings================================================================================================
1522 dunkaist 104
 
1518 dunkaist 105
    cmp  [is_new_record], 1
106
     jnz @f
107
 
1522 dunkaist 108
    mov  ebx, [window_width]
109
    shr  ebx, 1
110
    sub  ebx, (string_enter_your_name-string_congratulations-1+8)*3+6
111
    shl  ebx, 16
112
    add  ebx, [bottom_top_strings]
113
      mcall     4, ,[game_over_strings_color],string_congratulations
114
    mov  ebx, [window_width]
115
    shr  ebx, 1
116
    sub  ebx, (strings_end-string_enter_your_name-1+8)*3+6
117
;    add  ebx, (strings_end-string_enter_your_name)*6
118
    shl  ebx, 16
119
    add  ebx, [bottom_bottom_strings]
120
      mcall      , , ,string_enter_your_name
121
    mov  ebx, [window_width]
122
    shr  ebx, 1
123
    sub  ebx, (press_to_start-string_apply_name_enter-1)*3+6
124
    shl  ebx, 16
125
    add  ebx, [top_strings]
126
      mcall      , ,[navigation_strings_color],string_apply_name_enter
127
    mov  edx, [window_width]
128
    shr  edx, 1
129
    sub  edx, (string_enter_your_name-string_congratulations-1+8)*3+7
130
    add  edx, (string_enter_your_name-string_congratulations)*6
131
    shl  edx, 16
132
    add  edx, dword[bottom_top_strings]
133
      mcall     47,0x00070000,[score], ,[game_over_hiscore_color]
134
    mov  ebx, [window_width]
135
    shr  ebx, 1
136
    sub  ebx, (strings_end-string_enter_your_name-1+8)*3+9
137
    add  ebx, (strings_end-string_enter_your_name)*6
138
    mov  [edit1+0x04],  ebx
139
    push    dword edit1
140
      call      [edit_box.draw]
1518 dunkaist 141
 
142
    ret
1522 dunkaist 143
 
1518 dunkaist 144
  @@:
1522 dunkaist 145
 
1518 dunkaist 146
    call    Draw_menu_esc
147
 
148
    ret
1522 dunkaist 149
 
1518 dunkaist 150
    ;;---Draw_game_over_strings------------------------------------------------------------------------------------------------
1522 dunkaist 151
 
152
 
1518 dunkaist 153
Score_and_name_store:
154
    ;;===Name_store============================================================================================================
155
 
156
      invoke    ini.set_str, cur_dir_path, aScore, aChampion_name, hed, 15
157
      invoke    ini.set_int, cur_dir_path, aScore, aHiscore, [score]
158
 
159
    ret
160
 
161
    ;;---Name_store------------------------------------------------------------------------------------------------------------
162
 
163
;;---Some_functions------------------------------------------------------------------------------------------------------------