mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
2D3D:: better radar in Euclidean
This commit is contained in:
parent
dec0d191a8
commit
b9fa90cafb
@ -705,6 +705,8 @@ bool drawing_usershape_on(cell *c, mapeditor::eShapegroup sg) {
|
||||
#endif
|
||||
}
|
||||
|
||||
ld max_eu_dist = 0;
|
||||
|
||||
void addradar(const transmatrix& V, char ch, color_t col, color_t outline) {
|
||||
hyperpoint h = tC0(V);
|
||||
using namespace hyperpoint_vec;
|
||||
@ -729,7 +731,8 @@ void addradar(const transmatrix& V, char ch, color_t col, color_t outline) {
|
||||
}
|
||||
else {
|
||||
ld z = h[2] + h[1]/1000000;
|
||||
if(d) h = h * (d / sightranges[geometry] / hypot_d(3, h));
|
||||
if(d > max_eu_dist) max_eu_dist = d;
|
||||
if(d) h = h * (d / (max_eu_dist + scalefactor/4) / hypot_d(3, h));
|
||||
h[1] = hypot(h[1], h[2]) / (1 + h[3]);
|
||||
if(z < 0) h[1] = -h[1];
|
||||
h[2] = 0;
|
||||
@ -6484,6 +6487,7 @@ void drawthemap() {
|
||||
|
||||
if(DIM == 3) make_clipping_planes();
|
||||
radarpoints.clear();
|
||||
if(!(cmode & sm::NORMAL)) max_eu_dist = 0;
|
||||
callhooks(hooks_drawmap);
|
||||
|
||||
frameid++;
|
||||
|
3
hud.cpp
3
hud.cpp
@ -350,6 +350,7 @@ void drawMobileArrow(int i) {
|
||||
#endif
|
||||
|
||||
bool nofps = false;
|
||||
extern ld max_eu_dist;
|
||||
|
||||
void draw_radar(bool cornermode) {
|
||||
|
||||
@ -406,7 +407,7 @@ void draw_radar(bool cornermode) {
|
||||
displaychr(int(cx + rad * r.h[0]), int(cy - rad * r.h[1]), 0, siz, r.glyph, r.color);
|
||||
}
|
||||
else {
|
||||
displaychr(int(cx + rad * r.h[0]), int(cy - rad * r.h[1]), 0, 8, r.glyph, r.color);
|
||||
displaychr(int(cx + rad * r.h[0]), int(cy - rad * r.h[1]), 0, rad * scalefactor / (max_eu_dist + scalefactor/4) * 0.8, r.glyph, r.color);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user