Subversion Repositories Kolibri OS

Rev

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