mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-12 02:10:34 +00:00
2d3d:: ASCII mini-map replaces the radar
This commit is contained in:
parent
dea2073714
commit
5c65ba9a7f
29
graph.cpp
29
graph.cpp
@ -696,7 +696,16 @@ void addradar(const transmatrix& V, char ch, color_t col, color_t outline) {
|
||||
using namespace hyperpoint_vec;
|
||||
ld d = hdist0(h);
|
||||
if(d > sightranges[geometry]) return;
|
||||
h = h * (d / sightranges[geometry] / hypot_d(3, h));
|
||||
if(WDIM == 3)
|
||||
h = h * (d / sightranges[geometry] / hypot_d(3, h));
|
||||
else {
|
||||
ld z = h[2] + h[1]/1000000;
|
||||
h[1] = hypot(h[1], h[2]) / (1 + h[3]);
|
||||
// we add h[1]/1000000 so that it also works for h[2] == 0
|
||||
if(z < 0) h[1] = -h[1];
|
||||
h[0] = h[0] / (1 + h[3]);
|
||||
h[2] = 0;
|
||||
}
|
||||
radarpoints.emplace_back(radarpoint{h, ch, col, outline});
|
||||
}
|
||||
|
||||
@ -2262,7 +2271,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col) {
|
||||
|
||||
if(isDragon(c->monst) && c->stuntime == 0) col = 0xFF6000;
|
||||
|
||||
if(DIM == 3 && among(c->monst, moIvyRoot, moWorm, moHexSnake, moDragonHead, moKrakenH))
|
||||
if(DIM == 3)
|
||||
addradar(Vparam, minf[m].glyph, col, isFriendly(m) ? 0x00FF00FF : 0xFF0000FF);
|
||||
|
||||
transmatrix Vb0 = Vb;
|
||||
@ -4653,6 +4662,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
#endif
|
||||
|
||||
bool error = false;
|
||||
bool onradar = true;
|
||||
|
||||
#if CAP_SHAPES
|
||||
chasmg = chasmgraph(c);
|
||||
@ -5615,7 +5625,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
#endif
|
||||
}
|
||||
|
||||
else {
|
||||
if(wmascii || (WDIM == 2 && GDIM == 3)) {
|
||||
if(c->wall == waNone || isWatery(c)) asciicol = fcol;
|
||||
if(c->wall == waBoat) asciicol = 0xC06000;
|
||||
|
||||
if(c->wall == waArrowTrap)
|
||||
asciicol = trapcol[c->wparam & 3];
|
||||
if(c->wall == waFireTrap)
|
||||
@ -5631,7 +5644,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
else if(ch == '@') asciicol = minecolors[mines%10];
|
||||
}
|
||||
if(!(it || c->monst || c->cpdist == 0)) error = true;
|
||||
if(wmascii && !(it || c->monst || c->cpdist == 0)) error = true;
|
||||
}
|
||||
|
||||
#if CAP_SHAPES
|
||||
@ -5735,14 +5748,16 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
Vboat = &(Vboat0 = *Vboat * ddspin(c, i) * xpush(-.13));
|
||||
}
|
||||
|
||||
error |= drawItemType(it, c, *Vboat, icol, ticks, hidden);
|
||||
if(drawItemType(it, c, *Vboat, icol, ticks, hidden)) error = true, onradar = false;
|
||||
}
|
||||
|
||||
if(true) {
|
||||
#if CAP_SHAPES
|
||||
int q = ptds.size();
|
||||
#endif
|
||||
error |= drawMonster(V, ctype, c, moncol);
|
||||
bool m = drawMonster(V, ctype, c, moncol);
|
||||
if(m) error = true;
|
||||
if(m || c->monst) onradar = false;
|
||||
#if CAP_SHAPES
|
||||
if(Vboat != &V && Vboat != &Vboat0 && q != isize(ptds)) {
|
||||
if(WDIM == 2 && GDIM == 3)
|
||||
@ -5843,6 +5858,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
|
||||
if(vid.grid || c->land == laAsteroids) draw_grid_at(c, V);
|
||||
|
||||
if(onradar) addradar(V, ch, darkenedby(asciicol, darken), 0);
|
||||
#endif
|
||||
|
||||
if(!euclid) {
|
||||
|
24
hud.cpp
24
hud.cpp
@ -366,16 +366,18 @@ void draw_radar(bool cornermode) {
|
||||
curvepoint(atscreenpos(cx-cos(i * degree)*rad, cy-sin(i*degree)*rad, 1) * C0);
|
||||
queuecurve(0xFFFFFFFF, 0x000000FF, PPR::ZERO);
|
||||
|
||||
for(int i=0; i<360; i++)
|
||||
curvepoint(atscreenpos(cx-cos(i * degree)*rad, cy-sin(i*degree)*rad/3, 1) * C0);
|
||||
queuecurve(0xFF0000FF, 0x200000FF, PPR::ZERO);
|
||||
if(WDIM == 3) {
|
||||
for(int i=0; i<360; i++)
|
||||
curvepoint(atscreenpos(cx-cos(i * degree)*rad, cy-sin(i*degree)*rad/3, 1) * C0);
|
||||
queuecurve(0xFF0000FF, 0x200000FF, PPR::ZERO);
|
||||
|
||||
curvepoint(atscreenpos(cx-sin(vid.fov*degree/2)*rad, cy-sin(vid.fov*degree/2)*rad/3, 1) * C0);
|
||||
curvepoint(atscreenpos(cx, cy, 1) * C0);
|
||||
curvepoint(atscreenpos(cx+sin(vid.fov*degree/2)*rad, cy-sin(vid.fov*degree/2)*rad/3, 1) * C0);
|
||||
queuecurve(0xFF8000FF, 0, PPR::ZERO);
|
||||
curvepoint(atscreenpos(cx-sin(vid.fov*degree/2)*rad, cy-sin(vid.fov*degree/2)*rad/3, 1) * C0);
|
||||
curvepoint(atscreenpos(cx, cy, 1) * C0);
|
||||
curvepoint(atscreenpos(cx+sin(vid.fov*degree/2)*rad, cy-sin(vid.fov*degree/2)*rad/3, 1) * C0);
|
||||
queuecurve(0xFF8000FF, 0, PPR::ZERO);
|
||||
}
|
||||
|
||||
for(auto& r: radarpoints) {
|
||||
if(WDIM == 3) for(auto& r: radarpoints) {
|
||||
queueline(atscreenpos(cx+rad * r.h[0], cy - rad * r.h[2]/3 + rad * r.h[1]*2/3, 0)*C0, atscreenpos(cx+rad*r.h[0], cy - rad*r.h[2]/3, 0)*C0, r.line, -1);
|
||||
}
|
||||
|
||||
@ -383,7 +385,11 @@ void draw_radar(bool cornermode) {
|
||||
glflush();
|
||||
|
||||
for(auto& r: radarpoints)
|
||||
displaychr(int(cx + rad * r.h[0]), int(cy - rad * r.h[2]/3 + rad * r.h[1]*2/3), 0, 8, r.glyph, r.color);
|
||||
if(WDIM == 3) displaychr(int(cx + rad * r.h[0]), int(cy - rad * r.h[2]/3 + rad * r.h[1]*2/3), 0, 8, r.glyph, r.color);
|
||||
else {
|
||||
int siz = 1/(1+r.h[3]) * scalefactor * current_display->radius / (inHighQual ? 10 : 6);
|
||||
displaychr(int(cx + rad * r.h[0]), int(cy - rad * r.h[1]), 0, siz, r.glyph, r.color);
|
||||
}
|
||||
}
|
||||
|
||||
void drawStats() {
|
||||
|
Loading…
Reference in New Issue
Block a user