Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1518 dunkaist 1
;;===HEADER====================================================================================================================
2
 
3
use32
4
    org 0x0
5
    db  'MENUET01'
1566 dunkaist 6
    dd  0x01,start,i_end,d_end,stacktop,0x0,cur_dir_path
1518 dunkaist 7
 
8
;;---HEADER--------------------------------------------------------------------------------------------------------------------
9
 
10
include '../../../proc32.inc'
11
include '../../../macros.inc'
3015 dunkaist 12
include '../../../dll.inc'
1518 dunkaist 13
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
2061 dunkaist 14
;include '../../../system/board/trunk/debug.inc'
1518 dunkaist 15
 
16
;;===Define_chapter============================================================================================================
17
 
1677 dunkaist 18
WINDOW_MODE_WINDOWED        equ     0
19
WINDOW_MODE_FULLSCREEN      equ     1
20
 
1566 dunkaist 21
GRID_WIDTH                  equ     28
22
GRID_HEIGHT                 equ     14
23
 
24
MIN_SQUARE_SIDE_LENGTH      equ     9
25
 
1518 dunkaist 26
SCORE_EAT                   equ     100
27
 
28
LEFT                        equ     0
29
DOWN                        equ     1
30
UP                          equ     2
31
RIGHT                       equ     3
32
 
1566 dunkaist 33
struct  LEVEL
1677 dunkaist 34
    field                   db      4*GRID_HEIGHT  dup (?)
1566 dunkaist 35
    snake_dots              db      6   dup (?)
36
    snake_direction         dd      ?
37
    snake_direction_next    dd      ?
38
    number_of_stones        dd      ?
1677 dunkaist 39
    name                    dd      ?
1566 dunkaist 40
ends
41
 
42
CLASSIC_MODE                equ     0
43
LEVELS_MODE                 equ     1
44
 
45
CLASSIC_MODE_FIRST_LEVEL    equ     0
46
LEVELS_MODE_FIRST_LEVEL     equ     1
47
 
1677 dunkaist 48
EAT_TO_END_LEVEL            equ     7
49
PAUSE_BETWEEN_LEVELS        equ     200
50
PAUSE_WHILE_DRAWING_SPLASH  equ     3
1566 dunkaist 51
 
52
CHAMPION_NAME_LENGTH        equ     15
1677 dunkaist 53
LAST_LEVEL_NUMBER           equ     36
1566 dunkaist 54
 
1677 dunkaist 55
START_LIVES                 equ     3
56
 
1518 dunkaist 57
;;---Define_chapter------------------------------------------------------------------------------------------------------------
58
 
59
start:
60
 
61
stdcall dll.Load,@IMPORT
62
    or   eax, eax
63
    jnz  Exit
64
 
65
align 4
66
 
1677 dunkaist 67
    mov  edi, cur_dir_path
68
    mov  al,  0
69
    mov  ecx, 4096
70
    repne scasb
71
    mov  dword[edi-1],    '.ini'
1518 dunkaist 72
 
1520 dunkaist 73
      invoke  ini.get_int, cur_dir_path, aPreferences, aSpeed, 80
1518 dunkaist 74
    neg  eax
75
    add  [time_wait_limit],    eax
1677 dunkaist 76
    mov  ebx, [time_wait_limit]
77
    mov  [time_wait_limit_const],  ebx
78
    sub  ebx, 4
79
    mov  eax, 200
80
    div  bl
81
    mov  byte[speed_up_counter],    al
82
    mov  byte[speed_up_counter+1],  al
1522 dunkaist 83
      invoke  ini.get_str, cur_dir_path, aPreferences, aTheme, aTheme_name, 31, aTheme_name
1677 dunkaist 84
      invoke  ini.get_int, cur_dir_path, aPreferences, aSmart_reverse, 0
85
    mov  [smart_reverse],   eax
86
      invoke  ini.get_int, cur_dir_path, aPreferences, aShow_lives_style, 2
87
    mov  [show_lives_style],    eax
88
      invoke  ini.get_int, cur_dir_path, aPreferences, aDraw_level_name_in_window_title, 1
89
    mov  [draw_level_name_in_window_title], eax
90
      invoke  ini.get_str, cur_dir_path, aPreferences, aSeparating_symbol, separating_symbol, 3, default_separating_symbol
1522 dunkaist 91
 
1677 dunkaist 92
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_left, 0x23, 0
93
    mov  [shortcut_move_left],  al
94
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_down, 0x24, 0
95
    mov  [shortcut_move_down],  al
96
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_up, 0x25, 0
97
    mov  [shortcut_move_up],    al
98
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_right, 0x26, 0
99
    mov  [shortcut_move_right], al
100
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aReverse, 0x0F, 0
101
    mov  [shortcut_reverse], al
102
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aIncrease, 0x16, 0
103
    mov  [shortcut_increase],   al
104
      invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aDecrease, 0x17, 0
105
    mov  [shortcut_decrease],   al
106
 
107
      invoke  ini.get_int, cur_dir_path, aTheme_name, aDecorations, 3
1566 dunkaist 108
    mov  [decorations], eax
1522 dunkaist 109
      invoke  ini.get_color, cur_dir_path, aTheme_name, aBackground_color, 0x000000
1518 dunkaist 110
    or   [background_color],    eax
1677 dunkaist 111
    or   [window_style_windowed],   eax
1566 dunkaist 112
      invoke  ini.get_color, cur_dir_path, aTheme_name, aDecorations_color, 0xAAAA00
1518 dunkaist 113
    or   [decorations_color],  eax
1522 dunkaist 114
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_color, 0x1111ff
1518 dunkaist 115
    or   [snake_color], eax
1566 dunkaist 116
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_head_color, 0x6B6Bff
1518 dunkaist 117
    or   [snake_head_color], eax
1677 dunkaist 118
      invoke  ini.get_color, cur_dir_path, aTheme_name, aLives_in_head_number_color, 0xff8800
119
    or   [lives_in_head_number_color],  eax
1522 dunkaist 120
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_picture_color, 0x4488ff
1518 dunkaist 121
    or   [snake_picture_color], eax
1522 dunkaist 122
      invoke  ini.get_color, cur_dir_path, aTheme_name, aVersion_picture_color, 0x55ff55
1518 dunkaist 123
    or   [version_picture_color],   eax
1522 dunkaist 124
      invoke  ini.get_color, cur_dir_path, aTheme_name, aPause_picture_color, 0x11ff11
1518 dunkaist 125
    or   [pause_picture_color], eax
1522 dunkaist 126
      invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_picture_color, 0xff1111
1518 dunkaist 127
    or   [game_over_picture_color], eax
1566 dunkaist 128
      invoke  ini.get_color, cur_dir_path, aTheme_name, aYou_win_picture_color, 0xffff11
129
    or   [you_win_picture_color],   eax
1522 dunkaist 130
      invoke  ini.get_color, cur_dir_path, aTheme_name, aEat_color, 0xffff11
1518 dunkaist 131
    or   [eat_color],   eax
1522 dunkaist 132
      invoke  ini.get_color, cur_dir_path, aTheme_name, aNavigation_strings_color, 0x80ff7777
1518 dunkaist 133
    or   [navigation_strings_color], eax
1522 dunkaist 134
      invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_strings_color, 0x80ff9900
1518 dunkaist 135
    or   [game_over_strings_color],  eax
1522 dunkaist 136
      invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_string_color, 0x80ffffff
1518 dunkaist 137
    or   [score_string_color],   eax
1566 dunkaist 138
      invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_string_color, 0xffffff
139
    or   [level_string_color],  eax
1522 dunkaist 140
      invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_string_color, 0x80ffffff
1518 dunkaist 141
    or   [hiscore_string_color],   eax
1522 dunkaist 142
      invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_string_color, 0x80ffffff
1518 dunkaist 143
    or   [champion_string_color],   eax
1522 dunkaist 144
      invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_hiscore_color, 0x80ffdd44
1518 dunkaist 145
    or   [game_over_hiscore_color], eax
1522 dunkaist 146
      invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_number_color, 0xffffff
1518 dunkaist 147
    or   [score_number_color],   eax
1566 dunkaist 148
      invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_number_color, 0xffffff
149
    or   [level_number_color],  eax
1522 dunkaist 150
      invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_number_color, 0x00ffffff
1518 dunkaist 151
    or   [hiscore_number_color],   eax
1522 dunkaist 152
      invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_name_color, 0x80ffffff
1518 dunkaist 153
    or   [champion_name_color],   eax
1522 dunkaist 154
      invoke  ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00
1566 dunkaist 155
    or   [edit1.shift_color],   eax
156
      invoke  ini.get_color, cur_dir_path, aTheme_name, aButton_color, 0xDDDDDD
157
    or   [button_color],    eax
158
      invoke  ini.get_color, cur_dir_path, aTheme_name, aButton_text_color, 0x000000
159
    or   [button_text_color],   eax
160
      invoke  ini.get_color, cur_dir_path, aTheme_name, aStone_color, 0x5f8700
161
    or   [stone_color], eax
162
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_background_color, 0xAAAA00
163
    or   [splash_background_color],    eax
164
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_level_number_color, 0x000000
165
    or   [splash_level_number_color],   eax
166
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_level_string_color, 0x000000
167
    or   [splash_level_string_color],   eax
1518 dunkaist 168
 
1566 dunkaist 169
      invoke  ini.get_int, cur_dir_path, aReserved, aSquare_side_length, 19
170
    mov  [square_side_length],  eax
171
      invoke  ini.get_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, CHAMPION_NAME_LENGTH, champion_name_classic
172
      invoke  ini.get_int, cur_dir_path, aReserved, aHiscore_classic, 777
173
    or   [hi_score_classic],    eax
174
      invoke  ini.get_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, CHAMPION_NAME_LENGTH, champion_name_levels
175
      invoke  ini.get_int, cur_dir_path, aReserved, aHiscore_levels, 777
176
    or   [hi_score_levels], eax
177
 
1520 dunkaist 178
    mov  eax, [background_color]
1566 dunkaist 179
    mov  [edit1.color], eax
180
    mov  [edit1.focus_border_color],    eax
181
    mov  [edit1.blur_border_color], eax
1520 dunkaist 182
    mov  eax, [game_over_hiscore_color]
1566 dunkaist 183
    mov  [edit1.text_color],    eax
1520 dunkaist 184
 
1566 dunkaist 185
      mcall     37,4,cursor_data,2                  ; load empty cursor (for "hiding" cursor while level_mode)
186
    mov  [cursor_handle],   eax
187
 
1677 dunkaist 188
    mov  eax, WINDOW_MODE_WINDOWED
189
      call      Set_window_mode
2061 dunkaist 190
      mcall     0,0,0,[window_style_windowed]       ; create empty window. Set_geometry will set all parameters
1677 dunkaist 191
      call      Set_geometry.by_hotkey
192
      mcall     71,1,window_title
1522 dunkaist 193
 
1518 dunkaist 194
include 'first_menu.asm'            ; First menu body and functions
195
include 'level.asm'                 ; Level body and functions (game process)
196
include 'pause.asm'                 ; Pause body and functions
197
include 'game_over.asm'             ; Game_over body and functions
198
 
199
;;===Some_functions============================================================================================================
200
 
1566 dunkaist 201
 
202
Save_do_smth_else_and_exit:
203
    ;;===Save_do_smth_else_and_exit============================================================================================
204
 
205
      mcall     37,6,[cursor_handle]                ; delete cursor
206
 
207
      invoke    ini.set_int, cur_dir_path, aReserved, aSquare_side_length, [square_side_length]
208
 
209
    mov  edi, champion_name_classic
210
    xor  al,  al
211
    mov  ecx, CHAMPION_NAME_LENGTH+1
212
    cld
213
    repne scasb
214
    neg  ecx
215
    add  ecx, CHAMPION_NAME_LENGTH
216
      invoke    ini.set_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, ecx
217
      invoke    ini.set_int, cur_dir_path, aReserved, aHiscore_classic, [hi_score_classic]
218
 
219
    mov  edi, champion_name_levels
220
    xor  al,  al
221
    mov  ecx, CHAMPION_NAME_LENGTH+1
222
    cld
223
    repne scasb
224
    neg  ecx
225
    add  ecx, CHAMPION_NAME_LENGTH
226
      invoke    ini.set_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, ecx
227
      invoke    ini.set_int, cur_dir_path, aReserved, aHiscore_levels, [hi_score_levels]
228
 
229
    ;;---Save_do_smth_else_and_exit--------------------------------------------------------------------------------------------
230
 
231
 
1518 dunkaist 232
Exit:
1522 dunkaist 233
    ;;===Exit==================================================================================================================
1518 dunkaist 234
 
235
    or  eax,    -1
236
    int 0x40
237
 
1522 dunkaist 238
    ;;---Exit------------------------------------------------------------------------------------------------------------------
239
 
240
 
241
Set_geometry:
242
    ;;===Set_geometry==========================================================================================================
243
 
1677 dunkaist 244
    cmp  [resized_by_hotkey],   1
245
     je  .by_hotkey
246
 
247
    test [proc_info.wnd_state], 0x01
248
     jnz .by_hotkey
249
 
250
      mcall     9,proc_info,-1
2061 dunkaist 251
    test [proc_info.wnd_state], 0x04		; is rolled up?
252
     jz  @f
1677 dunkaist 253
    mov  eax, [proc_info.box.width]
2061 dunkaist 254
    mov  [window_width], eax
255
    mov  eax, [proc_info.box.height]
256
    mov  [window_height], eax
257
     jmp .quit
258
  @@:
259
    mov  eax, [proc_info.box.width]
1677 dunkaist 260
    cmp  eax, [window_width]
261
     jne @f
262
    mov  eax, [proc_info.box.height]
263
    cmp  eax, [window_height]
264
     jne @f
265
     jmp .quit
266
  @@:
267
    mov  eax, [proc_info.box.width]
268
    mov  [window_width],    eax
269
    mov  eax, [proc_info.box.height]
270
    mov  [window_height],   eax
271
 
272
  .by_mouse:                                    ; or any other kind of resizing. for example, double click on window title
273
 
274
    test [proc_info.wnd_state], 0x01
275
     jnz .by_hotkey
276
 
277
 
278
    cmp  [window_width],    250
279
     jnl @f
280
    mov  [window_width],    250
281
  @@:
282
    cmp  [window_height],   150
283
     jnl @f
284
    mov  [window_height],   150
285
  @@:
286
 
287
      mcall     48,4
288
    mov  ecx, [window_height]
289
    sub  ecx, eax
290
    sub  ecx, 5
291
    sub  ecx, [g_e]
292
    sub  ecx, [g_e]
293
    sub  ecx, 25+30
294
    mov  esi, ecx
295
 
296
    mov  eax, [window_width]
297
    sub  eax, 5+5
298
    sub  eax, [g_e]
299
    sub  eax, [g_e]
300
    sub  eax, [g_s]
