Subversion Repositories Kolibri OS

Rev

Rev 5264 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;*****************************************************************************
  2. ; Rusty Earth - for Kolibri OS
  3. ; Copyright (c) 2014, Marat Zakiyanov aka Mario79, aka Mario
  4. ; All rights reserved.
  5. ;
  6. ; Redistribution and use in source and binary forms, with or without
  7. ; modification, are permitted provided that the following conditions are met:
  8. ;        * Redistributions of source code must retain the above copyright
  9. ;          notice, this list of conditions and the following disclaimer.
  10. ;        * Redistributions in binary form must reproduce the above copyright
  11. ;          notice, this list of conditions and the following disclaimer in the
  12. ;          documentation and/or other materials provided with the distribution.
  13. ;        * Neither the name of the <organization> nor the
  14. ;          names of its contributors may be used to endorse or promote products
  15. ;          derived from this software without specific prior written permission.
  16. ;
  17. ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
  18. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  21. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. ;*****************************************************************************
  28.   use32
  29.   org 0x0
  30.  
  31.   db 'MENUET01'
  32.   dd 0x01
  33.   dd START
  34.   dd IM_END
  35.   dd I_END
  36.   dd stacktop
  37.   dd 0x0
  38.   dd path
  39. ;-----------------------------------------------------------------------------
  40. include 'lang.inc'
  41. include '../../macros.inc'
  42. include '../../proc32.inc'
  43. ;define __DEBUG__ 1
  44. ;define __DEBUG_LEVEL__ 1
  45. ;include '../../debug-fdo.inc'
  46. include '../../develop/libraries/box_lib/load_lib.mac'
  47. ;include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  48. @use_library
  49. ;---------------------------------------------------------------------
  50. FONT_SIZE_X = 32
  51. FONT_REAL_SIZE_X = 32
  52. FONT_SIZE_Y = 32
  53. ;---------------------------------------------------------------------
  54. LEVEL_MAP_SIZE_X = 10
  55. LEVEL_MAP_SIZE_Y = 10
  56. SPRITE_SIZE_X = 64
  57. SPRITE_SIZE_Y = 64
  58. ;-----------------------------------------------------------------------------
  59. ROUTE_UP    = 1
  60. ROUTE_DOWN  = 2
  61. ROUTE_LEFT  = 3
  62. ROUTE_RIGHT = 4
  63. ;-----------------------------------------------------------------------------
  64. OBJECT_DEATH = 1
  65. OBJECT_SKELETON = 2
  66. OBJECT_IFRIT = 3
  67. OBJECT_BARRET = 4
  68. OBJECT_FINAL_MONSTER = 14
  69. OBJECT_PROTAGONIST = 15
  70. OBJECT_RED_BRICK = 16
  71. OBJECT_WHITE_BRICK = 17
  72. RED_BRICK_CRASH_1 = 0x80
  73. RED_BRICK_CRASH_2 = 0x81
  74. ;-----------------------------------------------------------------------------
  75. BASE_SMALL_ROCK = 0
  76. BASE_GRASS = 1
  77. BASE_LAVA = 2
  78. BASE_WATER = 3
  79. ;-----------------------------------------------------------------------------
  80. TARGET_RANGE = 3
  81. ;-----------------------------------------------------------------------------
  82. START:
  83.         mcall   68,11
  84.         mcall   66,1,1
  85.         mcall   40,0x7  ;27
  86. ;--------------------------------------
  87. load_libraries  l_libs_start,end_l_libs
  88.         test    eax,eax
  89.         jnz     button.exit
  90. ;--------------------------------------
  91. ; unpack deflate
  92.         mov     eax,[unpack_DeflateUnpack2]
  93.         mov     [deflate_unpack],eax
  94. ;--------------------------------------
  95.         call    load_and_convert_all_icons
  96.         call    load_all_sound_files
  97.        
  98.         mov     eax,[background_music]
  99.         mov     [wav_for_test],eax
  100.         mov     ebx,eax
  101.         add     ebx,1024
  102.         mov     [wav_for_test_end],ebx
  103.         call    test_wav_file
  104.        
  105.         mov     [music_flag],1
  106.         mcall   51,1,snd_background_music_thread_start,snd_background_music_thread_stack
  107.        
  108.         mov     [sounds_flag],1
  109.         mcall   51,1,snd_kick_action_thread_start,snd_kick_action_thread_stack
  110. ;---------------------------------------------------------------------
  111. menu_still:
  112.         jmp     main_menu_start
  113. ;---------------------------------------------------------------------
  114. start_level_0:
  115.         mov     eax,[stone_kick_sound]
  116.         mov     [sounds_sample],eax
  117.         mov     [death_of_protagonist],0
  118.         mov     [protagonist_route],2
  119.         mov     [protagonist_position.x],4
  120.         mov     [protagonist_position.y],4
  121.        
  122.         mov     esi,map_level_0
  123.         call    map_level_to_plan_level
  124.         call    generate_objects_id
  125.         call    copy_plan_level_to_plan_level_old
  126. ;---------------------------------------------------------------------
  127. red:
  128.         call    draw_window
  129. ;---------------------------------------------------------------------
  130. still:
  131. ;       mcall   10
  132.         mcall   23,1
  133.  
  134.         cmp     eax,1
  135.         je      red
  136.  
  137.         cmp     eax,2
  138.         je      key
  139.  
  140.         cmp     eax,3
  141.         je      button
  142.        
  143.         call    actions_for_all_cell
  144.         call    show_tiles
  145.         call    harvest_of_death
  146.         call    show_tiles_one_iteration
  147.         cmp     [death_of_protagonist],1
  148.         je      death_of_protagonist_start
  149.        
  150.         mov     eax,[protagonist_position.y]
  151.         imul    eax,LEVEL_MAP_SIZE_X*4
  152.         mov     ebx,[protagonist_position.x]
  153.         shl     ebx,2
  154.         add     eax,ebx
  155.         add     eax,plan_level
  156.         mov     eax,[eax]
  157.         cmp     ah,OBJECT_PROTAGONIST
  158.         jne     death_of_protagonist_start
  159.  
  160.         jmp     still
  161. ;---------------------------------------------------------------------
  162. button:
  163.         mcall   17
  164.  
  165.         cmp     ah,1
  166.         jne     still
  167. ;--------------------------------------
  168. .exit:
  169.         mov     eax,[N_error]
  170. ;        DEBUGF  1, "N_error: %d\n",eax
  171.         test    eax,eax
  172.         jz      @f
  173.  
  174.         mcall   51,1,thread_start,thread_stack
  175. ;--------------------------------------
  176. @@:
  177.         mov     [music_flag],2
  178.         mov     [sounds_flag],2
  179.         mcall   -1
  180. ;---------------------------------------------------------------------
  181. draw_window:
  182.         mcall   12,1
  183.         mcall   48,4
  184.         mov     ecx,100 shl 16 + 644
  185.         add     cx,ax
  186.         mcall   0,<100,649>,,0x74AABBCC,,title
  187. ;       mcall   13,<0,640>,<0,640>,0xff0000
  188.         mov     [draw_all_level],1
  189. ;       call    show_tiles
  190.         call    show_tiles_one_iteration
  191.         mov     [draw_all_level],0
  192. ;       mcall   4,<3,8>,0,message,message.size
  193.         mcall   12,2
  194.         ret
  195. ;---------------------------------------------------------------------
  196. memory_free_error:
  197.         mov     [N_error],3
  198.         jmp     button.exit
  199. ;---------------------------------------------------------------------
  200. memory_get_error:
  201.         mov     [N_error],4
  202.         jmp     button.exit
  203. ;-----------------------------------------------------------------------------
  204. include 'key.inc'
  205. include 'show_tiles.inc'
  206. include 'show_base.inc'
  207. include 'show_object.inc'
  208. include 'death_protagonist.inc'
  209. include 'load.inc'
  210. include 'icon_convert.inc'
  211. include 'error_window.inc'
  212. include 'actions.inc'
  213. include 'actions_npc.inc'
  214. include 'actions_protagonist.inc'
  215. include 'actions_white_bricks.inc'
  216. include 'random.inc'
  217. include 'snd_api.inc'
  218. include 'sound.inc'
  219. include 'menu.inc'
  220. include 'font.inc'
  221. ;---------------------------------------------------------------------
  222. if lang eq ru
  223.         include 'localization_rus.inc'
  224. else
  225.         include 'localization_eng.inc'
  226. end if
  227. ;---------------------------------------------------------------------
  228. include 'i_data.inc'
  229. include 'levels.inc'
  230. ;---------------------------------------------------------------------
  231. IM_END:
  232. ;---------------------------------------------------------------------
  233. ;include_debug_strings
  234. ;---------------------------------------------------------------------
  235. include 'u_data.inc'
  236. ;---------------------------------------------------------------------
  237. I_END:
  238.