Subversion Repositories Kolibri OS

Rev

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