Subversion Repositories Kolibri OS

Rev

Rev 5274 | Blame | Last modification | View Log | Download | RSS feed

  1. ;---------------------------------------------------------------------
  2. main_menu_start:
  3.         mov     [main_menu_pointer],0
  4.         mov     eax,[menu_sound]
  5.         mov     [sounds_sample],eax
  6. ;--------------------------------------        
  7. .red:
  8.         mov     [menu_text_pointers],main_menu_text_pointers
  9.         mov     [text_step_Y],SPRITE_SIZE_Y
  10.         mov     [use_separate_draw_text],1
  11.         call    draw_menu_window
  12.         call    draw_new_pointer
  13. ;---------------------------------------------------------------------
  14. .still:
  15.         mcall   10
  16.  
  17.         cmp     eax,1
  18.         je      .red
  19.  
  20.         cmp     eax,2
  21.         je      .key
  22.  
  23.         cmp     eax,3
  24.         je      .button
  25.        
  26.         jmp     .still
  27. ;---------------------------------------------------------------------
  28. .key:
  29.         mcall   2
  30.         cmp     [extended_key],1
  31.         je      .extended_key
  32.  
  33.         test    al,al
  34.         jnz     .still
  35.  
  36.         cmp     ah,0xE0
  37.         jne     @f
  38.  
  39.         mov     [extended_key],1
  40.         jmp     .still
  41. ;--------------------------------------
  42. @@:
  43.         cmp     ah,72   ; arrow up
  44.         je      .arrow_up
  45.  
  46.         cmp     ah,80   ; arrow down
  47.         je      .arrow_down
  48.  
  49.         cmp     ah,17   ; w - arrow up
  50.         je      .arrow_up
  51.  
  52.         cmp     ah,31   ; s - arrow down
  53.         je      .arrow_down
  54.  
  55.         cmp     ah,57   ; space
  56.         je      .enter_to_point
  57.        
  58.         cmp     ah,28   ; enter
  59.         je      .enter_to_point
  60.  
  61.         jmp     .still
  62. ;---------------------------------------------------------------------
  63. .extended_key:
  64.         mov     [extended_key],0
  65.         cmp     ah,72   ; arrow up
  66.         je      .arrow_up
  67.  
  68.         cmp     ah,80   ; arrow down
  69.         je      .arrow_down
  70.        
  71.         jmp     .still
  72. ;---------------------------------------------------------------------
  73. .arrow_up:
  74.         cmp     [main_menu_pointer],0
  75.         je      .still
  76.        
  77.         call    snd_kick_action
  78.         call    clear_old_pointer
  79.         dec     [main_menu_pointer]
  80.         call    draw_new_pointer
  81.         jmp     .still
  82. ;---------------------------------------------------------------------
  83. .arrow_down:
  84.         cmp     [main_menu_pointer],4
  85.         je      .still
  86.        
  87.         call    snd_kick_action
  88.         call    clear_old_pointer
  89.         inc     [main_menu_pointer]
  90.         call    draw_new_pointer
  91.         jmp     .still
  92. ;---------------------------------------------------------------------
  93. .enter_to_point:
  94.         cmp     [main_menu_pointer],0   ; game
  95.         je      start_level_0
  96.        
  97.         cmp     [main_menu_pointer],1   ; settings
  98.         je      settings_menu_start
  99.  
  100.         cmp     [main_menu_pointer],2   ; credits
  101.         je      menu_credits
  102.        
  103.         cmp     [main_menu_pointer],3   ; help
  104.         je      menu_help
  105.  
  106.         cmp     [main_menu_pointer],4   ; exit
  107.         je      button.exit
  108.        
  109.         jmp     .still
  110. ;---------------------------------------------------------------------
  111. .button:
  112.         mcall   17
  113.  
  114.         cmp     ah,1
  115.         jne     .still
  116.        
  117.         jmp     button.exit
  118. ;---------------------------------------------------------------------
  119. clear_old_pointer:
  120.         movzx   ecx,byte [main_menu_pointer]
  121.         imul    ecx,SPRITE_SIZE_Y
  122.         add     ecx,SPRITE_SIZE_Y*3 - 16
  123.         shl     ecx,16
  124.         mov     cx,SPRITE_SIZE_Y
  125.         mcall   13,<SPRITE_SIZE_X*2,SPRITE_SIZE_X>,,0
  126.         ret
  127. ;---------------------------------------------------------------------
  128. draw_new_pointer:
  129. ;       movzx   ecx,byte [main_menu_pointer]
  130. ;       imul    ecx,SPRITE_SIZE_Y
  131. ;       add     ecx,SPRITE_SIZE_Y*2
  132. ;       shl     ecx,16
  133. ;       mov     cx,SPRITE_SIZE_Y
  134. ;       mcall   13,<SPRITE_SIZE_X*1,SPRITE_SIZE_X>,,0xff0000
  135.  
  136.         movzx   edx,byte [main_menu_pointer]
  137.         imul    edx,SPRITE_SIZE_Y
  138.         add     edx,SPRITE_SIZE_Y*3 - 16
  139.         add     edx,SPRITE_SIZE_X*2 shl 16
  140.        
  141.         mov     eax,[npc_miku_icons]
  142.         mov     ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*12
  143.         call    copy_base_8bpp
  144.        
  145.         xor     ebp,ebp
  146.         mcall   65,buffer_area,<SPRITE_SIZE_X,SPRITE_SIZE_Y>,,32
  147.         ret
  148. ;---------------------------------------------------------------------
  149. draw_menu_window:
  150.         mcall   12,1
  151.         mcall   48,4
  152.         mov     ecx,100 shl 16 + 644
  153.         add     cx,ax
  154.         mcall   0,<100,649>,,0x74AABBCC,,title
  155.        
  156.         call    clear_screen
  157.  
  158.         mov     eax,4
  159.         mov     ebx,SPRITE_SIZE_X*3 shl 16 + SPRITE_SIZE_Y*3
  160.         mov     ecx,0x90ffffff
  161.         mov     esi,[menu_text_pointers]
  162. ;--------------------------------------
  163. @@:
  164.         mov     edx,[esi]
  165.         test    edx,edx
  166.         jz      .end
  167.  
  168.         cmp     [use_separate_draw_text],1
  169.         je      .use_separate_draw_text
  170.  
  171.         mcall
  172.         jmp     .continue
  173. ;--------------------------------------        
  174. .use_separate_draw_text:
  175.         call    draw_font
  176. ;--------------------------------------
  177. .continue:
  178.         add     ebx,[text_step_Y]
  179.         add     esi,4
  180.         jmp     @b
  181. ;--------------------------------------        
  182. .end:
  183.  
  184.         mcall   12,2
  185.         ret
  186. ;---------------------------------------------------------------------
  187. clear_screen:  
  188.         xor     edx,edx
  189.         mcall   13,<0,SPRITE_SIZE_X*LEVEL_MAP_SIZE_X>,<0,SPRITE_SIZE_Y*LEVEL_MAP_SIZE_Y>
  190.         ret
  191. ;---------------------------------------------------------------------
  192. menu_credits:
  193.         call    snd_kick_action
  194.         mov     [menu_text_pointers],menu_credits_text_pointers
  195.         jmp     menu_help.1
  196. ;---------------------------------------------------------------------
  197. menu_help:
  198.         call    snd_kick_action
  199.         mov     [menu_text_pointers],menu_help_text_pointers
  200. ;--------------------------------------
  201. .1:
  202.         mov     [text_step_Y],20
  203. ;--------------------------------------
  204. .red:
  205.         mov     [use_separate_draw_text],0
  206.         call    draw_menu_window
  207. ;---------------------------------------------------------------------
  208. .still:
  209.         mcall   10
  210.  
  211.         cmp     eax,1
  212.         je      .red
  213.  
  214.         cmp     eax,2
  215.         je      .key
  216.  
  217.         cmp     eax,3
  218.         je      .button
  219.        
  220.         jmp     .still
  221. ;---------------------------------------------------------------------
  222. .key:
  223.         mcall   2
  224.         cmp     [extended_key],1
  225.         je      .extended_key
  226.  
  227.         test    al,al
  228.         jnz     .still
  229.  
  230.         cmp     ah,0xE0
  231.         jne     @f
  232.  
  233.         mov     [extended_key],1
  234.         jmp     .still
  235. ;--------------------------------------
  236. @@:
  237.         cmp     ah,57   ; space
  238.         je      main_menu_start.red
  239.  
  240.         cmp     ah,28   ; enter
  241.         je      main_menu_start.red
  242.  
  243.         cmp     ah,1    ; esc
  244.         je      main_menu_start.red
  245.  
  246.         jmp     .still
  247. ;---------------------------------------------------------------------
  248. .extended_key:
  249.         mov     [extended_key],0
  250.  
  251.         jmp     .still
  252. ;---------------------------------------------------------------------
  253. .button:
  254.         mcall   17
  255.  
  256.         cmp     ah,1
  257.         jne     .still
  258.        
  259.         jmp     button.exit
  260. ;---------------------------------------------------------------------
  261. settings_menu_start:
  262.         call    snd_kick_action
  263.         mov     al,[main_menu_pointer]
  264.         mov     [settings_menu_pointer],al
  265.         xor     al,al
  266.         mov     [main_menu_pointer],al
  267. ;--------------------------------------        
  268. .red:
  269.         mov     [menu_text_pointers],settings_menu_text_pointers
  270.         mov     [text_step_Y],SPRITE_SIZE_Y
  271.         call    prepare_settings_text
  272.         mov     [use_separate_draw_text],1
  273.         call    draw_menu_window
  274.         call    draw_new_pointer
  275. ;---------------------------------------------------------------------
  276. .still:
  277.         mcall   10
  278.  
  279.         cmp     eax,1
  280.         je      .red
  281.  
  282.         cmp     eax,2
  283.         je      .key
  284.  
  285.         cmp     eax,3
  286.         je      .button
  287.        
  288.         jmp     .still
  289. ;---------------------------------------------------------------------
  290. .key:
  291.         mcall   2
  292.         cmp     [extended_key],1
  293.         je      .extended_key
  294.  
  295.         test    al,al
  296.         jnz     .still
  297.  
  298.         cmp     ah,0xE0
  299.         jne     @f
  300.  
  301.         mov     [extended_key],1
  302.         jmp     .still
  303. ;--------------------------------------
  304. @@:
  305.         cmp     ah,72   ; arrow up
  306.         je      .arrow_up
  307.  
  308.         cmp     ah,80   ; arrow down
  309.         je      .arrow_down
  310.  
  311.         cmp     ah,17   ; w - arrow up
  312.         je      .arrow_up
  313.  
  314.         cmp     ah,31   ; s - arrow down
  315.         je      .arrow_down
  316.  
  317.         cmp     ah,57   ; space
  318.         je      .enter_to_point
  319.        
  320.         cmp     ah,28   ; enter
  321.         je      .enter_to_point
  322.        
  323.         cmp     ah,1    ; esc
  324.         je      .exit
  325.  
  326.         jmp     .still
  327. ;---------------------------------------------------------------------
  328. .extended_key:
  329.         mov     [extended_key],0
  330.         cmp     ah,72   ; arrow up
  331.         je      .arrow_up
  332.  
  333.         cmp     ah,80   ; arrow down
  334.         je      .arrow_down
  335.        
  336.         jmp     .still
  337. ;---------------------------------------------------------------------
  338. .arrow_up:
  339.         cmp     [main_menu_pointer],0
  340.         je      .still
  341.        
  342.         call    snd_kick_action
  343.         call    clear_old_pointer
  344.         dec     [main_menu_pointer]
  345.         call    draw_new_pointer
  346.         jmp     .still
  347. ;---------------------------------------------------------------------
  348. .arrow_down:
  349.         cmp     [main_menu_pointer],2
  350.         je      .still
  351.        
  352.         call    snd_kick_action
  353.         call    clear_old_pointer
  354.         inc     [main_menu_pointer]
  355.         call    draw_new_pointer
  356.         jmp     .still
  357. ;---------------------------------------------------------------------
  358. .enter_to_point:
  359.         cmp     [main_menu_pointer],0   ; sounds
  360.         jne     @f
  361.        
  362.         inc     [sounds_flag]
  363.         and     [sounds_flag],1b
  364.         jmp     .red
  365. ;--------------------------------------
  366. @@:
  367.         cmp     [main_menu_pointer],1   ; music
  368.         jne     @f
  369.        
  370.         inc     [music_flag]
  371.         and     [music_flag],1b
  372.         jmp     .red
  373. ;--------------------------------------
  374. @@:
  375.         cmp     [main_menu_pointer],2   ; exit
  376.         jne     .still
  377.  
  378. ;--------------------------------------
  379. .exit:
  380.         call    snd_kick_action
  381.         mov     al,[settings_menu_pointer]
  382.         mov     [main_menu_pointer],al
  383.  
  384.         jmp     main_menu_start.red
  385. ;---------------------------------------------------------------------
  386. .button:
  387.         mcall   17
  388.  
  389.         cmp     ah,1
  390.         jne     .still
  391.        
  392.         jmp     button.exit
  393. ;---------------------------------------------------------------------
  394. prepare_settings_text:
  395.         mov     eax,[text_on_label]
  396.         cmp     [sounds_flag],1
  397.         je      @f
  398.        
  399.         mov     eax,[text_off_label]
  400. ;--------------------------------------
  401. @@:
  402.         mov     [menu_settings_sound_label+7],eax
  403. ;--------------------------------------
  404.         mov     eax,[text_on_label]
  405.         cmp     [music_flag],1
  406.         je      @f
  407.        
  408.         mov     eax,[text_off_label]
  409. ;--------------------------------------
  410. @@:
  411.         mov     [menu_settings_music_label+7],eax      
  412.         ret
  413. ;---------------------------------------------------------------------