1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

ray:: fixed for nil with nilwidth changed

This commit is contained in:
Zeno Rogue 2021-03-21 11:29:20 +01:00
parent 0f081fb1ab
commit ee1837e3d8

View File

@ -1031,6 +1031,9 @@ void enable_raycaster() {
fmain += fmain +=
"if(next >= minstep) {\n"; "if(next >= minstep) {\n";
string hnilw = to_glsl(nilv::nilwidth / 2);
string hnilw2 = to_glsl(nilv::nilwidth * nilv::nilwidth / 2);
if(reg) fmain += "if(which != -1) {\n"; if(reg) fmain += "if(which != -1) {\n";
else if(asonov) fmain += else if(asonov) fmain +=
"if(abs(sp.x) > 1. || abs(sp.y) > 1. || abs(sp.z) > 1.) {\n"; "if(abs(sp.x) > 1. || abs(sp.y) > 1. || abs(sp.z) > 1.) {\n";
@ -1039,7 +1042,7 @@ void enable_raycaster() {
else if(sol) fmain += else if(sol) fmain +=
"if(abs(nposition.x) > uBinaryWidth || abs(nposition.y) > uBinaryWidth || abs(nposition.z) > log(2.)/2.) {\n"; "if(abs(nposition.x) > uBinaryWidth || abs(nposition.y) > uBinaryWidth || abs(nposition.z) > log(2.)/2.) {\n";
else fmain += else fmain +=
"if(abs(nposition.x) > .5 || abs(nposition.y) > .5 || abs(rz) > .5) {\n"; "if(abs(nposition.x) > "+hnilw+" || abs(nposition.y) > "+hnilw+" || abs(rz) > "+hnilw2+") {\n";
fmain += fmain +=
"next = dist / 2.; continue;\n" "next = dist / 2.; continue;\n"
@ -1089,12 +1092,12 @@ void enable_raycaster() {
"if(nposition.z <-log(2.)/2.) which = nposition.y > 0. ? 7 : 6;\n"; "if(nposition.z <-log(2.)/2.) which = nposition.y > 0. ? 7 : 6;\n";
} }
else if(nil) fmain += else if(nil) fmain +=
"if(nposition.x > .5) which = 3;\n" "if(nposition.x > "+hnilw+") which = 3;\n"
"if(nposition.x <-.5) which = 0;\n" "if(nposition.x <-"+hnilw+") which = 0;\n"
"if(nposition.y > .5) which = 4;\n" "if(nposition.y > "+hnilw+") which = 4;\n"
"if(nposition.y <-.5) which = 1;\n" "if(nposition.y <-"+hnilw+") which = 1;\n"
"if(rz > .5) which = 5;\n" "if(rz > "+hnilw2+") which = 5;\n"
"if(rz <-.5) which = 2;\n"; "if(rz <-"+hnilw2+") which = 2;\n";
fmain += fmain +=
"next = maxstep;\n" "next = maxstep;\n"