mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
improved the automatic rotation
This commit is contained in:
parent
4d2fc2ba76
commit
a10491f3d6
@ -293,6 +293,7 @@ void initConfig() {
|
|||||||
addsaver(conformal::bandhalf, "band width");
|
addsaver(conformal::bandhalf, "band width");
|
||||||
addsaver(conformal::bandsegment, "band segment");
|
addsaver(conformal::bandsegment, "band segment");
|
||||||
addsaver(conformal::rotation, "conformal rotation");
|
addsaver(conformal::rotation, "conformal rotation");
|
||||||
|
addsaver(conformal::do_rotate, "conformal rotation mode", 1);
|
||||||
addsaver(conformal::autoband, "automatic band");
|
addsaver(conformal::autoband, "automatic band");
|
||||||
addsaver(conformal::autobandhistory, "automatic band history");
|
addsaver(conformal::autobandhistory, "automatic band history");
|
||||||
addsaver(conformal::dospiral, "do spiral");
|
addsaver(conformal::dospiral, "do spiral");
|
||||||
@ -518,10 +519,12 @@ void loadOldConfig(FILE *f) {
|
|||||||
conformal::autobandhistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv;
|
conformal::autobandhistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv;
|
||||||
|
|
||||||
aa=conformal::autoband; bb=conformal::autobandhistory; cc=conformal::dospiral;
|
aa=conformal::autoband; bb=conformal::autobandhistory; cc=conformal::dospiral;
|
||||||
|
int crot;
|
||||||
err=fscanf(f, "%d%d%d%d%d%d",
|
err=fscanf(f, "%d%d%d%d%d%d",
|
||||||
&conformal::bandhalf, &conformal::bandsegment, &conformal::rotation,
|
&conformal::bandhalf, &conformal::bandsegment, &crot,
|
||||||
&aa, &bb, &cc);
|
&aa, &bb, &cc);
|
||||||
conformal::autoband = aa; conformal::autobandhistory = bb; conformal::dospiral = cc;
|
conformal::autoband = aa; conformal::autobandhistory = bb; conformal::dospiral = cc;
|
||||||
|
conformal::rotation = crot * 90;
|
||||||
|
|
||||||
err=fscanf(f, "%d", &polygonal::maxcoef);
|
err=fscanf(f, "%d", &polygonal::maxcoef);
|
||||||
if(polygonal::maxcoef < 0) polygonal::maxcoef = 0;
|
if(polygonal::maxcoef < 0) polygonal::maxcoef = 0;
|
||||||
|
@ -272,7 +272,8 @@ namespace conformal {
|
|||||||
ld lvspeed = 1;
|
ld lvspeed = 1;
|
||||||
int bandhalf = 200;
|
int bandhalf = 200;
|
||||||
int bandsegment = 16000;
|
int bandsegment = 16000;
|
||||||
int rotation = 0;
|
ld rotation = 0;
|
||||||
|
int do_rotate = 1;
|
||||||
bool autoband = false;
|
bool autoband = false;
|
||||||
bool autobandhistory = false;
|
bool autobandhistory = false;
|
||||||
bool dospiral = true;
|
bool dospiral = true;
|
||||||
@ -366,7 +367,7 @@ namespace conformal {
|
|||||||
hyperpoint next = shmup::calc_relative_matrix(v[j+1]->base, v[j]->base->master) *
|
hyperpoint next = shmup::calc_relative_matrix(v[j+1]->base, v[j]->base->master) *
|
||||||
v[j+1]->at * C0;
|
v[j+1]->at * C0;
|
||||||
|
|
||||||
View = spin(M_PI/2 * rotation) * xpush(-(phase-ph) * hdist(now, next)) * View;
|
View = spin(M_PI/180 * rotation) * xpush(-(phase-ph) * hdist(now, next)) * View;
|
||||||
playermoved = false;
|
playermoved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +571,7 @@ namespace conformal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void model_menu() {
|
void model_menu() {
|
||||||
cmode = sm::SIDE | sm::MAYDARK;
|
cmode = sm::SIDE | sm::MAYDARK | sm::CENTER;
|
||||||
gamescreen(0);
|
gamescreen(0);
|
||||||
dialog::init(XLAT("models of hyperbolic geometry"));
|
dialog::init(XLAT("models of hyperbolic geometry"));
|
||||||
for(int i=0; i<mdGUARD; i++) {
|
for(int i=0; i<mdGUARD; i++) {
|
||||||
@ -581,6 +582,10 @@ namespace conformal {
|
|||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
|
|
||||||
|
dialog::addBoolItem(XLAT("rotation"), do_rotate == 2, 'r');
|
||||||
|
if(do_rotate == 0) dialog::lastItem().value = XLAT("NEVER");
|
||||||
|
dialog::lastItem().value += " " + its(rotation) + "°";
|
||||||
|
|
||||||
// if(pmodel == mdBand && sphere)
|
// if(pmodel == mdBand && sphere)
|
||||||
dialog::addSelItem(XLAT("scale factor"), fts(vid.scale), 'z');
|
dialog::addSelItem(XLAT("scale factor"), fts(vid.scale), 'z');
|
||||||
|
|
||||||
@ -676,7 +681,15 @@ namespace conformal {
|
|||||||
}
|
}
|
||||||
else if(sym == 'n' && pmodel == mdPolynomial)
|
else if(sym == 'n' && pmodel == mdPolynomial)
|
||||||
dialog::editNumber(polygonal::coefid, 0, polygonal::MSI-1, 1, 0, XLAT("which coefficient"), "");
|
dialog::editNumber(polygonal::coefid, 0, polygonal::MSI-1, 1, 0, XLAT("which coefficient"), "");
|
||||||
else if(sym == 'r') rotation += (shiftmul > 0 ? 1:3);
|
else if(sym == 'r') {
|
||||||
|
if(rotation < 0) rotation = 0;
|
||||||
|
dialog::editNumber(rotation, 0, 360, 90, 0, XLAT("rotation"),
|
||||||
|
"This controls the automatic rotation of the world. "
|
||||||
|
"It affects the line animation in the history mode, and "
|
||||||
|
"lands which have a special direction. Note that if finding this special direction is a part of the puzzle, "
|
||||||
|
"it works only in the cheat mode.");
|
||||||
|
dialog::dialogflags |= sm::CENTER;
|
||||||
|
}
|
||||||
else if(doexiton(sym, uni)) popScreen();
|
else if(doexiton(sym, uni)) popScreen();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
13
dialogs.cpp
13
dialogs.cpp
@ -697,6 +697,13 @@ namespace dialog {
|
|||||||
addItem(sphere ? "towards orthographic" : "towards Gans model", 'o');
|
addItem(sphere ? "towards orthographic" : "towards Gans model", 'o');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ne.editwhat == &conformal::rotation) {
|
||||||
|
addBreak(100);
|
||||||
|
addBoolItem("line animation only", conformal::do_rotate == 0, 'n');
|
||||||
|
addBoolItem("gravity lands", conformal::do_rotate == 1, 'g');
|
||||||
|
addBoolItem("all directional lands", conformal::do_rotate == 2, 'd');
|
||||||
|
}
|
||||||
|
|
||||||
if(ne.editwhat == &ne.intbuf && ne.intval == &sightrange && cheater)
|
if(ne.editwhat == &ne.intbuf && ne.intval == &sightrange && cheater)
|
||||||
addBoolItem("overgenerate", overgenerate, 'o');
|
addBoolItem("overgenerate", overgenerate, 'o');
|
||||||
|
|
||||||
@ -747,6 +754,12 @@ namespace dialog {
|
|||||||
ne.inverse_scale(d * (ne.scale(ne.vmax) - ne.scale(ne.vmin)) + ne.scale(ne.vmin));
|
ne.inverse_scale(d * (ne.scale(ne.vmax) - ne.scale(ne.vmin)) + ne.scale(ne.vmin));
|
||||||
affect('v');
|
affect('v');
|
||||||
}
|
}
|
||||||
|
else if(uni == 'n' && ne.editwhat == &conformal::rotation)
|
||||||
|
conformal::do_rotate = 0;
|
||||||
|
else if(uni == 'g' && ne.editwhat == &conformal::rotation)
|
||||||
|
conformal::do_rotate = 1;
|
||||||
|
else if(uni == 'd' && ne.editwhat == &conformal::rotation)
|
||||||
|
conformal::do_rotate = 2;
|
||||||
else if(uni == 'o' && ne.editwhat == &ne.intbuf && ne.intval == &sightrange && cheater)
|
else if(uni == 'o' && ne.editwhat == &ne.intbuf && ne.intval == &sightrange && cheater)
|
||||||
overgenerate = !overgenerate;
|
overgenerate = !overgenerate;
|
||||||
else if(uni == 'o' && ne.editwhat == &vid.linewidth)
|
else if(uni == 'o' && ne.editwhat == &vid.linewidth)
|
||||||
|
@ -4816,15 +4816,16 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
|
|
||||||
if(isGravityLand(cwt.c->land)) {
|
if(isGravityLand(cwt.c->land)) {
|
||||||
if(cwt.c->land == laDungeon) rev = true;
|
if(cwt.c->land == laDungeon) rev = true;
|
||||||
|
if(conformal::do_rotate >= 1)
|
||||||
if(!straightDownSeek || edgeDepth(c) < edgeDepth(straightDownSeek)) {
|
if(!straightDownSeek || edgeDepth(c) < edgeDepth(straightDownSeek)) {
|
||||||
usethis = true;
|
usethis = true;
|
||||||
spd = cwt.c->landparam / 10.;
|
spd = cwt.c->landparam / 10.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c->master->alt && cwt.c->master->alt &&
|
if(c->master->alt && cwt.c->master->alt &&
|
||||||
(cwt.c->land == laMountain ||
|
(cwt.c->land == laMountain ||
|
||||||
(pmodel &&
|
(conformal::do_rotate >= 2 &&
|
||||||
(cwt.c->land == laTemple || cwt.c->land == laWhirlpool ||
|
(cwt.c->land == laTemple || cwt.c->land == laWhirlpool ||
|
||||||
(cheater && (cwt.c->land == laClearing || cwt.c->land == laCaribbean ||
|
(cheater && (cwt.c->land == laClearing || cwt.c->land == laCaribbean ||
|
||||||
cwt.c->land == laCamelot || cwt.c->land == laPalace)))
|
cwt.c->land == laCamelot || cwt.c->land == laPalace)))
|
||||||
@ -4837,7 +4838,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pmodel && cwt.c->land == laOcean && cwt.c->landparam < 25) {
|
if(conformal::do_rotate >= 2 && cwt.c->land == laOcean && cwt.c->landparam < 25) {
|
||||||
if(!straightDownSeek || coastval(c, laOcean) < coastval(straightDownSeek, laOcean)) {
|
if(!straightDownSeek || coastval(c, laOcean) < coastval(straightDownSeek, laOcean)) {
|
||||||
usethis = true;
|
usethis = true;
|
||||||
spd = cwt.c->landparam / 10;
|
spd = cwt.c->landparam / 10;
|
||||||
@ -4850,7 +4851,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
downspin = atan2(VC0[1], VC0[0]);
|
downspin = atan2(VC0[1], VC0[0]);
|
||||||
downspin -= M_PI/2;
|
downspin -= M_PI/2;
|
||||||
if(rev) downspin += M_PI;
|
if(rev) downspin += M_PI;
|
||||||
downspin += M_PI/2 * (conformal::rotation%4);
|
downspin += M_PI/180 * conformal::rotation;
|
||||||
while(downspin < -M_PI) downspin += 2*M_PI;
|
while(downspin < -M_PI) downspin += 2*M_PI;
|
||||||
while(downspin > +M_PI) downspin -= 2*M_PI;
|
while(downspin > +M_PI) downspin -= 2*M_PI;
|
||||||
downspin = downspin * min(spd, (double)1);
|
downspin = downspin * min(spd, (double)1);
|
||||||
|
3
hyper.h
3
hyper.h
@ -897,7 +897,8 @@ namespace conformal {
|
|||||||
extern vector<pair<cell*, eItem> > findhistory;
|
extern vector<pair<cell*, eItem> > findhistory;
|
||||||
extern vector<cell*> movehistory;
|
extern vector<cell*> movehistory;
|
||||||
extern bool includeHistory;
|
extern bool includeHistory;
|
||||||
extern int rotation;
|
extern ld rotation;
|
||||||
|
extern int do_rotate;
|
||||||
extern bool autoband;
|
extern bool autoband;
|
||||||
extern bool autobandhistory;
|
extern bool autobandhistory;
|
||||||
extern bool dospiral;
|
extern bool dospiral;
|
||||||
|
@ -549,11 +549,9 @@ void centerpc(ld aspd) {
|
|||||||
if(vid.sspeed >= 4.99) aspd = 1000;
|
if(vid.sspeed >= 4.99) aspd = 1000;
|
||||||
DEBB(DF_GRAPH, (debugfile,"center pc\n"));
|
DEBB(DF_GRAPH, (debugfile,"center pc\n"));
|
||||||
hyperpoint H = ypush(-vid.yshift) * sphereflip * tC0(cwtV);
|
hyperpoint H = ypush(-vid.yshift) * sphereflip * tC0(cwtV);
|
||||||
if(H[0] == 0 && H[1] == 0) {
|
ld R = H[0] == 0 && H[1] == 0 ? 0 : hdist0(H); // = sqrt(H[0] * H[0] + H[1] * H[1]);
|
||||||
return; // either already centered or direction unknown
|
|
||||||
}
|
|
||||||
ld R = 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
|
||||||
/* if(playerfoundL && playerfoundR) {
|
/* if(playerfoundL && playerfoundR) {
|
||||||
|
|
||||||
} */
|
} */
|
||||||
|
@ -6834,3 +6834,17 @@ S("The larger the number, the more twisted it is.",
|
|||||||
// parameter for concave barrel
|
// parameter for concave barrel
|
||||||
S("Controls the inner radius.", "Określa promień wewnętrzny.")
|
S("Controls the inner radius.", "Określa promień wewnętrzny.")
|
||||||
|
|
||||||
|
// improved rotation
|
||||||
|
S(
|
||||||
|
"This controls the automatic rotation of the world. "
|
||||||
|
"It affects the line animation in the history mode, and "
|
||||||
|
"lands which have a special direction. Note that if finding this special direction is a part of the puzzle, "
|
||||||
|
"it works only in the cheat mode.",
|
||||||
|
|
||||||
|
"To ustawienie steruje automatycznym obracaniem świata. "
|
||||||
|
"Ma wpływ na animację linii (tryb historii) i "
|
||||||
|
"krainy ze szczególnym kierunkiem. Jeśli znalezienie "
|
||||||
|
"tego szczególnego kierunku jest częścią zadania gracza, "
|
||||||
|
"opcja ta działa tylko w trybie oszusta."
|
||||||
|
);
|
||||||
|
S("NEVER", "NIGDY")
|
||||||
|
@ -265,6 +265,7 @@ void initgame() {
|
|||||||
lastsafety = gold();
|
lastsafety = gold();
|
||||||
bfs();
|
bfs();
|
||||||
checkmove();
|
checkmove();
|
||||||
|
playermoved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool havesave = true;
|
bool havesave = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user