301
    sub  eax, [g_s]
302
    mov  edi, eax
303
 
304
    mov  dx,  0
305
    div  cx
306
    cmp  ax,  2
307
     jl  .fit_to_width
308
 
309
  .fit_to_height:
310
    mov  eax, esi
311
    mov  ebx, GRID_HEIGHT
312
    div  bl
313
    cmp  al,  MIN_SQUARE_SIDE_LENGTH
314
     jnl @f
315
    mov  al,  MIN_SQUARE_SIDE_LENGTH
316
  @@:
317
    dec al
318
    mov byte[square_side_length],   al
319
     jmp .by_hotkey
320
 
321
  .fit_to_width:
322
    mov  eax, edi
323
    mov  ebx, GRID_WIDTH
324
    div  bl
325
    cmp  al,  MIN_SQUARE_SIDE_LENGTH
326
     jnl @f
327
    mov  al,  MIN_SQUARE_SIDE_LENGTH
328
  @@:
329
    dec al
330
    mov byte[square_side_length],   al
331
     jmp .by_hotkey
332
 
333
;     jmp .done
334
 
335
  .by_hotkey:
336
      mcall     9,proc_info,-1
337
    mov  [resized_by_hotkey],   0
2061 dunkaist 338
    test [proc_info.wnd_state], 0x04		; is rolled up?
339
     jz  @f
340
    mov  eax, [proc_info.box.width]
341
    mov  [window_width], eax
342
    mov  eax, [proc_info.box.height]
343
    mov  [window_height], eax
344
     jmp .quit
345
  @@:
1566 dunkaist 346
    mov  eax, [square_side_length]
347
    inc  eax                                            ; space between squares
1522 dunkaist 348
    mov  [g_s],   eax
349
 
350
    mov  eax, [g_s]
351
    shr  eax, 1
352
    mov  ebx, eax
353
    shr  ebx, 1
354
    add  eax, ebx
355
    mov  [g_e], eax
356
 
1566 dunkaist 357
    mov  edx, GRID_WIDTH
1522 dunkaist 358
    mov  eax, [g_s]
359
    mul  dx
360
    mov  [gw_mul_gs],   eax
361
 
1566 dunkaist 362
    mov  edx, GRID_HEIGHT
1522 dunkaist 363
    mov  eax, [g_s]
364
    mul  dx
365
    mov  [gh_mul_gs],   eax
366
 
1677 dunkaist 367
    mov  eax, [gw_mul_gs]
368
    add  eax, [g_s]
369
    add  eax, [g_s]
370
    add  eax, [g_e]
371
    add  eax, [g_e]
372
    add  eax, 5*2                                   ; skin width
373
    mov  esi, eax
374
    test [proc_info.wnd_state], 0x01
1861 dunkaist 375
     jz  @f
376
    mov  eax, [proc_info.box.width]
377
  @@:
1677 dunkaist 378
    mov  [window_width],    eax
1522 dunkaist 379
 
1677 dunkaist 380
    sub  eax, [gw_mul_gs]
381
    sub  eax, 5*2
382
    shr  eax, 1
383
    mov  [gbxm1],   eax
384
 
385
      mcall     48,4                                ; get skin header height
386
    mov  ebx, eax
1522 dunkaist 387
    add  eax, [gh_mul_gs]
1677 dunkaist 388
    add  eax, [g_e]
389
    add  eax, 25
390
    add  eax, [g_e]
391
    add  eax, 30
392
    add  eax, 5                                      ; skin height (bottom part)
393
    mov  edi, eax
394
    test [proc_info.wnd_state], 0x01
1861 dunkaist 395
     jz	 @f
396
    mov  eax, [proc_info.box.height]
397
  @@:
1677 dunkaist 398
    mov  [window_height],   eax
1522 dunkaist 399
 
1677 dunkaist 400
    sub  eax, [gh_mul_gs]
401
    sub  eax, ebx
402
    sub  eax, 5
403
    sub  eax, 5
404
 
405
    shr  eax, 1
406
    mov  [gbym1],   eax
407
 
1522 dunkaist 408
    mov  eax, [g_s]
409
    shl  eax, 16
410
    add  eax, [g_s]
411
    mov  [gs_shl16_gs], eax
412
 
413
    mov  eax, [gbxm1]
414
    shl  eax, 16
415
    add  eax, [gbxm1]
416
    mov  [gbxm1_shl16_gbxm1],   eax
417
 
418
    mov  eax, [gbym1]
419
    shl  eax, 16
420
    add  eax, [gbym1]
421
    mov  [gbym1_shl16_gbym1],   eax
422
 
1677 dunkaist 423
    mov  eax, [gbxm1]
424
    add  eax, [gw_mul_gs]
425
    mov  [gbxm1_plus_gw_mul_gs],    eax
1522 dunkaist 426
 
1677 dunkaist 427
    mov  eax, [gbym1]
1566 dunkaist 428
    add  eax, [gh_mul_gs]
1677 dunkaist 429
    mov  [gbym1_plus_gh_mul_gs],    eax
1522 dunkaist 430
 
431
      mcall     48, 5
432
    mov  dx,  ax
433
    shr  eax, 16
434
    sub  dx,  ax
1677 dunkaist 435
    cmp  dx,  si                                    ; does window fit to work area width?
1522 dunkaist 436
     jnl @f
437
    dec  [square_side_length]
1677 dunkaist 438
     jmp Set_geometry.by_hotkey
1522 dunkaist 439
  @@:
440
 
441
    mov  cx,  bx
442
    shr  ebx, 16
443
    sub  cx,  bx
1677 dunkaist 444
    cmp  cx,  di                                    ; does window fit to work area height?
1522 dunkaist 445
     jnl @f
446
    dec  [square_side_length]
1677 dunkaist 447
     jmp Set_geometry.by_hotkey
1522 dunkaist 448
  @@:
449
 
1677 dunkaist 450
    sub  dx,  si
1522 dunkaist 451
    shr  dx,  1
452
    mov  word[wp_x],    dx
453
    sub  cx,  word[window_height]
454
    shr  cx,  1
455
    mov  dx,  cx
456
    shr  cx,  1
457
    add  cx,  dx
458
    mov  word[wp_y],    cx
459
 
460
    mov  [top_strings], 8
461
    mov  eax, [window_height]
462
    sub  eax, 50
463
    mov  [bottom_top_strings],  eax
464
    add  eax, 6
465
    mov  [bottom_middle_strings],  eax
466
    add  eax, 6
467
    mov  [bottom_bottom_strings],  eax
468
 
469
    sub  eax, 4
1566 dunkaist 470
    mov  [edit1.top],   eax
1522 dunkaist 471
 
1566 dunkaist 472
 
473
    mov  eax, [g_s]
474
    shl  eax, 2
475
    sub  eax, 2
476
    mov  [button_width_short],  eax
477
    mov  eax, [g_s]
478
    shl  eax, 3
479
    add  eax, [g_s]
480
    sub  eax, 2
481
    mov  [button_width_long],   eax
482
    mov  eax, [g_s]
483
    sub  eax, 2
484
    mov  [button_height],   eax
485
 
486
    mov  bl,  0x10
487
    mov  cl,  0x08
488
 
489
    mov  al,  byte[g_s]
490
    mul  bl
491
    mov  bx,  ax
492
    add  bx,  word[gbxm1]
493
    inc  bx
494
 
495
    mov  al,  byte[g_s]
496
    mul  cl
497
    mov  cx,  ax
498
    add  cx,  word[gbym1]
499
    inc  cx
500
 
501
    mov  [button_x_left],   ebx
502
    mov  [button_y_top],    ecx
503
 
504
    add  ebx, [g_s]
505
    add  ebx, [g_s]
506
    add  ebx, [g_s]
507
    add  ebx, [g_s]
508
    add  ebx, [g_s]
509
 
510
    mov  [button_x_right],  ebx
511
 
512
    add  ecx,  [g_s]
513
    add  ecx,  [g_s]
514
 
515
    mov  [button_y_middle], ecx
516
 
517
    add  ecx,  [g_s]
518
    add  ecx,  [g_s]
519
 
520
    mov  [button_y_bottom], ecx
521
 
1677 dunkaist 522
  .done:
523
      mcall     67,[wp_x],[wp_y],[window_width],[window_height]
1566 dunkaist 524
 
1677 dunkaist 525
  .quit:
1522 dunkaist 526
    ret
527
 
528
    ;;---Set_geometry------------------------------------------------------------------------------------------------------
529
 
530
 
1566 dunkaist 531
Increase_geometry:
532
    ;;===Increase_geometry=================================================================================================
533
 
534
    inc  [square_side_length]
1677 dunkaist 535
    mov  [resized_by_hotkey],   1
1566 dunkaist 536
 
537
    ret
538
 
539
    ;;---Increase_geometry-------------------------------------------------------------------------------------------------
540
 
541
 
542
Decrease_geometry:
543
    ;;===Decrease_geometry=================================================================================================
544
 
545
    cmp  [square_side_length],  MIN_SQUARE_SIDE_LENGTH
546
     je  @f
547
    dec  [square_side_length]
1677 dunkaist 548
    mov  [resized_by_hotkey],   1
1566 dunkaist 549
 
550
  @@:
551
    ret
552
 
553
    ;;---Decrease_geometry-------------------------------------------------------------------------------------------------
554
 
555
 
1518 dunkaist 556
Draw_decorations:
557
    ;;===Draw_decorations==================================================================================================
558
 
1566 dunkaist 559
    mov  al, byte[decorations]
1522 dunkaist 560
    dec  al
561
     jz  grid_lines
562
    dec  al
563
     jz  grid_lines_with_ends
564
    dec  al
565
     jz  grid_lines_with_corners
566
    dec  al
567
     jz  grid_dots
568
    dec  al
569
     jz  borders_lines
570
    dec  al
571
     jz  borders_lines_with_corners
572
    dec  al
573
     jz  borders_dots
574
    dec  al
575
     jz  corners_dots
576
    dec  al
577
     jz  corners_inner
578
    dec  al
579
     jz  corners_outer
580
    dec  al
581
     jz  corners_crosses
1518 dunkaist 582
    ret
583
 
584
 
585
  grid_lines:
586
 
587
    mov  eax, 38
1522 dunkaist 588
;mov  ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1)
589
    mov  ebx, [gbxm1_shl16_gbxm1]
590
;mov  ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP)
591
    mov  ecx, [gbym1_shl16_gbym1]
592
    add  ecx, [gh_mul_gs]
1518 dunkaist 593
    mov  edx, [decorations_color]
1566 dunkaist 594
    mov  esi, GRID_WIDTH
1522 dunkaist 595
    add  esi, 1
1518 dunkaist 596
 
597
  @@:
598
      mcall
1522 dunkaist 599
    add  ebx, [gs_shl16_gs]
600
    dec  esi
601
     jnz @b
1518 dunkaist 602
 
1522 dunkaist 603
;mov  ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP)
604
    mov  ebx, [gbxm1_shl16_gbxm1]
605
    add  ebx, [gw_mul_gs]
606
    mov  ecx, [gbym1_shl16_gbym1]
1566 dunkaist 607
    mov  esi, GRID_HEIGHT
1522 dunkaist 608
    add  esi, 1
1518 dunkaist 609
 
610
  @@:
611
      mcall
1522 dunkaist 612
    add  ecx, [gs_shl16_gs]
613
    dec  esi
614
     jnz @b
1518 dunkaist 615
 
616
    ret
617
 
618
 
619
  grid_lines_with_ends:
620
 
621
    mov  eax, 38
1522 dunkaist 622
    mov  ebx, [gbxm1_shl16_gbxm1]
623
    mov  ecx, [gbym1]
624
    sub  ecx, [g_e]
625
    shl  ecx, 16
626
    add  ecx, [gbym1_plus_gh_mul_gs]
627
    add  ecx, [g_e]
1518 dunkaist 628
    mov  edx, [decorations_color]
1566 dunkaist 629
    mov  esi, GRID_WIDTH
1522 dunkaist 630
    add  esi, 1
1518 dunkaist 631
 
632
  @@:
633
      mcall
1522 dunkaist 634
    add  ebx, [gs_shl16_gs]
635
    dec  esi
636
     jnz @b
1518 dunkaist 637
 
1522 dunkaist 638
    mov  ebx, [gbxm1]
639
    sub  ebx, [g_e]
640
    shl  ebx, 16
641
    add  ebx, [gbxm1_plus_gw_mul_gs]
642
    add  ebx, [g_e]
643
    mov  ecx, [gbym1_shl16_gbym1]
1566 dunkaist 644
    mov  esi, GRID_HEIGHT
1522 dunkaist 645
    add  esi, 1
1518 dunkaist 646
 
647
  @@:
648
      mcall
1522 dunkaist 649
    add  ecx, [gs_shl16_gs]
650
    dec  esi
651
     jnz @b
1518 dunkaist 652
 
653
    ret
654
 
655
 
656
  grid_lines_with_corners:
657
 
658
      call      grid_lines
659
      call      corners_outer
660
 
661
    ret
662
 
663
 
664
  grid_dots:
665
 
666
    mov  eax, 1
1522 dunkaist 667
    mov  ebx, [gbxm1]
668
    mov  ecx, [gbym1]
1518 dunkaist 669
    mov  edx, [decorations_color]
670
 
671
  @@:
672
      mcall
1522 dunkaist 673
    add  ebx, [g_s]
674
    cmp  ebx, [gbxm1_plus_gw_mul_gs]
1518 dunkaist 675
     jng @b
1522 dunkaist 676
    add  ecx, [g_s]
677
    cmp  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 678
     jg  @f
1522 dunkaist 679
    mov  ebx, [gbxm1]
1518 dunkaist 680
     jmp @b
681
 
682
  @@:
683
    ret
684
 
685
 
686
  borders_lines:
687
 
1522 dunkaist 688
    mov  eax, 38
689
    mov  ebx, [gbxm1_shl16_gbxm1]
690
    mov  ecx, [gbym1_shl16_gbym1]
691
    add  ecx, [gh_mul_gs]
692
    mov  edx, [decorations_color]
693
      mcall
1518 dunkaist 694
 
1522 dunkaist 695
    mov  ebx, [gbxm1_plus_gw_mul_gs]
696
    shl  ebx, 16
697
    add  ebx, [gbxm1_plus_gw_mul_gs]
698
      mcall
699
 
700
    mov  ebx, [gbxm1_shl16_gbxm1]
701
    add  ebx, [gw_mul_gs]
702
    mov  ecx, [gbym1_shl16_gbym1]
703
      mcall
704
 
705
    mov  ecx, [gbym1_plus_gh_mul_gs]
706
    shl  ecx, 16
707
    add  ecx, [gbym1_plus_gh_mul_gs]
708
      mcall
709
 
1518 dunkaist 710
    ret
711
 
712
 
1522 dunkaist 713
  borders_lines_with_corners:
1518 dunkaist 714
 
