Subversion Repositories Kolibri OS

Rev

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. LEVEL_MAP_SIZE_X = 10
  51. LEVEL_MAP_SIZE_Y = 10
  52. SPRITE_SIZE_X = 64
  53. SPRITE_SIZE_Y = 64
  54. ;-----------------------------------------------------------------------------
  55. ROUTE_UP    = 1
  56. ROUTE_DOWN  = 2
  57. ROUTE_LEFT  = 3
  58. ROUTE_RIGHT = 4
  59. ;-----------------------------------------------------------------------------
  60. OBJECT_DEATH = 1
  61. OBJECT_SKELETON = 2
  62. OBJECT_IFRIT = 3
  63. OBJECT_BARRET = 4
  64. OBJECT_FINAL_MONSTER = 14
  65. OBJECT_PROTAGONIST = 15
  66. OBJECT_RED_BRICK = 16
  67. OBJECT_WHITE_BRICK = 17
  68. RED_BRICK_CRASH_1 = 0x80
  69. RED_BRICK_CRASH_2 = 0x81
  70. ;-----------------------------------------------------------------------------
  71. BASE_SMALL_ROCK = 0
  72. BASE_GRASS = 1
  73. BASE_LAVA = 2
  74. BASE_WATER = 3
  75. ;-----------------------------------------------------------------------------
  76. TARGET_RANGE = 3
  77. ;-----------------------------------------------------------------------------
  78. START:
  79.         mcall   68,11
  80.         mcall   66,1,1
  81.         mcall   40,0x7  ;27
  82. ;--------------------------------------
  83. load_libraries  l_libs_start,end_l_libs
  84.         test    eax,eax
  85.         jnz     button.exit
  86. ;--------------------------------------
  87. ; unpack deflate
  88.         mov     eax,[unpack_DeflateUnpack2]
  89.         mov     [deflate_unpack],eax
  90. ;--------------------------------------
  91.         call    load_and_convert_all_icons
  92.         call    load_all_sound_files
  93.        
  94.         mov     eax,[background_music]
  95.         mov     [wav_for_test],eax
  96.         mov     ebx,eax
  97.         add     ebx,1024
  98.         mov     [wav_for_test_end],ebx
  99.         call    initialize_sound_system
  100.        
  101.         mcall   51,1,snd_background_music_thread_start,snd_background_music_thread_stack
  102. ;---------------------------------------------------------------------
  103. start_level_0:
  104.         mov     [death_of_protagonist],0
  105.         mov     [protagonist_route],2
  106.         mov     [protagonist_position.x],4
  107.         mov     [protagonist_position.y],4
  108.        
  109.         mov     esi,map_level_0
  110.         call    map_level_to_plan_level
  111.         call    generate_objects_id
  112.         call    copy_plan_level_to_plan_level_old
  113. ;---------------------------------------------------------------------
  114. red:
  115.         call    draw_window
  116. ;---------------------------------------------------------------------
  117. still:
  118. ;       mcall   10
  119.         mcall   23,1
  120.  
  121.         cmp     eax,1
  122.         je      red
  123.  
  124.         cmp     eax,2
  125.         je      key
  126.  
  127.         cmp     eax,3
  128.         je      button
  129.        
  130.         call    actions_for_all_cell
  131.         call    show_tiles
  132.         call    harvest_of_death
  133.         call    show_tiles_one_iteration
  134.         cmp     [death_of_protagonist],1
  135.         je      death_of_protagonist_start
  136.        
  137.         mov     eax,[protagonist_position.y]
  138.         imul    eax,LEVEL_MAP_SIZE_X*4
  139.         mov     ebx,[protagonist_position.x]
  140.         shl     ebx,2
  141.         add     eax,ebx
  142.         add     eax,plan_level
  143.         mov     eax,[eax]
  144.         cmp     ah,OBJECT_PROTAGONIST
  145.         jne     death_of_protagonist_start
  146.  
  147.         jmp     still
  148. ;---------------------------------------------------------------------
  149. button:
  150.         mcall   17
  151.  
  152.         cmp     ah,1
  153.         jne     still
  154. ;--------------------------------------
  155. .exit:
  156.         mov     eax,[N_error]
  157. ;        DEBUGF  1, "N_error: %d\n",eax
  158.         test    eax,eax
  159.         jz      @f
  160.  
  161.         mcall   51,1,thread_start,thread_stack
  162. ;--------------------------------------
  163. @@:
  164.         mcall   -1
  165. ;---------------------------------------------------------------------
  166. draw_window:
  167.         mcall   12,1
  168.         mcall   48,4
  169.         mov     ecx,100 shl 16 + 644
  170.         add     cx,ax
  171.         mcall   0,<100,649>,,0x74AABBCC,,title
  172. ;       mcall   13,<0,640>,<0,640>,0xff0000
  173.         mov     [draw_all_level],1
  174. ;       call    show_tiles
  175.         call    show_tiles_one_iteration
  176.         mov     [draw_all_level],0
  177. ;       mcall   4,<3,8>,0,message,message.size
  178.         mcall   12,2
  179.         ret
  180. ;---------------------------------------------------------------------
  181. memory_free_error:
  182.         mov     [N_error],3
  183.         jmp     button.exit
  184. ;---------------------------------------------------------------------
  185. memory_get_error:
  186.         mov     [N_error],4
  187.         jmp     button.exit
  188. ;-----------------------------------------------------------------------------
  189. include 'key.inc'
  190. include 'show_tiles.inc'
  191. include 'show_base.inc'
  192. include 'show_object.inc'
  193. include 'death_protagonist.inc'
  194. include 'load.inc'
  195. include 'icon_convert.inc'
  196. include 'error_window.inc'
  197. include 'actions.inc'
  198. include 'actions_npc.inc'
  199. include 'actions_protagonist.inc'
  200. include 'actions_white_bricks.inc'
  201. include 'random.inc'
  202. include 'snd_api.inc'
  203. include 'sound.inc'
  204. ;---------------------------------------------------------------------
  205. include 'i_data.inc'
  206. include 'levels.inc'
  207. ;---------------------------------------------------------------------
  208. IM_END:
  209. ;---------------------------------------------------------------------
  210. ;include_debug_strings
  211. ;---------------------------------------------------------------------
  212. include 'u_data.inc'
  213. ;---------------------------------------------------------------------
  214. I_END:
  215.