Rev 1881 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1880 | mario79 | 1 | ;--------------------------------------------------------------------- |
2 | ; Free3D version 0.5 |
||
3 | ; |
||
4 | ; last update: 20/02/2011 |
||
5 | ; written by: Marat Zakiyanov aka Mario79, aka Mario |
||
6 | ; changes: PNG textures 128x128 |
||
7 | ; using libraries cnv_png.obj and archiver.obj |
||
8 | ; using dinamically allocation of memory |
||
9 | ; |
||
10 | ;--------------------------------------------------------------------- |
||
11 | ; |
||
12 | ; Fisheye Raycasting Engine Etc. FREE3D for MENUETOS by Dieter Marfurt |
||
13 | ; Version 0.4 (requires some texture-files to compile (see Data Section)) |
||
14 | ; dietermarfurt@angelfire.com - www.melog.ch/mos_pub/ |
||
15 | ; Don't hit me - I'm an ASM-Newbie... since years :) |
||
16 | ; |
||
17 | ; Compile with FASM for Menuet (requires .INC files - see DATA Section) |
||
18 | ; |
||
19 | ; Willow - greatly srinked code size by using GIF texture and FPU to calculate sine table |
||
20 | ; |
||
21 | ; !!!! Don't use GIF_LITE.INC in your apps - it's modified for FREE3D !!!! |
||
22 | ; |
||
23 | ; Heavyiron - new 0-function of drawing window from kolibri (do not work correctly with menuet) |
||
24 | |||
25 | TEX_SIZE equ 128*128*4 ;64*64*4 ; |
||
26 | |||
27 | ICON_SIZE_X equ 128 ;64 |
||
28 | ICON_SIZE_Y equ 128 ;64 |
||
29 | |||
30 | Floors_Height equ 32000 |
||
31 | ;ceil = sinus+TEX_SIZE ;16*1024 |
||
32 | ;wall = ceil+TEX_SIZE*1 |
||
33 | ;wall2 = ceil+TEX_SIZE*2 |
||
34 | ;wall3 = ceil+TEX_SIZE*3 |
||
35 | ;wall4 = ceil+TEX_SIZE*4 |
||
36 | ;wall5 = ceil+TEX_SIZE*5 |
||
37 | ;wall6 = ceil+TEX_SIZE*6 |
||
38 | ;wall7 = ceil+TEX_SIZE*7 |
||
39 | ;APP_MEM equ 0x400000 |
||
40 | ;--------------------------------------------------------------------- |
||
41 | use32 |
||
42 | org 0x0 |
||
43 | db 'MENUET01' ; 8 byte id |
||
44 | dd 0x01 ; header version |
||
45 | dd START ; start of code |
||
46 | dd IM_END ; size of image |
||
47 | dd I_END ; 0x100000 ; memory for app |
||
48 | dd stacktop ; 0x100000 ; esp |
||
49 | dd 0x0 |
||
50 | dd path |
||
51 | ;--------------------------------------------------------------------- |
||
52 | include '..\..\..\macros.inc' |
||
53 | ;include 'macros.inc' |
||
54 | include '../../../develop/libraries/box_lib/load_lib.mac' |
||
55 | ;include 'load_lib.mac' |
||
56 | @use_library |
||
57 | ;COLOR_ORDER equ OTHER |
||
58 | ;include 'gif_lite.inc' |
||
59 | ;--------------------------------------------------------------------- |
||
60 | START: ; start of execution |
||
61 | mcall 68,11 |
||
62 | |||
63 | load_libraries l_libs_start,end_l_libs |
||
64 | test eax,eax |
||
65 | jnz finish |
||
66 | |||
67 | ; unpack deflate |
||
68 | mov eax,[unpack_DeflateUnpack2] |
||
69 | mov [deflate_unpack],eax |
||
70 | |||
71 | call load_icons |
||
72 | call convert_icons |
||
73 | |||
74 | mov esi,sinus |
||
75 | mov ecx,360*10 |
||
76 | fninit |
||
77 | fld [sindegree] |
||
78 | ;-------------------------------------- |
||
79 | .sinlp: |
||
80 | fst st1 |
||
81 | fsin |
||
82 | fmul [sindiv] |
||
83 | fistp dword[esi] |
||
84 | add esi,4 |
||
85 | fadd [sininc] |
||
86 | loop .sinlp |
||
87 | call draw_window ; at first, draw the window |
||
88 | call draw_stuff |
||
89 | ;-------------------------------------- |
||
90 | align 4 |
||
91 | gamestart: |
||
92 | ; ******* MOUSE CHECK ******* |
||
93 | ; mov eax,37 ; check mouse (use mouse over window to navigate) |
||
94 | ; mov ebx,2 ; check mousebuttons |
||
95 | ; mcall |
||
96 | ; cmp eax,0 ; only use mouse when button down |
||
97 | ; je noneed ; deactivated cause of disappear-bug etc. |
||
98 | |||
99 | mcall 37,1 ; check mouseposition |
||
100 | mov ebx,eax |
||
101 | shr eax,16 |
||
102 | and eax,0x0000FFFF ; mousex |
||
103 | and ebx,0x0000FFFF ; mousey |
||
104 | |||
105 | cmp eax,5 ; mouse out of window ? |
||
106 | jb check_refresh ; it will prevent an app-crash |
||
107 | |||
108 | cmp ebx,22 |
||
109 | jb check_refresh |
||
110 | |||
111 | cmp eax,640 |
||
112 | jg check_refresh |
||
113 | |||
114 | cmp ebx,501 |
||
115 | jg check_refresh |
||
116 | |||
117 | cmp eax,315 ; navigating? |
||
118 | jb m_left |
||
119 | |||
120 | cmp eax,325 ; |
||
121 | jg m_right |
||
122 | ;-------------------------------------- |
||
123 | continue: |
||
124 | cmp ebx,220 ; |
||
125 | jb s_up |
||
126 | |||
127 | cmp ebx,260 ; |
||
128 | jg s_down |
||
129 | ;-------------------------------------- |
||
130 | ; ******* END OF MOUSE CHECK ******* |
||
131 | align 4 |
||
132 | check_refresh: |
||
133 | |||
134 | ; mov eax,23 ; wait for system event with 10 ms timeout |
||
135 | ; mov ebx,1 ; thats max 100 FPS |
||
136 | mcall 11 ; ask no wait for full speed |
||
137 | |||
138 | cmp eax,1 ; window redraw request ? |
||
139 | je red2 |
||
140 | |||
141 | cmp eax,2 ; key in buffer ? |
||
142 | je key2 |
||
143 | |||
144 | cmp eax,3 ; button in buffer ? |
||
145 | je button2 |
||
146 | |||
147 | mov edi,[mouseya] ; check flag if a refresh has to be done |
||
148 | cmp edi,1 |
||
149 | jne gamestart |
||
150 | |||
151 | mov [mouseya],dword 0 |
||
152 | call draw_stuff |
||
153 | jmp gamestart |
||
154 | ;--------------------------------------------------------------------- |
||
155 | align 4 |
||
156 | red2: ; redraw |
||
157 | call draw_window |
||
158 | call draw_stuff |
||
159 | jmp gamestart |
||
160 | ;--------------------------------------------------------------------- |
||
161 | align 4 |
||
162 | key2: ; key |
||
163 | mcall 2 |
||
164 | cmp al,1 |
||
165 | je gamestart ; keybuffer empty |
||
166 | |||
167 | cmp ah,27 ; esc=End App |
||
168 | je finish |
||
169 | |||
170 | cmp ah,178 ; up |
||
171 | je s_up |
||
172 | |||
173 | cmp ah,177 ; down |
||
174 | je s_down |
||
175 | |||
176 | cmp ah,176 ; left |
||
177 | je s_left |
||
178 | |||
179 | cmp ah,179 ; right |
||
180 | je s_right |
||
181 | |||
182 | jmp gamestart ; was any other key |
||
183 | ;--------------------------------------------------------------------- |
||
184 | align 4 |
||
185 | s_up: ; walk forward (key or mouse) |
||
186 | mov eax,[vpx] |
||
187 | mov ebx,[vpy] |
||
188 | |||
189 | mov ecx,[vheading] |
||
190 | mov edi,[sinus+ecx*4] |
||
191 | |||
192 | mov edx,[vheading] |
||
193 | lea edx,[sinus+3600+edx*4] |
||
194 | cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 |
||
195 | jb ok200 |
||
196 | |||
197 | sub edx,14400 |
||
198 | ;-------------------------------------- |
||
199 | ok200: |
||
200 | mov esi,[edx] |
||
201 | ; sal esi,1 ; edit walking speed here |
||
202 | ; sal edi,1 |
||
203 | add eax,edi ; newPx |
||
204 | add ebx,esi ; newPy |
||
205 | mov edi,eax ; newPx / ffff |
||
206 | mov esi,ebx ; newPy / ffff |
||
207 | sar edi,16 |
||
208 | sar esi,16 |
||
209 | mov ecx,esi |
||
210 | sal ecx,5 ; equal *32 |
||
211 | lea ecx,[grid+ecx+edi] |
||
212 | cmp [ecx],byte 0 ; collision check |
||
213 | jne cannotwalk0 |
||
214 | mov [vpx],eax |
||
215 | mov [vpy],ebx |
||
216 | mov [mouseya],dword 1 ; set refresh flag |
||
217 | ;-------------------------------------- |
||
218 | cannotwalk0: |
||
219 | jmp check_refresh |
||
220 | ;--------------------------------------------------------------------- |
||
221 | align 4 |
||
222 | s_down: ; walk backward |
||
223 | mov eax,[vpx] |
||
224 | mov ebx,[vpy] |
||
225 | mov ecx,[vheading] |
||
226 | mov edi,[sinus+ecx*4] |
||
227 | mov edx,[vheading] |
||
228 | lea edx,[sinus+3600+edx*4] |
||
229 | cmp edx,eosinus ; cosinus taken from (sinus plus 900) mod 3600 |
||
230 | jb ok201 |
||
231 | sub edx,14400 |
||
232 | ;-------------------------------------- |
||
233 | ok201: |
||
234 | mov esi,[edx] |
||
235 | ; sal esi,1 ; edit walking speed here |
||
236 | ; sal edi,1 |
||
237 | sub eax,edi ; newPx |
||
238 | sub ebx,esi ; newPy |
||
239 | mov edi,eax ; newPx / ffff |
||
240 | mov esi,ebx ; newPy / ffff |
||
241 | sar edi,16 |
||
242 | sar esi,16 |
||
243 | mov ecx,esi |
||
244 | sal ecx,5 |
||
245 | lea ecx,[grid+ecx+edi] |
||
246 | cmp [ecx],byte 0 |
||
247 | jne cannotwalk1 |
||
248 | mov [vpx],eax |
||
249 | mov [vpy],ebx |
||
250 | mov [mouseya],dword 1 |
||
251 | ;-------------------------------------- |
||
252 | cannotwalk1: |
||
253 | jmp check_refresh |
||
254 | ;--------------------------------------------------------------------- |
||
255 | align 4 |
||
256 | s_left: ; turn left (key) |
||
257 | mov edi,[vheading] ; heading |
||
258 | add edi,50 |
||
259 | cmp edi,3600 |
||
260 | jb ok_heading0 |
||
261 | |||
262 | sub edi,3600 |
||
263 | ;-------------------------------------- |
||
264 | ok_heading0: |
||
265 | mov [vheading],edi |
||
266 | mov [mouseya],dword 1 |
||
267 | jmp check_refresh |
||
268 | ;--------------------------------------------------------------------- |
||
269 | align 4 |
||
270 | s_right: ; turn right |
||
271 | mov edi,[vheading] |
||
272 | sub edi,50 |
||
273 | cmp edi,-1 |
||
274 | jg ok_heading1 |
||
275 | |||
276 | add edi,3600 |
||
277 | ;-------------------------------------- |
||
278 | ok_heading1: |
||
279 | mov [vheading],edi |
||
280 | mov [mouseya],dword 1 |
||
281 | jmp check_refresh |
||
282 | ;--------------------------------------------------------------------- |
||
283 | align 4 |
||
284 | m_left: ; turn left (mouse) |
||
285 | mov edi,[vheading] ; heading |
||
286 | mov ecx,315 |
||
287 | sub ecx,eax |
||
288 | sar ecx,2 |
||
289 | add edi,ecx |
||
290 | cmp edi,3600 |
||
291 | jb ok_heading2 |
||
292 | |||
293 | sub edi,3600 |
||
294 | ;-------------------------------------- |
||
295 | ok_heading2: |
||
296 | mov [vheading],edi |
||
297 | mov [mouseya],dword 1 |
||
298 | jmp continue ; allow both: walk and rotate |
||
299 | ;--------------------------------------------------------------------- |
||
300 | align 4 |
||
301 | m_right: ; turn right |
||
302 | mov edi,[vheading] |
||
303 | sub eax,325 |
||
304 | sar eax,2 |
||
305 | sub edi,eax |
||
306 | cmp edi,-1 |
||
307 | jg ok_heading3 |
||
308 | |||
309 | add edi,3600 |
||
310 | ;-------------------------------------- |
||
311 | ok_heading3: |
||
312 | mov [vheading],edi |
||
313 | mov [mouseya],dword 1 |
||
314 | jmp continue |
||
315 | ;--------------------------------------------------------------------- |
||
316 | align 4 |
||
317 | button2: ; button |
||
318 | mcall 17 |
||
319 | cmp ah,1 ; button id=1 ? |
||
320 | jne gamestart |
||
321 | ;-------------------------------------- |
||
322 | finish: |
||
323 | mcall -1 ; close this program |
||
324 | ;--------------------------------------------------------------------- |
||
325 | ; ********************************************* |
||
326 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
327 | ; ********************************************* |
||
328 | align 4 |
||
329 | draw_window: |
||
330 | mcall 12,1 |
||
331 | xor eax,eax |
||
332 | xor esi,esi |
||
333 | mcall ,<50,649>,<50,506>,0x74ffffff,,title |
||
334 | mcall 12,2 |
||
335 | ret |
||
336 | ;--------------------------------------------------------------------- |
||
337 | ; ********************************************* |
||
338 | ; ******* COMPUTE 3D-VIEW ******** |
||
339 | ; ********************************************* |
||
340 | align 4 |
||
341 | draw_stuff: |
||
342 | mov [step1],dword 1 |
||
343 | ; mov [step64],dword 64 |
||
344 | mov esi,[vheading] |
||
345 | add esi,320 |
||
346 | mov [va],esi |
||
347 | mov eax,[vheading] |
||
348 | sub eax,320 |
||
349 | mov [vacompare],eax |
||
350 | ;------------------------------------ CAST 640 PIXEL COLUMNS --------------- |
||
351 | ; FOR A=320+heading to -319+heading step -1 (a is stored in [va]) |
||
352 | ;--------------------------------------------------------------------------- |
||
353 | ; mov edx,5 |
||
354 | mov [vx1],dword 0 ;5 ;edx ; init x1 ... pixelcolumn |
||
355 | ;-------------------------------------- |
||
356 | align 4 |
||
357 | for_a: |
||
358 | mov edx,[vx1] |
||
359 | mov [vx1b],edx |
||
360 | sub [vx1b],dword 320 |
||
361 | mov edx,[va] ; a2 |
||
362 | cmp edx,-1 ; a2 is a mod 3600 |
||
363 | jg ok1 |
||
364 | |||
365 | add edx,3600 |
||
366 | ;-------------------------------------- |
||
367 | ok1: |
||
368 | cmp edx,3600 |
||
369 | jb ok2 |
||
370 | |||
371 | sub edx,3600 |
||
372 | ;-------------------------------------- |
||
373 | ok2: |
||
374 | ; get stepx and stepy |
||
375 | ; pointer to stepx |
||
376 | lea ecx,[sinus+edx*4] |
||
377 | mov esi,[ecx] |
||
378 | sar esi,4 ; accuracy |
||
379 | mov [vstepx],esi ; store stepx |
||
380 | lea esi,[sinus+3600+edx*4] |
||
381 | cmp esi,eosinus ;cosinus taken from ((sinus plus 900) mod 3600) |
||
382 | jb ok202 |
||
383 | |||
384 | sub esi,14400 |
||
385 | ;-------------------------------------- |
||
386 | ok202: |
||
387 | mov ecx,[esi] |
||
388 | sar ecx,4 |
||
389 | mov [vstepy],ecx ; store stepy |
||
390 | |||
391 | mov eax,[vpx] ; get Camera Position |
||
392 | mov ebx,[vpy] |
||
393 | mov [vxx],eax ; init caster position |
||
394 | mov [vyy],ebx |
||
395 | |||
396 | mov edi,0 ; init L (number of raycsting-steps) |
||
397 | mov [step1],dword 1 ; init Caster stepwidth for L. |
||
398 | ;-------------------------------------- |
||
399 | ; raycast a pixel column |
||
400 | align 4 |
||
401 | raycast: |
||
402 | add edi,[step1] ; count caster steps |
||
403 | jmp nodouble ; use this to prevent blinking/wobbling textures: much slower! |
||
404 | |||
405 | ; cmp edi,32 |
||
406 | ; je double |
||
407 | |||
408 | ; cmp edi,512 |
||
409 | ; je double |
||
410 | |||
411 | ; cmp edi,1024 |
||
412 | ; je double |
||
413 | |||
414 | ; jmp nodouble |
||
415 | ;--------------------------------------------------------------------- |
||
416 | ;double: |
||
417 | ; mov edx,[step1] |
||
418 | ; sal edx,1 |
||
419 | ; mov [step1],edx |
||
420 | |||
421 | ; mov edx,[vstepx] |
||
422 | ; sal edx,1 |
||
423 | ; mov [vstepx],edx |
||
424 | |||
425 | ; mov edx,[vstepy] |
||
426 | ; sal edx,1 |
||
427 | ; mov [vstepy],edx |
||
428 | ;-------------------------------------- |
||
429 | nodouble: |
||
430 | mov eax,Floors_Height ;32000 ; 3600 ; determine Floors Height based on distance |
||
431 | xor edx,edx |
||
432 | mov ebx,edi |
||
433 | |||
434 | div ebx |
||
435 | |||
436 | shl edx,1 |
||
437 | cmp ebx,edx |
||
438 | jae @f |
||
439 | inc eax |
||
440 | @@: |
||
441 | |||
442 | mov esi,eax |
||
443 | mov [vdd],esi |
||
444 | mov edx,260 |
||
445 | sub edx,esi |
||
446 | mov [vh],edx |
||
447 | |||
448 | cmp edx,22 |
||
449 | jb no_nu_pixel |
||
450 | |||
451 | cmp edx,259 |
||
452 | jg no_nu_pixel ; draw only new pixels |
||
453 | |||
454 | cmp edx,[h_old] |
||
455 | je no_nu_pixel |
||
456 | |||
457 | mov eax,[vxx] ; calc floor pixel |
||
458 | mov ebx,[vyy] |
||
459 | |||
460 | and eax,0x0000FFFF |
||
461 | and ebx,0x0000FFFF |
||
462 | |||
463 | shr eax,10 |
||
464 | shr ebx,10 ; pixel coords inside Texture x,y 64*64 |
||
465 | mov [xfrac],eax |
||
466 | mov [yfrac],ebx |
||
467 | ; plot floor pixel !!!! |
||
468 | mov [vl],edi ; save L |
||
469 | mov [ytemp],esi ; remember L bzw. H |
||
470 | |||
471 | mov edi,[yfrac] ; get pixel color of this floor pixel |
||
472 | sal edi,9 ;8 - for 64x64 |
||
473 | mov esi,[xfrac] |
||
474 | sal esi,3 ;2 - for 64x64 |
||
475 | ; in fact its floor, just using the wall texture :) |
||
476 | ; lea edi,[wall+edi+esi] |
||
477 | add edi,[wall1] |
||
478 | add edi,esi |
||
479 | mov edx,[edi] |
||
480 | mov [remesi],esi |
||
481 | ;**** calculate pixel adress:**** |
||
482 | mov esi,[ytemp] |
||
483 | add esi,240 |
||
484 | imul esi,1920 |
||
485 | mov eax,[vx1] |
||
486 | lea eax,[eax+eax*2] |
||
487 | lea esi,[screen_buffer+eax+esi] |
||
488 | |||
489 | cmp esi,screen_buffer+1920*480 |
||
490 | jg foff0 |
||
491 | |||
492 | cmp esi,screen_buffer |
||
493 | jb foff0 |
||
494 | ; now we have the adress of the floor-pixel color in edi |
||
495 | ; and the adress of the pixel in the image in esi |
||
496 | mov edx,[edi] |
||
497 | ;******************** custom distance DARKEN Floor |
||
498 | mov eax,[vdd] |
||
499 | ; jmp nodark0 ; use this to deactivate darkening floor (a bit faster) |
||
500 | |||
501 | cmp eax,80 |
||
502 | jg nodark0 |
||
503 | ; split rgb |
||
504 | mov [blue],edx |
||
505 | and [blue],dword 255 |
||
506 | |||
507 | shr edx,8 |
||
508 | mov [green],edx |
||
509 | and [green],dword 255 |
||
510 | |||
511 | shr edx,8 |
||
512 | mov [red],edx |
||
513 | and [red],dword 255 |
||
514 | |||
515 | mov eax,81 ; darkness parameter |
||
516 | sub eax,[vdd] |
||
517 | sal eax,1 |
||
518 | ; reduce rgb |
||
519 | sub [red],eax |
||
520 | cmp [red],dword 0 |
||
521 | jg notblack10 |
||
522 | |||
523 | mov [red],dword 0 |
||
524 | ;-------------------------------------- |
||
525 | notblack10: |
||
526 | sub [green],eax |
||
527 | cmp [green],dword 0 |
||
528 | jg notblack20 |
||
529 | |||
530 | mov [green],dword 0 |
||
531 | ;-------------------------------------- |
||
532 | notblack20: |
||
533 | mov edx,[blue] |
||
534 | sub [blue],eax |
||
535 | cmp [blue],dword 0 |
||
536 | jg notblack30 |
||
537 | |||
538 | mov [blue],dword 0 |
||
539 | ;-------------------------------------- |
||
540 | notblack30: |
||
541 | shl dword [red],16 ; reassemble rgb |
||
542 | shl dword [green],8 |
||
543 | mov edx,[red] |
||
544 | or edx,[green] |
||
545 | or edx,[blue] |
||
546 | ;-------------------------------------- |
||
547 | nodark0: |
||
548 | ; eo custom darken floor |
||
549 | mov eax,edx |
||
550 | |||
551 | ; cmp esi,screen_buffer+1920*480 |
||
552 | ; ja foff0 |
||
553 | |||
554 | ; cmp esi,screen_buffer |
||
555 | ; jb foff0 |
||
556 | |||
557 | mov [esi],eax ; actually draw the floor pixel |
||
558 | ; paint "forgotten" pixels |
||
559 | mov edx,[lasty] |
||
560 | sub edx,1920 |
||
561 | cmp esi,edx |
||
562 | je foff0 |
||
563 | |||
564 | mov [esi+1920],eax |
||
565 | sub edx,1920 |
||
566 | cmp esi,edx |
||
567 | je foff0 |
||
568 | |||
569 | mov [edx+1920],eax |
||
570 | sub edx,1920 |
||
571 | cmp esi,edx |
||
572 | je foff0 |
||
573 | |||
574 | mov [edx+1920],eax |
||
575 | ;-------------------------------------- |
||
576 | align 4 |
||
577 | foff0: |
||
578 | mov [lasty],esi |
||
579 | ;**** end of draw floor pixel **** |
||
580 | mov esi,[remesi] |
||
581 | mov edi,[vl] ; restore L |
||
582 | ;-------------------------------------- |
||
583 | no_nu_pixel: |
||
584 | mov esi,[vh] |
||
585 | mov [h_old],esi |
||
586 | |||
587 | mov eax,[vxx] |
||
588 | mov ebx,[vyy] |
||
589 | |||
590 | add eax,[vstepx] ; casting... |
||
591 | add ebx,[vstepy] |
||
592 | |||
593 | mov [vxx],eax |
||
594 | mov [vyy],ebx |
||
595 | |||
596 | sar eax,16 |
||
597 | sar ebx,16 |
||
598 | |||
599 | mov [vpxi],eax ; casters position in Map Grid |
||
600 | mov [vpyi],ebx |
||
601 | |||
602 | mov edx,ebx |
||
603 | shl edx,5 |
||
604 | lea edx,[grid+edx+eax] |
||
605 | |||
606 | cmp [edx],byte 0 ; raycaster reached a wall? (0=no) |
||
607 | jne getout |
||
608 | |||
609 | cmp edi,10000 ; limit view range |
||
610 | jb raycast |
||
611 | ;-------------------------------------- |
||
612 | getout: |
||
613 | mov eax,[edx] ; store Grid Wall Value for Texture Selection |
||
614 | mov [vk],eax |
||
615 | call blur ; deactivate this (blurs the near floor) : a bit faster |
||
616 | |||
617 | ; simply copy floor to ceil pixel column here |
||
618 | ; jmp nocopy ; use this for test purposes |
||
619 | pusha |
||
620 | mov eax,screen_buffer+1920*240 |
||
621 | mov ebx,eax ;screen_buffer+1920*240 |
||
622 | ;-------------------------------------- |
||
623 | align 4 |
||
624 | copyfloor: |
||
625 | sub eax,1920 |
||
626 | add ebx,1920 |
||
627 | mov ecx,[vx1] |
||
628 | lea ecx,[ecx+ecx*2] |
||
629 | lea edx,[ecx+ebx] |
||
630 | add ecx,eax |
||
631 | mov esi,[edx] |
||
632 | mov [ecx],esi |
||
633 | cmp eax,screen_buffer |
||
634 | jg copyfloor |
||
635 | ;@@: |
||
636 | popa |
||
637 | ; *** end of copy floor to ceil |
||
638 | ;nocopy: |
||
639 | ;-------------------------------------- |
||
640 | ; draw this pixelrows wall |
||
641 | mov [vl],edi |
||
642 | mov edi,260 |
||
643 | sub edi,[vdd] |
||
644 | cmp edi,0 |
||
645 | jg ok3 |
||
646 | |||
647 | xor edi,edi |
||
648 | ;-------------------------------------- |
||
649 | ok3: |
||
650 | mov [vbottom],edi ; end wall ceil (or window top) |
||
651 | mov esi,262 |
||
652 | add esi,[vdd] ; start wall floor |
||
653 | xor edi,edi |
||
654 | ; somethin is wrong with xfrac,so recalc... |
||
655 | mov eax,[vxx] |
||
656 | and eax,0x0000FFFF |
||
657 | shr eax,10 |
||
658 | mov [xfrac],eax |
||
659 | |||
660 | mov eax,[vyy] |
||
661 | and eax,0x0000FFFF |
||
662 | shr eax,10 |
||
663 | mov [yfrac],eax |
||
664 | ;-------------------------------------- |
||
665 | pixelrow: |
||
666 | ; find each pixels color: |
||
667 | add edi,ICON_SIZE_Y |
||
668 | sub esi,1 |
||
669 | cmp esi,502 ; dont calc offscreen-pixels |
||
670 | jg speedup |
||
671 | |||
672 | xor edx,edx |
||
673 | mov eax,edi |
||
674 | mov ebx,[vdd] |
||
675 | ; add ebx,ebx |
||
676 | shl ebx,1 |
||
677 | div ebx |
||
678 | |||
679 | shl edx,1 |
||
680 | cmp ebx,edx |
||
681 | jae @f |
||
682 | inc eax |
||
683 | @@: |
||
684 | and eax,ICON_SIZE_Y-1 |
||
685 | mov [ytemp],eax ; get y of texture for wall |
||
686 | |||
687 | mov eax,[xfrac] |
||
688 | add eax,[yfrac] |
||
689 | and eax,ICON_SIZE_X-1 |
||
690 | mov [xtemp],eax ; get x of texture for wall |
||
691 | ; now prepare to plot that wall-pixel... |
||
692 | mov [remedi],edi |
||
693 | mov edi,[ytemp] |
||
694 | sal edi,9 ;8 - for 64x64 |
||
695 | mov edx,[xtemp] |
||
696 | sal edx,3 ;2 - for 64x64 |
||
697 | add edi,edx |
||
698 | mov eax,[vk] ; determine which texture should be used |
||
699 | and eax,255 |
||
700 | |||
701 | cmp eax,1 |
||
702 | jne checkmore1 |
||
703 | |||
704 | add edi,[wall0] ;ceil |
||
705 | jmp foundtex |
||
706 | ;--------------------------------------------------------------------- |
||
707 | align 4 |
||
708 | checkmore1: |
||
709 | cmp eax,2 |
||
710 | jne checkmore2 |
||
711 | |||
712 | add edi,[wall1] |
||
713 | jmp foundtex |
||
714 | ;--------------------------------------------------------------------- |
||
715 | align 4 |
||
716 | checkmore2: |
||
717 | cmp eax,3 |
||
718 | jne checkmore3 |
||
719 | |||
720 | add edi,[wall2] |
||
721 | jmp foundtex |
||
722 | ;--------------------------------------------------------------------- |
||
723 | align 4 |
||
724 | checkmore3: |
||
725 | cmp eax,4 |
||
726 | jne checkmore4 |
||
727 | |||
728 | add edi,[wall3] |
||
729 | jmp foundtex |
||
730 | ;--------------------------------------------------------------------- |
||
731 | align 4 |
||
732 | checkmore4: |
||
733 | cmp eax,5 |
||
734 | jne checkmore5 |
||
735 | |||
736 | add edi,[wall4] |
||
737 | jmp foundtex |
||
738 | ;--------------------------------------------------------------------- |
||
739 | align 4 |
||
740 | checkmore5: |
||
741 | cmp eax,6 |
||
742 | jne checkmore6 |
||
743 | |||
744 | add edi,[wall5] |
||
745 | jmp foundtex |
||
746 | ;--------------------------------------------------------------------- |
||
747 | align 4 |
||
748 | checkmore6: |
||
749 | cmp eax,7 |
||
750 | jne checkmore7 |
||
751 | |||
752 | add edi,[wall6] |
||
753 | jmp foundtex |
||
754 | ;--------------------------------------------------------------------- |
||
755 | align 4 |
||
756 | checkmore7: |
||
757 | cmp eax,8 |
||
758 | jne checkmore8 |
||
759 | |||
760 | add edi,[wall7] |
||
761 | jmp foundtex |
||
762 | ;--------------------------------------------------------------------- |
||
763 | align 4 |
||
764 | checkmore8: |
||
765 | foundtex: |
||
766 | mov edx,[edi] ; get pixel color inside texture |
||
767 | ; ***pseudoshade south-west |
||
768 | ; jmp east ; activate this for southwest pseudoshade : a bit slower + blink-bug |
||
769 | ;--------------------------------------------------------------------- |
||
770 | ; mov edi,[yfrac] |
||
771 | ; mov [pseudo],dword 0 ; store flag for custom distance darkening |
||
772 | ; cmp edi,[xfrac] |
||
773 | ; jge east |
||
774 | |||
775 | ; and edx,0x00FEFEFE |
||
776 | ; shr edx,1 |
||
777 | ; mov [pseudo],dword 1 |
||
778 | ;-------------------------------------- |
||
779 | east: |
||
780 | call dark_distance ; deactivate wall distance darkening: a bit faster |
||
781 | ; ******* DRAW WALL PIXEL ******* |
||
782 | mov eax,esi |
||
783 | lea eax,[esi-22] |
||
784 | imul eax,1920 |
||
785 | mov ebx,[vx1] |
||
786 | lea ebx,[ebx+ebx*2] |
||
787 | lea eax,[eax+screen_buffer+ebx] |
||
788 | |||
789 | cmp eax,screen_buffer+1920*480 |
||
790 | ja dont_draw |
||
791 | |||
792 | cmp eax,screen_buffer |
||
793 | jb dont_draw |
||
794 | |||
795 | mov [eax],edx ; actually set the pixel in the image |
||
796 | ;-------------------------------------- |
||
797 | ; *** eo draw wall pixel |
||
798 | dont_draw: |
||
799 | mov edi,[remedi] |
||
800 | ;-------------------------------------- |
||
801 | speedup: |
||
802 | cmp esi,[vbottom] ; end of this column? |
||
803 | jg pixelrow |
||
804 | |||
805 | mov edi,[vl] ; restoring |
||
806 | mov eax,[vx1] ; inc X1 |
||
807 | add eax,1 |
||
808 | mov [vx1],eax |
||
809 | ;*** NEXT A *** |
||
810 | mov esi,[va] |
||
811 | sub esi,1 |
||
812 | mov [va],esi |
||
813 | cmp esi,[vacompare] |
||
814 | jg for_a |
||
815 | ;*** EO NEXT A *** |
||
816 | ;-------------------------------------- |
||
817 | ; **** put image !!!!!**** |
||
818 | xor edx,edx |
||
819 | mcall 7,screen_buffer,<640,480> |
||
820 | ret |
||
821 | ;--------------------------------------------------------------------- |
||
822 | align 4 |
||
823 | blur: |
||
824 | pusha |
||
825 | mov eax,screen_buffer+360*1920 |
||
826 | ;-------------------------------------- |
||
827 | align 4 |
||
828 | copyfloor2: |
||
829 | add eax,1920 |
||
830 | mov ebx,[vx1] |
||
831 | lea ebx,[ebx+ebx*2] |
||
832 | add ebx,eax |
||
833 | |||
834 | mov ecx,[ebx-15] |
||
835 | and ecx,0x00FEFEFE |
||
836 | shr ecx,1 |
||
837 | |||
838 | mov edx,[ebx-12] |
||
839 | and edx,0x00FEFEFE |
||
840 | shr edx,1 |
||
841 | add edx,ecx |
||
842 | and edx,0x00FEFEFE |
||
843 | shr edx,1 |
||
844 | |||
845 | mov ecx,[ebx-9] |
||
846 | and ecx,0x00FEFEFE |
||
847 | shr ecx,1 |
||
848 | add edx,ecx |
||
849 | |||
850 | and edx,0x00FEFEFE |
||
851 | shr edx,1 |
||
852 | |||
853 | mov ecx,[ebx-6] |
||
854 | and ecx,0x00FEFEFE |
||
855 | shr ecx,1 |
||
856 | add edx,ecx |
||
857 | |||
858 | and edx,0x00FEFEFE |
||
859 | shr edx,1 |
||
860 | |||
861 | mov ecx,[ebx-3] |
||
862 | and ecx,0x00FEFEFE |
||
863 | shr ecx,1 |
||
864 | add edx,ecx |
||
865 | |||
866 | and edx,0x00FEFEFE |
||
867 | shr edx,1 |
||
868 | |||
869 | mov ecx,[ebx] |
||
870 | and ecx,0x00FEFEFE |
||
871 | shr ecx,1 |
||
872 | add edx,ecx |
||
873 | |||
874 | mov [ebx],edx |
||
875 | |||
876 | cmp eax,screen_buffer+478*1920 |
||
877 | jb copyfloor2 |
||
878 | |||
879 | popa |
||
880 | ret |
||
881 | ;--------------------------------------------------------------------- |
||
882 | ; ******* Darken by Distance ******* |
||
883 | align 4 |
||
884 | dark_distance: |
||
885 | ; color must be in edx, wall height in [vdd] |
||
886 | mov eax,[vdd] |
||
887 | cmp eax,50 |
||
888 | jg nodark |
||
889 | ; split rgb |
||
890 | mov [blue],edx |
||
891 | and [blue],dword 255 |
||
892 | |||
893 | shr edx,8 |
||
894 | mov [green],edx |
||
895 | and [green],dword 255 |
||
896 | |||
897 | shr edx,8 |
||
898 | mov [red],edx |
||
899 | and [red],dword 255 |
||
900 | |||
901 | mov eax,51 ; darkness parameter |
||
902 | sub eax,[vdd] |
||
903 | cmp [pseudo],dword 1 |
||
904 | je isdarkside |
||
905 | |||
906 | sal eax,2 |
||
907 | ;-------------------------------------- |
||
908 | align 4 |
||
909 | isdarkside: |
||
910 | ; reduce rgb |
||
911 | sub [red],eax |
||
912 | cmp [red], dword 0 |
||
913 | jg notblack10b |
||
914 | |||
915 | mov [red],dword 0 |
||
916 | ;-------------------------------------- |
||
917 | align 4 |
||
918 | notblack10b: |
||
919 | sub [green],eax |
||
920 | cmp [green],dword 0 |
||
921 | jg notblack20b |
||
922 | |||
923 | mov [green],dword 0 |
||
924 | ;-------------------------------------- |
||
925 | align 4 |
||
926 | notblack20b: |
||
927 | mov edx,[blue] |
||
928 | sub [blue],eax |
||
929 | cmp [blue],dword 0 |
||
930 | jg notblack30b |
||
931 | |||
932 | mov [blue],dword 0 |
||
933 | ;-------------------------------------- |
||
934 | align 4 |
||
935 | notblack30b: |
||
936 | shl dword [red],16 ; reassemble rgb |
||
937 | shl dword [green],8 |
||
938 | mov edx,[red] |
||
939 | or edx,[green] |
||
940 | or edx,[blue] |
||
941 | mov eax,edx |
||
942 | ;-------------------------------------- |
||
943 | align 4 |
||
944 | nodark: |
||
945 | ret |
||
946 | ;--------------------------------------------------------------------- |
||
947 | load_icons: |
||
948 | mov ebx,icons_file_name |
||
949 | mov esi,path |
||
950 | mov edi,file_name |
||
951 | call copy_file_path |
||
952 | |||
953 | mov [fileinfo.subfunction],dword 5 |
||
954 | mov [fileinfo.size],dword 0 |
||
955 | mov [fileinfo.return],dword file_info |
||
956 | mcall 70,fileinfo |
||
957 | test eax,eax |
||
958 | jnz .error |
||
959 | |||
960 | mov [fileinfo.subfunction],dword 0 |
||
961 | |||
962 | mov ecx,[file_info+32] |
||
963 | mov [fileinfo.size],ecx |
||
964 | mov [img_size],ecx |
||
965 | |||
966 | mcall 68,12 |
||
967 | test eax,eax |
||
968 | jz finish ;memory_get_error |
||
969 | |||
970 | mov [fileinfo.return],eax |
||
971 | mov [image_file],eax |
||
972 | |||
973 | mcall 70,fileinfo |
||
974 | test eax,eax |
||
975 | jnz .error |
||
976 | ret |
||
977 | .error: |
||
978 | ; mov [N_error],2 |
||
979 | ; mov [error_type],eax |
||
980 | jmp finish |
||
981 | ;--------------------------------------------------------------------- |
||
982 | copy_file_path: |
||
983 | xor eax,eax |
||
984 | cld |
||
985 | @@: |
||
986 | lodsb |
||
987 | stosb |
||
988 | test eax,eax |
||
989 | jnz @b |
||
990 | mov esi,edi |
||
991 | dec esi |
||
992 | std |
||
993 | @@: |
||
994 | lodsb |
||
995 | cmp al,'/' |
||
996 | jnz @b |
||
997 | mov edi,esi |
||
998 | add edi,2 |
||
999 | mov esi,ebx |
||
1000 | cld |
||
1001 | @@: |
||
1002 | lodsb |
||
1003 | stosb |
||
1004 | test eax,eax |
||
1005 | jnz @b |
||
1006 | ret |
||
1007 | ;--------------------------------------------------------------------- |
||
1008 | convert_icons: |
||
1009 | xor eax,eax |
||
1010 | mov [return_code],eax |
||
1011 | mov eax,image_file |
||
1012 | call [cnv_png_import.Start] |
||
1013 | |||
1014 | mov ecx,[image_file] |
||
1015 | mcall 68,13, |
||
1016 | test eax,eax |
||
1017 | jz finish ;memory_free_error |
||
1018 | |||
1019 | cmp [return_code],dword 0 |
||
1020 | ; je @f |
||
1021 | ; mov [N_error],6 |
||
1022 | ; jmp button.exit |
||
1023 | ;@@: |
||
1024 | jne finish |
||
1025 | |||
1026 | mcall 68,20,ICON_SIZE_X*ICON_SIZE_Y*4*8+44,[raw_pointer] |
||
1027 | mov [raw_pointer],eax |
||
1028 | |||
1029 | mov ebx,[raw_pointer] |
||
1030 | ; set RAW area for icon |
||
1031 | mov eax,[ebx+28] |
||
1032 | add eax,ebx |
||
1033 | mov edi,eax |
||
1034 | mov esi,eax |
||
1035 | add esi,ICON_SIZE_X*ICON_SIZE_Y*8*3-1 |
||
1036 | add edi,ICON_SIZE_X*ICON_SIZE_Y*8*4-4 |
||
1037 | |||
1038 | ; add eax,TEX_SIZE |
||
1039 | mov [wall0],eax |
||
1040 | add eax,TEX_SIZE |
||
1041 | mov [wall1],eax |
||
1042 | add eax,TEX_SIZE |
||
1043 | mov [wall2],eax |
||
1044 | add eax,TEX_SIZE |
||
1045 | mov [wall3],eax |
||
1046 | add eax,TEX_SIZE |
||
1047 | mov [wall4],eax |
||
1048 | add eax,TEX_SIZE |
||
1049 | mov [wall5],eax |
||
1050 | add eax,TEX_SIZE |
||
1051 | mov [wall6],eax |
||
1052 | add eax,TEX_SIZE |
||
1053 | mov [wall7],eax |
||
1054 | add eax,TEX_SIZE |
||
1055 | ; conversion 24b to 32 b |
||
1056 | mov ecx,ICON_SIZE_X*ICON_SIZE_Y*8 |
||
1057 | std |
||
1058 | @@: |
||
1059 | xor eax,eax |
||
1060 | lodsb |
||
1061 | rol eax,8 |
||
1062 | lodsb |
||
1063 | rol eax,8 |
||
1064 | lodsb |
||
1065 | ; ror eax,16 |
||
1066 | stosd |
||
1067 | dec ecx |
||
1068 | jnz @b |
||
1069 | cld |
||
1070 | ret |
||
1071 | ;--------------------------------------------------------------------- |
||
1072 | ; DATA AREA |
||
1073 | ;ceil=ceil |
||
1074 | ;wall=wall floor |
||
1075 | ;2 corner stone |
||
1076 | ;3 leaf mosaic |
||
1077 | ;4 closed window |
||
1078 | ;5 greek mosaic |
||
1079 | ;6 old street stones |
||
1080 | ;7 maya wall |
||
1081 | ;--------------------------------------------------------------------- |
||
1082 | align 4 |
||
1083 | grid: ; 32*32 Blocks, Map: 0 = Air, 1 to 8 = Wall |
||
1084 | db 2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 |
||
1085 | db 1,0,0,0,1,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8 |
||
1086 | db 5,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 |
||
1087 | db 1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,3,3,3,3,0,0,0,0,0,0,8 |
||
1088 | db 5,0,1,2,3,4,5,6,7,8,2,1,3,3,3,0,5,0,2,1,2,3,0,0,0,0,0,0,0,0,0,8 |
||
1089 | db 1,0,0,0,0,0,0,0,0,0,2,3,0,0,0,0,5,0,0,0,0,3,0,0,0,0,0,0,0,0,0,8 |
||
1090 | db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,5,0,0,0,0,3,3,0,3,3,0,0,0,0,0,8 |
||
1091 | db 1,1,0,1,1,1,1,4,1,0,1,3,0,0,0,0,5,2,1,2,0,3,0,0,0,3,0,0,0,0,0,8 |
||
1092 | db 5,0,0,0,1,0,0,0,0,0,0,1,0,3,3,3,5,0,0,0,0,3,0,0,0,3,0,0,0,0,0,8 |
||
1093 | db 1,0,0,0,1,0,0,5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,3,0,0,0,0,0,8 |
||
1094 | db 5,0,0,0,0,0,0,5,0,0,0,1,0,0,0,0,5,0,0,0,0,3,0,0,0,0,0,0,0,0,0,8 |
||
1095 | db 1,4,4,4,4,4,4,4,4,4,4,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,8,8 |
||
1096 | db 2,2,2,2,2,2,8,8,8,8,8,8,8,8,8,0,0,0,6,6,0,7,7,7,7,7,7,7,7,7,8,8 |
||
1097 | db 1,0,0,0,1,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1 |
||
1098 | db 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,2,2,2,2,0,0,0,0,3,3,3,3,3,1 |
||
1099 | db 1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,6,0,0,0,0,2,0,0,0,0,3,0,0,0,0,1 |
||
1100 | db 5,0,2,3,2,3,2,3,2,3,2,1,0,0,0,0,6,0,2,2,0,2,0,0,0,0,3,0,5,5,0,1 |
||
1101 | db 1,0,0,0,0,0,0,4,0,0,0,3,0,0,0,0,6,0,0,2,0,2,0,2,0,0,3,0,0,0,0,1 |
||
1102 | db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,6,0,0,2,2,2,0,2,0,0,3,3,3,3,0,1 |
||
1103 | db 1,1,0,1,1,1,1,4,1,0,1,3,7,7,7,0,6,0,0,0,0,0,0,2,0,0,0,0,0,3,0,1 |
||
1104 | db 5,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,6,0,0,0,0,2,2,2,0,0,0,0,0,3,0,1 |
||
1105 | db 1,0,0,0,1,0,0,5,0,0,0,3,0,0,0,0,6,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1 |
||
1106 | db 5,0,0,0,0,0,0,5,0,0,0,1,0,0,0,0,6,0,5,1,0,2,0,0,4,4,0,4,4,0,0,1 |
||
1107 | db 1,4,1,4,1,4,1,4,1,4,1,3,0,0,0,0,6,0,0,5,0,2,0,0,0,4,0,4,0,0,0,1 |
||
1108 | db 1,0,0,0,0,0,0,4,0,0,0,3,0,3,3,3,6,0,0,1,0,1,0,0,4,4,0,4,4,0,0,1 |
||
1109 | db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,6,0,0,5,0,1,0,4,4,0,0,0,4,4,0,1 |
||
1110 | db 1,1,0,1,1,1,1,4,1,0,1,3,0,0,0,0,6,0,0,1,0,1,0,4,0,0,0,0,0,4,0,1 |
||
1111 | db 5,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,6,0,0,5,0,1,0,4,0,0,0,0,0,4,0,1 |
||
1112 | db 1,0,0,0,1,0,0,5,0,0,0,3,0,0,0,0,6,1,5,1,0,1,0,4,4,0,0,0,4,4,0,1 |
||
1113 | db 5,0,0,0,0,0,0,5,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,4,4,4,4,4,0,0,1 |
||
1114 | db 1,4,1,4,1,4,1,4,1,4,1,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1 |
||
1115 | db 2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 |
||
1116 | ;--------------------------------------------------------------------- |
||
1117 | vpx: |
||
1118 | dd 0x0001FFFF ; initial player position * 0xFFFF |
||
1119 | vpy: |
||
1120 | dd 0x0001FFFF |
||
1121 | |||
1122 | title db 'Free3D v0.5 - fisheye raycasting engine etc.',0 |
||
1123 | |||
1124 | sindegree dd 0.0 |
||
1125 | sininc dd 0.0017453292519943295769236907684886 |
||
1126 | sindiv dd 6553.5 |
||
1127 | ;textures: |
||
1128 | ;file 'texture.gif' |
||
1129 | ;--------------------------------------------------------------------- |
||
1130 | align 4 |
||
1131 | fileinfo: |
||
1132 | .subfunction dd 5 |
||
1133 | .Offset dd 0 |
||
1134 | .Offset_1 dd 0 |
||
1135 | .size dd 0 |
||
1136 | .return dd file_info |
||
1137 | db 0 |
||
1138 | .name: dd file_name |
||
1139 | ;--------------------------------------------------------------------- |
||
1140 | icons_file_name db 'texture_24b.png',0 |
||
1141 | ;--------------------------------------------------------------------- |
||
1142 | plugins_directory db 0 |
||
1143 | |||
1144 | system_dir_Boxlib db '/sys/lib/box_lib.obj',0 |
||
1145 | system_dir_CnvPNG db '/sys/lib/cnv_png.obj',0 |
||
1146 | system_dir_Sort db '/sys/lib/sort.obj',0 |
||
1147 | system_dir_UNPACK db '/sys/lib/archiver.obj',0 |
||
1148 | |||
1149 | ihead_f_i: |
||
1150 | ihead_f_l db 'System error',0 |
||
1151 | |||
1152 | er_message_found_lib1 db 'cnv_png.obj - Not found!',0 |
||
1153 | er_message_import1 db 'cnv_png.obj - Wrong import!',0 |
||
1154 | |||
1155 | err_message_found_lib2 db 'archiver.obj - Not found!',0 |
||
1156 | err_message_import2 db 'archiver.obj - Wrong import!',0 |
||
1157 | |||
1158 | |||
1159 | align 4 |
||
1160 | l_libs_start: |
||
1161 | library01 l_libs system_dir_CnvPNG+9,path,file_name,system_dir_CnvPNG,\ |
||
1162 | er_message_found_lib1,ihead_f_l,cnv_png_import,er_message_import1,ihead_f_i,plugins_directory |
||
1163 | |||
1164 | library02 l_libs system_dir_UNPACK+9,path,file_name,system_dir_UNPACK,\ |
||
1165 | err_message_found_lib2,ihead_f_l,UNPACK_import,err_message_import2,ihead_f_i,plugins_directory |
||
1166 | |||
1167 | end_l_libs: |
||
1168 | ;--------------------------------------------------------------------- |
||
1169 | align 4 |
||
1170 | cnv_png_import: |
||
1171 | .Start dd aCP_Start |
||
1172 | .Version dd aCP_Version |
||
1173 | .Check dd aCP_Check |
||
1174 | .Assoc dd aCP_Assoc |
||
1175 | dd 0 |
||
1176 | dd 0 |
||
1177 | aCP_Start db 'START',0 |
||
1178 | aCP_Version db 'version',0 |
||
1179 | aCP_Check db 'Check_Header',0 |
||
1180 | aCP_Assoc db 'Associations',0 |
||
1181 | ;--------------------------------------------------------------------- |
||
1182 | align 4 |
||
1183 | UNPACK_import: |
||
1184 | ;unpack_Version dd aUnpack_Version |
||
1185 | ;unpack_PluginLoad dd aUnpack_PluginLoad |
||
1186 | ;unpack_OpenFilePlugin dd aUnpack_OpenFilePlugin |
||
1187 | ;unpack_ClosePlugin dd aUnpack_ClosePlugin |
||
1188 | ;unpack_ReadFolder dd aUnpack_ReadFolder |
||
1189 | ;unpack_SetFolder dd aUnpack_SetFolder |
||
1190 | ;unpack_GetFiles dd aUnpack_GetFiles |
||
1191 | ;unpack_GetOpenPluginInfo dd aUnpack_GetOpenPluginInfo |
||
1192 | ;unpack_Getattr dd aUnpack_Getattr |
||
1193 | ;unpack_Open dd aUnpack_Open |
||
1194 | ;unpack_Read dd aUnpack_Read |
||
1195 | ;unpack_Setpos dd aUnpack_Setpos |
||
1196 | ;unpack_Close dd aUnpack_Close |
||
1197 | ;unpack_DeflateUnpack dd aUnpack_DeflateUnpack |
||
1198 | unpack_DeflateUnpack2 dd aUnpack_DeflateUnpack2 |
||
1199 | dd 0 |
||
1200 | dd 0 |
||
1201 | |||
1202 | ;aUnpack_Version db 'version',0 |
||
1203 | ;aUnpack_PluginLoad db 'plugin_load',0 |
||
1204 | ;aUnpack_OpenFilePlugin db 'OpenFilePlugin',0 |
||
1205 | ;aUnpack_ClosePlugin db 'ClosePlugin',0 |
||
1206 | ;aUnpack_ReadFolder db 'ReadFolder',0 |
||
1207 | ;aUnpack_SetFolder db 'SetFolder',0 |
||
1208 | ;aUnpack_GetFiles db 'GetFiles',0 |
||
1209 | ;aUnpack_GetOpenPluginInfo db 'GetOpenPluginInfo',0 |
||
1210 | ;aUnpack_Getattr db 'getattr',0 |
||
1211 | ;aUnpack_Open db 'open',0 |
||
1212 | ;aUnpack_Read db 'read',0 |
||
1213 | ;aUnpack_Setpos db 'setpos',0 |
||
1214 | ;aUnpack_Close db 'close',0 |
||
1215 | ;aUnpack_DeflateUnpack db 'deflate_unpack',0 |
||
1216 | aUnpack_DeflateUnpack2 db 'deflate_unpack2',0 |
||
1217 | |||
1218 | ;--------------------------------------------------------------------- |
||
1219 | IM_END: |
||
1220 | ;--------------------------------------------------------------------- |
||
1221 | ; not change this section!!! |
||
1222 | ; start section |
||
1223 | ;--------------------------------------------------------------------- |
||
1224 | align 4 |
||
1225 | image_file rd 1 |
||
1226 | raw_pointer rd 1 |
||
1227 | return_code rd 1 |
||
1228 | img_size rd 1 |
||
1229 | deflate_unpack rd 1 |
||
1230 | raw_pointer_2 rd 1 ;+20 |
||
1231 | ;--------------------------------------------------------------------- |
||
1232 | ; end section |
||
1233 | ;--------------------------------------------------------------------- |
||
1234 | align 4 |
||
1235 | ;--------------------------------------------------------------------- |
||
1236 | wall0 rd 1 |
||
1237 | wall1 rd 1 |
||
1238 | wall2 rd 1 |
||
1239 | wall3 rd 1 |
||
1240 | wall4 rd 1 |
||
1241 | wall5 rd 1 |
||
1242 | wall6 rd 1 |
||
1243 | wall7 rd 1 |
||
1244 | ;screen_buffer rd 1 |
||
1245 | ;--------------------------------------------------------------------- |
||
1246 | align 4 |
||
1247 | col1: |
||
1248 | dd ? ;- |
||
1249 | ; misc raycaster vars: |
||
1250 | vxx: |
||
1251 | dd ? ;- |
||
1252 | vyy: |
||
1253 | dd ? ;- |
||
1254 | vl: |
||
1255 | dd ? ;- |
||
1256 | vstepx: |
||
1257 | dd ? ;- |
||
1258 | vstepy: |
||
1259 | dd ? ;- |
||
1260 | vxxint: |
||
1261 | dd ? ;- |
||
1262 | vyyint: |
||
1263 | dd ? ;- |
||
1264 | vk: |
||
1265 | dd ? ;- |
||
1266 | va: |
||
1267 | dd ? ;- |
||
1268 | va2: |
||
1269 | dd ? ;- |
||
1270 | vdd: |
||
1271 | dd ? ;- |
||
1272 | vx1: |
||
1273 | dd ? ;- |
||
1274 | vx1b: |
||
1275 | dd ? ;- |
||
1276 | vh: |
||
1277 | dd ? ;- |
||
1278 | vdt: |
||
1279 | dd ? ;- |
||
1280 | vheading: ; initial heading: 0 to 3599 |
||
1281 | dd ? ;- |
||
1282 | vacompare: |
||
1283 | dd ? ;- |
||
1284 | vpxi: |
||
1285 | dd ? ;- |
||
1286 | vpyi: |
||
1287 | dd ? ;- |
||
1288 | wtolong: |
||
1289 | dw ?,? ;-,?;- |
||
1290 | |||
1291 | xtemp: |
||
1292 | dd ? ;- |
||
1293 | ytemp: |
||
1294 | dd ? ;- |
||
1295 | xfrac: |
||
1296 | dd ? ;- |
||
1297 | yfrac: |
||
1298 | dd ? ;- |
||
1299 | h_old: |
||
1300 | dd ? ;- |
||
1301 | vbottom: |
||
1302 | dd ? ;- |
||
1303 | mouseya: |
||
1304 | dd ? ;- |
||
1305 | remeax: |
||
1306 | dd ? ;- |
||
1307 | remebx: |
||
1308 | dd ? ;- |
||
1309 | remecx: |
||
1310 | dd ? ;- |
||
1311 | remedx: |
||
1312 | dd ? ;- |
||
1313 | remedi: |
||
1314 | dd ? ;- |
||
1315 | remesi: |
||
1316 | dd ? ;- |
||
1317 | red: |
||
1318 | dd ? ;- |
||
1319 | green: |
||
1320 | dd ? ;- |
||
1321 | blue: |
||
1322 | dd ? ;- |
||
1323 | pseudo: |
||
1324 | dd ? ;- |
||
1325 | step1: |
||
1326 | dd ? ;- |
||
1327 | ;step64: |
||
1328 | ; dd ? ;- |
||
1329 | lasty: |
||
1330 | dd ? ;- |
||
1331 | ;--------------------------------------------------------------------- |
||
1332 | ;I_END: |
||
1333 | IncludeUGlobals |
||
1334 | align 4 |
||
1335 | sinus rd 360*10 |
||
1336 | eosinus: |
||
1337 | ; rd 16*1024*4 |
||
1338 | ;--------------------------------------------------------------------- |
||
1339 | align 4 |
||
1340 | rb 1024 |
||
1341 | stacktop: |
||
1342 | ;--------------------------------------------------------------------- |
||
1343 | path: |
||
1344 | rb 4096 |
||
1345 | ;--------------------------------------------------------------------- |
||
1346 | file_name: |
||
1347 | rb 4096 |
||
1348 | ;--------------------------------------------------------------------- |
||
1349 | file_info: |
||
1350 | rb 40 |
||
1351 | ;--------------------------------------------------------------------- |
||
1352 | screen_buffer: |
||
1353 | rb 640*480*3 *3/2 |
||
1354 | ;--------------------------------------------------------------------- |
||
1355 | I_END: |
||
1356 | ;---------------------------------------------------------------------640,480>50,506>50,649> |