715
      call      borders_lines
716
      call      corners_outer
717
 
718
    ret
719
 
720
 
721
  borders_dots:
722
 
723
    mov  eax, 1
1522 dunkaist 724
    mov  ebx, [gbxm1]
725
    mov  ecx, [gbym1]
1518 dunkaist 726
    mov  edx, [decorations_color]
727
  @@:
728
      mcall
1522 dunkaist 729
    add  ebx, [g_s]
730
    cmp  ebx, [gbxm1_plus_gw_mul_gs]
1518 dunkaist 731
     jng @b
732
 
1522 dunkaist 733
    mov  ebx, [gbxm1]
734
    mov  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 735
  @@:
736
      mcall
1522 dunkaist 737
    add  ebx, [g_s]
738
    cmp  ebx, [gbxm1_plus_gw_mul_gs]
1518 dunkaist 739
     jng @b
740
 
1522 dunkaist 741
    mov  ebx, [gbxm1]
742
    mov  ecx, [gbym1]
1518 dunkaist 743
  @@:
744
      mcall
1522 dunkaist 745
    add  ecx, [g_s]
746
    cmp  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 747
     jng @b
748
 
1522 dunkaist 749
    mov  ebx, [gbxm1_plus_gw_mul_gs]
750
    mov  ecx, [gbym1]
1518 dunkaist 751
  @@:
752
      mcall
1522 dunkaist 753
    add  ecx, [g_s]
754
    cmp  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 755
     jng @b
756
 
757
    ret
758
 
759
 
760
  corners_dots:
761
 
1522 dunkaist 762
    mov  eax, 13
763
    mov  ebx, [gbxm1]
764
    dec  ebx
765
    shl  ebx, 16
766
    add  ebx, 2
767
    mov  ecx, [gbym1]
768
    dec  ecx
769
    shl  ecx, 16
770
    add  ecx, 2
771
    mov  edx, [decorations_color]
772
      mcall
1518 dunkaist 773
 
1522 dunkaist 774
    mov  ebx, [gbxm1_plus_gw_mul_gs]
775
    shl  ebx, 16
776
    add  ebx, 2
777
      mcall
778
 
779
    mov  ebx, [gbxm1]
780
    dec  ebx
781
    shl  ebx, 16
782
    add  ebx, 2
783
    mov  ecx, [gbym1_plus_gh_mul_gs]
784
    shl  ecx, 16
785
    add  ecx, 2
786
      mcall
787
 
788
    mov  ebx, [gbxm1_plus_gw_mul_gs]
789
    shl  ebx, 16
790
    add  ebx, 2
791
      mcall
792
 
1518 dunkaist 793
    ret
794
 
795
 
796
  corners_inner:
797
 
1522 dunkaist 798
    mov  eax, 38
799
    mov  ebx, [gbxm1_shl16_gbxm1]
800
    add  ebx, [g_e]
801
    mov  ecx, [gbym1_shl16_gbym1]
802
    mov  edx, [decorations_color]
803
      mcall
1518 dunkaist 804
 
1522 dunkaist 805
    mov  ecx, [gbym1_plus_gh_mul_gs]
806
    shl  ecx, 16
807
    add  ecx, [gbym1_plus_gh_mul_gs]
808
      mcall
809
 
810
    mov  ebx, [gbxm1_plus_gw_mul_gs]
811
    sub  ebx, [g_e]
812
    shl  ebx, 16
813
    add  ebx, [gbxm1_plus_gw_mul_gs]
814
      mcall
815
 
816
    mov  ecx, [gbym1_shl16_gbym1]
817
      mcall
818
 
819
    mov  ebx, [gbxm1_shl16_gbxm1]
820
    mov  ecx, [gbym1_shl16_gbym1]
821
    add  ecx, [g_e]
822
      mcall
823
 
824
    mov  ebx, [gbxm1_plus_gw_mul_gs]
825
    shl  ebx, 16
826
    add  ebx, [gbxm1_plus_gw_mul_gs]
827
      mcall
828
 
829
    mov  ecx, [gbym1_plus_gh_mul_gs]
830
    sub  ecx, [g_e]
831
    shl  ecx, 16
832
    add  ecx, [gbym1_plus_gh_mul_gs]
833
      mcall
834
 
835
    mov  ebx, [gbxm1_shl16_gbxm1]
836
      mcall
837
 
1518 dunkaist 838
    ret
839
 
840
 
841
  corners_outer:
842
 
1522 dunkaist 843
    mov  eax, 38
844
    mov  ebx, [gbxm1_shl16_gbxm1]
845
    sub  ebx, [g_e]
846
    mov  ecx, [gbym1_shl16_gbym1]
847
    mov  edx, [decorations_color]
848
      mcall
1518 dunkaist 849
 
1522 dunkaist 850
    mov  ecx, [gbym1_plus_gh_mul_gs]
851
    shl  ecx, 16
852
    add  ecx, [gbym1_plus_gh_mul_gs]
853
      mcall
854
 
855
    mov  ebx, [gbxm1_plus_gw_mul_gs]
856
    shl  ebx, 16
857
    add  ebx, [gbxm1_plus_gw_mul_gs]
858
    add  ebx, [g_e]
859
      mcall
860
 
861
    mov  ecx, [gbym1_shl16_gbym1]
862
      mcall
863
 
864
    mov  ebx, [gbxm1_shl16_gbxm1]
865
    mov  ecx, [gbym1_shl16_gbym1]
866
    sub  ecx, [g_e]
867
      mcall
868
 
869
    mov  ebx, [gbxm1_plus_gw_mul_gs]
870
    shl  ebx, 16
871
    add  ebx, [gbxm1_plus_gw_mul_gs]
872
      mcall
873
 
874
    mov  ecx, [gbym1_plus_gh_mul_gs]
875
    shl  ecx, 16
876
    add  ecx, [gbym1_plus_gh_mul_gs]
877
    add  ecx, [g_e]
878
      mcall
879
 
880
    mov  ebx, [gbxm1_shl16_gbxm1]
881
      mcall
882
 
1518 dunkaist 883
    ret
884
 
885
 
886
  corners_crosses:
887
 
888
      call      corners_inner
889
      call      corners_outer
890
 
891
    ret
892
 
893
 
894
    ;;---Draw_decorations--------------------------------------------------------------------------------------------------
895
 
896
 
897
Draw_square:
898
    ;;===Draw_square=======================================================================================================
899
    ;; bl   -   x_coord
900
    ;; bh   -   y_coord
901
    ;; edx  -   color
902
 
1566 dunkaist 903
    push eax ebx ecx edx
904
 
1518 dunkaist 905
    mov  cl,  bh
906
 
1522 dunkaist 907
    mov  al,  byte[g_s]
1518 dunkaist 908
    mul  bl
909
    mov  bx,  ax
1522 dunkaist 910
    add  bx,  word[gbxm1]
911
    inc  bx
1518 dunkaist 912
    shl  ebx, 16
1522 dunkaist 913
    add  ebx, [g_s]
914
    dec  ebx
1518 dunkaist 915
 
1522 dunkaist 916
    mov  al,  byte[g_s]
1518 dunkaist 917
    mul  cl
918
    mov  cx,  ax
1522 dunkaist 919
    add  cx,  word[gbym1]
920
    inc  cx
1518 dunkaist 921
    shl  ecx, 16
1522 dunkaist 922
    add  ecx, [g_s]
923
    dec  ecx
1566 dunkaist 924
 
1518 dunkaist 925
      mcall     13
926
 
1566 dunkaist 927
    pop  edx ecx ebx eax
928
 
1518 dunkaist 929
    ret
930
 
931
    ;;---Draw_square-------------------------------------------------------------------------------------------------------
932
 
933
 
934
Draw_menu_esc:
935
    ;;===Draw_menu_esc=====================================================================================================
936
 
1522 dunkaist 937
    mov  ebx, [window_width]
938
    shr  ebx, 1
1566 dunkaist 939
    sub  ebx, string_menu_esc.size*3+6
1522 dunkaist 940
    shl  ebx, 16
941
    add  ebx, dword[top_strings]
942
      mcall     4, ,[navigation_strings_color],string_menu_esc
1518 dunkaist 943
 
944
    ret
945
 
946
    ;;---Draw_menu_esc-----------------------------------------------------------------------------------------------------
947
 
948
 
949
Draw_score_string:
950
    ;;===Draw_score_string=================================================================================================
1522 dunkaist 951
 
952
    mov  ebx, [window_width]
953
    shr  ebx, 3
954
    sub  ebx, 5
955
    shl  ebx, 16
956
    add  ebx, dword[bottom_top_strings]
957
      mcall     4, ,[score_string_color],string_score
1566 dunkaist 958
 
1518 dunkaist 959
    ret
1566 dunkaist 960
 
1518 dunkaist 961
    ;;---Draw_score_string-------------------------------------------------------------------------------------------------
962
 
963
 
964
Draw_score_number:
965
    ;;===Draw_score_number=================================================================================================
1522 dunkaist 966
 
967
    mov  edx, [window_width]
968
    shr  edx, 3
1566 dunkaist 969
    sub  edx, 5+1
970
    add  edx, string_score.size*6
1522 dunkaist 971
    shl  edx, 16
972
    add  edx, dword[bottom_top_strings]
973
      mcall     47,0x00070000,[score], ,[score_number_color],[background_color]
1566 dunkaist 974
 
1518 dunkaist 975
    ret
1566 dunkaist 976
 
1518 dunkaist 977
    ;;---Draw_score_number-------------------------------------------------------------------------------------------------
978
 
979
 
980
Draw_hiscore_string:
981
    ;;===Draw_hiscore_string===============================================================================================
982
 
1522 dunkaist 983
    mov  ebx, [window_width]
984
    shr  ebx, 3
985
    neg  ebx
986
    add  ebx, [window_width]
1566 dunkaist 987
    sub  ebx, string_hi_score.size*6+7*6+5
1522 dunkaist 988
    shl  ebx, 16
989
    add  ebx, dword[bottom_top_strings]
990
      mcall     4, ,[hiscore_string_color],string_hi_score
1518 dunkaist 991
 
992
    ret
993
 
994
    ;;---Draw_hiscore_string-----------------------------------------------------------------------------------------------
995
 
1566 dunkaist 996
 
1518 dunkaist 997
Draw_hiscore_number:
1566 dunkaist 998
    ;;===Draw_hiscore_number===================================================================================================
1518 dunkaist 999
 
1522 dunkaist 1000
    mov  edx, [window_width]
1001
    shr  edx, 3
1002
    neg  edx
1003
    add  edx, [window_width]
1004
    sub  edx, 7*6+6
1005
    shl  edx, 16
1006
    add  edx, dword[bottom_top_strings]
1518 dunkaist 1007
 
1566 dunkaist 1008
    cmp  [play_mode],   CLASSIC_MODE
1009
     jne @f
1010
    mov  ecx, [hi_score_classic]
1011
     jmp .done
1012
  @@:
1013
    mov  ecx, [hi_score_levels]
1014
 
1015
  .done:
1016
      mcall     47,0x00070000, , ,[hiscore_number_color]
1017
 
1518 dunkaist 1018
    ret
1019
 
1566 dunkaist 1020
    ;;---Draw_hiscore_number---------------------------------------------------------------------------------------------------
1021
 
1022
 
1518 dunkaist 1023
Draw_champion_string:
1566 dunkaist 1024
    ;;===Draw_champion_string==================================================================================================
1518 dunkaist 1025
 
1522 dunkaist 1026
    mov  ebx, [window_width]
1027
    shr  ebx, 3
1028
    neg  ebx
1029
    add  ebx, [window_width]
1566 dunkaist 1030
    sub  ebx, string_champion.size*6+7*6+5
1522 dunkaist 1031
    shl  ebx, 16
1032
    add  ebx, dword[bottom_bottom_strings]
1033
      mcall     4, ,[champion_string_color],string_champion
1518 dunkaist 1034
 
1035
    ret
1036
 
1037
    ;;---Draw_champion_string----------------------------------------------------------------------------------------------
1038
 
1039
 
1040
Draw_champion_name:
1041
    ;;===Draw_champion_name================================================================================================
1042
 
1522 dunkaist 1043
    mov  ebx, [window_width]
1044
    shr  ebx, 3
1045
    neg  ebx
1046
    add  ebx, [window_width]
1566 dunkaist 1047
    sub  ebx, CHAMPION_NAME_LENGTH/2*6+7*6+6                ; there is no difference between length of champion names for other play_modes
1048
    add  ebx, CHAMPION_NAME_LENGTH/2*6
1522 dunkaist 1049
    shl  ebx, 16
1050
    add  ebx, dword[bottom_bottom_strings]
1518 dunkaist 1051
 
1566 dunkaist 1052
    cmp  [play_mode],   CLASSIC_MODE
1053
     jne @f
1054
    mov  edx, champion_name_classic
1055
     jmp .done
1056
  @@:
1057
    mov  edx, champion_name_levels
1058
 
1059
  .done:
1060
      mcall     4, ,[champion_name_color],
1061
 
1518 dunkaist 1062
    ret
1063
 
1064
    ;;---Draw_champion_name------------------------------------------------------------------------------------------------
1065
 
1066
 
1067
Draw_picture:
1068
    ;;===Draw_picture======================================================================================================
1069
    ;;  in  :
1522 dunkaist 1070
    ;;           ax =   number of left square *0x100+ picture width (in squares)
1071
    ;;           cx =   number of top square *0x100+ picture height (in squares)
1518 dunkaist 1072
    ;;          edx =   picture color
1522 dunkaist 1073
    ;;          esi =   pointer to picture data
1518 dunkaist 1074
    ;;
1075
 
1522 dunkaist 1076
    add  al,  ah
1077
    add  cl,  ch
1078
    mov  bh,  ch
1079
 
1518 dunkaist 1080
  .draw:
1522 dunkaist 1081
    mov  bl,  ah
1677 dunkaist 1082
    mov  di,  7
1518 dunkaist 1083
 
1084
  .loop:
1677 dunkaist 1085
    bt  word[esi],  di
1086
     jnc @f
1087
    push eax ebx ecx esi edi
1518 dunkaist 1088
      call      Draw_square
1677 dunkaist 1089
    pop  edi esi ecx ebx eax
1518 dunkaist 1090
 
1091
  @@:
1677 dunkaist 1092
    dec  di
1093
     jns @f
1094
    mov  di,  7
1522 dunkaist 1095
    inc  esi
1677 dunkaist 1096
  @@:
1518 dunkaist 1097
    inc  bl
1522 dunkaist 1098
    cmp  bl,  al
1518 dunkaist 1099
     jne .loop
1100
 
1522 dunkaist 1101
    inc  bh
1677 dunkaist 1102
    cmp  di,  7
1103
     jz  @f
1104
    inc  esi
1105
  @@:
1522 dunkaist 1106
    cmp  bh,  cl
1107
     jne .draw
1677 dunkaist 1108
 
