free3d04 1) fixed I_END 2)small arithmetic optimization

git-svn-id: svn://kolibrios.org@272 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-01-13 06:40:41 +00:00
parent b9300edb72
commit 0cb93396cf

View File

@ -149,14 +149,16 @@ s_up: ; walk forward (key or mouse)
mov ecx,[vheading]
imul ecx,4
add ecx,sinus
; imul ecx,4
; add ecx,sinus
lea ecx, [sinus+ecx*4]
mov edi,[ecx]
mov edx,[vheading]
imul edx,4
add edx,sinus
add edx,3600
; imul edx,4
; add edx,sinus
; add edx,3600
lea edx, [sinus+3600+edx*4]
cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600
jb ok200
sub edx,14400
@ -173,8 +175,9 @@ s_up: ; walk forward (key or mouse)
sar esi,16
mov ecx,esi
sal ecx,5 ; equal *32
add ecx,edi
add ecx,grid
; add ecx,edi
; add ecx,grid
lea ecx, [grid+ecx+edi]
cmp [ecx],byte 0 ; collision check
jne cannotwalk0
mov [vpx],eax
@ -188,14 +191,16 @@ s_down: ; walk backward
mov ebx,[vpy]
mov ecx,[vheading]
imul ecx,4
add ecx,sinus
; imul ecx,4
; add ecx,sinus
lea ecx, [sinus+ecx*4]
mov edi,[ecx]
mov edx,[vheading]
imul edx,4
add edx,sinus
add edx,3600
; imul edx,4
; add edx,sinus
; add edx,3600
lea edx, [sinus+3600+edx*4]
cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600
jb ok201
sub edx,14400
@ -213,8 +218,9 @@ s_down: ; walk backward
sar esi,16
mov ecx,esi
sal ecx,5
add ecx,edi
add ecx,grid
; add ecx,edi
; add ecx,grid
lea ecx, [grid+ecx+edi]
cmp [ecx],byte 0
jne cannotwalk1
mov [vpx],eax
@ -363,17 +369,19 @@ ok1:
ok2:
; get stepx and stepy
mov ecx,edx
imul ecx,4
add ecx,sinus ; pointer to stepx
; mov ecx,edx
; imul ecx,4
; add ecx,sinus ; pointer to stepx
lea ecx, [sinus+edx*4]
mov esi,[ecx]
sar esi,4 ; accuracy
mov [vstepx],esi ; store stepx
mov esi,edx
imul esi,4
add esi,sinus ; pointer to stepy
add esi,3600
; mov esi,edx
; imul esi,4
; add esi,sinus ; pointer to stepy
; add esi,3600
lea esi, [sinus+3600+edx*4]
cmp esi,eosinus ;cosinus taken from ((sinus plus 900) mod 3600)
jb ok202
sub esi,14400
@ -459,8 +467,10 @@ nodouble:
sal edi,8
mov esi,[xfrac]
sal esi,2
add edi,esi
add edi,wall ; in fact its floor, just using the wall texture :)
; add edi,esi
; add edi,wall ; in fact its floor, just using the wall texture :)
lea edi, [wall+edi+esi]
mov edx,[edi]
mov [remesi],esi
@ -468,10 +478,13 @@ nodouble:
mov esi,[ytemp]
add esi,240
imul esi,1920
add esi,[vx1]
add esi,[vx1]
add esi,[vx1]
add esi,0x80000
; add esi,[vx1]
; add esi,[vx1]
; add esi,[vx1]
; add esi,0x80000
mov eax, [vx1]
lea eax, [eax+eax*2]
lea esi, [0x80000+eax+esi]
cmp esi,0x80000+1920*480
jg foff0
@ -588,8 +601,10 @@ no_nu_pixel:
mov edx,ebx
; imul edx,32
shl edx,5
add edx,grid
add edx,eax
; add edx,grid
; add edx,eax
lea edx, [grid+edx+eax]
cmp [edx],byte 0 ; raycaster reached a wall? (0=no)
jne getout
cmp edi,10000 ; limit view range
@ -612,14 +627,18 @@ copyfloor:
sub eax,1920
add ebx,1920
mov ecx,0
add ecx,[vx1]
add ecx,[vx1]
add ecx,[vx1]
; mov ecx,0
; add ecx,[vx1]
; add ecx,[vx1]
; add ecx,[vx1]
mov ecx, [vx1]
lea ecx, [ecx+ecx*2]
mov edx,ecx
; mov edx,ecx
; add ecx,eax
; add edx,ebx
lea edx, [ecx+ebx]
add ecx,eax
add edx,ebx
mov esi,[edx]
mov [ecx],esi
@ -673,7 +692,8 @@ copyfloor:
xor edx,edx
mov eax, edi
mov ebx,[vdd]
add ebx,[vdd]
; add ebx,[vdd]
add ebx, ebx
div ebx
and eax,63
mov [ytemp],eax ; get y of texture for wall
@ -763,12 +783,16 @@ east:
; ******* DRAW WALL PIXEL *******
mov eax,esi
sub eax,22
; sub eax,22
lea eax, [esi-22]
imul eax,1920
add eax,[vx1]
add eax,[vx1]
add eax,[vx1]
add eax,0x80000
; add eax,[vx1]
; add eax,[vx1]
; add eax,[vx1]
; add eax,0x80000
mov ebx, [vx1]
lea ebx, [ebx+ebx*2]
lea eax, [eax+0x80000+ebx]
cmp eax,0x80000+1920*480
jg dont_draw
@ -814,10 +838,14 @@ mov eax,0x080000+360*1920
copyfloor2:
add eax,1920
mov ebx,eax
add ebx,[vx1]
add ebx,[vx1]
add ebx,[vx1]
; mov ebx,eax
; add ebx,[vx1]
; add ebx,[vx1]
; add ebx,[vx1]
mov ebx,[vx1]
lea ebx, [ebx+ebx*2]
add ebx, eax
mov ecx,[ebx-15]
and ecx,0x00FEFEFE
@ -988,7 +1016,8 @@ sininc dd 0.0017453292519943295769236907684886
sindiv dd 6553.5
textures:
file 'texture.gif'
I_END:
align 4
col1:
dd ?;-
@ -1075,5 +1104,6 @@ step64:
lasty:
dd ?;-
I_END:
sinus rd 360*10
eosinus: