mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
3d:: radar feature
This commit is contained in:
parent
b48cf6eba1
commit
5871a4b208
@ -138,6 +138,7 @@ void initConfig() {
|
||||
addsaver(fontscale, "fontscale", 100);
|
||||
|
||||
addsaver(vid.mobilecompasssize, "mobile compass size", 0); // ISMOBILE || ISPANDORA ? 30 : 0);
|
||||
addsaver(vid.radarsize, "radarsize size", 120);
|
||||
addsaver(vid.axes, "movement help", 1);
|
||||
addsaver(vid.shifttarget, "shift-targetting", 2);
|
||||
addsaver(vid.steamscore, "scores to Steam", 1);
|
||||
@ -1399,6 +1400,12 @@ void show3D() {
|
||||
dialog::addSelItem(XLAT("model used"), conformal::get_model_name(pmodel), 'M');
|
||||
}
|
||||
if(DIM == 3) add_edit_fov('f');
|
||||
if(DIM == 3) {
|
||||
dialog::addSelItem(XLAT("radar size"), fts3(vid.radarsize), 'r');
|
||||
dialog::add_action([] () {
|
||||
dialog::editNumber(vid.radarsize, 0, 360, 15, 90, "", "");
|
||||
});
|
||||
}
|
||||
|
||||
dialog::addBreak(50);
|
||||
#if CAP_RUG
|
||||
|
40
graph.cpp
40
graph.cpp
@ -632,7 +632,24 @@ bool drawing_usershape_on(cell *c, mapeditor::eShapegroup sg) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int pticks, bool hidden) {
|
||||
hyperpoint makeradar(transmatrix V) {
|
||||
hyperpoint h = tC0(V);
|
||||
using namespace hyperpoint_vec;
|
||||
h = h * (hdist0(h) / sightranges[geometry] / hypot_d(3, h));
|
||||
return h;
|
||||
}
|
||||
|
||||
color_t kind_outline(eItem it) {
|
||||
int k = itemclass(it);
|
||||
if(k == IC_TREASURE)
|
||||
return OUTLINE_TREASURE;
|
||||
else if(k == IC_ORB)
|
||||
return OUTLINE_ORB;
|
||||
else
|
||||
return OUTLINE_OTHER;
|
||||
}
|
||||
|
||||
bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int pticks, bool hidden) {
|
||||
#if !CAP_SHAPES
|
||||
return it;
|
||||
#else
|
||||
@ -661,15 +678,12 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int pticks,
|
||||
it == itRevolver ? &shGun :
|
||||
NULL;
|
||||
|
||||
if(c && doHighlight()) {
|
||||
int k = itemclass(it);
|
||||
if(k == IC_TREASURE)
|
||||
poly_outline = OUTLINE_TREASURE;
|
||||
else if(k == IC_ORB)
|
||||
poly_outline = OUTLINE_ORB;
|
||||
else
|
||||
poly_outline = OUTLINE_OTHER;
|
||||
}
|
||||
if(c && doHighlight())
|
||||
poly_outline = kind_outline(it);
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(c && DIM == 3) radarpoints.emplace_back(radarpoint{makeradar(V), iinf[it].glyph, icol, kind_outline(it)});
|
||||
#endif
|
||||
|
||||
transmatrix Vit = V;
|
||||
if(DIM == 3 && c) Vit = rgpushxto0(tC0(V));
|
||||
@ -843,6 +857,11 @@ void drawTerraWarrior(const transmatrix& V, int t, int hp, double footphase) {
|
||||
|
||||
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase) {
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(DIM == 3 && m != moPlayer)
|
||||
radarpoints.emplace_back(radarpoint{makeradar(V), minf[m].glyph, col, isFriendly(m) ? 0x00FF00FF : 0xFF0000FF });
|
||||
#endif
|
||||
|
||||
#if CAP_SHAPES
|
||||
char xch = minf[m].glyph;
|
||||
|
||||
@ -5738,6 +5757,7 @@ void precise_mouseover() {
|
||||
|
||||
void drawthemap() {
|
||||
|
||||
radarpoints.clear();
|
||||
callhooks(hooks_drawmap);
|
||||
|
||||
frameid++;
|
||||
|
43
hud.cpp
43
hud.cpp
@ -3,6 +3,8 @@
|
||||
|
||||
namespace hr {
|
||||
|
||||
vector<radarpoint> radarpoints;
|
||||
|
||||
purehookset hooks_stats;
|
||||
|
||||
int monsterclass(eMonster m) {
|
||||
@ -346,6 +348,37 @@ void drawMobileArrow(int i) {
|
||||
|
||||
bool nofps = false;
|
||||
|
||||
void draw_radar(bool cornermode) {
|
||||
dynamicval<eGeometry> g(geometry, gEuclid);
|
||||
initquickqueue();
|
||||
current_display->set_projection(0, false);
|
||||
int rad = vid.radarsize;
|
||||
|
||||
ld cx = cornermode ? rad+2 : vid.xres-rad-2;
|
||||
ld cy = vid.yres-rad-2 - vid.fsize;
|
||||
for(int i=0; i<360; i++)
|
||||
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);
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
quickqueue();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void drawStats() {
|
||||
if(nohud || vid.stereo_mode == sLR) return;
|
||||
if(callhandlers(false, hooks_prestats)) return;
|
||||
@ -362,6 +395,14 @@ void drawStats() {
|
||||
|
||||
calcparam();
|
||||
current_display->set_projection(0, false);
|
||||
|
||||
bool cornermode = (vid.xres > vid.yres * 85/100 && vid.yres > vid.xres * 85/100);
|
||||
|
||||
if(DIM == 3 && vid.radarsize > 0 && !peace::on && playermoved && vid.sspeed > -5 && vid.yshift == 0)
|
||||
#if CAP_RACING
|
||||
if(!racing::on)
|
||||
#endif
|
||||
draw_radar(cornermode);
|
||||
|
||||
if(haveMobileCompass()) {
|
||||
initquickqueue();
|
||||
@ -386,7 +427,7 @@ void drawStats() {
|
||||
#else
|
||||
{}
|
||||
#endif
|
||||
else if(vid.xres > vid.yres * 85/100 && vid.yres > vid.xres * 85/100) {
|
||||
else if(cornermode) {
|
||||
int bycorner[4];
|
||||
for(int u=0; u<4; u++) bycorner[u] = 0;
|
||||
for(int i=0; i<glyphs; i++) if(ikappear(i) && (glyphflags(i) & GLYPH_INSQUARE))
|
||||
|
12
hyper.h
12
hyper.h
@ -1041,10 +1041,20 @@ extern reaction_t help_delegate;
|
||||
|
||||
enum eStereo { sOFF, sAnaglyph, sLR, sODS };
|
||||
|
||||
struct radarpoint {
|
||||
hyperpoint h;
|
||||
char glyph;
|
||||
color_t color;
|
||||
color_t line;
|
||||
};
|
||||
|
||||
extern vector<radarpoint> radarpoints;
|
||||
|
||||
struct videopar {
|
||||
ld scale, alpha, sspeed, mspeed, yshift, camera_angle;
|
||||
ld ballangle, ballproj, euclid_to_sphere, twopoint_param, stretch, binary_width, fixed_facing_dir;
|
||||
int mobilecompasssize;
|
||||
int radarsize; // radar for 3D geometries
|
||||
int aurastr, aurasmoothen;
|
||||
bool fixed_facing;
|
||||
|
||||
@ -2471,7 +2481,7 @@ namespace inv {
|
||||
void show();
|
||||
}
|
||||
|
||||
bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks, bool hidden);
|
||||
bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int ticks, bool hidden);
|
||||
|
||||
void initquickqueue();
|
||||
void quickqueue();
|
||||
|
Loading…
Reference in New Issue
Block a user