1518 dunkaist 1109
    ret
1110
 
1111
    ;;---Draw_picture------------------------------------------------------------------------------------------------------
1112
 
1113
 
1114
Draw_on_map:
1115
    ;;===Draw_on_map=======================================================================================================
1116
    ;;  in  :
1117
    ;;           al =   x coord
1118
    ;;           ah =   y coord
1119
    ;;           cl =   value to draw
1120
    ;;
1121
 
1122
    and  eax, 0x0000ffff
1123
    xor  bx,  bx
1124
    mov  bl,  al
1125
    shr  ax,  8
1566 dunkaist 1126
    mov  dx,  GRID_WIDTH
1518 dunkaist 1127
    mul  dx
1128
    add  ax,  bx
1677 dunkaist 1129
    mov  edi, field_map
1130
    add  edi, eax
1131
    mov  [edi], cl
1518 dunkaist 1132
 
1133
    ret
1134
 
1677 dunkaist 1135
    ;;---Draw_on_map-------------------------------------------------------------------------------------------------------
1518 dunkaist 1136
 
1137
 
1138
Get_from_map:
1677 dunkaist 1139
    ;;===Get_from_map======================================================================================================
1518 dunkaist 1140
    ;;  in  :
1141
    ;;           al =   x coord
1142
    ;;           ah =   y coord
1143
    ;;  out :
1522 dunkaist 1144
    ;;           bl =   value on map
1518 dunkaist 1145
    ;;
1146
 
1147
    push eax
1148
 
1149
    and  eax, 0x0000ffff
1150
    xor  bx,  bx
1151
    mov  bl,  al
1152
    shr  ax,  8
1566 dunkaist 1153
    mov  dx,  GRID_WIDTH
1518 dunkaist 1154
    mul  dx
1155
    add  ax,  bx
1156
    mov  edi, field_map
1157
    add  edi, eax
1158
    mov  bl,  [edi]
1159
 
1160
    pop  eax
1161
 
1162
    ret
1163
 
1566 dunkaist 1164
    ;;---Get_from_map-----------------------------------------------------------------------------------------------------------
1518 dunkaist 1165
 
1166
 
1566 dunkaist 1167
Load_level:
1168
    ;;===Load_level=============================================================================================================
1169
    ;;  in  :
1170
    ;;          cur_level_number    =   level number to load
1171
    ;;
1518 dunkaist 1172
 
1566 dunkaist 1173
    mov  eax, [cur_level_number]
1174
    mov  edx, stage_00
1175
  @@:
1176
    test al,  al
1177
     jz  @f
1677 dunkaist 1178
    add  edx, stage_01-stage_00
1566 dunkaist 1179
    dec  al
1180
     jmp @b
1181
  @@:
1677 dunkaist 1182
 
1183
    mov  esi, window_title_with_lives
1184
    mov  edi, window_title+5
1185
 
1186
  .lives_in_title:
1187
    cmp  [play_mode],   LEVELS_MODE
1188
     jne .level_name_in_title
1189
    test [show_lives_style],    1
1190
     jz  .level_name_in_title
1191
    mov  [edi], byte ' '
1192
    mov  al,  byte[separating_symbol]
1193
    mov  [edi+1], byte al
1194
    mov  [edi+2], byte ' '
1195
    add  edi, 3
1196
    mov  eax, [lives]
1197
    add  al,  0x30
1198
    mov  [window_title_with_lives],   al
1199
    mov  ecx, 10
1200
    rep  movsb
1201
    dec  edi
1202
 
1203
  .level_name_in_title:
1204
    cmp  [draw_level_name_in_window_title], 1
1205
     jne @f
1206
    mov  [edi], byte ' '
1207
    mov  al,  byte[separating_symbol]
1208
    mov  [edi+1], byte al
1209
    mov  [edi+2], byte ' '
1210
    add  edi, 3
1211
    mov  esi, edx
1212
    add  esi, LEVEL.name
1213
    mov  esi, [esi]
1214
    mov  ecx, 16
1215
    rep  movsd
1216
 
1217
  @@:
1218
      mcall     71,1,window_title
1219
 
1566 dunkaist 1220
    mov  [cur_level],   edx
1518 dunkaist 1221
 
1566 dunkaist 1222
    mov  esi, edx
1223
    add  esi, LEVEL.field
1224
    mov  edi, field_map
1677 dunkaist 1225
    mov  ecx, 2
1226
    mov  ah,  GRID_HEIGHT
1227
  .begin:
1228
    mov  ebx, 7
1229
    mov  al,  GRID_WIDTH
1230
  .loop:
1231
    bt   [esi], ebx
1232
     jnc @f
1233
    mov  byte[edi], cl
1234
     jmp .skip
1235
  @@:
1236
    mov  byte[edi], 0
1237
  .skip:
1238
    dec  ebx
1239
     jns @f
1240
    mov  ebx, 7
1241
    inc  esi
1242
  @@:
1243
    inc  edi
1244
    dec  al
1245
     jnz .loop
1246
    inc  esi
1247
    dec  ah
1248
     jnz .begin
1518 dunkaist 1249
 
1677 dunkaist 1250
 
1566 dunkaist 1251
    mov  esi, edx
1252
    add  esi, LEVEL.snake_dots
1253
    mov  edi, snake_dots
1254
    mov  ecx, 3
1255
    rep  movsw
1256
 
1257
    mov  esi, edx
1258
    add  esi, LEVEL.snake_direction
1259
    mov  eax, [esi]
1260
    mov  [snake_direction], eax
1261
 
1262
    mov  esi, edx
1263
    add  esi, LEVEL.snake_direction_next
1264
    mov  eax, [esi]
1265
    mov  [snake_direction_next],    eax
1266
 
1267
    mov  esi, edx
1268
    add  esi, LEVEL.number_of_stones
1269
    mov  eax, [esi]
1270
    mov  [number_of_free_dots], GRID_WIDTH*GRID_HEIGHT-3
1271
    sub  [number_of_free_dots], eax
1272
 
1273
    mov  ax,  word[snake_dots]
1274
    mov  cl,  1
1275
      call      Draw_on_map
1276
    mov  ax,  word[snake_dots+2]
1277
    mov  cl,  1
1278
      call      Draw_on_map
1279
    mov  ax,  word[snake_dots+4]
1280
    mov  cl,  1
1281
      call      Draw_on_map
1282
 
1283
    mov  [action],  0
1284
    mov  [snake_length_x2], 6
1285
 
1286
    ret
1287
 
1288
    ;;---Load_level-------------------------------------------------------------------------------------------------------------
1289
 
1290
 
1291
Draw_stones:
1292
    ;;===Draw_stones============================================================================================================
1293
 
1294
    mov  ax,  0*0x100+GRID_WIDTH
1295
    mov  cx,  0*0x100+GRID_HEIGHT
1296
    mov  edx, [stone_color]
1297
    mov  esi, [cur_level]
1298
    add  esi, LEVEL.field
1299
      call      Draw_picture
1300
 
1301
    ret
1302
 
1303
    ;;---Draw_stones------------------------------------------------------------------------------------------------------------
1304
 
1305
 
1306
Hide_cursor:
1307
    ;;===Hide_cursor===========================================================================================================
1308
 
1309
      mcall     37,5,[cursor_handle]
1310
 
1311
    ret
1312
 
1313
    ;;---Show_cursor-----------------------------------------------------------------------------------------------------------
1314
 
1315
 
1316
Show_cursor:
1317
    ;;===Hide_cursor===========================================================================================================
1318
 
1319
      mcall     37,5,0
1320
 
1321
    ret
1322
 
1323
    ;;---Show_cursor-----------------------------------------------------------------------------------------------------------
1324
 
1325
 
1677 dunkaist 1326
Set_window_mode:
1327
    ;;===Set_window_mode=======================================================================================================
1566 dunkaist 1328
 
1677 dunkaist 1329
    test al,  al
1330
     jnz .fullscreen
1331
    mov  eax, [window_style_windowed]
1332
     jmp .quit
1566 dunkaist 1333
 
1677 dunkaist 1334
  .fullscreen:
1335
    mov  eax, [window_style_fullscreen]
1336
 
1337
  .quit:
1338
    mov [window_style], eax
1339
    ret
1340
 
1341
;;---Some_functions------------------------------------------------------------------------------------------------------------
1342
 
1343
 
1344
Reverse_snake:
1345
    ;;===Reverse_snake=========================================================================================================
1346
 
1347
    cmp  [snake_direction], LEFT
1348
     jne @f
1349
    mov  [snake_direction_next],    RIGHT
1350
     jmp .quit
1351
  @@:
1352
    cmp  [snake_direction], RIGHT
1353
     jne @f
1354
    mov  [snake_direction_next],    LEFT
1355
     jmp .quit
1356
  @@:
1357
    cmp  [snake_direction], UP
1358
     jne @f
1359
    mov  [snake_direction_next],    DOWN
1360
     jmp .quit
1361
  @@:
1362
   cmp  [snake_direction], DOWN
1363
     jne @f
1364
    mov  [snake_direction_next],    UP
1365
;     jmp .quit
1366
  @@:
1367
 
1368
  .quit:
1369
    ret
1370
 
1371
    ;;---Reverse_snake---------------------------------------------------------------------------------------------------------
1372
 
1373
 
1566 dunkaist 1374
;;===Variables==================================================================================================================
1375
 
1677 dunkaist 1376
window_title                db      'Snake',64+15 dup (0)
1377
window_title_with_lives     db      '_ live(s)',0
1378
default_separating_symbol   db      '|',0
1379
window_style_windowed       dd      0x33000000              ; scalable skinned window
1380
window_style_fullscreen     dd      0x00000000
1518 dunkaist 1381
time_before_waiting         dd      0x0
1382
time_to_wait                dd      0x0
1383
time_wait_limit             dd      101
1677 dunkaist 1384
time_wait_limit_const       dd      0x0
1518 dunkaist 1385
 
1566 dunkaist 1386
play_mode                   dd      0x0
1677 dunkaist 1387
lives                       dd      START_LIVES
1388
acceleration_mask           dd      0x0
1518 dunkaist 1389
 
1677 dunkaist 1390
resized_by_hotkey           dd      0x0
1391
fullscreen                  dd      0x0
1566 dunkaist 1392
 
1393
szZ string_score            ,'SCORE : '
1394
szZ string_hi_score         ,'HI-SCORE : '
1395
szZ string_champion         ,'CHAMPION : '
1396
szZ string_level            ,'LEVEL : '
1397
szZ string_pause_space      ,'PAUSE - ',0x27,'SPACE',0x27
1398
szZ string_resume_space     ,'RESUME - ',0x27,'SPACE',0x27
1399
szZ string_menu_esc         ,'MENU - ',0x27,'ESC',0x27
1400
szZ string_apply_name_enter ,'APPLY NAME - ',0x27,'ENTER',0x27
1401
szZ press_to_start          ,'PRESS ',0x27,'ENTER',0x27,' TO START'
1402
szZ press_esc_to_exit       ,'PRESS ',0x27,'ESC',0x27,' TO EXIT'
1518 dunkaist 1403
;press_F2_to_options         db      'PRESS ',0x27,'F2',0x27,' TO OPTIONS',0
1404
 
1566 dunkaist 1405
szZ string_congratulations  ,'   Congratulations!!! New hi-score is : '
1406
szZ string_enter_your_name  ,'You are the champion! Enter your name : '
1522 dunkaist 1407
 
1566 dunkaist 1408
szZ string_button_play      ,'PLAY'
1409
szZ string_button_exit      ,'EXIT'
1410
szZ string_button_inc       ,'+INC+'
1411
szZ string_button_dec       ,'-dec-'
1412
szZ string_button_pm_classic,'CLASSIC mode'
1413
szZ string_button_pm_levels ,'LEVELS mode'
1518 dunkaist 1414
 
1566 dunkaist 1415
is_new_record               dd      0
1518 dunkaist 1416
 
1566 dunkaist 1417
action                      dd      0
1518 dunkaist 1418
 
1677 dunkaist 1419
picture_first_menu_snake    db      0xf4,0x99,0x2f,\
1420
                                    0x86,0xa5,0x49,\
1421
                                    0xf5,0xa5,0x8f,\
1422
                                    0x15,0xbd,0x48,\
1423
                                    0xf4,0xa5,0x2f
1518 dunkaist 1424
 
1677 dunkaist 1425
picture_first_menu_version  db      0xf1,0xe0,\
1426
                                    0x90,0x20,\
1427
                                    0x90,0x20,\
1428
                                    0x90,0x20,\
1429
                                    0xf4,0x20
1518 dunkaist 1430
 
1677 dunkaist 1431
picture_pause               db      11100011b,00100101b,11101111b,\
1432
                                    10010100b,10100101b,00001000b,\
1433
                                    10010100b,10100101b,00001000b,\
1434
                                    11100111b,10100101b,11101111b,\
1435
                                    10000100b,10100100b,00101000b,\
1436
                                    10000100b,10011001b,11101111b
1518 dunkaist 1437
 
1677 dunkaist 1438
picture_game_over           db      00110000b,00000000b,00000000b,00000000b,\
1439
                                    01001001b,11001000b,10111100b,00000000b,\
1440
                                    10000010b,00101101b,10100000b,00000000b,\
1441
                                    10011010b,00101010b,10111000b,00000000b,\
1442
                                    10001011b,11101000b,10100000b,00000000b,\
1443
                                    01110010b,00101000b,10111100b,00000000b,\
1444
                                    00000000b,00000000b,00000000b,00000000b,\
1445
                                    00000111b,00000000b,00000000b,00000000b,\
1446
                                    00001000b,10100010b,11110111b,10000000b,\
1447
                                    00001000b,10100010b,10000100b,01000000b,\
1448
                                    00001000b,10100010b,11100100b,01000000b,\
1449
                                    00001000b,10010100b,10000111b,10000000b,\
1450
                                    00000111b,00001000b,11110100b,01000000b
1518 dunkaist 1451
 
1760 dunkaist 1452
;picture_you_win             db      10001001b,11001000b,10000000b,\
1453
;                                    10001010b,00101000b,10000000b,\
1454
;                                    01010010b,00101000b,10000000b,\
1455
;                                    00100010b,00101000b,10000000b,\
1456
;                                    00100001b,11000111b,00000000b,\
1457
;                                    00000000b,00000000b,00000000b,\
1458
;                                    00000000b,00000000b,00000000b,\
1459
;                                    01000100b,10010001b,00000000b,\
1460
;                                    01010100b,10011001b,00000000b,\
1461
;                                    01010100b,10010101b,00000000b,\
1462
;                                    01010100b,10010011b,00000000b,\
1463
;                                    00101000b,10010001b,00000000b
1518 dunkaist 1464
 
1760 dunkaist 1465
picture_you_win             db      01000100b,01000011b,10001000b,10000000b,\
1466
                                    01000100b,01000100b,01001000b,10000000b,\
