Subversion Repositories Kolibri OS

Rev

Rev 5253 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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