mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 13:07:16 +00:00
improved display in Halloween
This commit is contained in:
parent
32edc68a6d
commit
0c154d6751
@ -1,5 +1,11 @@
|
||||
double randd() { return (rand() % 1000000) / 1000000. + .0000005; }
|
||||
|
||||
transmatrix cellrelmatrix(cell *c, int i) {
|
||||
double d =
|
||||
purehepta ? tessf : c->type == 6 ? hexhexdist : crossf;
|
||||
return ddspin(c, i) * xpush(d) * iddspin(c->mov[i], c->spin(i), euclid ? 0 : S42);
|
||||
}
|
||||
|
||||
hyperpoint randomPointIn(int t) {
|
||||
while(true) {
|
||||
hyperpoint h = spin(2*M_PI*(randd()-.5)/t) * tC0(xpush(asinh(randd())));
|
||||
|
35
graph.cpp
35
graph.cpp
@ -219,6 +219,11 @@ transmatrix ddspin(cell *c, int d, int bonus) {
|
||||
return getspinmatrix(hdir);
|
||||
}
|
||||
|
||||
transmatrix iddspin(cell *c, int d, int bonus = 0) {
|
||||
int hdir = displaydir(c, d) + bonus;
|
||||
return getspinmatrix(-hdir);
|
||||
}
|
||||
|
||||
void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
||||
if(!onplayer && !items[itOrbEmpathy]) return;
|
||||
if(items[itOrbShield] > (shmup::on ? 0 : ORBBASE)) drawShield(V, itOrbShield);
|
||||
@ -4056,21 +4061,25 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
bool w = isWarped(c);
|
||||
int col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
|
||||
if(!chasmg) {
|
||||
|
||||
#define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V * cellrelmatrix(c,i)) : 1), 1), fd, 0xFF)
|
||||
|
||||
if(sha & 1) {
|
||||
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
||||
placeSidewallX(c, i, SIDE_LAKE, V, w, false, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF));
|
||||
placeSidewallX(c, i, SIDE_LAKE, V, w, false, D(.8));
|
||||
}
|
||||
if(sha & 2) {
|
||||
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
||||
placeSidewallX(c, i, SIDE_LTOB, V, w, false, darkena(gradient(0, col, 0, .7, 1), fd, 0xFF));
|
||||
placeSidewallX(c, i, SIDE_LTOB, V, w, false, D(.7));
|
||||
}
|
||||
if(sha & 4) {
|
||||
bool dbot = true;
|
||||
forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) {
|
||||
if(dbot) dbot = false,
|
||||
warpfloor(c, mscale(V, geom3::BOTTOM), 0x080808FF, PPR_LAKEBOTTOM, isWarped(c));
|
||||
placeSidewallX(c, i, SIDE_BTOI, V, w, false, darkena(gradient(0, col, 0, .6, 1), fd, 0xFF));
|
||||
placeSidewallX(c, i, SIDE_BTOI, V, w, false, D(.6));
|
||||
}
|
||||
#undef D
|
||||
}
|
||||
}
|
||||
// wall between lake and chasm -- no Escher here
|
||||
@ -4081,6 +4090,26 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
}
|
||||
|
||||
if(chasmg == 2 && wmspatial && sphere) {
|
||||
forCellIdEx(c2, i, c) if(chasmgraph(c2) == 0) {
|
||||
transmatrix V2 = V * cellrelmatrix(c, i);
|
||||
if(!behindsphere(V2)) continue;
|
||||
bool w = isWarped(c2);
|
||||
int wcol2, fcol2;
|
||||
setcolors(c2, wcol2, fcol2);
|
||||
int col = (highwall(c2) || c->wall == waTower) ? wcol2 : fcol2;
|
||||
col = gradient(0, col, 0, spherity(V), 1);
|
||||
int j = c->spin(i);
|
||||
if(ticks % 500 < -250) {
|
||||
V2 = V2 * ddspin(c2, j);
|
||||
j = 0;
|
||||
}
|
||||
placeSidewall(c2, j, SIDE_LAKE, V2, w, false, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF));
|
||||
placeSidewall(c2, j, SIDE_LTOB, V2, w, false, darkena(gradient(0, col, 0, .7, 1), fd, 0xFF));
|
||||
placeSidewall(c2, j, SIDE_BTOI, V2, w, false, darkena(gradient(0, col, 0, .6, 1), fd, 0xFF));
|
||||
}
|
||||
}
|
||||
|
||||
if(chasmg == 1 && wmspatial) {
|
||||
int fd0 = fd ? fd-1 : 0;
|
||||
|
||||
|
2
hyper.h
2
hyper.h
@ -1592,3 +1592,5 @@ void showMessageLog();
|
||||
int getgametime();
|
||||
string getgametime_s(int timespent = getgametime());
|
||||
extern int stampbase;
|
||||
|
||||
transmatrix cellrelmatrix(cell *c, int i);
|
||||
|
24
hypgraph.cpp
24
hypgraph.cpp
@ -291,10 +291,34 @@ bool behindsphere(const hyperpoint& h) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ld to01(ld a0, ld a1, ld x) {
|
||||
if(x < a0) return 0;
|
||||
if(x > a1) return 1;
|
||||
return (x-a0) / (a1-a0);
|
||||
}
|
||||
|
||||
ld spherity(const hyperpoint& h) {
|
||||
if(!sphere) return 1;
|
||||
|
||||
if(vid.alpha > 1) {
|
||||
return to01(1/vid.alpha, 1, -h[2]);
|
||||
}
|
||||
|
||||
if(vid.alpha <= 1) {
|
||||
return to01(-.8, 1, h[2]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool behindsphere(const transmatrix& V) {
|
||||
return behindsphere(tC0(V));
|
||||
}
|
||||
|
||||
ld spherity(const transmatrix& V) {
|
||||
return spherity(tC0(V));
|
||||
}
|
||||
|
||||
bool confusingGeometry() {
|
||||
return elliptic || quotient == 1 || torus;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user