1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

RogueViz legend as HUD replacement, lists edge types too

This commit is contained in:
Zeno Rogue 2018-07-09 18:39:34 +02:00
parent 44e26cee3e
commit dd8e30e041
3 changed files with 55 additions and 28 deletions

View File

@ -335,11 +335,8 @@ void drawMobileArrow(cell *c, transmatrix V) {
bool nofps = false;
void drawStats() {
callhandlers(false, hooks_prestats);
#if CAP_ROGUEVIZ
if(rogueviz::on) return;
#endif
if(nohud || stereo::mode == stereo::sLR) return;
if(callhandlers(false, hooks_prestats)) return;
if(viewdists && sidescreen) {
distcolors[0] = forecolor;
dialog::init("");

View File

@ -949,7 +949,7 @@ namespace mapeditor {
cmode = sm::DRAW;
gamescreen(0);
drawGrid();
callhandlers(false, hooks_prestats);
if(callhandlers(false, hooks_prestats)) return;
if(!mouseout()) getcstat = '-';

View File

@ -1286,6 +1286,52 @@ vector<int> legend;
vector<cell*> named;
bool rogueviz_hud() {
if(!rogueviz::on) return false;
if(cmode & sm::DRAW) return false;
if(legend.empty()) return true;
initquickqueue();
int qet = isize(edgetypes);
if(qet == 1) qet = 0;
int legit = qet + isize(legend);
int rad = vid.radius/10;
ld x = vid.xres - rad;
for(int i=0; i<isize(legend); i++) {
int k = legend[i];
vertexdata& vd = vdata[k];
ld y = (vid.radius * (i+.5)) / legit * 2 - vid.radius + vid.yres/2;
transmatrix V = atscreenpos(x, y, vid.radius/4);
poly_outline = OUTLINE_NONE;
queuedisk(V, vd.cp, true);
poly_outline = OUTLINE_DEFAULT;
queuestr(int(x-rad), int(y), 0, rad*(svg::in?5:3)/4, vd.name, forecolor, 0, 16);
}
for(int i=0; i<qet; i++) {
auto t = edgetypes[i];
ld y = (vid.radius * (i+isize(legend)+.5)) / legit * 2 - vid.radius + vid.yres/2;
transmatrix V = atscreenpos(x, y, vid.radius/8);
poly_outline = t->color | 0xFF;
queuepolyat(V, shTriangle, 0, PPR_MONSTER_HEAD);
poly_outline = OUTLINE_DEFAULT;
queuestr(int(x-rad), int(y), 0, rad*(svg::in?5:3)/4, t->name, forecolor, 0, 16);
}
quickqueue();
return true;
}
void drawExtra() {
if(kind == kFullNet) {
@ -1309,26 +1355,6 @@ void drawExtra() {
canmove = true; items[itOrbAether] = true;
}
#if CAP_RUG
if(!rug::rugged)
#endif
for(int i=0; i<isize(legend); i++) {
int k = legend[i];
vertexdata& vd = vdata[k];
int rad = vid.radius/10;
ld x = vid.xres - rad;
ld y = (vid.radius * (i+.5)) / isize(legend) * 2 - vid.radius + vid.yres/2;
transmatrix V = atscreenpos(x, y, vid.radius/4);
poly_outline = OUTLINE_NONE;
queuedisk(V, vd.cp, true);
poly_outline = OUTLINE_DEFAULT;
queuestr(int(x-rad), int(y), 0, rad*(svg::in?5:3)/4, vd.name, forecolor, 0, 16);
}
}
void readcolor(const string& cfname) {
@ -1461,8 +1487,11 @@ void turn(int delta) {
}
void fixparam() {
if((svg::in || inHighQual) && isize(legend) && pngformat == 0) vid.xres = vid.xres * 22/16;
if(isize(legend)) vid.xcenter = vid.ycenter;
if(!legend.empty() && !nohud) {
if((svg::in || inHighQual) && pngformat == 0)
vid.xres = vid.xres * 22/16;
vid.xcenter = vid.ycenter;
}
}
#if CAP_COMMANDLINE
@ -2005,7 +2034,8 @@ auto hooks =
addHook(hooks_args, 100, readArgs) +
addHook(hooks_config, 0, [] () { tour::ss::list(rogueviz::rvtour::rvslides); }) +
#endif
addHook(clearmemory, 0, close);
addHook(clearmemory, 0, close) +
addHook(hooks_prestats, 100, rogueviz_hud);
};