1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-15 13:17:13 +00:00

basic raycaster implementation

This commit is contained in:
Zeno Rogue
2019-10-22 00:37:57 +02:00
parent 315e93a76a
commit edbbb51135
3 changed files with 357 additions and 2 deletions

View File

@@ -6065,6 +6065,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
color_t dummy;
int ofs = wall_offset(c);
if(isWall3(c, wcol)) {
if(!use_raycasting) {
color_t wcol2 = wcol;
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol);
@@ -6115,9 +6116,9 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
queuepoly(V, cgi.shPlainWall3D[ofs + a], darkena(wcol2 - d * get_darkval(c, a), 0, 0xFF));
}
}
}
} }
else {
for(int a=0; a<c->type; a++) if(c->move(a)) {
if(!use_raycasting) for(int a=0; a<c->type; a++) if(c->move(a)) {
color_t t = transcolor(c, c->move(a), wcol);
if(t) {
t = t - get_darkval(c, a) * ((t & 0xF0F0F000) >> 4);
@@ -7345,6 +7346,8 @@ EX void precise_mouseover() {
EX transmatrix Viewbase;
EX bool use_raycasting;
EX void drawthemap() {
check_cgi();
cgi.require_shapes();
@@ -7398,6 +7401,10 @@ EX void drawthemap() {
for(int m=0; m<motypes; m++) if(isPrincess(eMonster(m)))
minf[m].name = princessgender() ? "Princess" : "Prince";
use_raycasting = false;
if(hyperbolic && pmodel == mdPerspective && !binarytiling)
use_raycasting = true;
iinf[itSavedPrincess].name = minf[moPrincess].name;
@@ -7438,6 +7445,7 @@ EX void drawthemap() {
profile_start(1);
make_actual_view();
currentmap->draw();
if(use_raycasting) do_raycast();
drawWormSegments();
drawBlizzards();
drawArrowTraps();