Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
485 heavyiron 1
;
2
; Functions for moving objects
3
;
4
; Author:   Trans
5
; Date:     10.03.2005
6
; Compiler: FASM
7
; Target:   Hunter - MeOS game
8
;
9
 
10
;
11
; In:
12
; Out:
13
init_object:
14
	pusha
15
	mov ecx,16
16
	mov edi,movieng_objects
17
	mov esi,present_objects_list
18
io_loc_00:
19
	call init_one_object
20
	add edi,16
21
	loop io_loc_00
22
	call set_current_objects_list
23
	popa
24
	retn
25
 
26
 
27
;
28
; In:  EDI - pointer to object structure
29
;      ESI - pointer to present_objects_list
30
; Out:
31
init_one_object:
32
	call set_object
33
	call set_obj_direction
34
	call set_obj_coord
35
	call set_obj_speed
36
	call set_obj_amplitude
37
	call set_obj_cost
38
	retn
39
 
40
 
41
;
42
;
43
;
44
set_object:
45
	call random_8
46
	and al,07
47
	shl eax,2
48
	mov ebx,[esi+eax]
49
	mov [edi],ebx
50
	retn
51
 
52
;
53
;
54
;
55
set_obj_coord:
56
	call random_8
57
	and ax,07Fh
58
	cmp al,0
59
	jz set_obj_coord
60
	add ax,10
61
	cmp ax,120
62
	jb soc_loc_01
63
	sub ax,20
64
soc_loc_01:
65
	shl eax,16
66
	xor ax,ax
67
	mov al,byte [edi+0Ah]
68
	cmp al,byte 0
69
	jz soc_loc_00
70
	mov ax,319
71
soc_loc_00:
72
	ror eax,16
73
	mov [edi+4],eax
74
	retn
75
 
76
;
77
;
78
;
79
set_obj_speed:
80
	call random_8
81
	and al,07h	;0Fh
82
	cmp al,0
83
	jz set_obj_speed
84
	mov [edi+8],al
85
	retn
86
 
87
;
88
;
89
;
90
set_obj_amplitude:
91
	call random_8
92
	and al,0Fh
93
	mov [edi+9],al
94
	retn
95
 
96
;
97
;
98
;
99
set_obj_direction:
100
	call random_8
101
	and al,1
102
	mov [edi+0Ah],al
103
	retn
104
 
105
;
106
;
107
;
108
set_obj_cost:
109
	call random_8
110
	cmp al,0
111
	jz set_obj_cost
112
	mov [edi+0Bh],al
113
	retn
114
 
115
;
116
;
117
;
118
set_current_objects_list:
119
	pusha
120
	xor eax,eax
121
	mov edi,forward_list
122
	stosd
123
	stosd
124
	mov edi,back_list
125
	stosd
126
	stosd
127
	mov edi,forward_list
128
	call random_8
129
	and al,7
130
	cmp al,0
131
	jz scol_loc_00a
132
	mov ecx,eax
133
scol_loc_00:
134
	call random_8
135
	and al,7
136
	stosb
137
	loop scol_loc_00
138
scol_loc_00a:
139
	mov edi,back_list
140
	call random_8
141
	and al,07
142
	cmp al,0
143
	jz scol_loc_01a
144
	mov ecx,eax
145
scol_loc_01:
146
	call random_8
147
	and al,7
148
	stosb
149
	loop scol_loc_01
150
scol_loc_01a:
151
	popa
152
	retn
153
 
154
;
155
; In:  EDI - pointer to object structure
156
; Out:
157
movie_one_object:
158
	pusha
159
	mov eax,[edi+4]
160
	xor ebx,ebx
161
	mov bl,byte [edi+8]
162
	ror eax,16
163
	cmp byte [edi+0Ah],0
164
	jz moo_loc_00
165
	sub ax,bx
166
	cmp ax,320
167
	jb moo_loc_01
168
	mov ax,319
169
	jmp moo_loc_01
170
moo_loc_00:
171
	add ax,bx
172
	cmp ax,320
173
	jb moo_loc_01
174
	xor ax,ax
175
moo_loc_01:
176
	rol eax,16
177
	mov [edi+4],eax
178
	popa
179
	retn
180
 
181
;
182
;
183
;
184
movie_objects:
185
	pusha
186
	mov esi,forward_list
187
	mov ebx,movieng_objects
188
	mov ecx,8
189
mo_loc_00:
190
	xor eax,eax
191
	lodsb
192
	cmp al,0
193
	jz mo_loc_01
194
	mov edi,ebx
195
	shl eax,4
196
	add edi,eax
197
	call movie_one_object
198
mo_loc_01:
199
	loop mo_loc_00
200
	add ebx,16*8
201
	mov ecx,8
202
mo_loc_02:
203
	xor eax,eax
204
	lodsb
205
	cmp al,0
206
	jz mo_loc_03
207
	mov edi,ebx
208
	shl eax,4
209
	add edi,eax
210
	call movie_one_object
211
mo_loc_03:
212
	loop mo_loc_02
213
	popa
214
	retn
215
 
216
 
217
;
218
; In:  EDI - pointer to object structure
219
; Out:
220
draw_one_forward_object:
221
	push esi
