Subversion Repositories Kolibri OS

Rev

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