Subversion Repositories Kolibri OS

Rev

Rev 1677 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;===First_menu_mode===========================================================================================================
  2.  
  3. First_menu:
  4.     mov  byte[window_title+5],  0
  5.       mcall     71,1,window_title
  6.       mcall     40,111b                         ; set events: standart
  7.       mcall     66,1,1                          ; set scan codes mode for keyboard
  8.     mov  [is_new_record],   0
  9.     mov  [lives],   START_LIVES
  10.       call      Show_cursor
  11.  
  12.     mov  [score],   0
  13.       call      Set_first_level_of_play_mode
  14.  
  15.     mov  ebx, [time_wait_limit_const]
  16.     mov  [time_wait_limit], ebx
  17.  
  18.   .redraw:
  19.       call      Set_geometry
  20.       mcall     12,1
  21.       mcall     0, , ,[window_style], ,window_title
  22.     test [proc_info.wnd_state], 0x04            ; is rolled up?
  23.      jnz @f
  24.  
  25.       call      Draw_decorations
  26.       call      Draw_first_menu_picture
  27.       call      Draw_menu_strings
  28.       call      Draw_buttons
  29.   @@:
  30.       mcall     12,2
  31.   .still:
  32.       mcall     10                              ; wait for event
  33.                                                 ; ok, what an event?
  34.     dec  al                                     ; has the window been moved or resized?
  35.      jz  .redraw                                ;
  36.     dec  al                                     ; was a key pressed?
  37.      jz  .key                                   ;
  38.  
  39.  
  40.   .button:                                      ; a button was pressed
  41.       mcall     17                              ; get button number
  42.     shr  eax, 8                                 ; we should do it to get the real button code
  43.  
  44.     cmp  eax, 1                                 ; is it close button?
  45.      je  Save_do_smth_else_and_exit             ; if so, jump to quit...
  46.     cmp  eax, 0xD0                              ; 'play' button?
  47.      je  Level_begin
  48.     cmp  eax, 0xD1                              ; 'exit' button?
  49.      je  Save_do_smth_else_and_exit
  50.     cmp  eax, 0xD2                              ; change play mode button?
  51.      jne @f
  52.       call      Change_play_mode
  53.       call      Delete_buttons
  54.       call      Draw_buttons
  55.      jmp .still                                 ; jump to wait for another event
  56.   @@:
  57.     cmp  eax, 0xD3                              ; '+INC+' button?
  58.      jne @f
  59.       call      Increase_geometry
  60.      jmp .redraw                                ; jump to wait for another event
  61.   @@:
  62.     cmp  eax, 0xD4                              ; '-dec-' button?
  63.      jne @f
  64.       call      Decrease_geometry
  65.      jmp .redraw                                ; jump to wait for another event
  66.   @@:
  67.  
  68.      jmp .still                                 ; jump to wait for another event
  69.  
  70.  
  71.   .key:                                         ; a key was pressed
  72.       mcall     2                               ; get keycode
  73.  
  74.     cmp  ah, 0x01                               ; Escape
  75.      je  Save_do_smth_else_and_exit
  76.     cmp  ah, 0x1C                               ; Enter
  77.      je  Level_begin
  78.     cmp  ah, 0x39                               ; Space
  79.      jne @f
  80.       call      Change_play_mode
  81.       call      Delete_buttons
  82.       call      Draw_buttons
  83.      jmp .still                                 ; jump to wait for another event
  84.   @@:
  85.     cmp  ah, [shortcut_increase]
  86.      jne @f
  87.       call      Increase_geometry
  88.      jmp .redraw
  89.   @@:
  90.     cmp  ah, [shortcut_decrease]
  91.      jne @f
  92.       call      Decrease_geometry
  93.      jmp .redraw
  94.   @@:
  95.      jmp .still                                 ; jump to wait for another event
  96.  
  97. ;;---First_menu_mode-----------------------------------------------------------------------------------------------------------
  98.  
  99.  
  100. ;;===Some_functions============================================================================================================
  101.  
  102. Draw_first_menu_picture:
  103.     ;;===Draw_first_menu_picture================================================================================================
  104.  
  105.     mov  ax,  2*0x100+24
  106.     mov  cx,  1*0x100+5
  107.     mov  edx, [snake_picture_color]
  108.     mov  esi, picture_first_menu_snake
  109.       call      Draw_picture
  110.  
  111.     mov  ax,  3*0x100+11
  112.     mov  cx,  8*0x100+5
  113.     mov  edx, [version_picture_color]
  114.     mov  esi, picture_first_menu_version
  115.       call      Draw_picture
  116.  
  117.     ret
  118.            
  119.     ;;---Draw_first_menu_picture------------------------------------------------------------------------------------------------
  120.  
  121.  
  122. Draw_menu_strings:
  123.     ;;===Make_menu_strings======================================================================================================
  124.  
  125.     mov  ebx, [window_width]
  126.     shr  ebx, 1
  127.     sub  ebx, press_to_start.size*3+6
  128.     shl  ebx, 16
  129.     add  ebx, dword[bottom_middle_strings]
  130.       mcall     4, ,[navigation_strings_color],press_to_start
  131.     mov  ebx, [window_width]
  132.     shr  ebx, 1
  133.     sub  ebx, press_esc_to_exit.size*3+6
  134.     shl  ebx, 16
  135.     add  ebx, [top_strings]
  136.       mcall     , ,[navigation_strings_color],press_esc_to_exit
  137. ;      mcall     ,406*65536+TOP_STRINGS,[navigation_strings_color],press_F2_to_options
  138.  
  139.     ret
  140.  
  141.     ;;---Make_menu_strings------------------------------------------------------------------------------------------------------
  142.  
  143.  
  144. Draw_buttons:
  145.     ;;===Draw_buttons===========================================================================================================
  146.  
  147.     mov  ebx, [button_x_left]
  148.     shl  ebx, 16
  149.     mov  bx,  word[button_width_short]
  150.     mov  ecx, [button_y_top]
  151.     shl  ecx, 16
  152.     add  cx,  word[button_height]
  153.       mcall     8, , ,0x000000D0,[button_color]                             ; top left button
  154.     shr  ecx, 16
  155.     mov  bx,  cx
  156.     mov  edx, [button_height]
  157.     shr  edx, 1
  158.     sub  edx, 3                                                             ; ~half of font height
  159.     add  bx,  dx
  160.     ror  ebx, 16
  161.     mov  edx, [button_width_short]
  162.     shr  edx, 1
  163.     sub  edx, string_button_play.size*3
  164.     add  bx,  dx
  165.     ror  ebx, 16
  166.       mcall     4, ,[button_text_color],string_button_play
  167.  
  168.     mov  ebx, [button_x_right]
  169.     shl  ebx, 16
  170.     mov  bx,  word[button_width_short]
  171.     mov  ecx, [button_y_top]
  172.     shl  ecx, 16
  173.     add  cx,  word[button_height]
  174.       mcall     8, , ,0x000000D1,                                           ; top right button
  175.     shr  ecx, 16
  176.     mov  bx,  cx
  177.     mov  edx, [button_height]
  178.     shr  edx, 1
  179.     sub  edx, 3                                                             ; ~half of font height
  180.     add  bx,  dx
  181.     ror  ebx, 16
  182.     mov  edx, [button_width_short]
  183.     shr  edx, 1
  184.     sub  edx, string_button_exit.size*3
  185.     add  bx,  dx
  186.     ror  ebx, 16
  187.       mcall     4, ,[button_text_color],string_button_exit
  188.  
  189.     mov  ebx, [button_x_left]
  190.     shl  ebx, 16
  191.     mov  bx,  word[button_width_long]
  192.     mov  ecx, [button_y_middle]
  193.     shl  ecx, 16
  194.     add  cx,  word[button_height]
  195.       mcall     8, , ,0x000000D2,                                           ; middle button
  196.     shr  ecx, 16
  197.     mov  bx,  cx
  198.     mov  edi, [button_height]
  199.     shr  edi, 1
  200.     sub  edi, 3                                                             ; ~half of font height
  201.     add  bx,  di
  202.     ror  ebx, 16
  203.     mov  edi, [button_width_long]
  204.     shr  edi, 1
  205.     cmp  [play_mode],   0
  206.      jne @f
  207.     sub  edi, string_button_pm_classic.size*3
  208.     mov  edx, string_button_pm_classic
  209.      jmp .skip
  210.   @@:
  211.     sub  edi, string_button_pm_levels.size*3
  212.     mov  edx, string_button_pm_levels
  213.   .skip:
  214.     add  bx,  di
  215.     ror  ebx, 16
  216.       mcall     4, ,[button_text_color],
  217.  
  218.     mov  ebx, [button_x_left]
  219.     shl  ebx, 16
  220.     mov  bx,  word[button_width_short]
  221.     mov  ecx, [button_y_bottom]
  222.     shl  ecx, 16
  223.     add  cx,  word[button_height]
  224.       mcall     8, , ,0x000000D3,                                           ; bottom left button
  225.     shr  ecx, 16
  226.     mov  bx,  cx
  227.     mov  edx, [button_height]
  228.     shr  edx, 1
  229.     sub  edx, 3                                                             ; ~half of font height
  230.     add  bx,  dx
  231.     ror  ebx, 16
  232.     mov  edx, [button_width_short]
  233.     shr  edx, 1
  234.     sub  edx, string_button_inc.size*3
  235.     add  bx,  dx
  236.     ror  ebx, 16
  237.       mcall     4, ,[button_text_color],string_button_inc
  238.  
  239.     mov  ebx, [button_x_right]
  240.     shl  ebx, 16
  241.     mov  bx,  word[button_width_short]
  242.     mov  ecx, [button_y_bottom]
  243.     shl  ecx, 16
  244.     add  cx,  word[button_height]
  245.       mcall     8, , ,0x000000D4,
  246.     shr  ecx, 16
  247.     mov  bx,  cx
  248.     mov  edx, [button_height]
  249.     shr  edx, 1
  250.     sub  edx, 3                                                             ; ~half of font height
  251.     add  bx,  dx
  252.     ror  ebx, 16
  253.     mov  edx, [button_width_short]
  254.     shr  edx, 1
  255.     sub  edx, string_button_dec.size*3
  256.     add  bx,  dx
  257.     ror  ebx, 16
  258.       mcall     4, ,[button_text_color],string_button_dec
  259.  
  260.     ret
  261.  
  262.     ;;---Draw_buttons----------------------------------------------------------------------------------------------------------
  263.  
  264.  
  265. Delete_buttons:
  266.     ;;===Delete_buttons========================================================================================================
  267.  
  268.       mcall     8,,,0x800000D0
  269.       mcall      ,,,0x800000D1
  270.       mcall      ,,,0x800000D2
  271.       mcall      ,,,0x800000D3
  272.       mcall      ,,,0x800000D4
  273.  
  274.     ret
  275.  
  276.     ;;---Delete_buttons--------------------------------------------------------------------------------------------------------
  277.  
  278.  
  279. Change_play_mode:
  280.     ;;===Change_play_mode======================================================================================================
  281.  
  282.     cmp  [play_mode],   LEVELS_MODE
  283.      jne @f
  284.     mov  [play_mode],   CLASSIC_MODE
  285.     mov  [cur_level_number],   0
  286.     ret
  287.   @@:
  288.     inc  [play_mode]
  289.  
  290.       call      Set_first_level_of_play_mode
  291.  
  292.     ret
  293.  
  294.     ;;---Change_play_mode------------------------------------------------------------------------------------------------------
  295.  
  296.  
  297. Set_first_level_of_play_mode:
  298.     ;;===Set_first_level_of_play_mode==========================================================================================
  299.  
  300.     cmp  [play_mode],   CLASSIC_MODE
  301.      jne @f
  302.     mov  [cur_level_number],   CLASSIC_MODE_FIRST_LEVEL
  303.   @@:
  304.     cmp  [play_mode],   LEVELS_MODE
  305.      jne @f
  306.     mov  [cur_level_number],   LEVELS_MODE_FIRST_LEVEL
  307.   @@:
  308.  
  309.     ret
  310.  
  311.     ;;---Set_first_level_of_play_mode-------------------------------------------------------------------------------------------
  312.  
  313. ;;---Some_functions-------------------------------------------------------------------------------------------------------------
  314.