1467
                                    01000100b,01000100b,00001000b,10000000b,\
1468
                                    01111100b,01000100b,11001111b,10000000b,\
1469
                                    01000100b,01000100b,01001000b,10000000b,\
1470
                                    01000100b,01000011b,10001000b,10000000b,\
1471
                                    00000000b,00000000b,00000000b,00000000b,\
1472
                                    11110011b,10011100b,11110011b,11000000b,\
1473
                                    10000100b,00100010b,10001010b,00000000b,\
1474
                                    11110100b,00100010b,10001011b,10000000b,\
1475
                                    00010100b,00100010b,11110010b,00000000b,\
1476
                                    11110011b,10011100b,10001011b,11000000b
1477
 
1677 dunkaist 1478
picture_level               db      10000111b,10100101b,11101000b,\
1479
                                    10000100b,00100101b,00001000b,\
1480
                                    10000111b,00100101b,11001000b,\
1481
                                    10000100b,00101001b,00001000b,\
1482
                                    11110111b,10110001b,11101111b
1566 dunkaist 1483
 
1677 dunkaist 1484
digits_font                 db      0xf0,0x90,0x90,0x90,0xf0,\
1485
                                    0x20,0x60,0x20,0x20,0x20,\
1486
                                    0xf0,0x10,0xf0,0x80,0xf0,\
1487
                                    0xf0,0x10,0x70,0x10,0xf0,\
1488
                                    0x90,0x90,0xf0,0x10,0x10,\
1489
                                    0xf0,0x80,0xf0,0x10,0xf0,\
1490
                                    0xf0,0x80,0xf0,0x90,0xf0,\
1491
                                    0xf0,0x10,0x10,0x10,0x10,\
1492
                                    0xf0,0x90,0xf0,0x90,0xf0,\
1493
                                    0xf0,0x90,0xf0,0x10,0xf0
1566 dunkaist 1494
 
1495
stage_00:
1677 dunkaist 1496
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1497
                                    00000000b,00000000b,00000000b,00000000b,\
1498
                                    00000000b,00000000b,00000000b,00000000b,\
1499
                                    00000000b,00000000b,00000000b,00000000b,\
1500
                                    00000000b,00000000b,00000000b,00000000b,\
1501
                                    00000000b,00000000b,00000000b,00000000b,\
1502
                                    00000000b,00000000b,00000000b,00000000b,\
1503
                                    00000000b,00000000b,00000000b,00000000b,\
1504
                                    00000000b,00000000b,00000000b,00000000b,\
1505
                                    00000000b,00000000b,00000000b,00000000b,\
1506
                                    00000000b,00000000b,00000000b,00000000b,\
1507
                                    00000000b,00000000b,00000000b,00000000b,\
1508
                                    00000000b,00000000b,00000000b,00000000b,\
1509
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1510
 
1511
.snake_dots                 db      3,3, 4,3, 5,3
1512
.snake_direction            dd      RIGHT
1513
.snake_direction_next       dd      RIGHT
1514
.number_of_stones           dd      0
1677 dunkaist 1515
.name                       dd      stage_00_name
1566 dunkaist 1516
 
1517
stage_01:
1677 dunkaist 1518
.field                      db      11111000b,00000000b,00000001b,11110000b,\
1519
                                    10000000b,00000000b,00000000b,00010000b,\
1520
                                    10000000b,00000000b,00000000b,00010000b,\
1521
                                    10000000b,00000000b,00000000b,00010000b,\
1522
                                    10000000b,00000000b,00000000b,00010000b,\
1523
                                    00000000b,00000000b,00000000b,00000000b,\
1524
                                    00000000b,00000000b,00000000b,00000000b,\
1525
                                    00000000b,00000000b,00000000b,00000000b,\
1526
                                    00000000b,00000000b,00000000b,00000000b,\
1527
                                    10000000b,00000000b,00000000b,00010000b,\
1528
                                    10000000b,00000000b,00000000b,00010000b,\
1529
                                    10000000b,00000000b,00000000b,00010000b,\
1530
                                    10000000b,00000000b,00000000b,00010000b,\
1531
                                    11111000b,00000000b,00000001b,11110000b
1566 dunkaist 1532
 
1533
.snake_dots                 db      3,3, 4,3, 5,3
1534
.snake_direction            dd      RIGHT
1535
.snake_direction_next       dd      RIGHT
1536
.number_of_stones           dd      36
1677 dunkaist 1537
.name                       dd      stage_01_name
1566 dunkaist 1538
 
1539
stage_02:
1677 dunkaist 1540
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1541
                                    00000000b,00000000b,00000000b,00000000b,\
1542
                                    00011111b,11000000b,00111111b,10000000b,\
1543
                                    00010000b,00000000b,00000000b,10000000b,\
1544
                                    00010000b,00000000b,00000000b,10000000b,\
1545
                                    00010000b,00000000b,00000000b,10000000b,\
1546
                                    00000000b,00000000b,00000000b,00000000b,\
1547
                                    00000000b,00000000b,00000000b,00000000b,\
1548
                                    00010000b,00000000b,00000000b,10000000b,\
1549
                                    00010000b,00000000b,00000000b,10000000b,\
1550
                                    00010000b,00000000b,00000000b,10000000b,\
1551
                                    00011111b,11000000b,00111111b,10000000b,\
1552
                                    00000000b,00000000b,00000000b,00000000b,\
1553
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1554
 
1555
.snake_dots                 db      7,5, 8,5, 9,5
1556
.snake_direction            dd      RIGHT
1557
.snake_direction_next       dd      RIGHT
1558
.number_of_stones           dd      40
1677 dunkaist 1559
.name                       dd      stage_02_name
1566 dunkaist 1560
 
1561
stage_03:
1677 dunkaist 1562
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1563
                                    00000000b,00000000b,00000000b,00000000b,\
1564
                                    00000000b,00001001b,00000000b,00000000b,\
1565
                                    00000000b,00001001b,00000000b,00000000b,\
1566
                                    00000000b,00001001b,00000000b,00000000b,\
1567
                                    00001111b,11111001b,11111111b,00000000b,\
1568
                                    00000000b,00000000b,00000000b,00000000b,\
1569
                                    00000000b,00000000b,00000000b,00000000b,\
1570
                                    00001111b,11111001b,11111111b,00000000b,\
1571
                                    00000000b,00001001b,00000000b,00000000b,\
1572
                                    00000000b,00001001b,00000000b,00000000b,\
1573
                                    00000000b,00001001b,00000000b,00000000b,\
1574
                                    00000000b,00000000b,00000000b,00000000b,\
1575
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1576
 
1577
.snake_dots                 db      23,0, 22,0, 21,0
1578
.snake_direction            dd      LEFT
1579
.snake_direction_next       dd      LEFT
1677 dunkaist 1580
.number_of_stones           dd      48
1581
.name                       dd      stage_03_name
1566 dunkaist 1582
 
1583
stage_04:
1677 dunkaist 1584
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1585
                                    00000000b,00100000b,01000000b,00000000b,\
1586
                                    00000010b,00100000b,01000100b,00000000b,\
1587
                                    00000010b,00000000b,00000100b,00000000b,\
1588
                                    00010000b,00100000b,01000000b,10000000b,\
1589
                                    00000010b,00100000b,01000100b,00000000b,\
1590
                                    00010010b,00000000b,00000100b,10000000b,\
1591
                                    00010010b,00000000b,00000100b,10000000b,\
1592
                                    00000010b,00100000b,01000000b,00000000b,\
1593
                                    00010000b,00100000b,01000000b,10000000b,\
1594
                                    00000010b,00000000b,00000100b,00000000b,\
1595
                                    00000010b,00100000b,01000100b,00000000b,\
1596
                                    00000000b,00100000b,01000000b,00000000b,\
1597
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1598
 
1599
.snake_dots                 db      19,6, 19,7, 19,8
1600
.snake_napravlenie          dd      DOWN
1601
.snake_napravlenie_next     dd      DOWN
1677 dunkaist 1602
.number_of_stones           dd      39
1603
.name                       dd      stage_04_name
1566 dunkaist 1604
 
1605
stage_05:
1677 dunkaist 1606
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1607
                                    00000000b,00000000b,00000000b,00000000b,\
1608
                                    00000001b,11111111b,11111000b,00000000b,\
1609
                                    00000001b,11111111b,11111000b,00000000b,\
1610
                                    00000000b,00000000b,00000000b,00000000b,\
1611
                                    00000000b,00000000b,00000000b,00000000b,\
1612
                                    00000111b,11111111b,11111110b,00000000b,\
1613
                                    00000111b,11111111b,11111110b,00000000b,\
1614
                                    00000000b,00000000b,00000000b,00000000b,\
1615
                                    00000000b,00000000b,00000000b,00000000b,\
1616
                                    00111111b,11111111b,11111111b,11000000b,\
1617
                                    00111111b,11111111b,11111111b,11000000b,\
1618
                                    00000000b,00000000b,00000000b,00000000b,\
1619
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1620
 
1621
.snake_dots                 db      0,0, 0,1, 1,1
1622
.snake_direction            dd      RIGHT
1623
.snake_direction_next       dd      RIGHT
1624
.number_of_stones           dd      112
1677 dunkaist 1625
.name                       dd      stage_05_name
1566 dunkaist 1626
 
1627
stage_06:
1677 dunkaist 1628
.field                      db      00000001b,10000000b,00000000b,00000000b,\
1629
                                    00000001b,11111111b,11111000b,00000000b,\
1630
                                    00000001b,11111111b,11111000b,00000000b,\
1631
                                    00000000b,00000000b,00011000b,00000000b,\
1632
                                    00000000b,00000000b,00011000b,00000000b,\
1633
                                    00011111b,11111111b,11111000b,00000000b,\
1634
                                    00011111b,11111111b,11111000b,00000000b,\
1635
                                    00011000b,00000000b,00000000b,00000000b,\
1636
                                    00011000b,00000000b,00000000b,00000000b,\
1637
                                    00011111b,11111111b,11111111b,11100000b,\
1638
                                    00011111b,11111111b,11111111b,11100000b,\
1639
                                    00000000b,00000000b,00000000b,01100000b,\
1640
                                    00000000b,00000000b,00000000b,01100000b,\
1641
                                    00000000b,00000000b,00000000b,01100000b
1566 dunkaist 1642
 
1643
.snake_dots                 db      0,0, 0,1, 1,1
1644
.snake_direction            dd      RIGHT
1645
.snake_direction_next       dd      RIGHT
1646
.number_of_stones           dd      128
1677 dunkaist 1647
.name                       dd      stage_06_name
1566 dunkaist 1648
 
1649
stage_07:
1677 dunkaist 1650
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1651
                                    00000000b,00000000b,00000000b,00000000b,\
1652
                                    00000000b,00000000b,00000000b,00000000b,\
1653
                                    00000011b,11111111b,11111100b,00000000b,\
1654
                                    00000000b,00000000b,00000100b,00000000b,\
1655
                                    00000011b,11111111b,11110100b,00000000b,\
1656
                                    00000010b,00000000b,00010100b,00000000b,\
1657
                                    00000010b,11111111b,11010100b,00000000b,\
1658
                                    00000010b,00000000b,00010100b,00000000b,\
1659
                                    00000010b,11111111b,11110100b,00000000b,\
1660
                                    00000010b,00000000b,00000100b,00000000b,\
1661
                                    00000011b,11111111b,11111100b,00000000b,\
1662
                                    00000000b,00000000b,00000000b,00000000b,\
1663
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1664
 
1665
.snake_dots                 db      8,1, 9,1, 10,1
1666
.snake_direction            dd      RIGHT
1667
.snake_direction_next       dd      RIGHT
1668
.number_of_stones           dd      83
1677 dunkaist 1669
.name                       dd      stage_07_name
1566 dunkaist 1670
 
1671
stage_08:
1677 dunkaist 1672
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1673
                                    00000000b,00000000b,00000000b,00000000b,\
1674
                                    00000000b,00000000b,00010000b,00000000b,\
1675
                                    00001001b,00000001b,00000000b,00000000b,\
1676
                                    00000001b,01001001b,00000101b,00000000b,\
1677
                                    00000000b,01000000b,00000100b,00000000b,\
1678
                                    00001111b,00000000b,11100000b,00000000b,\
1679
                                    00000000b,00000000b,00001000b,10000000b,\
1680
                                    00000111b,00100000b,10000010b,10000000b,\
1681
                                    00010000b,00000000b,00000010b,00000000b,\
1682
                                    00010000b,11000000b,01110010b,00000000b,\
1683
                                    00010010b,00000000b,00000010b,00000000b,\
1684
                                    00000000b,00000000b,00000000b,00000000b,\
1685
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1686
 
1687
.snake_dots                 db      0,0, 1,0, 2,0
1688
.snake_direction            dd      RIGHT
1689
.snake_direction_next       dd      RIGHT
1690
.number_of_stones           dd      40
1677 dunkaist 1691
.name                       dd      stage_08_name
1566 dunkaist 1692
 
1693
stage_09:
1677 dunkaist 1694
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1695
                                    00000000b,00000000b,00000000b,00000000b,\
1696
                                    00000000b,00000000b,00000000b,00000000b,\
1697
                                    00000000b,00000000b,00000000b,00000000b,\
1698
                                    00111101b,00100110b,01001011b,11000000b,\
1699
                                    00100001b,10101001b,01010010b,00000000b,\
1700
                                    00111101b,01100001b,01100011b,10000000b,\
1701
                                    00000101b,01100111b,01010010b,00000000b,\
1702
                                    00111101b,00100001b,01001011b,11000000b,\
1703
                                    00000000b,00000000b,00000000b,00000000b,\
1704
                                    00000000b,00000000b,00000000b,00000000b,\
1705
                                    00000000b,00000000b,00000000b,00000000b,\
1706
                                    00000000b,00000000b,00000000b,00000000b,\
1707
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1708
 
1709
.snake_dots                 db      12,6, 12,7, 12,8
1710
.snake_direction            dd      DOWN
1711
.snake_direction_next       dd      DOWN
1712
.number_of_stones           dd      59
1677 dunkaist 1713
.name                       dd      stage_09_name
1566 dunkaist 1714
 
1715
stage_10:
1677 dunkaist 1716
.field                      db      11101110b,11101110b,11101110b,11100000b,\
1717
                                    11101110b,11101110b,11101110b,11100000b,\
1718
                                    11101110b,11101110b,11101110b,11100000b,\
1719
                                    00000000b,00000000b,00000000b,00000000b,\
1720
                                    11101110b,11101110b,11101110b,11100000b,\
1721
                                    11101110b,11101110b,11101110b,11100000b,\
1722
                                    11101110b,11101110b,11101110b,11100000b,\
1723
                                    00000000b,00000000b,00000000b,00000000b,\
1724
                                    11101110b,11101110b,11101110b,11100000b,\
1725
                                    11101110b,11101110b,11101110b,11100000b,\
