Rev 109 | Rev 316 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 272 | ||
---|---|---|---|
Line 147... | Line 147... | ||
147 | mov eax,[vpx] |
147 | mov eax,[vpx] |
148 | mov ebx,[vpy] |
148 | mov ebx,[vpy] |
Line 149... | Line 149... | ||
149 | 149 | ||
150 | 150 | ||
151 | mov ecx,[vheading] |
151 | mov ecx,[vheading] |
- | 152 | ; imul ecx,4 |
|
152 | imul ecx,4 |
153 | ; add ecx,sinus |
Line 153... | Line 154... | ||
153 | add ecx,sinus |
154 | lea ecx, [sinus+ecx*4] |
154 | mov edi,[ecx] |
155 | mov edi,[ecx] |
155 | 156 | ||
156 | mov edx,[vheading] |
157 | mov edx,[vheading] |
- | 158 | ; imul edx,4 |
|
157 | imul edx,4 |
159 | ; add edx,sinus |
158 | add edx,sinus |
160 | ; add edx,3600 |
159 | add edx,3600 |
161 | lea edx, [sinus+3600+edx*4] |
160 | cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 |
162 | cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 |
161 | jb ok200 |
163 | jb ok200 |
Line 171... | Line 173... | ||
171 | mov esi,ebx ; newPy / ffff |
173 | mov esi,ebx ; newPy / ffff |
172 | sar edi,16 |
174 | sar edi,16 |
173 | sar esi,16 |
175 | sar esi,16 |
174 | mov ecx,esi |
176 | mov ecx,esi |
175 | sal ecx,5 ; equal *32 |
177 | sal ecx,5 ; equal *32 |
176 | add ecx,edi |
178 | ; add ecx,edi |
177 | add ecx,grid |
179 | ; add ecx,grid |
- | 180 | lea ecx, [grid+ecx+edi] |
|
178 | cmp [ecx],byte 0 ; collision check |
181 | cmp [ecx],byte 0 ; collision check |
179 | jne cannotwalk0 |
182 | jne cannotwalk0 |
180 | mov [vpx],eax |
183 | mov [vpx],eax |
181 | mov [vpy],ebx |
184 | mov [vpy],ebx |
182 | mov [mouseya],dword 1 ; set refresh flag |
185 | mov [mouseya],dword 1 ; set refresh flag |
Line 186... | Line 189... | ||
186 | s_down: ; walk backward |
189 | s_down: ; walk backward |
187 | mov eax,[vpx] |
190 | mov eax,[vpx] |
188 | mov ebx,[vpy] |
191 | mov ebx,[vpy] |
Line 189... | Line 192... | ||
189 | 192 | ||
190 | mov ecx,[vheading] |
193 | mov ecx,[vheading] |
191 | imul ecx,4 |
194 | ; imul ecx,4 |
- | 195 | ; add ecx,sinus |
|
192 | add ecx,sinus |
196 | lea ecx, [sinus+ecx*4] |
Line 193... | Line 197... | ||
193 | mov edi,[ecx] |
197 | mov edi,[ecx] |
194 | 198 | ||
195 | mov edx,[vheading] |
199 | mov edx,[vheading] |
196 | imul edx,4 |
200 | ; imul edx,4 |
- | 201 | ; add edx,sinus |
|
197 | add edx,sinus |
202 | ; add edx,3600 |
198 | add edx,3600 |
203 | lea edx, [sinus+3600+edx*4] |
199 | cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 |
204 | cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 |
200 | jb ok201 |
205 | jb ok201 |
Line 211... | Line 216... | ||
211 | mov esi,ebx ; newPy / ffff |
216 | mov esi,ebx ; newPy / ffff |
212 | sar edi,16 |
217 | sar edi,16 |
213 | sar esi,16 |
218 | sar esi,16 |
214 | mov ecx,esi |
219 | mov ecx,esi |
215 | sal ecx,5 |
220 | sal ecx,5 |
216 | add ecx,edi |
221 | ; add ecx,edi |
217 | add ecx,grid |
222 | ; add ecx,grid |
- | 223 | lea ecx, [grid+ecx+edi] |
|
218 | cmp [ecx],byte 0 |
224 | cmp [ecx],byte 0 |
219 | jne cannotwalk1 |
225 | jne cannotwalk1 |
220 | mov [vpx],eax |
226 | mov [vpx],eax |
221 | mov [vpy],ebx |
227 | mov [vpy],ebx |
222 | mov [mouseya],dword 1 |
228 | mov [mouseya],dword 1 |
Line 361... | Line 367... | ||
361 | jb ok2 |
367 | jb ok2 |
362 | sub edx,3600 |
368 | sub edx,3600 |
363 | ok2: |
369 | ok2: |
Line 364... | Line 370... | ||
364 | 370 | ||
365 | ; get stepx and stepy |
371 | ; get stepx and stepy |
366 | mov ecx,edx |
372 | ; mov ecx,edx |
367 | imul ecx,4 |
373 | ; imul ecx,4 |
- | 374 | ; add ecx,sinus ; pointer to stepx |
|
368 | add ecx,sinus ; pointer to stepx |
375 | lea ecx, [sinus+edx*4] |
369 | mov esi,[ecx] |
376 | mov esi,[ecx] |
370 | sar esi,4 ; accuracy |
377 | sar esi,4 ; accuracy |
Line 371... | Line 378... | ||
371 | mov [vstepx],esi ; store stepx |
378 | mov [vstepx],esi ; store stepx |
372 | 379 | ||
373 | mov esi,edx |
380 | ; mov esi,edx |
374 | imul esi,4 |
381 | ; imul esi,4 |
- | 382 | ; add esi,sinus ; pointer to stepy |
|
375 | add esi,sinus ; pointer to stepy |
383 | ; add esi,3600 |
376 | add esi,3600 |
384 | lea esi, [sinus+3600+edx*4] |
377 | cmp esi,eosinus ;cosinus taken from ((sinus plus 900) mod 3600) |
385 | cmp esi,eosinus ;cosinus taken from ((sinus plus 900) mod 3600) |
378 | jb ok202 |
386 | jb ok202 |
Line 457... | Line 465... | ||
457 | 465 | ||
458 | mov edi,[yfrac] ; get pixel color of this floor pixel |
466 | mov edi,[yfrac] ; get pixel color of this floor pixel |
459 | sal edi,8 |
467 | sal edi,8 |
460 | mov esi,[xfrac] |
468 | mov esi,[xfrac] |
461 | sal esi,2 |
469 | sal esi,2 |
462 | add edi,esi |
470 | ; add edi,esi |
- | 471 | ; add edi,wall ; in fact its floor, just using the wall texture :) |
|
- | 472 | lea edi, [wall+edi+esi] |
|
463 | add edi,wall ; in fact its floor, just using the wall texture :) |
473 | |
464 | mov edx,[edi] |
474 | mov edx,[edi] |
Line 465... | Line 475... | ||
465 | mov [remesi],esi |
475 | mov [remesi],esi |
466 | 476 | ||
467 | ;**** calculate pixel adress:**** |
477 | ;**** calculate pixel adress:**** |
468 | mov esi,[ytemp] |
478 | mov esi,[ytemp] |
469 | add esi,240 |
479 | add esi,240 |
470 | imul esi,1920 |
480 | imul esi,1920 |
471 | add esi,[vx1] |
481 | ; add esi,[vx1] |
472 | add esi,[vx1] |
482 | ; add esi,[vx1] |
- | 483 | ; add esi,[vx1] |
|
- | 484 | ; add esi,0x80000 |
|
- | 485 | mov eax, [vx1] |
|
Line 473... | Line 486... | ||
473 | add esi,[vx1] |
486 | lea eax, [eax+eax*2] |
474 | add esi,0x80000 |
487 | lea esi, [0x80000+eax+esi] |
475 | 488 | ||
476 | cmp esi,0x80000+1920*480 |
489 | cmp esi,0x80000+1920*480 |
Line 586... | Line 599... | ||
586 | mov [vpyi],ebx |
599 | mov [vpyi],ebx |
Line 587... | Line 600... | ||
587 | 600 | ||
588 | mov edx,ebx |
601 | mov edx,ebx |
589 | ; imul edx,32 |
602 | ; imul edx,32 |
590 | shl edx,5 |
603 | shl edx,5 |
591 | add edx,grid |
604 | ; add edx,grid |
- | 605 | ; add edx,eax |
|
- | 606 | lea edx, [grid+edx+eax] |
|
592 | add edx,eax |
607 | |
593 | cmp [edx],byte 0 ; raycaster reached a wall? (0=no) |
608 | cmp [edx],byte 0 ; raycaster reached a wall? (0=no) |
594 | jne getout |
609 | jne getout |
595 | cmp edi,10000 ; limit view range |
610 | cmp edi,10000 ; limit view range |
596 | jb raycast |
611 | jb raycast |
Line 610... | Line 625... | ||
610 | 625 | ||
611 | copyfloor: |
626 | copyfloor: |
612 | sub eax,1920 |
627 | sub eax,1920 |
Line 613... | Line 628... | ||
613 | add ebx,1920 |
628 | add ebx,1920 |
614 | 629 | ||
615 | mov ecx,0 |
630 | ; mov ecx,0 |
616 | add ecx,[vx1] |
631 | ; add ecx,[vx1] |
- | 632 | ; add ecx,[vx1] |
|
- | 633 | ; add ecx,[vx1] |
|
617 | add ecx,[vx1] |
634 | mov ecx, [vx1] |
618 | add ecx,[vx1] |
635 | lea ecx, [ecx+ecx*2] |
- | 636 | ||
- | 637 | ; mov edx,ecx |
|
- | 638 | ; add ecx,eax |
|
619 | 639 | ; add edx,ebx |
|
620 | mov edx,ecx |
- | |
Line 621... | Line 640... | ||
621 | add ecx,eax |
640 | lea edx, [ecx+ebx] |
622 | add edx,ebx |
641 | add ecx,eax |
Line 623... | Line 642... | ||
623 | 642 | ||
Line 671... | Line 690... | ||
671 | jg speedup |
690 | jg speedup |
Line 672... | Line 691... | ||
672 | 691 | ||
673 | xor edx,edx |
692 | xor edx,edx |
674 | mov eax, edi |
693 | mov eax, edi |
675 | mov ebx,[vdd] |
694 | mov ebx,[vdd] |
- | 695 | ; add ebx,[vdd] |
|
676 | add ebx,[vdd] |
696 | add ebx, ebx |
677 | div ebx |
697 | div ebx |
678 | and eax,63 |
698 | and eax,63 |
Line 679... | Line 699... | ||
679 | mov [ytemp],eax ; get y of texture for wall |
699 | mov [ytemp],eax ; get y of texture for wall |
Line 761... | Line 781... | ||
761 | 781 | ||
Line 762... | Line 782... | ||
762 | call dark_distance ; deactivate wall distance darkening: a bit faster |
782 | call dark_distance ; deactivate wall distance darkening: a bit faster |
763 | 783 | ||
764 | ; ******* DRAW WALL PIXEL ******* |
784 | ; ******* DRAW WALL PIXEL ******* |
- | 785 | mov eax,esi |
|
765 | mov eax,esi |
786 | ; sub eax,22 |
766 | sub eax,22 |
787 | lea eax, [esi-22] |
767 | imul eax,1920 |
788 | imul eax,1920 |
768 | add eax,[vx1] |
789 | ; add eax,[vx1] |
769 | add eax,[vx1] |
790 | ; add eax,[vx1] |
- | 791 | ; add eax,[vx1] |
|
- | 792 | ; add eax,0x80000 |
|
- | 793 | mov ebx, [vx1] |
|
Line 770... | Line 794... | ||
770 | add eax,[vx1] |
794 | lea ebx, [ebx+ebx*2] |
771 | add eax,0x80000 |
795 | lea eax, [eax+0x80000+ebx] |
772 | 796 | ||
773 | cmp eax,0x80000+1920*480 |
797 | cmp eax,0x80000+1920*480 |
Line 812... | Line 836... | ||
812 | pusha |
836 | pusha |
813 | mov eax,0x080000+360*1920 |
837 | mov eax,0x080000+360*1920 |
Line 814... | Line 838... | ||
814 | 838 | ||
815 | copyfloor2: |
839 | copyfloor2: |
816 | add eax,1920 |
840 | add eax,1920 |
817 | mov ebx,eax |
841 | ; mov ebx,eax |
818 | add ebx,[vx1] |
842 | ; add ebx,[vx1] |
819 | add ebx,[vx1] |
843 | ; add ebx,[vx1] |
- | 844 | ; add ebx,[vx1] |
|
- | 845 | mov ebx,[vx1] |
|
- | 846 | lea ebx, [ebx+ebx*2] |
|
- | 847 | add ebx, eax |
|
Line 820... | Line 848... | ||
820 | add ebx,[vx1] |
848 | |
821 | 849 | ||
822 | mov ecx,[ebx-15] |
850 | mov ecx,[ebx-15] |
823 | and ecx,0x00FEFEFE |
851 | and ecx,0x00FEFEFE |
Line 986... | Line 1014... | ||
986 | sindegree dd 0.0 |
1014 | sindegree dd 0.0 |
987 | sininc dd 0.0017453292519943295769236907684886 |
1015 | sininc dd 0.0017453292519943295769236907684886 |
988 | sindiv dd 6553.5 |
1016 | sindiv dd 6553.5 |
989 | textures: |
1017 | textures: |
990 | file 'texture.gif' |
1018 | file 'texture.gif' |
- | 1019 | ||
991 | I_END: |
1020 | align 4 |
Line 992... | Line 1021... | ||
992 | 1021 | ||
993 | col1: |
1022 | col1: |
994 | dd ?;- |
1023 | dd ?;- |
995 | ; misc raycaster vars: |
1024 | ; misc raycaster vars: |
Line 1073... | Line 1102... | ||
1073 | step64: |
1102 | step64: |
1074 | dd ?;- |
1103 | dd ?;- |
1075 | lasty: |
1104 | lasty: |
1076 | dd ?;- |
1105 | dd ?;- |
Line -... | Line 1106... | ||
- | 1106 | ||
1077 | 1107 | I_END: |
|
1078 | sinus rd 360*10 |
1108 | sinus rd 360*10 |