2D3D:: Hall of Mirrors

This commit is contained in:
Zeno Rogue 2019-05-09 21:53:00 +02:00
parent f652e6139c
commit 55d7678c99
3 changed files with 30 additions and 7 deletions

View File

@ -92,11 +92,11 @@ void add_prism(ld z0, vector<hyperpoint> vh0, ld z1, vector<hyperpoint> vh1) {
}
void shift_last(ld z) {
for(int i=last->s; i<isize(hpc); i++) hpc[i] = cpush(2, z) * hpc[i];
for(int i=last->s; i<isize(hpc); i++) hpc[i] = zshift(hpc[i], z);
}
void shift_shape(hpcshape& sh, ld z) {
for(int i=sh.s; i<sh.e; i++) hpc[i] = cpush(2, z) * hpc[i];
for(int i=sh.s; i<sh.e; i++) hpc[i] = zshift(hpc[i], z);
}
extern
@ -865,6 +865,11 @@ void make_3d_models() {
make_ball(shDisk, orbsize*.2, 2);
make_ball(shHeptaMarker, zhexf*.2, 1);
make_ball(shSnowball, zhexf*.1, 0);
if(WDIM == 2) {
for(int i=0; i<3; i++)
shift_shape(shHalfFloor[i], geom3::lev_to_factor(geom3::human_height * .01));
}
}
#undef S

View File

@ -19,7 +19,7 @@ int detaillevel = 0;
bool first_cell_to_draw = true;
bool hide_player() {
return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && pmodel == mdPerspective && first_cell_to_draw && (WDIM == 3 || geom3::camera == 0);
return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && pmodel == mdPerspective && first_cell_to_draw && (WDIM == 3 || geom3::camera == 0) && !inmirrorcount;
}
hookset<bool(int sym, int uni)> *hooks_handleKey;
@ -4556,7 +4556,11 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
queuepolyat(V2 * spin(d*M_PI/S3), shHalfFloor[2], darkena(fcol, fd, 0xFF), PPR::FLOORa);
inmirrorcount-=d;
}
if(wmspatial) {
if(GDIM == 3) {
for(int d=0; d<6; d++)
queuepolyat(V2 * spin(d*M_PI/S3), shHalfMirror[2], 0xC0C0C080, PPR::TRANSPARENT).subprio = 3 * c->cpdist + c->move(d)->cpdist;
}
else if(wmspatial) {
const int layers = 2 << detaillevel;
for(int z=1; z<layers; z++)
queuepolyat(mscale(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), shHalfMirror[2], 0xC0C0C080, PPR::WALL3+z-layers);
@ -4574,7 +4578,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
queuepolyat(mirrorif(V2, onleft), shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR::FLOORa);
}
if(wmspatial) {
if(GDIM == 3) {
queuepolyat(V2, shHalfMirror[ct6], 0xC0C0C080, PPR::TRANSPARENT).subprio = 3 * c->cpdist + c->move(d)->cpdist;
}
else if(wmspatial) {
const int layers = 2 << detaillevel;
for(int z=1; z<layers; z++)
queuepolyat(mscale(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), shHalfMirror[ct6], 0xC0C0C080, PPR::WALL3+z-layers);
@ -4936,7 +4943,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
int fd0 = fd ? fd-1 : 0;
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd0, 0x80), PPR::TRANSPARENT);
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd0, 0x80), PPR::TRANSPARENT), ptds.back()->subprio = c->cpdist * 4;
else
draw_qfi(c, (*Vdp), darkena(fcol, fd0, 0x80), PPR::LAKELEV);
}

View File

@ -2758,7 +2758,18 @@ void buildpolys() {
bshape(shHalfFloor[2], PPR::FLOOR, scalefactor, 331);
bshape(shHalfMirror[0], PPR::WALL, scalefactor, 330);
bshape(shHalfMirror[1], PPR::WALL, scalefactor, 328);
bshape(shHalfMirror[2], PPR::WALL, scalefactor, 332);
if(GDIM == 2) {
bshape(shHalfMirror[2], PPR::WALL, scalefactor, 332);
}
else {
bshape(shHalfMirror[2], PPR::WALL);
hpcpush(hpxy(-0.016778,0)); hpcpush(hpxy(-0.261607,0)); chasmifyPoly(geom3::FLOOR, geom3::WALL, 0);
bshape(shHalfMirror[1], PPR::WALL);
hpcpush(hpxy(-0.315398,0)); hpcpush(hpxy(+0.568278,0)); chasmifyPoly(geom3::FLOOR, geom3::WALL, 0);
bshape(shHalfMirror[0], PPR::WALL);
hpcpush(hpxy(+0.262597,0)); hpcpush(hpxy(-0.261563,0)); chasmifyPoly(geom3::FLOOR, geom3::WALL, 0);
}
bshape(shAsymmetric, PPR::TEXT, scalefactor, 374);