1726
                                    11101110b,11101110b,11101110b,11100000b,\
1727
                                    00000000b,00000000b,00000000b,00000000b,\
1728
                                    11101110b,11101110b,11101110b,11100000b,\
1729
                                    11101110b,11101110b,11101110b,11100000b
1566 dunkaist 1730
 
1731
.snake_dots                 db      3,2, 3,3, 4,3
1732
.snake_direction            dd      RIGHT
1733
.snake_direction_next       dd      RIGHT
1734
.number_of_stones           dd      231
1677 dunkaist 1735
.name                       dd      stage_10_name
1566 dunkaist 1736
 
1737
stage_11:
1677 dunkaist 1738
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1739
                                    00000000b,00000000b,00000000b,00000000b,\
1740
                                    00000000b,00000000b,00000000b,00000000b,\
1741
                                    00000111b,00000111b,00000111b,00000000b,\
1742
                                    00001101b,10001101b,10001101b,10000000b,\
1743
                                    00011000b,11011000b,11011000b,11000000b,\
1744
                                    00000000b,01000000b,01000000b,01000000b,\
1745
                                    00011000b,11011000b,11011000b,11000000b,\
1746
                                    00001101b,10001101b,10001101b,10000000b,\
1747
                                    00000111b,00000111b,00000111b,00000000b,\
1748
                                    00000000b,00000000b,00000000b,00000000b,\
1749
                                    00000000b,00000000b,00000000b,00000000b,\
1750
                                    00000000b,00000000b,00000000b,00000000b,\
1751
                                    00000000b,00000000b,00000000b,00000000b
1566 dunkaist 1752
 
1753
.snake_dots                 db      3,12, 4,12, 5,12
1754
.snake_direction            dd      RIGHT
1755
.snake_direction_next       dd      RIGHT
1756
.number_of_stones           dd      69
1677 dunkaist 1757
.name                       dd      stage_11_name
1566 dunkaist 1758
 
1759
stage_12:
1677 dunkaist 1760
.field                      db      00000000b,00011000b,00001110b,00000000b,\
1761
                                    01101110b,00010000b,00001010b,01010000b,\
1762
                                    01001011b,11011001b,11000000b,01110000b,\
1763
                                    01100001b,01000001b,01000000b,00000000b,\
1764
                                    00000000b,00000000b,00000011b,10000000b,\
1765
                                    00000000b,00000000b,00000010b,10000000b,\
1766
                                    01010011b,00001100b,10100110b,00110000b,\
1767
                                    01110010b,00001000b,11100100b,00010000b,\
1768
                                    00000011b,00001100b,00000110b,00110000b,\
1769
                                    00000000b,11100000b,00000000b,00000000b,\
1770
                                    00010100b,10100000b,00000110b,00000000b,\
1771
                                    11011100b,00000110b,10100100b,00000000b,\
1772
                                    01000011b,10000010b,11100110b,10100000b,\
1773
                                    11000010b,10000110b,00000000b,11100000b
1566 dunkaist 1774
 
1775
.snake_dots                 db      27,0, 26,0, 25,0
1776
.snake_direction            dd      LEFT
1777
.snake_direction_next       dd      LEFT
1778
.number_of_stones           dd      110
1677 dunkaist 1779
.name                       dd      stage_12_name
1566 dunkaist 1780
 
1677 dunkaist 1781
stage_13:
1782
.field                      db      00111000b,00100000b,00000000b,00000000b,\
1783
                                    01111100b,11110011b,11000011b,10000000b,\
1784
                                    11111100b,01110011b,10000001b,11000000b,\
1785
                                    11110000b,00000011b,11000000b,00000000b,\
1786
                                    00000000b,00000010b,00000000b,00000000b,\
1787
                                    00000000b,00000010b,00000001b,00000000b,\
1788
                                    00011110b,00000111b,00000111b,00000000b,\
1789
                                    00000111b,10001111b,11111110b,00000000b,\
1790
                                    00000011b,11111111b,11111100b,00000000b,\
1791
                                    00110001b,11111111b,11111001b,01100000b,\
1792
                                    00001110b,11101011b,00100111b,10000000b,\
1793
                                    01111000b,10000011b,10000010b,00000000b,\
1794
                                    00000011b,11100110b,00011010b,11000000b,\
1795
                                    00000000b,00000000b,00000000b,00000000b
1796
 
1797
.snake_dots                 db      0,5, 0,6, 0,7
1798
.snake_direction            dd      DOWN
1799
.snake_direction_next       dd      DOWN
1800
.number_of_stones           dd      141
1801
.name                       dd      stage_13_name
1802
 
1803
stage_14:
1804
.field                      db      00000110b,00000000b,00000000b,00000000b,\
1805
                                    00001000b,00000000b,00011000b,00000000b,\
1806
                                    00010000b,00000000b,00000100b,00000000b,\
1807
                                    00100001b,10000000b,11000010b,00000000b,\
1808
                                    01000010b,01000001b,00100001b,00000000b,\
1809
                                    10000100b,00000010b,00010000b,10000000b,\
1810
                                    10001000b,00000100b,00001000b,01000000b,\
1811
                                    10010000b,00001000b,00000100b,01000000b,\
1812
                                    01001000b,00010000b,00001000b,10000000b,\
1813
                                    00100100b,00100000b,00010001b,00000000b,\
1814
                                    00010010b,01000001b,00100010b,00000000b,\
1815
                                    00001001b,10000000b,11000100b,00000000b,\
1816
                                    00000100b,00000000b,00001000b,00000000b,\
1817
                                    00000000b,00000000b,00110000b,00000000b
1818
 
1819
.snake_dots                 db      8,0, 9,0, 10,0
1820
.snake_direction            dd      RIGHT
1821
.snake_direction_next       dd      RIGHT
1822
.number_of_stones           dd      60
1823
.name                       dd      stage_14_name
1824
 
1825
stage_15:
1826
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1827
                                    00000000b,01110000b,00110000b,00000000b,\
1828
                                    00000000b,10000000b,00001010b,00000000b,\
1829
                                    00100001b,00000000b,00110010b,00000000b,\
1830
                                    00010001b,00111111b,10011100b,00000000b,\
1831
                                    00001001b,00100000b,11000000b,00000000b,\
1832
                                    00010000b,00000010b,01000000b,00000000b,\
1833
                                    00100000b,00000010b,00100001b,10000000b,\
1834
                                    00010000b,00000010b,00110010b,01000000b,\
1835
                                    00001000b,01000100b,00011100b,01000000b,\
1836
                                    00010000b,00111000b,00010000b,01000000b,\
1837
                                    00100000b,00000000b,00010000b,01000000b,\
1838
                                    00000000b,00000000b,00000000b,00000000b,\
1839
                                    00000000b,00000000b,00000000b,00000000b
1840
 
1841
.snake_dots                 db      13,3, 13,2, 14,2
1842
.snake_direction            dd      RIGHT
1843
.snake_direction_next       dd      RIGHT
1844
.number_of_stones           dd      60
1845
.name                       dd      stage_15_name
1846
 
1847
stage_16:
1848
.field                      db      00000000b,10000010b,00000000b,00000000b,\
1849
                                    00000000b,01001010b,10000010b,10100000b,\
1850
                                    01111111b,11100111b,00000001b,11000000b,\
1851
                                    00000000b,01000010b,00000000b,10000000b,\
1852
                                    00000100b,10000000b,01000000b,00000001b,\
1853
                                    00000100b,00100000b,10000000b,00000010b,\
1854
                                    11000100b,00010001b,11111000b,00000111b,\
1855
                                    00010101b,00001000b,10000000b,00000010b,\
1856
                                    00001110b,00010000b,01000000b,00000001b,\
1857
                                    00000100b,00100010b,00000000b,10000000b,\
1858
                                    00000000b,00000010b,00000000b,01000000b,\
1859
                                    00111111b,11111111b,11111111b,11100000b,\
1860
                                    00000000b,00000010b,00000000b,01000000b,\
1861
                                    00000000b,00000010b,00000000b,10000000b
1862
 
1863
.snake_dots                 db      11,7, 10,7, 9,7
1864
.snake_direction            dd      LEFT
1865
.snake_direction_next       dd      LEFT
1866
.number_of_stones           dd      96
1867
.name                       dd      stage_16_name
1868
 
1869
stage_17:
1870
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1871
                                    00000000b,00000000b,00000000b,00000000b,\
1872
                                    00000000b,00000000b,00000000b,00000000b,\
1873
                                    00000111b,10000001b,11100000b,00000000b,\
1874
                                    00001000b,01000010b,00010000b,00000000b,\
1875
                                    00010001b,00100100b,01001000b,00000000b,\
1876
                                    00010001b,00000000b,01001000b,00000000b,\
1877
                                    00001000b,01000010b,00010000b,00000000b,\
1878
                                    00000111b,10000001b,11100000b,00000000b,\
1879
                                    00000000b,00000000b,00000000b,00000000b,\
1880
                                    00000000b,01000000b,00000000b,00000000b,\
1881
                                    00000000b,00111110b,00000000b,00000000b,\
1882
                                    00000000b,00000000b,00000000b,00000000b,\
1883
                                    00000000b,00000000b,00000000b,00000000b
1884
 
1885
.snake_dots                 db      11,7, 11,8, 12,8
1886
.snake_direction            dd      RIGHT
1887
.snake_direction_next       dd      RIGHT
1888
.number_of_stones           dd      40
1889
.name                       dd      stage_17_name
1890
 
1891
stage_18:
1892
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1893
                                    01000100b,01000100b,01000100b,01000000b,\
1894
                                    00101010b,10101010b,10101010b,10100000b,\
1895
                                    00010001b,00010001b,00010001b,00000000b,\
1896
                                    00000000b,00000000b,00000000b,00000000b,\
1897
                                    00000000b,00000000b,00000000b,00000000b,\
1898
                                    01000100b,01000100b,01000100b,01000000b,\
1899
                                    00101010b,10101010b,10101010b,10100000b,\
1900
                                    00010001b,00010001b,00010001b,00000000b,\
1901
                                    00000000b,00000000b,00000000b,00000000b,\
1902
                                    00000000b,00000000b,00000000b,00000000b,\
1903
                                    01000100b,01000100b,01000100b,01000000b,\
1904
                                    00101010b,10101010b,10101010b,10100000b,\
1905
                                    00010001b,00010001b,00010001b,00000000b
1906
 
1907
.snake_dots                 db      2,5, 3,5, 4,5
1908
.snake_direction            dd      RIGHT
1909
.snake_direction_next       dd      RIGHT
1910
.number_of_stones           dd      78
1911
.name                       dd      stage_18_name
1912
 
1913
stage_19:
1914
.field                      db      01000010b,00100100b,10000101b,00000000b,\
1915
                                    00010000b,00010000b,00100000b,10000000b,\
1916
                                    00111001b,00000010b,00010000b,00100000b,\
1917
                                    01000100b,00001000b,00000010b,00000000b,\
1918
                                    01010101b,01000000b,01000000b,01000000b,\
1919
                                    01010100b,00010000b,00001000b,11100000b,\
1920
                                    00000100b,10001001b,00100001b,00000000b,\
1921
                                    01111100b,00100000b,00000001b,01010000b,\
1922
                                    00111001b,00000100b,00010001b,01010000b,\
1923
                                    00010000b,00000000b,10000001b,00010000b,\
1924
                                    11010111b,11100000b,00011101b,11110000b,\
1925
                                    00010000b,01000000b,00100000b,11100000b,\
1926
                                    00010000b,10000000b,00100000b,01000000b,\
1927
                                    00000001b,00000000b,00010000b,01000000b
1928
 
1929
.snake_dots                 db      27,6, 0,6, 1,6
1930
.snake_direction            dd      RIGHT
1931
.snake_direction_next       dd      RIGHT
1932
.number_of_stones           dd      95
1933
.name                       dd      stage_19_name
1934
 
1935
stage_20:
1936
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1937
                                    00000000b,00000000b,10001000b,00000000b,\
1938
                                    00000000b,00011100b,10000100b,00000000b,\
1939
                                    00000000b,01100100b,10000010b,00000000b,\
1940
                                    00000011b,10000100b,10000100b,00000000b,\
1941
                                    00000010b,00000100b,10001000b,00000000b,\
1942
                                    00000010b,00000100b,10000100b,00000000b,\
1943
                                    00000010b,00000100b,10000010b,00000000b,\
1944
                                    00000010b,00111100b,10010010b,00000000b,\
1945
                                    00011110b,00111100b,10010100b,00000000b,\
1946
                                    00011110b,00111100b,10001000b,00000000b,\
1947
                                    00011110b,00000000b,10000000b,00000000b,\
1948
                                    00000000b,00000000b,10000000b,00000000b,\
1949
                                    00000000b,00000000b,00000000b,00000000b
1950
 
1951
.snake_dots                 db      17,2, 17,3, 17,4
1952
.snake_direction            dd      DOWN
1953
.snake_direction_next       dd      DOWN
1954
.number_of_stones           dd      65
1955
.name                       dd      stage_20_name
1956
 
1957
stage_21:
1958
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1959
                                    00000000b,00000000b,00000000b,00000000b,\
1960
                                    00000011b,11111111b,11111110b,00000000b,\
1961
                                    00000001b,01000100b,01000100b,00000000b,\
1962
                                    00000010b,01000100b,01000100b,00000000b,\
1963
                                    00001100b,01000100b,01000100b,00000000b,\
1964
                                    01110000b,01000100b,01000100b,00000000b,\
1965
                                    01110000b,01000100b,01000100b,00000000b,\
1966
                                    01110000b,11101110b,11101110b,00000000b,\
1967
                                    00000000b,11101110b,11101110b,00000000b,\
1968
                                    00000000b,11101110b,11101110b,00000000b,\
1969
                                    00000000b,00000000b,00000000b,00000000b,\
1970
                                    00000000b,00000000b,00000000b,00000000b,\
1971
                                    00000000b,00000000b,00000000b,00000000b
1972
 
1973
.snake_dots                 db      10,1, 11,1, 12,1
1974
.snake_direction            dd      RIGHT
1975
.snake_direction_next       dd      RIGHT
1976
.number_of_stones           dd      86
1977
.name                       dd      stage_21_name
1978
 
1979
stage_22:
1980
.field                      db      00000000b,00000000b,00000000b,00000000b,\
1981
                                    00000011b,10000000b,00000000b,00000000b,\
1982
                                    00000111b,11100000b,00000000b,00000000b,\
1983
                                    00001111b,11110000b,00000000b,00000000b,\
1984
                                    00011111b,11100000b,00000000b,00000000b,\
1985
                                    00011111b,11000011b,00001100b,00110000b,\
1986
                                    00011111b,10000111b,10011110b,01110000b,\
1987
                                    00011111b,11000111b,10011110b,01110000b,\
1988
                                    00011111b,11100011b,00001100b,00110000b,\
