mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
some work on 3D view
This commit is contained in:
parent
a3eb161235
commit
e73d2f2f22
@ -235,7 +235,7 @@ void display_data::set_projection(int ed, bool apply_models) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if(hyperbolic && vid.alpha > -1) {
|
if(hyperbolic && vid.alpha > -1 && DIM == 2) {
|
||||||
// Because of the transformation from H3 to the Minkowski hyperboloid,
|
// Because of the transformation from H3 to the Minkowski hyperboloid,
|
||||||
// points with negative Z can be generated in some 3D settings.
|
// points with negative Z can be generated in some 3D settings.
|
||||||
// This happens for points below the camera, but above the plane.
|
// This happens for points below the camera, but above the plane.
|
||||||
@ -299,7 +299,7 @@ void display_data::set_viewport(int ed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool model_needs_depth() {
|
bool model_needs_depth() {
|
||||||
return pmodel == mdBall;
|
return DIM == 3 || pmodel == mdBall;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGLProjection(color_t col) {
|
void setGLProjection(color_t col) {
|
||||||
|
@ -644,16 +644,16 @@ namespace conformal {
|
|||||||
"the point z is mapped to f(z). You can also use the underlying coordinates ux, uy, uz."
|
"the point z is mapped to f(z). You can also use the underlying coordinates ux, uy, uz."
|
||||||
) + "\n\n" + parser_help()
|
) + "\n\n" + parser_help()
|
||||||
);
|
);
|
||||||
#if CAP_POLY
|
#if CAP_QUEUE && CAP_CURVE
|
||||||
dialog::extra_options = [] () {
|
dialog::extra_options = [] () {
|
||||||
initquickqueue();
|
initquickqueue();
|
||||||
queuereset(mdUnchanged, PPR::LINE);
|
queuereset(mdUnchanged, PPR::LINE);
|
||||||
for(int a=-1; a<=1; a++) {
|
for(int a=-1; a<=1; a++) {
|
||||||
curvepoint(hpxyz(-M_PI/2 * current_display->radius, a*current_display->radius, 0));
|
curvepoint(point2(-M_PI/2 * current_display->radius, a*current_display->radius));
|
||||||
curvepoint(hpxyz(+M_PI/2 * current_display->radius, a*current_display->radius, 0));
|
curvepoint(point2(+M_PI/2 * current_display->radius, a*current_display->radius));
|
||||||
queuecurve(forecolor, 0, PPR::LINE);
|
queuecurve(forecolor, 0, PPR::LINE);
|
||||||
curvepoint(hpxyz(a*current_display->radius, -M_PI/2*current_display->radius, 0));
|
curvepoint(point2(a*current_display->radius, -M_PI/2*current_display->radius));
|
||||||
curvepoint(hpxyz(a*current_display->radius, +M_PI/2*current_display->radius, 0));
|
curvepoint(point2(a*current_display->radius, +M_PI/2*current_display->radius));
|
||||||
queuecurve(forecolor, 0, PPR::LINE);
|
queuecurve(forecolor, 0, PPR::LINE);
|
||||||
}
|
}
|
||||||
queuereset(pmodel, PPR::LINE);
|
queuereset(pmodel, PPR::LINE);
|
||||||
|
24
control.cpp
24
control.cpp
@ -177,6 +177,7 @@ void closeJoysticks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void checkjoy() {
|
void checkjoy() {
|
||||||
|
#if DIM == 2
|
||||||
DEBB(DF_GRAPH, (debugfile,"check joy\n"));
|
DEBB(DF_GRAPH, (debugfile,"check joy\n"));
|
||||||
if(!DEFAULTCONTROL) return;
|
if(!DEFAULTCONTROL) return;
|
||||||
ld joyvalue1 = sqr(vid.joyvalue);
|
ld joyvalue1 = sqr(vid.joyvalue);
|
||||||
@ -199,10 +200,11 @@ void checkjoy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
joydir = vectodir(hpxy(jx, jy));
|
joydir = vectodir(hpxy(jx, jy));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkpanjoy(double t) {
|
void checkpanjoy(double t) {
|
||||||
|
#if DIM == 2
|
||||||
if(shmup::on) return;
|
if(shmup::on) return;
|
||||||
|
|
||||||
if(vid.joypanspeed < 1e-7) return;
|
if(vid.joypanspeed < 1e-7) return;
|
||||||
@ -215,6 +217,7 @@ void checkpanjoy(double t) {
|
|||||||
|
|
||||||
playermoved = false;
|
playermoved = false;
|
||||||
View = gpushxto0(hpxy(jx, jy)) * View;
|
View = gpushxto0(hpxy(jx, jy)) * View;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -245,27 +248,38 @@ void handlePanning(int sym, int uni) {
|
|||||||
if(rug::rugged) return;
|
if(rug::rugged) return;
|
||||||
|
|
||||||
#if !ISPANDORA
|
#if !ISPANDORA
|
||||||
|
if(sym == SDLK_END && DIM == 3) {
|
||||||
|
View = cpush(2, -0.2*shiftmul) * View, didsomething = true, playermoved = false;
|
||||||
|
}
|
||||||
if(sym == SDLK_RIGHT) {
|
if(sym == SDLK_RIGHT) {
|
||||||
if(conformal::on)
|
if(conformal::on)
|
||||||
conformal::lvspeed += 0.1 * shiftmul;
|
conformal::lvspeed += 0.1 * shiftmul;
|
||||||
|
else if(DIM == 3)
|
||||||
|
View = cspin(0, 2, -0.2*shiftmul) * View, didsomething = true;
|
||||||
else
|
else
|
||||||
View = xpush(-0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
View = xpush(-0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
||||||
}
|
}
|
||||||
if(sym == SDLK_LEFT) {
|
if(sym == SDLK_LEFT) {
|
||||||
if(conformal::on)
|
if(conformal::on)
|
||||||
conformal::lvspeed -= 0.1 * shiftmul;
|
conformal::lvspeed -= 0.1 * shiftmul;
|
||||||
|
else if(DIM == 3)
|
||||||
|
View = cspin(0, 2, 0.2*shiftmul) * View, didsomething = true;
|
||||||
else
|
else
|
||||||
View = xpush(+0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
View = xpush(+0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
||||||
}
|
}
|
||||||
if(sym == SDLK_UP) {
|
if(sym == SDLK_UP) {
|
||||||
if(conformal::on)
|
if(conformal::on)
|
||||||
conformal::lvspeed += 0.1 * shiftmul;
|
conformal::lvspeed += 0.1 * shiftmul;
|
||||||
|
else if(DIM == 3)
|
||||||
|
View = cspin(1, 2, 0.2*shiftmul) * View, didsomething = true;
|
||||||
else
|
else
|
||||||
View = ypush(+0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
View = ypush(+0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
||||||
}
|
}
|
||||||
if(sym == SDLK_DOWN) {
|
if(sym == SDLK_DOWN) {
|
||||||
if(conformal::on)
|
if(conformal::on)
|
||||||
conformal::lvspeed -= 0.1 * shiftmul;
|
conformal::lvspeed -= 0.1 * shiftmul;
|
||||||
|
else if(DIM == 3)
|
||||||
|
View = cspin(1, 2, -0.2*shiftmul) * View, didsomething = true;
|
||||||
else
|
else
|
||||||
View = ypush(-0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
View = ypush(-0.2*shiftmul) * View, playermoved = false, didsomething = true;
|
||||||
}
|
}
|
||||||
@ -286,6 +300,7 @@ void handlePanning(int sym, int uni) {
|
|||||||
if(sym == SDLK_PAGEUP || sym == SDLK_PAGEDOWN)
|
if(sym == SDLK_PAGEUP || sym == SDLK_PAGEDOWN)
|
||||||
if(isGravityLand(cwt.at->land)) playermoved = false;
|
if(isGravityLand(cwt.at->land)) playermoved = false;
|
||||||
|
|
||||||
|
#if DIM == 2
|
||||||
if(sym == PSEUDOKEY_WHEELUP) {
|
if(sym == PSEUDOKEY_WHEELUP) {
|
||||||
ld jx = (mousex - current_display->xcenter - .0) / current_display->radius / 10;
|
ld jx = (mousex - current_display->xcenter - .0) / current_display->radius / 10;
|
||||||
ld jy = (mousey - current_display->ycenter - .0) / current_display->radius / 10;
|
ld jy = (mousey - current_display->ycenter - .0) / current_display->radius / 10;
|
||||||
@ -293,6 +308,7 @@ void handlePanning(int sym, int uni) {
|
|||||||
View = gpushxto0(hpxy(jx, jy)) * View;
|
View = gpushxto0(hpxy(jx, jy)) * View;
|
||||||
sym = 1;
|
sym = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SCALETUNER
|
#ifdef SCALETUNER
|
||||||
@ -760,7 +776,7 @@ void handle_event(SDL_Event& ev) {
|
|||||||
vid.xposition += (mousex - lmousex) * 1. / current_display->scrsize,
|
vid.xposition += (mousex - lmousex) * 1. / current_display->scrsize,
|
||||||
vid.yposition += (mousey - lmousey) * 1. / current_display->scrsize;
|
vid.yposition += (mousey - lmousey) * 1. / current_display->scrsize;
|
||||||
}
|
}
|
||||||
else if(mouseh[2] < 50 && mouseoh[2] < 50) {
|
else if(mouseh[DIM] < 50 && mouseoh[DIM] < 50) {
|
||||||
panning(mouseoh, mouseh);
|
panning(mouseoh, mouseh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -892,6 +908,7 @@ bool haveMobileCompass() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool handleCompass() {
|
bool handleCompass() {
|
||||||
|
#if DIM == 2
|
||||||
if(!haveMobileCompass()) return false;
|
if(!haveMobileCompass()) return false;
|
||||||
|
|
||||||
using namespace shmupballs;
|
using namespace shmupballs;
|
||||||
@ -913,6 +930,9 @@ bool handleCompass() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// orientation sensitivity
|
// orientation sensitivity
|
||||||
|
@ -197,7 +197,7 @@ void precalc() {
|
|||||||
|
|
||||||
transmatrix xspinpush(ld dir, ld dist) {
|
transmatrix xspinpush(ld dir, ld dist) {
|
||||||
if(euclid)
|
if(euclid)
|
||||||
return eupush(cos(dir) * dist, -sin(dir) * dist);
|
return eupush(cos(dir) * dist, -sin(dir) * dist DC(,0));
|
||||||
else
|
else
|
||||||
return spin(dir) * xpush(dist) * spin(-dir);
|
return spin(dir) * xpush(dist) * spin(-dir);
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ void virtualRebase(cell*& base, transmatrix& at, bool tohex) {
|
|||||||
|
|
||||||
void virtualRebase(cell*& base, hyperpoint& h, bool tohex) {
|
void virtualRebase(cell*& base, hyperpoint& h, bool tohex) {
|
||||||
// we perform fixing in check, so that it works with larger range
|
// we perform fixing in check, so that it works with larger range
|
||||||
virtualRebase(base, h, tohex, [] (const hyperpoint& h) { return hyperbolic ? hpxy(h[0], h[1]) :h; });
|
virtualRebase(base, h, tohex, [] (const hyperpoint& h) { return hyperbolic ? hpxy(h[0], h[1] DC(,h[2])) :h; });
|
||||||
}
|
}
|
||||||
|
|
||||||
// works only in geometries similar to the standard one, and only on heptagons
|
// works only in geometries similar to the standard one, and only on heptagons
|
||||||
|
16
graph.cpp
16
graph.cpp
@ -3777,10 +3777,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
if(!inmirrorcount) {
|
if(!inmirrorcount) {
|
||||||
transmatrix& gm = gmatrix[c];
|
transmatrix& gm = gmatrix[c];
|
||||||
orig =
|
orig =
|
||||||
gm[2][2] == 0 ? true :
|
gm[DIM][DIM] == 0 ? true :
|
||||||
euwrap ? hypot(gm[0][2], gm[1][2]) >= hypot(V[0][2], V[1][2]) :
|
euwrap ? hypot(gm[0][DIM], gm[1][DIM]) >= hypot(V[0][DIM], V[1][DIM]) :
|
||||||
sphereflipped() ? fabs(gm[2][2]-1) <= fabs(V[2][2]-1) :
|
sphereflipped() ? fabs(gm[DIM][DIM]-1) <= fabs(V[DIM][DIM]-1) :
|
||||||
fabs(gm[2][2]-1) >= fabs(V[2][2]-1) - 1e-8;
|
fabs(gm[DIM][DIM]-1) >= fabs(V[DIM][DIM]-1) - 1e-8;
|
||||||
|
|
||||||
if(orig) gm = V;
|
if(orig) gm = V;
|
||||||
}
|
}
|
||||||
@ -3853,7 +3853,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!euclid) {
|
if(!euclid) {
|
||||||
double dfc = euclid ? intval(VC0, C0) : VC0[2];
|
double dfc = euclid ? intval(VC0, C0) : VC0[DIM];
|
||||||
|
|
||||||
if(dfc < centdist) {
|
if(dfc < centdist) {
|
||||||
centdist = dfc;
|
centdist = dfc;
|
||||||
@ -5553,7 +5553,7 @@ purehookset hooks_drawmap;
|
|||||||
|
|
||||||
transmatrix cview() {
|
transmatrix cview() {
|
||||||
sphereflip = Id;
|
sphereflip = Id;
|
||||||
if(sphereflipped()) sphereflip[2][2] = -1;
|
if(sphereflipped()) sphereflip[DIM][DIM] = -1;
|
||||||
return ypush(vid.yshift) * sphereflip * View;
|
return ypush(vid.yshift) * sphereflip * View;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5768,10 +5768,10 @@ void drawmovestar(double dx, double dy) {
|
|||||||
transmatrix Centered = Id;
|
transmatrix Centered = Id;
|
||||||
|
|
||||||
if(masterless)
|
if(masterless)
|
||||||
Centered = eupush(H[0], H[1]);
|
Centered = eupush(H);
|
||||||
else if(R > 1e-9) Centered = rgpushxto0(H);
|
else if(R > 1e-9) Centered = rgpushxto0(H);
|
||||||
|
|
||||||
Centered = Centered * rgpushxto0(hpxy(dx*5, dy*5));
|
Centered = Centered * rgpushxto0(hpxy0(dx*5, dy*5));
|
||||||
if(multi::cpid >= 0) multi::crosscenter[multi::cpid] = Centered;
|
if(multi::cpid >= 0) multi::crosscenter[multi::cpid] = Centered;
|
||||||
|
|
||||||
int rax = vid.axes;
|
int rax = vid.axes;
|
||||||
|
29
hyper.h
29
hyper.h
@ -189,7 +189,6 @@ typedef complex<ld> cld;
|
|||||||
|
|
||||||
#define DEBSM(x)
|
#define DEBSM(x)
|
||||||
|
|
||||||
#define DIM 2
|
|
||||||
#define MDIM (DIM+1)
|
#define MDIM (DIM+1)
|
||||||
|
|
||||||
#if DIM == 2
|
#if DIM == 2
|
||||||
@ -224,7 +223,7 @@ inline transmatrix operator * (const transmatrix& T, const transmatrix& U) {
|
|||||||
transmatrix R;
|
transmatrix R;
|
||||||
// for(int i=0; i<3; i++) for(int j=0; j<3; j++) R[i][j] = 0;
|
// for(int i=0; i<3; i++) for(int j=0; j<3; j++) R[i][j] = 0;
|
||||||
for(int i=0; i<MDIM; i++) for(int j=0; j<MDIM; j++) // for(int k=0; k<3; k++)
|
for(int i=0; i<MDIM; i++) for(int j=0; j<MDIM; j++) // for(int k=0; k<3; k++)
|
||||||
R[i][j] = T[i][0] * U[0][j] + T[i][1] * U[1][j] + T[i][2] * U[2][j];
|
R[i][j] = T[i][0] * U[0][j] + T[i][1] * U[1][j] + T[i][2] * U[2][j] D3(+ T[i][3] * U[3][j]);
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,9 +257,11 @@ const static transmatrix centralsym = diag(-1,-1,-1,-1);
|
|||||||
#define hpxyz hyperpoint
|
#define hpxyz hyperpoint
|
||||||
|
|
||||||
#if DIM == 3
|
#if DIM == 3
|
||||||
hyperpoint point3(ld x, ld y, ld z) { return hpxyz(x,y,z,0); }
|
static hyperpoint point3(ld x, ld y, ld z) { return hpxyz(x,y,z,0); }
|
||||||
|
static hyperpoint point2(ld x, ld y) { return hpxyz(x,y,0,0); }
|
||||||
#else
|
#else
|
||||||
#define point3 hpxyz
|
#define point3 hpxyz
|
||||||
|
static hyperpoint point2(ld x, ld y) { return hpxyz(x,y,0); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace hyperpoint_vec {
|
namespace hyperpoint_vec {
|
||||||
@ -3381,7 +3382,7 @@ int fiftyval200(cell *c);
|
|||||||
// T * C0, optimized
|
// T * C0, optimized
|
||||||
inline hyperpoint tC0(const transmatrix &T) {
|
inline hyperpoint tC0(const transmatrix &T) {
|
||||||
hyperpoint z;
|
hyperpoint z;
|
||||||
z[0] = T[0][2]; z[1] = T[1][2]; z[2] = T[2][2];
|
for(int i=0; i<MDIM; i++) z[i] = T[i][DIM];
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3572,7 +3573,7 @@ void queuechr(const hyperpoint& h, int size, char chr, color_t col, int frame =
|
|||||||
string fts(float x);
|
string fts(float x);
|
||||||
bool model_needs_depth();
|
bool model_needs_depth();
|
||||||
|
|
||||||
hyperpoint hpxy(ld x, ld y);
|
hyperpoint hpxy(ld x, ld y DC(, ld z));
|
||||||
ld sqhypot2(const hyperpoint& h);
|
ld sqhypot2(const hyperpoint& h);
|
||||||
ld hypot2(const hyperpoint& h);
|
ld hypot2(const hyperpoint& h);
|
||||||
transmatrix pushxto0(const hyperpoint& H);
|
transmatrix pushxto0(const hyperpoint& H);
|
||||||
@ -3580,6 +3581,12 @@ transmatrix rpushxto0(const hyperpoint& H);
|
|||||||
transmatrix spintox(const hyperpoint& H);
|
transmatrix spintox(const hyperpoint& H);
|
||||||
transmatrix ypush(ld alpha);
|
transmatrix ypush(ld alpha);
|
||||||
|
|
||||||
|
#if DIM == 3
|
||||||
|
static hyperpoint hpxy0(ld x, ld y) { return hpxy(x, y, 0); }
|
||||||
|
#else
|
||||||
|
static hyperpoint hpxy0(ld x, ld y) { return hpxy(x, y); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CAP_SURFACE
|
#if CAP_SURFACE
|
||||||
namespace surface {
|
namespace surface {
|
||||||
|
|
||||||
@ -3772,7 +3779,7 @@ extern ld intval(const hyperpoint &h1, const hyperpoint &h2);
|
|||||||
extern ld intvalxy(const hyperpoint &h1, const hyperpoint &h2);
|
extern ld intvalxy(const hyperpoint &h1, const hyperpoint &h2);
|
||||||
transmatrix euscalezoom(hyperpoint h);
|
transmatrix euscalezoom(hyperpoint h);
|
||||||
transmatrix euaffine(hyperpoint h);
|
transmatrix euaffine(hyperpoint h);
|
||||||
transmatrix eupush(ld x, ld y);
|
transmatrix eupush(ld x, ld y DC(, ld z));
|
||||||
transmatrix eupush(hyperpoint h);
|
transmatrix eupush(hyperpoint h);
|
||||||
transmatrix rspintox(const hyperpoint& H);
|
transmatrix rspintox(const hyperpoint& H);
|
||||||
transmatrix gpushxto0(const hyperpoint& H);
|
transmatrix gpushxto0(const hyperpoint& H);
|
||||||
@ -4206,10 +4213,11 @@ bool saved_tortoise_on(cell *c);
|
|||||||
|
|
||||||
#if CAP_BT
|
#if CAP_BT
|
||||||
void horopoint(ld y, ld x);
|
void horopoint(ld y, ld x);
|
||||||
|
hyperpoint get_horopoint(ld y, ld x DC(,ld z));
|
||||||
|
|
||||||
namespace binary {
|
namespace binary {
|
||||||
heptagon *createStep(heptagon *parent, int d);
|
heptagon *createStep(heptagon *parent, int d);
|
||||||
transmatrix parabolic(ld u);
|
transmatrix parabolic(ld u DC(, ld v));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4466,11 +4474,11 @@ struct comma_printer {
|
|||||||
template<class T, size_t X> void print(hstream& hs, const array<T, X>& a) { print(hs, "("); comma_printer c(hs); for(const T& t: a) c(t); print(hs, ")"); }
|
template<class T, size_t X> void print(hstream& hs, const array<T, X>& a) { print(hs, "("); comma_printer c(hs); for(const T& t: a) c(t); print(hs, ")"); }
|
||||||
template<class T> void print(hstream& hs, const vector<T>& a) { print(hs, "("); comma_printer c(hs); for(const T& t: a) c(t); print(hs, ")"); }
|
template<class T> void print(hstream& hs, const vector<T>& a) { print(hs, "("); comma_printer c(hs); for(const T& t: a) c(t); print(hs, ")"); }
|
||||||
|
|
||||||
inline void print(hstream& hs, const hyperpoint h) { print(hs, (const array<ld, 3>&)h); }
|
inline void print(hstream& hs, const hyperpoint h) { print(hs, (const array<ld, MDIM>&)h); }
|
||||||
inline void print(hstream& hs, const transmatrix T) {
|
inline void print(hstream& hs, const transmatrix T) {
|
||||||
print(hs, "("); comma_printer c(hs);
|
print(hs, "("); comma_printer c(hs);
|
||||||
for(int i=0; i<3; i++)
|
for(int i=0; i<MDIM; i++)
|
||||||
for(int j=0; j<3; j++) c(T[i][j]);
|
for(int j=0; j<MDIM; j++) c(T[i][j]);
|
||||||
print(hs, ")"); }
|
print(hs, ")"); }
|
||||||
|
|
||||||
template<class T, class U> void print(hstream& hs, const pair<T, U> & t) { print(hs, "(", t.first, ",", t.second, ")"); }
|
template<class T, class U> void print(hstream& hs, const pair<T, U> & t) { print(hs, "(", t.first, ",", t.second, ")"); }
|
||||||
@ -4740,6 +4748,7 @@ extern int cells_drawn;
|
|||||||
|
|
||||||
void menuitem_sightrange(char c = 'r');
|
void menuitem_sightrange(char c = 'r');
|
||||||
|
|
||||||
|
bool invis_point(const hyperpoint h);
|
||||||
bool invalid_point(const hyperpoint h);
|
bool invalid_point(const hyperpoint h);
|
||||||
bool invalid_point(const transmatrix T);
|
bool invalid_point(const transmatrix T);
|
||||||
bool in_smart_range(const transmatrix& T);
|
bool in_smart_range(const transmatrix& T);
|
||||||
|
@ -438,7 +438,7 @@ void fixmatrix(transmatrix& T) {
|
|||||||
// show the matrix on screen
|
// show the matrix on screen
|
||||||
|
|
||||||
ld det(const transmatrix& T) {
|
ld det(const transmatrix& T) {
|
||||||
#if DIM == 3
|
#if DIM == 2
|
||||||
ld det = 0;
|
ld det = 0;
|
||||||
for(int i=0; i<3; i++)
|
for(int i=0; i<3; i++)
|
||||||
det += T[0][i] * T[1][(i+1)%3] * T[2][(i+2)%3];
|
det += T[0][i] * T[1][(i+1)%3] * T[2][(i+2)%3];
|
||||||
@ -472,7 +472,7 @@ void inverse_error(const transmatrix& T) {
|
|||||||
transmatrix inverse(const transmatrix& T) {
|
transmatrix inverse(const transmatrix& T) {
|
||||||
profile_start(7);
|
profile_start(7);
|
||||||
|
|
||||||
#if DIM == 3
|
#if DIM == 2
|
||||||
ld d = det(T);
|
ld d = det(T);
|
||||||
transmatrix T2;
|
transmatrix T2;
|
||||||
if(d == 0) {
|
if(d == 0) {
|
||||||
@ -493,8 +493,7 @@ transmatrix inverse(const transmatrix& T) {
|
|||||||
if(T1[b][a]) {
|
if(T1[b][a]) {
|
||||||
if(b != a)
|
if(b != a)
|
||||||
for(int c=0; c<MDIM; c++)
|
for(int c=0; c<MDIM; c++)
|
||||||
tie(T1[b][c], T1[a][c]) = make_pair(T1[a][c], T1[b][c]),
|
swap(T1[b][c], T1[a][c]), swap(T2[b][c], T2[a][c]);
|
||||||
tie(T2[b][c], T2[a][c]) = make_pair(T2[a][c], T2[b][c]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!T1[a][a]) { inverse_error(T); return Id; }
|
if(!T1[a][a]) { inverse_error(T); return Id; }
|
||||||
@ -612,7 +611,7 @@ transmatrix mzscale(const transmatrix& t, double fac) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix pushone() { return euclid ? eupush(1, 0) : xpush(sphere?.5 : 1); }
|
transmatrix pushone() { return xpush(sphere?.5 : 1); }
|
||||||
|
|
||||||
bool operator == (hyperpoint h1, hyperpoint h2) {
|
bool operator == (hyperpoint h1, hyperpoint h2) {
|
||||||
for(int i=0; i<MDIM; i++) if(h1[i] != h2[i]) return false;
|
for(int i=0; i<MDIM; i++) if(h1[i] != h2[i]) return false;
|
||||||
|
59
hypgraph.cpp
59
hypgraph.cpp
@ -34,7 +34,7 @@ hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) {
|
|||||||
ld hx = h[0], hy = h[1];
|
ld hx = h[0], hy = h[1];
|
||||||
|
|
||||||
if(gc == gcEuclid)
|
if(gc == gcEuclid)
|
||||||
return hpxy(hx * (1 + alpha), hy * (1 + alpha));
|
return hpxy0(hx * (1 + alpha), hy * (1 + alpha));
|
||||||
|
|
||||||
ld hr = hx*hx+hy*hy;
|
ld hr = hx*hx+hy*hy;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) {
|
|||||||
hyperpoint H;
|
hyperpoint H;
|
||||||
H[0] = hx * (hz+vid.alpha);
|
H[0] = hx * (hz+vid.alpha);
|
||||||
H[1] = hy * (hz+vid.alpha);
|
H[1] = hy * (hz+vid.alpha);
|
||||||
H[2] = hz;
|
H[DIM] = hz;
|
||||||
|
|
||||||
return H;
|
return H;
|
||||||
}
|
}
|
||||||
@ -66,10 +66,10 @@ hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) {
|
|||||||
hyperpoint space_to_perspective(hyperpoint z, ld alpha = vid.alpha);
|
hyperpoint space_to_perspective(hyperpoint z, ld alpha = vid.alpha);
|
||||||
|
|
||||||
hyperpoint space_to_perspective(hyperpoint z, ld alpha) {
|
hyperpoint space_to_perspective(hyperpoint z, ld alpha) {
|
||||||
ld s = 1 / (alpha + z[2]);
|
ld s = 1 / (alpha + z[DIM]);
|
||||||
z[0] *= s;
|
z[0] *= s;
|
||||||
z[1] *= s;
|
z[1] *= s;
|
||||||
z[2] = 0;
|
z[DIM] = 0;
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ hyperpoint gethyper(ld x, ld y) {
|
|||||||
|
|
||||||
void ballmodel(hyperpoint& ret, double alpha, double d, double zl) {
|
void ballmodel(hyperpoint& ret, double alpha, double d, double zl) {
|
||||||
hyperpoint H = ypush(geom3::camera) * xpush(d) * ypush(zl) * C0;
|
hyperpoint H = ypush(geom3::camera) * xpush(d) * ypush(zl) * C0;
|
||||||
ld tzh = vid.ballproj + H[2];
|
ld tzh = vid.ballproj + H[DIM];
|
||||||
ld ax = H[0] / tzh;
|
ld ax = H[0] / tzh;
|
||||||
ld ay = H[1] / tzh;
|
ld ay = H[1] / tzh;
|
||||||
|
|
||||||
@ -233,6 +233,13 @@ hyperpoint mobius(hyperpoint h, ld angle, ld scale = 1) {
|
|||||||
|
|
||||||
void applymodel(hyperpoint H, hyperpoint& ret) {
|
void applymodel(hyperpoint H, hyperpoint& ret) {
|
||||||
|
|
||||||
|
if(DIM == 3) {
|
||||||
|
ret[0] = H[0]/H[2];
|
||||||
|
ret[1] = H[1]/H[2];
|
||||||
|
ret[2] = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
using namespace hyperpoint_vec;
|
using namespace hyperpoint_vec;
|
||||||
|
|
||||||
hyperpoint H_orig = H;
|
hyperpoint H_orig = H;
|
||||||
@ -723,6 +730,10 @@ transmatrix applyspin(const heptspin& hs, const transmatrix& V) {
|
|||||||
return hs.spin ? V * spin(hs.spin*2*M_PI/S7) : V;
|
return hs.spin ? V * spin(hs.spin*2*M_PI/S7) : V;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool invis_point(const hyperpoint h) {
|
||||||
|
return h[2] < 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool invalid_point(const hyperpoint h) {
|
bool invalid_point(const hyperpoint h) {
|
||||||
return std::isnan(h[2]) || h[2] > 1e8 || std::isinf(h[2]);
|
return std::isnan(h[2]) || h[2] > 1e8 || std::isinf(h[2]);
|
||||||
}
|
}
|
||||||
@ -1040,7 +1051,7 @@ void centerpc(ld aspd) {
|
|||||||
ors::unrotate(cwtV); ors::unrotate(View);
|
ors::unrotate(cwtV); ors::unrotate(View);
|
||||||
|
|
||||||
hyperpoint H = ypush(-vid.yshift) * sphereflip * tC0(cwtV);
|
hyperpoint H = ypush(-vid.yshift) * sphereflip * tC0(cwtV);
|
||||||
ld R = H[0] == 0 && H[1] == 0 ? 0 : hdist0(H); // = sqrt(H[0] * H[0] + H[1] * H[1]);
|
ld R = zero2(H) ? 0 : hdist0(H); // = sqrt(H[0] * H[0] + H[1] * H[1]);
|
||||||
if(R < 1e-9) {
|
if(R < 1e-9) {
|
||||||
// either already centered or direction unknown
|
// either already centered or direction unknown
|
||||||
/* if(playerfoundL && playerfoundR) {
|
/* if(playerfoundL && playerfoundR) {
|
||||||
@ -1057,8 +1068,8 @@ void centerpc(ld aspd) {
|
|||||||
aspd *= (2+3*R*R);
|
aspd *= (2+3*R*R);
|
||||||
if(aspd > R) aspd = R;
|
if(aspd > R) aspd = R;
|
||||||
|
|
||||||
View[0][2] -= cwtV[0][2] * aspd / R;
|
for(int i=0; i<DIM; i++)
|
||||||
View[1][2] -= cwtV[1][2] * aspd / R;
|
View[i][DIM] -= cwtV[i][DIM] * aspd / R;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,7 +1109,7 @@ void optimizeview() {
|
|||||||
|
|
||||||
#if CAP_BT || CAP_ARCM
|
#if CAP_BT || CAP_ARCM
|
||||||
else if(binarytiling || archimedean) {
|
else if(binarytiling || archimedean) {
|
||||||
turn = -1, best = View[2][2];
|
turn = -1, best = View[DIM][DIM];
|
||||||
for(int i=0; i<viewctr.at->c7->type; i++) {
|
for(int i=0; i<viewctr.at->c7->type; i++) {
|
||||||
int i1 = i * DUALMUL;
|
int i1 = i * DUALMUL;
|
||||||
heptagon *h2 = createStep(viewctr.at, i1);
|
heptagon *h2 = createStep(viewctr.at, i1);
|
||||||
@ -1110,7 +1121,7 @@ void optimizeview() {
|
|||||||
if(archimedean) T = arcm::relative_matrix(h2, viewctr.at);
|
if(archimedean) T = arcm::relative_matrix(h2, viewctr.at);
|
||||||
#endif
|
#endif
|
||||||
hyperpoint H = View * tC0(T);
|
hyperpoint H = View * tC0(T);
|
||||||
ld quality = euclid ? hdist0(H) : H[2];
|
ld quality = euclid ? hdist0(H) : H[DIM];
|
||||||
if(quality < best) best = quality, turn = i1, TB = T;
|
if(quality < best) best = quality, turn = i1, TB = T;
|
||||||
}
|
}
|
||||||
if(turn >= 0) {
|
if(turn >= 0) {
|
||||||
@ -1128,7 +1139,7 @@ void optimizeview() {
|
|||||||
ld trot = -i * M_PI * 2 / (S7+.0);
|
ld trot = -i * M_PI * 2 / (S7+.0);
|
||||||
transmatrix T = i < 0 ? Id : spin(trot) * xpush(tessf) * pispin;
|
transmatrix T = i < 0 ? Id : spin(trot) * xpush(tessf) * pispin;
|
||||||
hyperpoint H = View * tC0(T);
|
hyperpoint H = View * tC0(T);
|
||||||
if(H[2] < best) best = H[2], turn = i, TB = T;
|
if(H[DIM] < best) best = H[DIM], turn = i, TB = T;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(turn >= 0) {
|
if(turn >= 0) {
|
||||||
@ -1267,8 +1278,8 @@ void draw_model_elements() {
|
|||||||
case mdHyperboloid: {
|
case mdHyperboloid: {
|
||||||
if(hyperbolic) {
|
if(hyperbolic) {
|
||||||
#if CAP_QUEUE
|
#if CAP_QUEUE
|
||||||
curvepoint(hpxyz(0,0,1));
|
curvepoint(point3(0,0,1));
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
curvepoint(point3(0,0,-vid.alpha));
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
|
|
||||||
ld& tz = conformal::top_z;
|
ld& tz = conformal::top_z;
|
||||||
@ -1281,16 +1292,16 @@ void draw_model_elements() {
|
|||||||
a[1] = sb * a[2] / -cb;
|
a[1] = sb * a[2] / -cb;
|
||||||
a[0] = sqrt(-1 + a[2] * a[2] - a[1] * a[1]);
|
a[0] = sqrt(-1 + a[2] * a[2] - a[1] * a[1]);
|
||||||
|
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
curvepoint(point3(0,0,-vid.alpha));
|
||||||
curvepoint(a);
|
curvepoint(a);
|
||||||
curvepoint(hpxyz(0,0,0));
|
curvepoint(point3(0,0,0));
|
||||||
a[0] = -a[0];
|
a[0] = -a[0];
|
||||||
curvepoint(a);
|
curvepoint(a);
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
curvepoint(point3(0,0,-vid.alpha));
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
|
|
||||||
curvepoint(hpxyz(-1,0,0));
|
curvepoint(point3(-1,0,0));
|
||||||
curvepoint(hpxyz(1,0,0));
|
curvepoint(point3(1,0,0));
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
|
|
||||||
a[1] = sb * tz / -cb;
|
a[1] = sb * tz / -cb;
|
||||||
@ -1298,7 +1309,7 @@ void draw_model_elements() {
|
|||||||
a[2] = tz - vid.alpha;
|
a[2] = tz - vid.alpha;
|
||||||
|
|
||||||
curvepoint(a);
|
curvepoint(a);
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
curvepoint(point3(0,0,-vid.alpha));
|
||||||
a[0] = -a[0];
|
a[0] = -a[0];
|
||||||
curvepoint(a);
|
curvepoint(a);
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
@ -1374,7 +1385,7 @@ void draw_boundary(int w) {
|
|||||||
ld z = -sqrt(1 - x*x);
|
ld z = -sqrt(1 - x*x);
|
||||||
conformal::apply_orientation(y, x);
|
conformal::apply_orientation(y, x);
|
||||||
hyperpoint h1;
|
hyperpoint h1;
|
||||||
applymodel(hpxyz(x,y,z), h1);
|
applymodel(hpxyz(x,y,DC(0,) z), h1);
|
||||||
|
|
||||||
conformal::apply_orientation(h1[0], h1[1]);
|
conformal::apply_orientation(h1[0], h1[1]);
|
||||||
h1[1] = abs(h1[1]) * b;
|
h1[1] = abs(h1[1]) * b;
|
||||||
@ -1424,7 +1435,7 @@ void draw_boundary(int w) {
|
|||||||
queuereset(mdUnchanged, p);
|
queuereset(mdUnchanged, p);
|
||||||
for(int i=0; i<=360; i++) {
|
for(int i=0; i<=360; i++) {
|
||||||
ld s = sin(i * degree);
|
ld s = sin(i * degree);
|
||||||
curvepoint(hpxyz(current_display->radius * cos(i * degree), current_display->radius * s * (conformal::cos_ball * s >= 0 - 1e-6 ? 1 : abs(conformal::sin_ball)), 0));
|
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * s * (conformal::cos_ball * s >= 0 - 1e-6 ? 1 : abs(conformal::sin_ball)), 0));
|
||||||
}
|
}
|
||||||
queuecurve(lc, fc, p);
|
queuecurve(lc, fc, p);
|
||||||
queuereset(pmodel, p);
|
queuereset(pmodel, p);
|
||||||
@ -1433,7 +1444,7 @@ void draw_boundary(int w) {
|
|||||||
|
|
||||||
for(int i=0; i<=360; i++) {
|
for(int i=0; i<=360; i++) {
|
||||||
ld s = sin(i * degree);
|
ld s = sin(i * degree);
|
||||||
curvepoint(hpxyz(current_display->radius * cos(i * degree), current_display->radius * s * conformal::sin_ball, 0));
|
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * s * conformal::sin_ball, 0));
|
||||||
}
|
}
|
||||||
queuecurve(lc, fc, p);
|
queuecurve(lc, fc, p);
|
||||||
queuereset(pmodel, p);
|
queuereset(pmodel, p);
|
||||||
@ -1441,7 +1452,7 @@ void draw_boundary(int w) {
|
|||||||
if(euclid || sphere) {
|
if(euclid || sphere) {
|
||||||
queuereset(mdUnchanged, p);
|
queuereset(mdUnchanged, p);
|
||||||
for(int i=0; i<=360; i++) {
|
for(int i=0; i<=360; i++) {
|
||||||
curvepoint(hpxyz(current_display->radius * cos(i * degree), current_display->radius * sin(i * degree), 0));
|
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * sin(i * degree), 0));
|
||||||
}
|
}
|
||||||
queuecurve(lc, fc, p);
|
queuecurve(lc, fc, p);
|
||||||
queuereset(pmodel, p);
|
queuereset(pmodel, p);
|
||||||
@ -1511,7 +1522,7 @@ void draw_boundary(int w) {
|
|||||||
queuereset(mdUnchanged, p);
|
queuereset(mdUnchanged, p);
|
||||||
for(ld a=-10; a<=10; a+=0.01 / (1 << vid.linequality) / u) {
|
for(ld a=-10; a<=10; a+=0.01 / (1 << vid.linequality) / u) {
|
||||||
cld z = exp(cld(a, a * imag(sm) / real(sm) + M_PI));
|
cld z = exp(cld(a, a * imag(sm) / real(sm) + M_PI));
|
||||||
hyperpoint ret = hpxyz(real(z), imag(z), 0);
|
hyperpoint ret = point2(real(z), imag(z));
|
||||||
ret = mobius(ret, vid.skiprope, 1);
|
ret = mobius(ret, vid.skiprope, 1);
|
||||||
ret *= current_display->radius;
|
ret *= current_display->radius;
|
||||||
curvepoint(ret);
|
curvepoint(ret);
|
||||||
|
13
polygons.cpp
13
polygons.cpp
@ -490,6 +490,9 @@ vector<glvertex> line_vertices;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void glapplymatrix(const transmatrix& V) {
|
void glapplymatrix(const transmatrix& V) {
|
||||||
|
#if DIM == 3
|
||||||
|
glhr::set_modelview(glhr::id);
|
||||||
|
#else
|
||||||
GLfloat mat[16];
|
GLfloat mat[16];
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
||||||
@ -509,6 +512,7 @@ void glapplymatrix(const transmatrix& V) {
|
|||||||
conformal::apply_orientation(mat[a*4], mat[a*4+1]);
|
conformal::apply_orientation(mat[a*4], mat[a*4+1]);
|
||||||
|
|
||||||
glhr::set_modelview(glhr::as_glmatrix(mat));
|
glhr::set_modelview(glhr::as_glmatrix(mat));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dqi_poly::gldraw() {
|
void dqi_poly::gldraw() {
|
||||||
@ -632,12 +636,16 @@ void dqi_poly::gldraw() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
double scale_at(const transmatrix& T) {
|
double scale_at(const transmatrix& T) {
|
||||||
|
#if DIM==3
|
||||||
|
return 1 / (tC0(T))[2];
|
||||||
|
#else
|
||||||
using namespace hyperpoint_vec;
|
using namespace hyperpoint_vec;
|
||||||
hyperpoint h1, h2, h3;
|
hyperpoint h1, h2, h3;
|
||||||
applymodel(tC0(T), h1);
|
applymodel(tC0(T), h1);
|
||||||
applymodel(T * xpush0(.01), h2);
|
applymodel(T * xpush0(.01), h2);
|
||||||
applymodel(T * ypush(.01) * C0, h3);
|
applymodel(T * ypush(.01) * C0, h3);
|
||||||
return sqrt(hypot2(h2-h1) * hypot2(h3-h1) / .0001);
|
return sqrt(hypot2(h2-h1) * hypot2(h3-h1) / .0001);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
double linewidthat(const hyperpoint& h) {
|
double linewidthat(const hyperpoint& h) {
|
||||||
@ -1262,7 +1270,7 @@ void dqi_string::draw() {
|
|||||||
svg::text(x, y, size, str, frame, color, align);
|
svg::text(x, y, size, str, frame, color, align);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#elseif ISMOBILE==0
|
#elif ISMOBILE==0
|
||||||
int fr = frame & 255;
|
int fr = frame & 255;
|
||||||
displayfrSP(x, y, shift, fr, size, str, color, align, frame >> 8);
|
displayfrSP(x, y, shift, fr, size, str, color, align, frame >> 8);
|
||||||
#else
|
#else
|
||||||
@ -2872,12 +2880,14 @@ void queuechr(const transmatrix& V, double size, char chr, color_t col, int fram
|
|||||||
|
|
||||||
void queuestr(const hyperpoint& h, int size, const string& chr, color_t col, int frame) {
|
void queuestr(const hyperpoint& h, int size, const string& chr, color_t col, int frame) {
|
||||||
if(invalid_point(h)) return;
|
if(invalid_point(h)) return;
|
||||||
|
if(DIM == 3 && invis_point(h)) return;
|
||||||
int xc, yc, sc; getcoord0(h, xc, yc, sc);
|
int xc, yc, sc; getcoord0(h, xc, yc, sc);
|
||||||
queuestr(xc, yc, sc, size, chr, col, frame);
|
queuestr(xc, yc, sc, size, chr, col, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void queuestr(const transmatrix& V, double size, const string& chr, color_t col, int frame, int align) {
|
void queuestr(const transmatrix& V, double size, const string& chr, color_t col, int frame, int align) {
|
||||||
if(invalid_point(V)) return;
|
if(invalid_point(V)) return;
|
||||||
|
if(DIM == 3 && invis_point(tC0(V))) return;
|
||||||
int xc, yc, sc; getcoord0(tC0(V), xc, yc, sc);
|
int xc, yc, sc; getcoord0(tC0(V), xc, yc, sc);
|
||||||
// int xs, ys, ss; getcoord0(V * xpush0(.01), xs, ys, ss);
|
// int xs, ys, ss; getcoord0(V * xpush0(.01), xs, ys, ss);
|
||||||
|
|
||||||
@ -2886,6 +2896,7 @@ void queuestr(const transmatrix& V, double size, const string& chr, color_t col,
|
|||||||
|
|
||||||
void queuecircle(const transmatrix& V, double size, color_t col) {
|
void queuecircle(const transmatrix& V, double size, color_t col) {
|
||||||
if(invalid_point(V)) return;
|
if(invalid_point(V)) return;
|
||||||
|
if(DIM == 3 && invis_point(tC0(V))) return;
|
||||||
int xc, yc, sc; getcoord0(tC0(V), xc, yc, sc);
|
int xc, yc, sc; getcoord0(tC0(V), xc, yc, sc);
|
||||||
int xs, ys, ss; getcoord0(V * xpush0(.01), xs, ys, ss);
|
int xs, ys, ss; getcoord0(V * xpush0(.01), xs, ys, ss);
|
||||||
queuecircle(xc, yc, scale_in_pixels(V) * size, col);
|
queuecircle(xc, yc, scale_in_pixels(V) * size, col);
|
||||||
|
@ -845,11 +845,15 @@ void handleInput(int delta) {
|
|||||||
multi::mdx[i] = multi::mdx[i] * (1 - delta / 1000.) + mdx * delta / 2000.;
|
multi::mdx[i] = multi::mdx[i] * (1 - delta / 1000.) + mdx * delta / 2000.;
|
||||||
multi::mdy[i] = multi::mdy[i] * (1 - delta / 1000.) + mdy * delta / 2000.;
|
multi::mdy[i] = multi::mdy[i] * (1 - delta / 1000.) + mdy * delta / 2000.;
|
||||||
|
|
||||||
|
#if DIM == 2
|
||||||
if(mdx != 0 || mdy != 0) if(!multi::combo[i]) {
|
if(mdx != 0 || mdy != 0) if(!multi::combo[i]) {
|
||||||
cwtV = multi::whereis[i]; cwt = multi::player[i];
|
cwtV = multi::whereis[i]; cwt = multi::player[i];
|
||||||
flipplayer = multi::flipped[i];
|
flipplayer = multi::flipped[i];
|
||||||
multi::whereto[i] = vectodir(hpxy(multi::mdx[i], multi::mdy[i]));
|
multi::whereto[i] = vectodir(hpxy(multi::mdx[i], multi::mdy[i]));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
ignore(mdx); ignore(mdy);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(multi::actionspressed[b+pcFire] ||
|
if(multi::actionspressed[b+pcFire] ||
|
||||||
(multi::actionspressed[b+pcMoveLeft] && multi::actionspressed[b+pcMoveRight]))
|
(multi::actionspressed[b+pcMoveLeft] && multi::actionspressed[b+pcMoveRight]))
|
||||||
@ -1536,6 +1540,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
double mturn = 0, mgo = 0, mdx = 0, mdy = 0;
|
double mturn = 0, mgo = 0, mdx = 0, mdy = 0;
|
||||||
|
ignore(mdx); ignore(mdy);
|
||||||
|
|
||||||
bool shotkey = false, dropgreen = false, facemouse = false;
|
bool shotkey = false, dropgreen = false, facemouse = false;
|
||||||
if(facemouse) {
|
if(facemouse) {
|
||||||
@ -1621,6 +1626,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
|
|
||||||
playerturn[cpid] = mturn * delta / 150.0;
|
playerturn[cpid] = mturn * delta / 150.0;
|
||||||
|
|
||||||
|
#if DIM == 2
|
||||||
double mdd = hypot(mdx, mdy);
|
double mdd = hypot(mdx, mdy);
|
||||||
|
|
||||||
if(mdd > 1e-6) {
|
if(mdd > 1e-6) {
|
||||||
@ -1634,6 +1640,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
playerturn[cpid] = -atan2(h[1], h[0]);
|
playerturn[cpid] = -atan2(h[1], h[0]);
|
||||||
mgo += mdd;
|
mgo += mdd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CAP_SDL
|
#if CAP_SDL
|
||||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||||
|
@ -443,6 +443,8 @@ union SDL_Event;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DIM 3
|
||||||
|
|
||||||
#ifndef CAP_GEOMETRY
|
#ifndef CAP_GEOMETRY
|
||||||
#define CAP_GEOMETRY (!(ISMINI))
|
#define CAP_GEOMETRY (!(ISMINI))
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user