Subversion Repositories Kolibri OS

Rev

Rev 5259 | 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    initialize_sound_system
  104.        
  105.         mov     [sounds_flag],1
  106.         mov     [music_flag],1
  107.         mcall   51,1,snd_background_music_thread_start,snd_background_music_thread_stack
  108. ;---------------------------------------------------------------------
  109. menu_still:
  110.         jmp     main_menu_start
  111. ;---------------------------------------------------------------------
  112. start_level_0:
  113.         mov     [death_of_protagonist],0
  114.         mov     [protagonist_route],2
  115.         mov     [protagonist_position.x],4
  116.         mov     [protagonist_position.y],4
  117.        
  118.         mov     esi,map_level_0
  119.         call    map_level_to_plan_level
  120.         call    generate_objects_id
  121.         call    copy_plan_level_to_plan_level_old
  122. ;---------------------------------------------------------------------
  123. red:
  124.         call    draw_window
  125. ;---------------------------------------------------------------------
  126. still:
  127. ;       mcall   10
  128.         mcall   23,1
  129.  
  130.         cmp     eax,1
  131.         je      red
  132.  
  133.         cmp     eax,2
  134.         je      key
  135.  
  136.         cmp     eax,3
  137.         je      button
  138.        
  139.         call    actions_for_all_cell
  140.         call    show_tiles
  141.         call    harvest_of_death
  142.         call    show_tiles_one_iteration
  143.         cmp     [death_of_protagonist],1
  144.         je      death_of_protagonist_start
  145.        
  146.         mov     eax,[protagonist_position.y]
  147.         imul    eax,LEVEL_MAP_SIZE_X*4
  148.         mov     ebx,[protagonist_position.x]
  149.         shl     ebx,2
  150.         add     eax,ebx
  151.         add     eax,plan_level
  152.         mov     eax,[eax]
  153.         cmp     ah,OBJECT_PROTAGONIST
  154.         jne     death_of_protagonist_start
  155.  
  156.         jmp     still
  157. ;---------------------------------------------------------------------
  158. button:
  159.         mcall   17
  160.  
  161.         cmp     ah,1
  162.         jne     still
  163. ;--------------------------------------
  164. .exit:
  165.         mov     eax,[N_error]
  166. ;        DEBUGF  1, "N_error: %d\n",eax
  167.         test    eax,eax
  168.         jz      @f
  169.  
  170.         mcall   51,1,thread_start,thread_stack
  171. ;--------------------------------------
  172. @@:
  173.         mcall   -1
  174. ;---------------------------------------------------------------------
  175. draw_window:
  176.         mcall   12,1
  177.         mcall   48,4
  178.         mov     ecx,100 shl 16 + 644
  179.         add     cx,ax
  180.         mcall   0,<100,649>,,0x74AABBCC,,title
  181. ;       mcall   13,<0,640>,<0,640>,0xff0000
  182.         mov     [draw_all_level],1
  183. ;       call    show_tiles
  184.         call    show_tiles_one_iteration
  185.         mov     [draw_all_level],0
  186. ;       mcall   4,<3,8>,0,message,message.size
  187.         mcall   12,2
  188.         ret
  189. ;---------------------------------------------------------------------
  190. memory_free_error:
  191.         mov     [N_error],3
  192.         jmp     button.exit
  193. ;---------------------------------------------------------------------
  194. memory_get_error:
  195.         mov     [N_error],4
  196.         jmp     button.exit
  197. ;-----------------------------------------------------------------------------
  198. include 'key.inc'
  199. include 'show_tiles.inc'
  200. include 'show_base.inc'
  201. include 'show_object.inc'
  202. include 'death_protagonist.inc'
  203. include 'load.inc'
  204. include 'icon_convert.inc'
  205. include 'error_window.inc'
  206. include 'actions.inc'
  207. include 'actions_npc.inc'
  208. include 'actions_protagonist.inc'
  209. include 'actions_white_bricks.inc'
  210. include 'random.inc'
  211. include 'snd_api.inc'
  212. include 'sound.inc'
  213. include 'menu.inc'
  214. include 'font.inc'
  215. ;---------------------------------------------------------------------
  216. if lang eq ru
  217.         include 'localization_rus.inc'
  218. else
  219.         include 'localization_eng.inc'
  220. end if
  221. ;---------------------------------------------------------------------
  222. include 'i_data.inc'
  223. include 'levels.inc'
  224. ;---------------------------------------------------------------------
  225. IM_END:
  226. ;---------------------------------------------------------------------
  227. ;include_debug_strings
  228. ;---------------------------------------------------------------------
  229. include 'u_data.inc'
  230. ;---------------------------------------------------------------------
  231. I_END:
  232.