1989
                                    00001111b,11110000b,00000000b,00000000b,\
1990
                                    00000111b,11100000b,00000000b,00000000b,\
1991
                                    00000011b,10000000b,00000000b,00000000b,\
1992
                                    00000000b,00000000b,00000000b,00000000b,\
1993
                                    00000000b,00000000b,00000000b,00000000b
1994
 
1995
.snake_dots                 db      1,7, 1,6, 1,5
1996
.snake_direction            dd      UP
1997
.snake_direction_next       dd      UP
1998
.number_of_stones           dd      104
1999
.name                       dd      stage_22_name
2000
 
2001
stage_23:
2002
.field                      db      00000000b,00000000b,00000000b,00000000b,\
2003
                                    00100000b,01000101b,00010000b,00100000b,\
2004
                                    00011010b,00100101b,00100010b,11000000b,\
2005
                                    00000100b,10101000b,10101001b,00000000b,\
2006
                                    00000100b,10010010b,01001001b,00000000b,\
2007
                                    00001011b,00110000b,01100110b,10000000b,\
2008
                                    00000000b,11001010b,10011000b,00000000b,\
2009
                                    00000001b,00000111b,00000100b,00000000b,\
2010
                                    00001110b,01001010b,10010011b,10000000b,\
2011
                                    00000010b,00110000b,01100010b,00000000b,\
2012
                                    00000101b,00010010b,01000101b,00000000b,\
2013
                                    00001001b,00001000b,10000100b,10000000b,\
2014
                                    00000000b,00001000b,10000000b,00000000b,\
2015
                                    00000000b,00000000b,00000000b,00000000b
2016
 
2017
.snake_dots                 db      15,0, 14,0, 13,0
2018
.snake_direction            dd      LEFT
2019
.snake_direction_next       dd      LEFT
2020
.number_of_stones           dd      85
2021
.name                       dd      stage_23_name
2022
 
2023
stage_24:
2024
.field                      db      00000000b,00000000b,00000000b,00000000b,\
2025
                                    00111111b,11111111b,11111111b,10000000b,\
2026
                                    00100000b,00000000b,00000000b,10000000b,\
2027
                                    00100011b,11111111b,11111000b,10000000b,\
2028
                                    00100010b,00000000b,00001000b,10000000b,\
2029
                                    00100010b,00111111b,10001000b,10000000b,\
2030
                                    00100010b,00100000b,10001000b,10000000b,\
2031
                                    00101010b,10101010b,10101010b,10000000b,\
2032
                                    00001000b,10001110b,00100010b,00000000b,\
2033
                                    00001000b,10000000b,00100010b,00000000b,\
2034
                                    00001000b,11111111b,11100010b,00000000b,\
2035
                                    00001000b,00000000b,00000010b,00000000b,\
2036
                                    00001111b,11111111b,11111110b,00000000b,\
2037
                                    00000000b,00000000b,00000000b,00000000b
2038
 
2039
.snake_dots                 db      1,0, 0,0, 0,1
2040
.snake_direction            dd      DOWN
2041
.snake_direction_next       dd      DOWN
2042
.number_of_stones           dd      120
2043
.name                       dd      stage_24_name
2044
 
2045
stage_25:
2046
.field                      db      00000100b,11000000b,00000000b,00000000b,\
2047
                                    00000011b,10000000b,00110010b,00000000b,\
2048
                                    10011010b,10000000b,00011100b,00000000b,\
2049
                                    01110000b,00000000b,00010101b,10010000b,\
2050
                                    01010000b,00000111b,00000000b,11100000b,\
2051
                                    00000100b,00000101b,00000000b,10100000b,\
2052
                                    00000100b,00000100b,00000000b,00000000b,\
2053
                                    00000011b,11111100b,00011001b,00000000b,\
2054
                                    00000010b,10010100b,00001110b,00000000b,\
2055
                                    00000010b,10010100b,00001010b,00000000b,\
2056
                                    00000000b,00000000b,00000000b,00000000b,\
2057
                                    00000011b,00100001b,10010011b,00100000b,\
2058
                                    00000001b,11000000b,11100001b,11000000b,\
2059
                                    00000001b,01000000b,10100001b,01000000b
2060
 
2061
.snake_dots                 db      11,2, 12,2, 13,2
2062
.snake_direction            dd      RIGHT
2063
.snake_direction_next       dd      RIGHT
2064
.number_of_stones           dd      88
2065
.name                       dd      stage_25_name
2066
 
2067
stage_26:
2068
.field                      db      00000000b,00000000b,00000000b,00000000b,\
2069
                                    00111100b,01001111b,01111010b,01000000b,\
2070
                                    00100000b,01000001b,00001010b,01000000b,\
2071
                                    00100100b,01001111b,01111011b,11000000b,\
2072
                                    00000100b,01001000b,00001000b,01000000b,\
2073
                                    00111100b,01001111b,01111000b,01000000b,\
2074
                                    00000000b,00000000b,00000000b,00000000b,\
2075
                                    00000000b,00000000b,00000000b,00000000b,\
2076
                                    00111101b,11101111b,01111011b,11000000b,\
2077
                                    00100001b,00000001b,00000000b,00000000b,\
2078
                                    00111101b,11100001b,01111011b,11000000b,\
2079
                                    00000100b,00000001b,00000000b,01000000b,\
2080
                                    00111101b,11100001b,01111011b,11000000b,\
2081
                                    00000000b,00000000b,00000000b,00000000b
2082
 
2083
.snake_dots                 db      1,5, 0,5, 0,6
2084
.snake_direction            dd      DOWN
2085
.snake_direction_next       dd      DOWN
2086
.number_of_stones           dd      115
2087
.name                       dd      stage_26_name
2088
 
2089
stage_27:
2090
.field                      db      00000000b,10000000b,00000000b,01000000b,\
2091
                                    00000000b,10000000b,01000000b,11100000b,\
2092
                                    00100011b,11100000b,01000000b,01000000b,\
2093
                                    01110000b,10000001b,11110000b,00000000b,\
2094
                                    00100000b,10000000b,01000000b,00000000b,\
2095
                                    00000000b,00000000b,01000010b,00000000b,\
2096
                                    00000000b,00000000b,00000000b,00000000b,\
2097
                                    00000010b,00000000b,00000000b,00000000b,\
2098
                                    00000111b,00000000b,00000000b,10000000b,\
2099
                                    00000010b,00001000b,00000001b,11000000b,\
2100
                                    00000000b,00000000b,10000000b,10000000b,\
2101
                                    00000000b,01000001b,11000000b,00000000b,\
2102
                                    01000000b,11100000b,10000000b,00000000b,\
2103
                                    00000000b,01000000b,00000000b,00000000b
2104
 
2105
.snake_dots                 db      12,8, 12,7, 12,6
2106
.snake_direction            dd      UP
2107
.snake_direction_next       dd      UP
2108
.number_of_stones           dd      51
2109
.name                       dd      stage_27_name
2110
 
2111
stage_28:
2112
.field                      db      00000000b,00000000b,00000000b,00000000b,\
2113
                                    00000000b,00000000b,00000000b,00000000b,\
2114
                                    00000000b,00000000b,00000000b,00000000b,\
2115
                                    00000000b,00000000b,00000000b,00000000b,\
2116
                                    00000100b,00000000b,00000010b,00000000b,\
2117
                                    00010100b,00000000b,00000010b,10000000b,\
2118
                                    01010100b,00000000b,00000010b,10100000b,\
2119
                                    01010101b,11111111b,11111010b,10100000b,\
2120
                                    01010100b,00000000b,00000010b,10100000b,\
2121
                                    00010100b,00000000b,00000010b,10000000b,\
2122
                                    00000100b,00000000b,00000010b,00000000b,\
2123
                                    00000000b,00000000b,00000000b,00000000b,\
2124
                                    00000000b,00000000b,00000000b,00000000b,\
2125
                                    00000000b,00000000b,00000000b,00000000b
2126
 
2127
.snake_dots                 db      13,8, 12,8, 11,8
2128
.snake_direction            dd      LEFT
2129
.snake_direction_next       dd      LEFT
2130
.number_of_stones           dd      44
2131
.name                       dd      stage_28_name
2132
 
2133
stage_29:
2134
.field                      db      00000000b,01110000b,00000000b,00000000b,\
2135
                                    00000100b,01000110b,00000001b,10000000b,\
2136
                                    01001110b,00001100b,01100000b,11000000b,\
2137
                                    01000000b,00000000b,01100000b,00000000b,\
2138
                                    01100000b,01111000b,00000001b,10010000b,\
2139
                                    00000000b,00000010b,10000101b,10110000b,\
2140
                                    00110000b,00110010b,10001100b,00100000b,\
2141
                                    00011011b,00110110b,10000100b,00000000b,\
2142
                                    00000001b,00000000b,10010000b,10000000b,\
2143
                                    00100001b,00000000b,00111000b,10000000b,\
2144
                                    00111001b,00110011b,00000011b,10000000b,\
2145
                                    01111111b,11111111b,00011011b,11010000b,\
2146
                                    11111111b,11111111b,00011111b,11110000b,\
2147
                                    11111111b,11111111b,00111111b,11110000b
2148
 
2149
.snake_dots                 db      0,0, 1,0, 2,0
2150
.snake_direction            dd      RIGHT
2151
.snake_direction_next       dd      RIGHT
2152
.number_of_stones           dd      151
2153
.name                       dd      stage_29_name
2154
 
2155
stage_30:
2156
.field                      db      00000000b,00000000b,00000000b,00000000b,\
2157
                                    00000000b,00000001b,01011100b,00000000b,\
2158
                                    00000000b,00000001b,11001000b,00000000b,\
2159
                                    00000100b,00000001b,01001000b,00000000b,\
2160
                                    00000100b,00000100b,00000000b,00000000b,\
2161
                                    00000100b,00000100b,00000100b,00000000b,\
2162
                                    00000100b,00000100b,00000100b,00000000b,\
2163
                                    00000100b,00000100b,00000100b,00000000b,\
2164
                                    01111111b,11000100b,11111111b,11100000b,\
2165
                                    00000100b,00000100b,00000100b,00000000b,\
2166
                                    00011111b,00111111b,10001110b,00000000b,\
2167
                                    00000100b,00000100b,00000100b,00000000b,\
2168
                                    00011111b,00011111b,00011111b,00000000b,\
2169
                                    11111111b,11111111b,11111111b,11110000b
2170
 
2171
.snake_dots                 db      8,2, 9,2, 10,2
2172
.snake_direction            dd      RIGHT
2173
.snake_direction_next       dd      RIGHT
2174
.number_of_stones           dd      109
2175
.name                       dd      stage_30_name
2176
 
2177
stage_31:
2178
.field                      db      00000101b,00010000b,00000100b,01000000b,\
2179
                                    01000100b,01010101b,00010100b,01000000b,\
2180
                                    01000101b,01010101b,01000101b,00010000b,\
2181
                                    01010000b,00010100b,01000000b,01010000b,\
2182
                                    00010101b,01000101b,01010100b,01000000b,\
2183
                                    01000001b,00010000b,01010101b,01000000b,\
2184
                                    01010101b,00010100b,00000101b,00010000b,\
2185
                                    00000101b,01010000b,01000101b,01010000b,\
2186
                                    01010000b,01000100b,00000000b,01010000b,\
2187
                                    00010101b,00000101b,00010100b,00010000b,\
2188
                                    01010001b,00010001b,01000001b,01000000b,\
2189
                                    01000100b,00000101b,01010100b,01010000b,\
2190
                                    00010001b,01010100b,00010001b,00010000b,\
2191
                                    00000100b,01000001b,00010001b,00000000b
2192
 
2193
.snake_dots                 db      18,8, 17,8, 16,8
2194
.snake_direction            dd      LEFT
2195
.snake_direction_next       dd      LEFT
2196
.number_of_stones           dd      112
2197
.name                       dd      stage_31_name
2198
 
2199
stage_32:
2200
.field                      db      11111111b,11111111b,11111111b,11110000b,\
2201
                                    10010010b,01001001b,00100100b,10010000b,\
2202
                                    10010000b,01000001b,00000100b,00010000b,\
2203
                                    10010010b,01001001b,00100100b,10010000b,\
2204
                                    10010010b,01001001b,00100100b,10010000b,\
2205
                                    10010010b,01001001b,00100100b,10010000b,\
2206
                                    10010010b,01001001b,00100100b,10010000b,\
2207
                                    10010010b,01001001b,00100100b,10010000b,\
2208
                                    10010010b,01001001b,00100100b,10010000b,\
2209
                                    10010010b,01001001b,00100100b,10010000b,\
2210
                                    10010010b,01001001b,00100100b,10010000b,\
2211
                                    10000010b,00001000b,00100000b,10010000b,\
2212
                                    10010010b,01001001b,00100100b,10010000b,\
2213
                                    11111111b,11111111b,11111111b,11110000b
2214
 
2215
.snake_dots                 db      1,1, 1,2, 1,3
2216
.snake_direction            dd      DOWN
2217
.snake_direction_next       dd      DOWN
2218
.number_of_stones           dd      168
2219
.name                       dd      stage_32_name
2220
 
2221
stage_33:
2222
.field                      db      00000000b,00000000b,00000000b,00000000b,\
2223
                                    00000000b,00000000b,00000000b,00000000b,\
2224
                                    01111111b,11001111b,11111111b,11100000b,\
2225
                                    01000100b,01001000b,01000000b,00100000b,\
2226
                                    01000100b,01001000b,01000001b,10100000b,\
2227
                                    01000100b,01001000b,01001101b,10100000b,\
2228
                                    00000000b,00000000b,00000110b,00000000b,\
2229
                                    01000100b,01001000b,01000010b,00100000b,\
2230
                                    01000100b,01001000b,01001111b,00100000b,\
2231
                                    01000100b,01001000b,01001111b,00100000b,\
2232
                                    01000100b,01001000b,01000110b,00100000b,\
2233
                                    01111111b,11001111b,11111111b,11100000b,\
2234
                                    00000000b,00000000b,00000000b,00000000b,\
2235
                                    00000000b,00000000b,00000000b,00000000b
2236
 
2237
.snake_dots                 db      6,6, 7,6, 8,6
2238
.snake_direction            dd      RIGHT
2239
.snake_direction_next       dd      RIGHT
2240
.number_of_stones           dd      109
2241
.name                       dd      stage_33_name
2242
 
2243
stage_34:
2244
.field                      db      01110000b,00000000b,00000011b,10000000b,\
2245
                                    00010010b,00010000b,01111100b,00000000b,\
2246
                                    00011110b,00010000b,00100100b,00000000b,\
2247
                                    00000100b,00011001b,00100111b,00000000b,\
2248
                                    00001111b,10001001b,00100000b,00110000b,\
2249
                                    00000001b,00001011b,00101000b,00100000b,\
2250
                                    00000001b,00011110b,01111000b,00100000b,\
