redone spinEdge so that fixed_yz works in gravity lands

This commit is contained in:
Zeno Rogue 2019-05-13 15:09:24 +02:00
parent 6713726975
commit d2c20fee22
3 changed files with 31 additions and 16 deletions

View File

@ -2644,8 +2644,9 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col) {
return false;
}
double downspin;
cell *straightDownSeek;
hyperpoint straightDownPoint;
ld straightDownSpeed;
#define AURA 180
@ -5958,12 +5959,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
if(usethis) {
straightDownSeek = c;
downspin = atan2(V[1][GDIM], V[0][GDIM]);
downspin += (side-1) * M_PI/2;
downspin += conformal::rotation * degree;
while(downspin < -M_PI) downspin += 2*M_PI;
while(downspin > +M_PI) downspin -= 2*M_PI;
downspin = downspin * min(spd, (double)1);
straightDownPoint = tC0(V);
straightDownSpeed = spd;
if(side == 2) for(int i=0; i<3; i++) straightDownPoint[i] = -straightDownPoint[i];
if(side == 1) straightDownPoint = spin(-M_PI/2) * straightDownPoint;
}
}
@ -6529,7 +6528,7 @@ void drawthemap() {
multi::ccdist[i] = 1e20; multi::ccat[i] = NULL;
}
straightDownSeek = NULL; downspin = 0;
straightDownSeek = NULL;
#if ISMOBILE
mouseovers = XLAT("No info about this...");

View File

@ -2678,7 +2678,9 @@ void preparesort();
bool dodrawcell(cell *c);
void drawcell(cell *c, transmatrix V, int spinv, bool mirrored);
extern double downspin;
extern cell* straightDownSeek;
extern hyperpoint straightDownPoint;
extern ld straightDownSpeed;
extern int frameid;
extern bool leftclick;

View File

@ -1063,7 +1063,7 @@ transmatrix eumovedir(int d) {
}
void spinEdge(ld aspd) {
ld downspin = 0;
if(playerfound && vid.fixed_facing) {
hyperpoint H = gpushxto0(playerV * C0) * playerV * xpush0(5);
downspin = atan2(H[1], H[0]);
@ -1073,14 +1073,28 @@ void spinEdge(ld aspd) {
while(downspin > +M_PI) downspin -= 2*M_PI;
aspd = (1 + 2 * abs(downspin)) * aspd;
}
else if(WDIM == 2 && GDIM == 3 && vid.fixed_yz) {
aspd = 999999;
if(straightDownSeek) {
if(straightDownPoint[0])
downspin = conformal::rotation * degree - atan2(straightDownPoint[0], straightDownPoint[1]);
}
else {
if(View[0][2])
downspin = -atan2(View[0][2], View[1][2]);
}
}
else if(straightDownSeek) {
downspin = atan2(straightDownPoint[1], straightDownPoint[0]);
downspin -= M_PI/2;
downspin += conformal::rotation * degree;
while(downspin < -M_PI) downspin += 2*M_PI;
while(downspin > +M_PI) downspin -= 2*M_PI;
downspin = downspin * min(straightDownSpeed, (double)1);
}
if(downspin > aspd) downspin = aspd;
if(downspin < -aspd) downspin = -aspd;
View = spin(downspin) * View;
if(WDIM == 2 && GDIM == 3 && vid.fixed_yz && View[0][2]) {
ld d12 = atan2(View[0][2], View[1][2]);
View = cspin(1, 0, d12) * View;
}
View = spin(downspin) * View;
}
void centerpc(ld aspd) {