222
	mov esi,[edi]
223
	mov eax,[edi+4]
224
	call draw_pict
225
	pop esi
226
	retn
227
 
228
;
229
; In:  EDI - pointer to object structure
230
; Out:
231
draw_one_back_object:
232
	push esi
233
	mov esi,[edi]
234
	mov eax,[edi+4]
235
	call draw_pict_scale_div_2
236
	pop esi
237
	retn
238
 
239
;
240
;
241
;
242
draw_objects:
243
	pusha
244
	mov esi,back_list+7
245
	mov ebx,movieng_objects+16*8
246
	mov edi,ebx
247
	mov ecx,8
248
do_loc_00:
249
	xor eax,eax
250
;	lodsb
251
	mov al,[esi]
252
	cmp al,0
253
	jz do_loc_01
254
	mov edi,ebx
255
	shl eax,4
256
	add edi,eax
257
	call draw_one_back_object
258
do_loc_01:
259
	dec esi
260
	loop do_loc_00
261
;	mov esi,forward_list
262
	mov ebx,movieng_objects
263
	mov ecx,8
264
do_loc_02:
265
	xor eax,eax
266
;	lodsb
267
	mov al,[esi]
268
	cmp al,0
269
	jz do_loc_03
270
	mov edi,ebx
271
	shl eax,4
272
	add edi,eax
273
	call draw_one_forward_object
274
do_loc_03:
275
	dec esi
276
	loop do_loc_02
277
	popa
278
	retn
279
 
280
;
281
; In:  EDI - pointer to object structure
282
; Out: Carry flag Clear/Set - No/Kill object
283
check_kill_one_forward_object:
284
	pusha
285
	mov esi,[edi]
286
	lodsw
287
	shl eax,16
288
	lodsw
289
	mov ebx,[edi+04]
290
	mov edx,[mouse_coord]
291
	add eax,ebx
292
	cmp dx,bx
293
	jb ckofo_loc_00
294
	cmp dx,ax
295
	ja ckofo_loc_00
296
	shr eax,16
297
	shr ebx,16
298
	shr edx,16
299
	cmp dx,bx
300
	jb ckofo_loc_00
301
	cmp dx,ax
302
	ja ckofo_loc_00
303
	stc
304
	popa
305
	retn
306
ckofo_loc_00:
307
	clc
308
	popa
309
	retn
310
 
311
;
312
; In:  EDI - pointer to object structure
313
; Out: Carry flag Clear/Set - No/Kill object
314
check_kill_one_back_object:
315
	pusha
316
	mov esi,[edi]
317
	lodsw
318
	shr eax,1
319
	shl eax,16
320
	lodsw
321
	shr ax,1
322
	mov ebx,[edi+04]
323
	mov edx,[mouse_coord]
324
	add eax,ebx
325
	cmp dx,bx
326
	jb ckobo_loc_00
327
	cmp dx,ax
328
	ja ckobo_loc_00
329
	shr eax,16
330
	shr ebx,16
331
	shr edx,16
332
	cmp dx,bx
333
	jb ckobo_loc_00
334
	cmp dx,ax
335
	ja ckobo_loc_00
336
	stc
337
	popa
338
	retn
339
ckobo_loc_00:
340
	clc
341
	popa
342
	retn
343
 
344
;
345
;
346
;
347
check_kill_object:
348
	pusha
349
	mov esi,forward_list
350
	mov ebx,movieng_objects
351
	mov ecx,8
352
cko_loc_00:
353
	xor eax,eax
354
	lodsb
355
	cmp al,0
356
	jz cko_loc_01
357
	shl eax,4
358
	mov edi,ebx
359
	add edi,eax
360
	call check_kill_one_forward_object
361
	jc cko_loc_kill
362
cko_loc_01:
363
	loop cko_loc_00
364
	add ebx,16*8
365
	mov ecx,8
366
cko_loc_02:
367
	xor eax,eax
368
	lodsb
369
	cmp al,0
370
	jz cko_loc_03
371
	shl eax,4
372
	mov edi,ebx
373
	add edi,eax
374
	call check_kill_one_back_object
375
	jc cko_loc_kill
376
cko_loc_03:
377
	loop cko_loc_02
378
	mov eax,[mouse_coord]
379
	xor ebx,ebx
380
	mov bl,byte [promakh_count]
381
	shl ebx,2
382
	add ebx,current_hole
383
	mov dword [ebx],eax
384
	inc byte [promakh_count]
385
	popa
386
	retn
387
cko_loc_kill:
388
	dec esi
389
	mov byte [esi],0
390
	xor eax,eax
391
	mov al,[edi+0Bh]
392
	add dword [score_count],eax
393
	clc
394
	popa
395
	retn
396
 
397
 
398
;
399
;
400
;
401
change_objects_speed:
402
	pusha
403
	mov esi,movieng_objects+8
404
	mov ecx,16
405
cos_loc_00:
406
	cmp byte [esi],0Fh
407
	jz cos_next
408
	inc byte [esi]
409
cos_next:
410
	add esi,16
411
	loop cos_loc_00
412
	popa
413
	retn