Subversion Repositories Kolibri OS

Rev

Rev 1861 | Rev 3015 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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