simplify
This not work
output:
Code: Select all
C:\Users\ACER>set /A ray[-32]=4
Operatore mancante.
Extracted of complete code:
Code: Select all
:raypacket
rem stack calls
set /A c=0 & :: empty stack
rem push(calls, (from, to))
set /A c+=1
set calls[%c%].1=!from!
set calls[%c%].2=!to!
set Break=
rem 65=Field of View 0..64
rem simulate while not empty(calls) do
echo qui0
For /L %%N in (0,1,64) do if not defined Break (
rem (from, to) = pop(calls)
set /A from=calls[!c!].1, to=calls[!c!].2, c-=1
rem if from = to then raytraverse(from) //simple problem
if !from! equ !to! (
echo qui1
rem TODO check if already traverse
set /A "Z=from, aStepY=%SIN(x):x=Z * 31416 / 180%, aStepX=%SIN(x):x=15708-(Z * 31416 / 180)%"
set /A "A=%Angle%, corr=%SIN(x):x=15708-(Z-A) * 31416 / 180%"
call :new_prepareDDA_raytraverse
set /A ray[!from!].dist=distance, ray[!from!].side=side, ray[!from!].C=$B
) else (
echo qui2
set /A diff=from-to
if !diff! equ 1 (
echo qui3
rem TODO check if already traverse
set /A "Z=from, aStepY=%SIN(x):x=Z * 31416 / 180%, aStepX=%SIN(x):x=15708-(Z * 31416 / 180)%"
set /A "A=%Angle%, corr=%SIN(x):x=15708-(Z-A) * 31416 / 180%"
call :new_prepareDDA_raytraverse
set /A ray[!from!].dist=distance, ray[!from!].side=side, ray[!from!].C=$B
set from+=1
rem TODO check if already traverse
set /A "Z=from, aStepY=%SIN(x):x=Z * 31416 / 180%, aStepX=%SIN(x):x=15708-(Z * 31416 / 180)%"
set /A "A=%Angle%, corr=%SIN(x):x=15708-(Z-A) * 31416 / 180%"
call :new_prepareDDA_raytraverse
set /A ray[!from!].dist=distance, ray[!from!].side=side, ray[!from!].C=$B
) else (
echo qui4
rem destination1=raytraverse(from)
rem TODO check if already traverse
set /A "Z=from, aStepY=%SIN(x):x=Z * 31416 / 180%, aStepX=%SIN(x):x=15708-(Z * 31416 / 180)%"
set /A "A=%Angle%, corr=%SIN(x):x=15708-(Z-A) * 31416 / 180%"
echo newprep
call :new_prepareDDA_raytraverse
echo set1
echo !distance! !side! !$B! !from! -
set /A ray[!from!].dist=distance, ray[!from!].side=side, ray[!from!].C=!$B!
echo setdest1
set dest1=!side! !$X! !$Y!
echo mezzo qui4
rem destination2=raytraverse(to)
rem TODO check if already traverse
set /A "Z=to, aStepY=%SIN(x):x=Z * 31416 / 180%, aStepX=%SIN(x):x=15708-(Z * 31416 / 180)%"
set /A "A=%Angle%, corr=%SIN(x):x=15708-(Z-A) * 31416 / 180%"
call :new_prepareDDA_raytraverse
set /A ray[!to!].dist=distance, ray[!to!].side=side, ray[!to!].C=$B
set dest2=!side! !$X! !$Y!
echo fine qui4
rem if destination1=destination2 then
if "!dest1!"=="!dest2!" (
echo qui5
rem linear_interpolate_distance(from,to)
rem https://en.wikipedia.org/wiki/Linear_interpolation
set /A x0=from, x1=to, y0=0
) else (
echo qui6
rem push(calls, (from+(to-from)/2+1,to))
rem push(calls, (from,from+(to-from)/2))
)
)
)
if !c! equ 0 set Break=True
)
exit /b