mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
face/edge/vertex centering
This commit is contained in:
parent
dc2658a98c
commit
650604227a
@ -8,6 +8,12 @@
|
|||||||
#include "hyper.h"
|
#include "hyper.h"
|
||||||
namespace hr {
|
namespace hr {
|
||||||
|
|
||||||
|
#if HDR
|
||||||
|
enum eCentering { face, edge, vertex };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EX eCentering centering;
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
struct supersaver {
|
struct supersaver {
|
||||||
string name;
|
string name;
|
||||||
@ -648,6 +654,8 @@ EX void initConfig() {
|
|||||||
addsaver(bright, "bright");
|
addsaver(bright, "bright");
|
||||||
addsaver(cblind, "cblind");
|
addsaver(cblind, "cblind");
|
||||||
|
|
||||||
|
addsaverenum(centering, "centering");
|
||||||
|
|
||||||
callhooks(hooks_configfile);
|
callhooks(hooks_configfile);
|
||||||
|
|
||||||
#if CAP_CONFIG
|
#if CAP_CONFIG
|
||||||
|
@ -566,7 +566,9 @@ void cheat_move(char c) {
|
|||||||
else if(c == 'r') cheat(), cwt += rev;
|
else if(c == 'r') cheat(), cwt += rev;
|
||||||
else if(c == 'm') cheat(), cwt += wmirror;
|
else if(c == 'm') cheat(), cwt += wmirror;
|
||||||
else if(c == 'z') cheat(), cwt.spin = 0, cwt.mirrored = false;
|
else if(c == 'z') cheat(), cwt.spin = 0, cwt.mirrored = false;
|
||||||
else if(c == 'F') fullcenter();
|
else if(c == 'F') centering = eCentering::face, fullcenter();
|
||||||
|
else if(c == 'E') centering = eCentering::edge, fullcenter();
|
||||||
|
else if(c == 'V') centering = eCentering::vertex, fullcenter();
|
||||||
else if(c == 'a') cheat(), history::save_end();
|
else if(c == 'a') cheat(), history::save_end();
|
||||||
else println(hlog, "unknown move command: ", c);
|
else println(hlog, "unknown move command: ", c);
|
||||||
}
|
}
|
||||||
|
18
hypgraph.cpp
18
hypgraph.cpp
@ -1442,10 +1442,22 @@ EX void resetview() {
|
|||||||
View = iddspin(cwt.at, cwt.spin);
|
View = iddspin(cwt.at, cwt.spin);
|
||||||
if(!flipplayer) View = pispin * View;
|
if(!flipplayer) View = pispin * View;
|
||||||
if(cwt.mirrored) View = Mirror * View;
|
if(cwt.mirrored) View = Mirror * View;
|
||||||
|
|
||||||
|
if(centering) {
|
||||||
|
hyperpoint vl = View * get_corner_position(cwt.at, cwt.spin);
|
||||||
|
hyperpoint vr = View * get_corner_position(cwt.at, (cwt.spin+1) % cwt.at->type);
|
||||||
|
|
||||||
|
hyperpoint vm = (centering == eCentering::edge) ? mid(vl, vr) : vl;
|
||||||
|
|
||||||
|
transmatrix rm = gpushxto0(vm);
|
||||||
|
|
||||||
|
View = spintox(rm*vr) * rm * View;
|
||||||
|
}
|
||||||
|
|
||||||
if(GDIM == 2) View = spin(M_PI + vid.fixed_facing_dir * degree) * View;
|
if(GDIM == 2) View = spin(M_PI + vid.fixed_facing_dir * degree) * View;
|
||||||
if(GDIM == 3 && !prod) View = cspin(0, 2, M_PI/2) * View;
|
if(GDIM == 3 && !prod) View = cspin(0, 2, M_PI/2) * View;
|
||||||
if(prod) NLP = cspin(0, 2, M_PI/2);
|
if(prod) NLP = cspin(0, 2, M_PI/2);
|
||||||
if(cheater && eqmatrix(View, lView)) {
|
if(cheater && eqmatrix(View, lView) && !centering) {
|
||||||
View = Id;
|
View = Id;
|
||||||
static ld cyc = 0;
|
static ld cyc = 0;
|
||||||
cyc += 90 * degree;
|
cyc += 90 * degree;
|
||||||
@ -1483,10 +1495,10 @@ EX void fullcenter() {
|
|||||||
bfs();
|
bfs();
|
||||||
resetview();
|
resetview();
|
||||||
drawthemap();
|
drawthemap();
|
||||||
centerpc(INF);
|
if(!centering) centerpc(INF);
|
||||||
centerover = cwt.at;
|
centerover = cwt.at;
|
||||||
}
|
}
|
||||||
playermoved = true;
|
playermoved = !centering;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix screenpos(ld x, ld y) {
|
transmatrix screenpos(ld x, ld y) {
|
||||||
|
@ -453,6 +453,23 @@ EX void menu() {
|
|||||||
|
|
||||||
dialog::addBoolItem_action_neg(XLAT("hide the player"), mapeditor::drawplayer, 'H');
|
dialog::addBoolItem_action_neg(XLAT("hide the player"), mapeditor::drawplayer, 'H');
|
||||||
|
|
||||||
|
if(WDIM == 2) {
|
||||||
|
dialog::addItem(XLAT("centering"), 'x');
|
||||||
|
dialog::add_action([] {
|
||||||
|
dialog::editNumber(vid.fixed_facing_dir, 0, 360, 15, 90, XLAT("centering"),
|
||||||
|
XLAT("You can pick the angle. Note: the direction the PC is facing matters."));
|
||||||
|
dialog::reaction = fullcenter;
|
||||||
|
dialog::extra_options = [] () {
|
||||||
|
dialog::addBoolItem(XLAT("face"), centering == eCentering::face, 'F');
|
||||||
|
dialog::add_action([] { centering = eCentering::face; fullcenter(); });
|
||||||
|
dialog::addBoolItem(XLAT("edge"), centering == eCentering::edge, 'E');
|
||||||
|
dialog::add_action([] { centering = eCentering::edge; fullcenter(); });
|
||||||
|
dialog::addBoolItem(XLAT("vertex"), centering == eCentering::vertex, 'V');
|
||||||
|
dialog::add_action([] { centering = eCentering::vertex; fullcenter(); });
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dialog::addItem(XLAT("colors & aura"), 'c');
|
dialog::addItem(XLAT("colors & aura"), 'c');
|
||||||
dialog::add_action_push(show_color_dialog);
|
dialog::add_action_push(show_color_dialog);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user