Subversion Repositories Kolibri OS

Rev

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

  1. ;;===Game_over_mode============================================================================================================
  2.  
  3. Game_over:
  4.  
  5.     cmp  [play_mode],   LEVELS_MODE
  6.      jne @f
  7.     dec  [lives]
  8.      jz  @f
  9.       call      Draw_splash
  10.      jmp Level_begin
  11.   @@:
  12.  
  13.     mov  byte[window_title+5],  0
  14.       mcall     71,1,window_title
  15.       mcall     66,1,0                          ; set ascii mode for keyboard
  16.       call      Show_cursor
  17.  
  18.     mov  ebx, [score]
  19.    
  20.     cmp  [play_mode],   CLASSIC_MODE
  21.      jne @f
  22.     cmp  ebx, [hi_score_classic]
  23.      jng .redraw
  24.     mov  [is_new_record], 1
  25.      jmp .done
  26.   @@:
  27.     cmp  ebx, [hi_score_levels]
  28.      jng .redraw
  29.     mov  [is_new_record], 1
  30.      jmp .done
  31.   .done:
  32.  
  33.       mcall     40,100111b                      ; set events: standart + mouse
  34.  
  35.   .redraw:
  36.       call      Set_geometry
  37.       mcall     12,1
  38.       mcall     0, , ,[window_style], ,window_title
  39.     test [proc_info.wnd_state], 0x04            ; is rolled up?
  40.      jnz @f
  41.  
  42.       call      Draw_decorations
  43.       call      Draw_game_over_picture
  44.       call      Draw_game_over_strings          ; edit_box is here
  45.       mcall     12,2
  46.   @@:
  47.   .still:
  48.       mcall     10                              ; wait for event
  49.                                                 ; ok, what an event?
  50.     dec  al                                     ; has the window been moved or resized?
  51.      jz  .redraw
  52.     dec  al                                     ; was a key pressed?
  53.      jz  .key
  54.     dec  al                                     ; was a button pressed?
  55.      jz  .button
  56.  
  57.  
  58.   .mouse:                                       ; mouse event received
  59.       invoke        edit_box.mouse, edit1
  60.    
  61.      jmp .still
  62.  
  63.  
  64.   .key:                                         ; a key was pressed
  65.       mcall     2                               ; get keycode
  66.  
  67.     cmp  [is_new_record],   1
  68.      je  .key.is_record
  69.  
  70.     cmp  ah,  0x1B                              ; Escape - go to menu
  71.      jne .still
  72.      jmp First_menu
  73.  
  74.   .key.is_record:
  75.     cmp  ah,  0x0D                              ; Enter
  76.      jnz @f
  77.       call      Score_and_name_store
  78.      jmp First_menu
  79.   @@:
  80.       invoke        edit_box.key, edit1
  81.      jmp .still
  82.  
  83.  
  84.   .button:                                      ; a button was pressed
  85.       mcall     17                              ; get button number
  86.     shr  eax, 8                                 ; we should do it to get the real button code
  87.  
  88.     cmp  eax, 1
  89.      je  Save_do_smth_else_and_exit
  90.  
  91.      jmp .still
  92.  
  93. ;;---Game_over_mode------------------------------------------------------------------------------------------------------------
  94.  
  95.  
  96. ;;===Some_functions============================================================================================================
  97.  
  98. Draw_game_over_picture:
  99.     ;;===Draw_game_over_picture================================================================================================
  100.  
  101.     cmp  [is_new_record],   1
  102.      je  @f
  103.     mov  ax,  1*0x100+26
  104.     mov  cx,  1*0x100+13
  105.     mov  edx, [game_over_picture_color]
  106.     mov  esi, picture_game_over
  107.      jmp .done
  108.   @@:
  109.     mov  ax,  1*0x100+26
  110.     mov  cx,  1*0x100+12
  111.     mov  edx, [you_win_picture_color]
  112.     mov  esi, picture_you_win
  113.   .done:
  114.       call      Draw_picture
  115.  
  116.     ret
  117.  
  118.     ;;---Draw_game_over_picture------------------------------------------------------------------------------------------------
  119.  
  120.  
  121. Draw_game_over_strings:
  122.     ;;===Draw_game_over_strings================================================================================================
  123.  
  124.     cmp  [is_new_record], 1
  125.      jnz @f
  126.  
  127.     mov  ebx, [window_width]
  128.     shr  ebx, 1
  129.     sub  ebx, string_congratulations.size*3+6*6
  130.     shl  ebx, 16
  131.     add  ebx, [bottom_top_strings]
  132.       mcall     4, ,[game_over_strings_color],string_congratulations
  133.     mov  ebx, [window_width]
  134.     shr  ebx, 1
  135.     sub  ebx, string_enter_your_name.size*3+6*6
  136.     shl  ebx, 16
  137.     add  ebx, [bottom_bottom_strings]
  138.       mcall      , , ,string_enter_your_name
  139.     mov  ebx, [window_width]
  140.     shr  ebx, 1
  141.     sub  ebx, string_apply_name_enter.size*3
  142.     shl  ebx, 16
  143.     add  ebx, [top_strings]
  144.       mcall      , ,[navigation_strings_color],string_apply_name_enter
  145.     mov  edx, [window_width]
  146.     shr  edx, 1
  147.     add  edx, string_congratulations.size*3-6*6-1
  148.     shl  edx, 16
  149.     add  edx, dword[bottom_top_strings]
  150.       mcall     47,0x00070000,[score], ,[game_over_hiscore_color]
  151.     mov  ebx, [window_width]
  152.     shr  ebx, 1
  153.     add  ebx, string_enter_your_name.size*3-6*6-3
  154.     mov  [edit1.left],  ebx
  155.       invoke        edit_box.draw, edit1
  156.  
  157.     ret
  158.  
  159.   @@:
  160.  
  161.     call    Draw_menu_esc
  162.  
  163.     ret
  164.  
  165.     ;;---Draw_game_over_strings------------------------------------------------------------------------------------------------
  166.  
  167.  
  168. Score_and_name_store:
  169.     ;;===Name_store============================================================================================================
  170.  
  171.     mov  esi, hed
  172.  
  173.     cmp  [play_mode],   CLASSIC_MODE
  174.      jne @f
  175.     mov  edi, champion_name_classic
  176.      jmp .done
  177.   @@:
  178.     mov  edi, champion_name_levels
  179.   .done:
  180.  
  181.     mov  ecx, CHAMPION_NAME_LENGTH
  182.     rep  movsb
  183.    
  184.     mov  eax, [score]
  185.  
  186.     cmp  [play_mode],   CLASSIC_MODE
  187.      jne @f
  188.     mov  [hi_score_classic],    eax
  189.      jmp .done2
  190.   @@:
  191.     mov  [hi_score_levels], eax
  192.   .done2:
  193.  
  194.     ret
  195.  
  196.     ;;---Name_store------------------------------------------------------------------------------------------------------------
  197.  
  198. ;;---Some_functions------------------------------------------------------------------------------------------------------------
  199.