Subversion Repositories Kolibri OS

Rev

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