Subversion Repositories Kolibri OS

Rev

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