2251
                                    00111000b,00000010b,00001100b,10100000b,\
2252
                                    00001110b,00100010b,00000000b,10100000b,\
2253
                                    01100011b,11111110b,01000011b,11100000b,\
2254
                                    00111110b,00100010b,01000000b,10000000b,\
2255
                                    00000000b,01100011b,11000010b,10000000b,\
2256
                                    00000000b,01000000b,01100111b,10000000b,\
2257
                                    00000000b,00000000b,00000010b,00000000b
2258
 
2259
.snake_dots                 db      7,0, 8,0, 9,0
2260
.snake_direction            dd      RIGHT
2261
.snake_direction_next       dd      RIGHT
2262
.number_of_stones           dd      113
2263
.name                       dd      stage_34_name
2264
 
2265
stage_35:
2266
.field                      db      00000100b,00000000b,00001010b,00000000b,\
2267
                                    00010100b,01000000b,00101010b,00000000b,\
2268
                                    00010100b,10000010b,00010010b,10000000b,\
2269
                                    00010001b,00000000b,00010010b,10000000b,\
2270
                                    00010001b,00000010b,00001010b,10000000b,\
2271
                                    01010010b,00000010b,00001000b,10100000b,\
2272
                                    01000100b,00000000b,00001000b,10100000b,\
2273
                                    01000100b,00000010b,00000100b,10100000b,\
2274
                                    01001000b,00000010b,00000100b,00100000b,\
2275
                                    01001000b,00000000b,00000010b,00100000b,\
2276
                                    00010000b,00000010b,00000010b,00100000b,\
2277
                                    00110000b,00000010b,00000010b,00100000b,\
2278
                                    00100000b,00000010b,00000001b,00000000b,\
2279
                                    00000000b,00000000b,00000000b,00000000b
2280
 
2281
.snake_dots                 db      13,11, 13,10, 13,9
2282
.snake_direction            dd      UP
2283
.snake_direction_next       dd      UP
2284
.number_of_stones           dd      66
2285
.name                       dd      stage_35_name
2286
 
2287
stage_36:
2288
.field                      db      10101110b,10001110b,00110100b,11100000b,\
2289
                                    11101000b,10001110b,00101010b,10000000b,\
2290
                                    10101110b,11101000b,00101010b,11100000b,\
2291
                                    00000000b,00000000b,00000000b,00000000b,\
2292
                                    00000000b,00000000b,00000000b,00000000b,\
2293
                                    00000000b,10110010b,01000100b,00000000b,\
2294
                                    00000001b,10100101b,01010100b,00000000b,\
2295
                                    00000001b,10100101b,00101000b,00000000b,\
2296
                                    00000000b,00000000b,00000000b,00000000b,\
2297
                                    00010001b,11010101b,11010001b,11000000b,\
2298
                                    00010001b,11010101b,11010001b,00000000b,\
2299
                                    00010001b,00010101b,00010000b,10000000b,\
2300
                                    00011101b,11001001b,11011100b,01000000b,\
2301
                                    00000000b,00000000b,00000001b,11010000b
2302
 
2303
.snake_dots                 db      27,11, 27,10, 27,9
2304
.snake_direction            dd      UP
2305
.snake_direction_next       dd      UP
2306
.number_of_stones           dd      112
2307
.name                       dd      stage_36_name
2308
 
2309
 
2310
stage_00_name               db      'Classic mode',0
2311
stage_01_name               db      'Begin',0
2312
stage_02_name               db      'Frame',0
2313
stage_03_name               db      'Sight',0
2314
stage_04_name               db      'Dashed',0
2315
stage_05_name               db      'Beams',0
2316
stage_06_name               db      'Pipe',0
2317
stage_07_name               db      'Labyrinth',0
2318
stage_08_name               db      'Sea battle',0
2319
stage_09_name               db      'Recursion',0
2320
stage_10_name               db      'Narrow corridors',0
2321
stage_11_name               db      'CCC',0
2322
stage_12_name               db      'Deadlocks',0
2323
stage_13_name               db      'Boat',0
2324
stage_14_name               db      'Pattern',0
2325
stage_15_name               db      'Guernica',0
2326
stage_16_name               db      'Goto',0
2327
stage_17_name               db      'Smiling face',0
2328
stage_18_name               db      'Waves',0
2329
stage_19_name               db      'First snow',0
2330
stage_20_name               db      'Music and silence',0
2331
stage_21_name               db      'Experiment',0
2332
stage_22_name               db      'Pacman',0
2333
stage_23_name               db      'Intricate pattern',0
2334
stage_24_name               db      'Square arcs',0
2335
stage_25_name               db      'In the animal world',0
2336
stage_26_name               db      'Digits',0
2337
stage_27_name               db      'Pluses',0
2338
stage_28_name               db      'Rod',0
2339
stage_29_name               db      'Tetris',0
2340
stage_30_name               db      'Towers of Hanoi',0
2341
stage_31_name               db      'Ruins',0
2342
stage_32_name               db      'Walls of Akendora',0
2343
stage_33_name               db      'Geranium in the window',0
2344
stage_34_name               db      'Algae',0
2345
stage_35_name               db      'The road ahead',0
2346
stage_36_name               db      'Help me draw levels!',0
2347
 
2348
 
1518 dunkaist 2349
background_color            dd      0x000000
2350
decorations_color           dd      0x00000000
2351
snake_color                 dd      0x000000
2352
snake_head_color            dd      0x000000
1677 dunkaist 2353
lives_in_head_number_color  dd      0x000000
1518 dunkaist 2354
snake_picture_color         dd      0x000000
2355
version_picture_color       dd      0x000000
2356
pause_picture_color         dd      0x000000
2357
game_over_picture_color     dd      0x000000
1566 dunkaist 2358
you_win_picture_color       dd      0x000000
1518 dunkaist 2359
eat_color                   dd      0x000000
2360
navigation_strings_color    dd      0x80000000
2361
game_over_strings_color     dd      0x80000000
2362
score_string_color          dd      0x80000000
2363
hiscore_string_color        dd      0x80000000
2364
champion_string_color       dd      0x80000000
2365
game_over_hiscore_color     dd      0x80000000
2366
score_number_color          dd      0x40000000
2367
hiscore_number_color        dd      0x00000000
2368
champion_name_color         dd      0x80000000
1566 dunkaist 2369
button_color                dd      0x000000
2370
button_text_color           dd      0x80000000
2371
stone_color                 dd      0x000000
2372
splash_background_color     dd      0x000000
2373
splash_level_string_color   dd      0x000000
2374
splash_level_number_color   dd      0x000000
2375
level_string_color          dd      0x80000000
2376
level_number_color          dd      0x00000000
1518 dunkaist 2377
 
1566 dunkaist 2378
 
1518 dunkaist 2379
align 4
2380
@IMPORT:
2381
 
2382
library \
2383
        libini      ,   'libini.obj'        ,\
2384
        box_lib     ,   'box_lib.obj'
2385
 
2386
import  libini,\
2387
    ini.get_str     ,   'ini_get_str'       ,\
2388
    ini.get_int     ,   'ini_get_int'       ,\
2389
    ini.set_str     ,   'ini_set_str'       ,\
2390
    ini.set_int     ,   'ini_set_int'       ,\
1677 dunkaist 2391
    ini.get_color   ,   'ini_get_color'     ,\
2392
    ini.get_shortcut,   'ini_get_shortcut'
1518 dunkaist 2393
 
2394
import  box_lib,\
2395
    edit_box.draw   ,   'edit_box'          ,\
2396
    edit_box.key    ,   'edit_box_key'      ,\
2397
    edit_box.mouse  ,   'edit_box_mouse'
2398
 
2399
bFirstDraw  db  0
2400
 
2401
aPreferences                db      'Preferences',0
2402
aSpeed                      db      'Speed',0
1522 dunkaist 2403
aTheme                      db      'Theme',0
1677 dunkaist 2404
aSmart_reverse              db      'Smart_reverse',0
2405
aShow_lives_style           db      'Show_lives_style',0
2406
aDraw_level_name_in_window_title db 'Draw_level_name_in_window_title',0
2407
aSeparating_symbol          db      'Separating_symbol',0
1522 dunkaist 2408
 
1677 dunkaist 2409
aShortcuts                  db      'Shortcuts',0
2410
aMove_left                  db      'Move_left',0
2411
aMove_down                  db      'Move_down',0
2412
aMove_up                    db      'Move_up',0
2413
aMove_right                 db      'Move_right',0
2414
aReverse                    db      'Reverse',0
2415
aIncrease                   db      'Increase',0
2416
aDecrease                   db      'Decrease',0
2417
 
1522 dunkaist 2418
aTheme_name                 db      32  dup (0)
1518 dunkaist 2419
aDecorations                db      'Decorations',0
2420
aBackground_color           db      'Background_color',0
2421
aDecorations_color          db      'Decorations_color',0
2422
aSnake_color                db      'Snake_color',0
2423
aSnake_head_color           db      'Snake_head_color',0
1677 dunkaist 2424
aLives_in_head_number_color db      'Lives_in_head_number_color',0
1518 dunkaist 2425
aSnake_picture_color        db      'Snake_picture_color',0
2426
aVersion_picture_color      db      'Version_picture_color',0
2427
aPause_picture_color        db      'Pause_picture_color',0
2428
aGame_over_picture_color    db      'Game_over_picture_color',0
1566 dunkaist 2429
aYou_win_picture_color      db      'You_win_picture_color',0
1518 dunkaist 2430
aEat_color                  db      'Eat_color',0
2431
aNavigation_strings_color   db      'Navigation_string_color',0
2432
aGame_over_strings_color    db      'Game_over_string_color',0
2433
aScore_string_color         db      'Score_string_color',0
2434
aHiscore_string_color       db      'Hiscore_string_color',0
2435
aChampion_string_color      db      'Champion_string_color',0
2436
aGame_over_hiscore_color    db      'Game_over_hiscore_color',0
2437
aScore_number_color         db      'Score_number_color',0
2438
aHiscore_number_color       db      'Hiscore_number_color',0
2439
aChampion_name_color        db      'Champion_name_color',0
1520 dunkaist 2440
aEdit_box_selection_color   db      'Edit_box_selection_color',0
1566 dunkaist 2441
aButton_color               db      'Button_color',0
2442
aButton_text_color          db      'Button_text_color',0
2443
aStone_color                db      'Stone_color',0
2444
aSplash_background_color    db      'Splash_background_color',0
2445
aSplash_level_string_color  db      'Splash_level_string_color',0
2446
aSplash_level_number_color  db      'Splash_level_number_color',0
2447
aLevel_string_color         db      'Level_string_color',0
2448
aLevel_number_color         db      'Level_number_color',0
1518 dunkaist 2449
 
1566 dunkaist 2450
aReserved                   db      'Reserved',0
2451
aSquare_side_length         db      'Square_side_length',0
2452
aHiscore_classic            db      'Hiscore_classic',0
2453
aChampion_name_classic      db      'Champion_name_classic',0
2454
aHiscore_levels             db      'Hiscore_levels',0
2455
aChampion_name_levels       db      'Champion_name_levels',0
1518 dunkaist 2456
 
1522 dunkaist 2457
edit1 edit_box 65,397,0x0,0x000000,0x000000,0x000000,0x000000,0x80000000,15,hed,mouse_dd,ed_focus,hed_end-hed-1,hed_end-hed-1
2458
 
1518 dunkaist 2459
hed                         db      '',0
1522 dunkaist 2460
;;---Variables-------------------------------------------------------------------------------------------------------------
2461
i_end:
1518 dunkaist 2462
hed_end:
2463
rb  256
2464
mouse_dd                    rd      1
2465
 
1677 dunkaist 2466
window_style                rd      1
2467
 
1566 dunkaist 2468
cur_level                   rd      1
2469
cur_level_number            rd      1
2470
hi_level                    rd      1
1522 dunkaist 2471
 
1566 dunkaist 2472
score                       rd      1
2473
hi_score_classic            rd      1
2474
hi_score_levels             rd      1
1522 dunkaist 2475
 
1566 dunkaist 2476
champion_name_classic       rb      CHAMPION_NAME_LENGTH
2477
champion_name_levels        rb      CHAMPION_NAME_LENGTH
2478
 
2479
snake_dots                  rb      GRID_WIDTH*GRID_HEIGHT*2+3          ; +3 bytes for faster dword copying
2480
snake_direction             rd      1
2481
snake_direction_next        rd      1
2482
snake_length_x2             rd      1
2483
 
2484
decorations                 rd      1
2485
number_of_free_dots         rd      1
2486
 
2487
eat                         rw      1
2488
 
1522 dunkaist 2489
g_s                         rd      1
1566 dunkaist 2490
g_e                         rd      1
1522 dunkaist 2491
 
2492
window_width                rd      1
2493
window_height               rd      1
2494
wp_x                        rd      1
2495
wp_y                        rd      1
2496
 
2497
gw_mul_gs                   rd      1
2498
gh_mul_gs                   rd      1
2499
gbxm1_plus_gw_mul_gs        rd      1
2500
gbym1_plus_gh_mul_gs        rd      1
2501
gs_shl16_gs                 rd      1
2502
gbxm1_shl16_gbxm1           rd      1
2503
gbym1_shl16_gbym1           rd      1
2504
 
2505
bottom_top_strings          rd      1
2506
bottom_middle_strings       rd      1
2507
bottom_bottom_strings       rd      1
2508
top_strings                 rd      1
2509
 
1566 dunkaist 2510
button_x_left               rd      1
2511
button_x_right              rd      1
2512
button_y_top                rd      1
2513
button_y_middle             rd      1
2514
button_y_bottom             rd      1
2515
button_width_short          rd      1
2516
button_width_long           rd      1
2517
button_height               rd      1
1522 dunkaist 2518
 
1566 dunkaist 2519
cursor_data                 rb      32*32*4
2520
cursor_handle               rd      1
2521
 
1518 dunkaist 2522
cur_dir_path                rb      4096
2523
@PARAMS                     rb      4096
2524
 
1566 dunkaist 2525
field_map                   rb      GRID_WIDTH*GRID_HEIGHT*2
2526
 
1677 dunkaist 2527
proc_info                   process_information
2528
 
2529
smart_reverse               rd      1
2530
show_lives_style            rd      1
2531
draw_level_name_in_window_title rd  1
2532
separating_symbol           rd      1
2533
 
2534
shortcut_move_left          rb      1
2535
shortcut_move_down          rb      1
2536
shortcut_move_up            rb      1
2537
shortcut_move_right         rb      1
2538
shortcut_reverse            rb      1
2539
shortcut_increase           rb      1
2540
shortcut_decrease           rb      1
2541
 
2542
square_side_length          rd      1
2543
 
2544
gbxm1                       rd      1
2545
gbym1                       rd      1
2546
speed_up_counter            rw      1
2547
 
1518 dunkaist 2548
rb 4096
2549
stacktop:
1677 dunkaist 2550
d_end: