Subversion Repositories Kolibri OS

Rev

Rev 1518 | Rev 1566 | 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.     mov  ebx, [score]
  6.     cmp  ebx, [hi_score]
  7.      jng .redraw
  8.      
  9.     mov  [is_new_record], 1
  10.  
  11.       mcall     40,100111b                      ; set events: standart + mouse
  12.  
  13.   .redraw:
  14.       mcall     12,1
  15.     mov  ebx, [wp_x]
  16.     shl  ebx, 16
  17.     add  ebx, dword[window_width]
  18.     mov  ecx, [wp_y]
  19.     shl  ecx, 16
  20.     add  ecx, dword[window_height]
  21.       mcall     0, , ,[window_style], ,window_title
  22.  
  23.       call      Draw_decorations
  24.       call      Draw_game_over_picture
  25.       call      Draw_game_over_strings          ; edit_box is here
  26.  
  27.       mcall     12,2
  28.  
  29.   .still:
  30.       mcall     10                              ; wait for event
  31.                                                 ; ok, what an event?
  32.     dec  al                                     ; has the window been moved or resized?
  33.      jz  .redraw
  34.     dec  al                                     ; was a key pressed?
  35.      jz  .key
  36.     dec  al                                     ; was a button pressed?
  37.      jz  .button
  38.  
  39.  
  40.   .mouse:                                       ; mouse event received
  41.     push dword edit1
  42.       call      [edit_box.mouse]
  43.    
  44.      jmp .still
  45.  
  46.  
  47.   .key:                                         ; a key was pressed
  48.       mcall     2                               ; get keycode
  49.  
  50.     cmp  [is_new_record], 1
  51.      jnz .key.skip
  52.      
  53.     cmp  ah,  0x0D                              ; Enter
  54.      jnz @f
  55.       call      Score_and_name_store
  56.     mov  [is_new_record],   0
  57.       mcall     40,111b                         ; set events: standart
  58.      jmp First_menu
  59.  
  60.   @@:
  61.     push    dword edit1
  62.     call    [edit_box.key]
  63.    
  64.      jmp .still
  65.   .key.skip:
  66.  
  67.     cmp  ah,  0x1B                              ; Escape - go to menu
  68.      jne  .still
  69.  
  70.       mcall     40,111b                         ; set events: standart
  71.      jmp First_menu
  72.  
  73.  
  74.   .button:                                      ; a button was pressed
  75.       mcall     17                              ; get button number
  76.     shr  eax, 8                                 ; we should do it to get the real button code
  77.  
  78.     cmp  eax, 1
  79.      je  Exit
  80.  
  81.      jmp .still
  82.  
  83. ;;---Game_over_mode------------------------------------------------------------------------------------------------------------
  84.  
  85.  
  86. ;;===Some_functions============================================================================================================
  87.  
  88. Draw_game_over_picture:
  89.     ;;===Draw_game_over_picture================================================================================================
  90.  
  91.     mov  ax,  0*0x100+29
  92.     mov  cx,  1*0x100+13
  93.     mov  edx, [game_over_picture_color]
  94.     mov  esi, picture_game_over
  95.       call      Draw_picture
  96.  
  97.     ret
  98.  
  99.     ;;---Draw_game_over_picture------------------------------------------------------------------------------------------------
  100.  
  101.  
  102. Draw_game_over_strings:
  103.     ;;===Draw_game_over_strings================================================================================================
  104.  
  105.     cmp  [is_new_record], 1
  106.      jnz @f
  107.  
  108.     mov  ebx, [window_width]
  109.     shr  ebx, 1
  110.     sub  ebx, (string_enter_your_name-string_congratulations-1+8)*3+6
  111.     shl  ebx, 16
  112.     add  ebx, [bottom_top_strings]
  113.       mcall     4, ,[game_over_strings_color],string_congratulations
  114.     mov  ebx, [window_width]
  115.     shr  ebx, 1
  116.     sub  ebx, (strings_end-string_enter_your_name-1+8)*3+6
  117. ;    add  ebx, (strings_end-string_enter_your_name)*6
  118.     shl  ebx, 16
  119.     add  ebx, [bottom_bottom_strings]
  120.       mcall      , , ,string_enter_your_name
  121.     mov  ebx, [window_width]
  122.     shr  ebx, 1
  123.     sub  ebx, (press_to_start-string_apply_name_enter-1)*3+6
  124.     shl  ebx, 16
  125.     add  ebx, [top_strings]
  126.       mcall      , ,[navigation_strings_color],string_apply_name_enter
  127.     mov  edx, [window_width]
  128.     shr  edx, 1
  129.     sub  edx, (string_enter_your_name-string_congratulations-1+8)*3+7
  130.     add  edx, (string_enter_your_name-string_congratulations)*6
  131.     shl  edx, 16
  132.     add  edx, dword[bottom_top_strings]
  133.       mcall     47,0x00070000,[score], ,[game_over_hiscore_color]
  134.     mov  ebx, [window_width]
  135.     shr  ebx, 1
  136.     sub  ebx, (strings_end-string_enter_your_name-1+8)*3+9
  137.     add  ebx, (strings_end-string_enter_your_name)*6
  138.     mov  [edit1+0x04],  ebx
  139.     push    dword edit1
  140.       call      [edit_box.draw]
  141.  
  142.     ret
  143.  
  144.   @@:
  145.  
  146.     call    Draw_menu_esc
  147.  
  148.     ret
  149.  
  150.     ;;---Draw_game_over_strings------------------------------------------------------------------------------------------------
  151.  
  152.  
  153. Score_and_name_store:
  154.     ;;===Name_store============================================================================================================
  155.  
  156.       invoke    ini.set_str, cur_dir_path, aScore, aChampion_name, hed, 15
  157.       invoke    ini.set_int, cur_dir_path, aScore, aHiscore, [score]
  158.  
  159.     ret
  160.  
  161.     ;;---Name_store------------------------------------------------------------------------------------------------------------
  162.  
  163. ;;---Some_functions------------------------------------------------------------------------------------------------------------