1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-27 07:33:19 +00:00

aura for spherical equi-models

This commit is contained in:
Zeno Rogue 2017-11-13 01:28:56 +01:00
parent 6312448e0c
commit c682b0d94c

View File

@ -1936,7 +1936,9 @@ cell *straightDownSeek;
int aurac[AURA+1][4]; int aurac[AURA+1][4];
bool haveaura() { bool haveaura() {
return pmodel == mdDisk && (!sphere || vid.alpha > 10) && !euclid && vid.aurastr>0 && !svg::in && (auraNOGL || vid.usingGL); if(!(vid.aurastr>0 && !svg::in && (auraNOGL || vid.usingGL))) return false;
if(sphere && (pmodel == mdEquidistant || pmodel == mdEquiarea)) return true;
return pmodel == mdDisk && (!sphere || vid.alpha > 10) && !euclid;
} }
vector<pair<int, int> > auraspecials; vector<pair<int, int> > auraspecials;
@ -1987,7 +1989,7 @@ void sumaura(int v) {
void drawaura() { void drawaura() {
if(!haveaura()) return; if(!haveaura()) return;
double rad = vid.radius; double rad = vid.radius;
if(sphere) rad /= sqrt(vid.alphax*vid.alphax - 1); if(sphere && pmodel != mdEquidistant && pmodel != mdEquiarea) rad /= sqrt(vid.alphax*vid.alphax - 1);
for(int v=0; v<4; v++) sumaura(v); for(int v=0; v<4; v++) sumaura(v);
for(auto& p: auraspecials) { for(auto& p: auraspecials) {
@ -2322,7 +2324,7 @@ void drawMovementArrows(cell *c, transmatrix V) {
int col = getcs().uicolor; int col = getcs().uicolor;
col -= (col & 0xFF) >> 1; col -= (col & 0xFF) >> 1;
poly_outline = OUTLINE_DEFAULT; poly_outline = OUTLINE_DEFAULT;
queuepoly(fixrot * spin(-d * M_PI/4 + (sphere && vid.alpha>1?M_PI:0))/* * eupush(1,0)*/, shArrow, col); queuepoly(fixrot * spin(-d * M_PI/4 + (sphereflipped()?M_PI:0))/* * eupush(1,0)*/, shArrow, col);
if((c->type & 1) && (isStunnable(c->monst) || c->wall == waThumperOn)) { if((c->type & 1) && (isStunnable(c->monst) || c->wall == waThumperOn)) {
transmatrix Centered = rgpushxto0(tC0(cwtV)); transmatrix Centered = rgpushxto0(tC0(cwtV));
@ -2334,8 +2336,6 @@ void drawMovementArrows(cell *c, transmatrix V) {
} }
} }
#define SKIPFAC .4
void drawMobileArrow(cell *c, transmatrix V) { void drawMobileArrow(cell *c, transmatrix V) {
// int col = getcs().uicolor; // int col = getcs().uicolor;
@ -2354,17 +2354,17 @@ void drawMobileArrow(cell *c, transmatrix V) {
transmatrix m2 = Id; transmatrix m2 = Id;
ld scale = vid.mobilecompasssize / 15.; ld scale = vid.mobilecompasssize / 15.;
m2[0][0] = scale; m2[1][1] = scale; m2[2][2] = 1; m2[0][0] = scale; m2[1][1] = scale; m2[2][2] = 1;
transmatrix Centered = rgpushxto0(tC0(cwtV)); transmatrix Centered = rgpushxto0(tC0(cwtV * sphereflip));
transmatrix t = inverse(Centered) * V; transmatrix t = inverse(Centered) * V;
double alpha = atan2(tC0(t)[1], tC0(t)[0]); double alpha = atan2(tC0(t)[1], tC0(t)[0]);
using namespace shmupballs; using namespace shmupballs;
double dx = xmove + rad*(1+SKIPFAC-.2)/2 * cos(alpha); double dx = xmove + rad*(1+SKIPFAC-.2)/2 * cos(alpha);
double dy = yb + rad*(1+SKIPFAC-.2)/2 * sin(alpha); double dy = yb + rad*(1+SKIPFAC-.2)/2 * sin(alpha);
queuepoly(screenpos(dx, dy) * spin(-alpha) * m2, shArrow, col); queuepolyat(screenpos(dx, dy) * spin(-alpha) * m2, shArrow, col, PPR_MOBILE_ARROW);
} }
int celldistAltPlus(cell *c) { return 1000000 + celldistAlt(c); } int celldistAltPlus(cell *c) { return 1000000 + celldistAlt(c); }
@ -3173,7 +3173,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
orig = orig =
gm[2][2] == 0 ? true : gm[2][2] == 0 ? true :
torus ? hypot(gm[0][2], gm[1][2]) >= hypot(V[0][2], V[1][2]) : torus ? hypot(gm[0][2], gm[1][2]) >= hypot(V[0][2], V[1][2]) :
(sphere && vid.alphax >= 1.001) ? fabs(gm[2][2]-1) <= fabs(V[2][2]-1) : sphereflipped() ? fabs(gm[2][2]-1) <= fabs(V[2][2]-1) :
fabs(gm[2][2]-1) >= fabs(V[2][2]-1) - 1e-8; fabs(gm[2][2]-1) >= fabs(V[2][2]-1) - 1e-8;
if(orig) gm = V; if(orig) gm = V;
@ -4721,18 +4721,16 @@ void drawMarkers() {
// process mouse // process mouse
#if ISMOBILE if(haveMobileCompass()) {
extern bool useRangedOrb; using namespace shmupballs;
if(canmove && !shmup::on && andmode == 0 && !useRangedOrb && vid.mobilecompasssize > 0) { calc();
using namespace shmupballs; queuecircle(xmove, yb, rad, 0xFF0000FF);
calc(); queuecircle(xmove, yb, rad*SKIPFAC,
queuecircle(xmove, yb, rad, 0xFF0000FF); legalmoves[MAX_EDGE] ? 0xFF0000FF : 0xFF000080
queuecircle(xmove, yb, rad*SKIPFAC, );
legalmoves[MAX_EDGE] ? 0xFF0000FF : 0xFF000080 forCellAll(c2, cwt.c) IG(c2) drawMobileArrow(c2, Gm(c2));
); if(hypot(mousex-xmove, mousey-yb) <= rad) getcstat = '-';
forCellAll(c2, cwt.c) IG(c2) drawMobileArrow(c2, Gm(c2)); }
}
#endif
if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on) { if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on) {
if(multi::players == 1) { if(multi::players == 1) {
@ -4916,7 +4914,7 @@ void drawthemap() {
if(euclid) if(euclid)
drawEuclidean(); drawEuclidean();
else { else {
if(sphere && vid.alpha > 1) sphereflip[2][2] = -1; if(sphereflipped()) sphereflip[2][2] = -1;
int sr = max(sightrange, ambush_distance); int sr = max(sightrange, ambush_distance);
maxreclevel = maxreclevel =
conformal::on ? sr + 2: conformal::on ? sr + 2: