mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-10-31 19:36:16 +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(fontscale, "fontscale", 100);
|
||||||
|
|
||||||
addsaver(vid.mobilecompasssize, "mobile compass size", 0); // ISMOBILE || ISPANDORA ? 30 : 0);
|
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.axes, "movement help", 1);
|
||||||
addsaver(vid.shifttarget, "shift-targetting", 2);
|
addsaver(vid.shifttarget, "shift-targetting", 2);
|
||||||
addsaver(vid.steamscore, "scores to Steam", 1);
|
addsaver(vid.steamscore, "scores to Steam", 1);
|
||||||
@ -1399,6 +1400,12 @@ void show3D() {
|
|||||||
dialog::addSelItem(XLAT("model used"), conformal::get_model_name(pmodel), 'M');
|
dialog::addSelItem(XLAT("model used"), conformal::get_model_name(pmodel), 'M');
|
||||||
}
|
}
|
||||||
if(DIM == 3) add_edit_fov('f');
|
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);
|
dialog::addBreak(50);
|
||||||
#if CAP_RUG
|
#if CAP_RUG
|
||||||
|
40
graph.cpp
40
graph.cpp
@ -632,7 +632,24 @@ bool drawing_usershape_on(cell *c, mapeditor::eShapegroup sg) {
|
|||||||
#endif
|
#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
|
#if !CAP_SHAPES
|
||||||
return it;
|
return it;
|
||||||
#else
|
#else
|
||||||
@ -661,15 +678,12 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int pticks,
|
|||||||
it == itRevolver ? &shGun :
|
it == itRevolver ? &shGun :
|
||||||
NULL;
|
NULL;
|
||||||
|
|
||||||
if(c && doHighlight()) {
|
if(c && doHighlight())
|
||||||
int k = itemclass(it);
|
poly_outline = kind_outline(it);
|
||||||
if(k == IC_TREASURE)
|
|
||||||
poly_outline = OUTLINE_TREASURE;
|
#if MAXMDIM >= 4
|
||||||
else if(k == IC_ORB)
|
if(c && DIM == 3) radarpoints.emplace_back(radarpoint{makeradar(V), iinf[it].glyph, icol, kind_outline(it)});
|
||||||
poly_outline = OUTLINE_ORB;
|
#endif
|
||||||
else
|
|
||||||
poly_outline = OUTLINE_OTHER;
|
|
||||||
}
|
|
||||||
|
|
||||||
transmatrix Vit = V;
|
transmatrix Vit = V;
|
||||||
if(DIM == 3 && c) Vit = rgpushxto0(tC0(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) {
|
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
|
#if CAP_SHAPES
|
||||||
char xch = minf[m].glyph;
|
char xch = minf[m].glyph;
|
||||||
|
|
||||||
@ -5738,6 +5757,7 @@ void precise_mouseover() {
|
|||||||
|
|
||||||
void drawthemap() {
|
void drawthemap() {
|
||||||
|
|
||||||
|
radarpoints.clear();
|
||||||
callhooks(hooks_drawmap);
|
callhooks(hooks_drawmap);
|
||||||
|
|
||||||
frameid++;
|
frameid++;
|
||||||
|
43
hud.cpp
43
hud.cpp
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
namespace hr {
|
namespace hr {
|
||||||
|
|
||||||
|
vector<radarpoint> radarpoints;
|
||||||
|
|
||||||
purehookset hooks_stats;
|
purehookset hooks_stats;
|
||||||
|
|
||||||
int monsterclass(eMonster m) {
|
int monsterclass(eMonster m) {
|
||||||
@ -346,6 +348,37 @@ void drawMobileArrow(int i) {
|
|||||||
|
|
||||||
bool nofps = false;
|
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() {
|
void drawStats() {
|
||||||
if(nohud || vid.stereo_mode == sLR) return;
|
if(nohud || vid.stereo_mode == sLR) return;
|
||||||
if(callhandlers(false, hooks_prestats)) return;
|
if(callhandlers(false, hooks_prestats)) return;
|
||||||
@ -363,6 +396,14 @@ void drawStats() {
|
|||||||
calcparam();
|
calcparam();
|
||||||
current_display->set_projection(0, false);
|
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()) {
|
if(haveMobileCompass()) {
|
||||||
initquickqueue();
|
initquickqueue();
|
||||||
using namespace shmupballs;
|
using namespace shmupballs;
|
||||||
@ -386,7 +427,7 @@ void drawStats() {
|
|||||||
#else
|
#else
|
||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
else if(vid.xres > vid.yres * 85/100 && vid.yres > vid.xres * 85/100) {
|
else if(cornermode) {
|
||||||
int bycorner[4];
|
int bycorner[4];
|
||||||
for(int u=0; u<4; u++) bycorner[u] = 0;
|
for(int u=0; u<4; u++) bycorner[u] = 0;
|
||||||
for(int i=0; i<glyphs; i++) if(ikappear(i) && (glyphflags(i) & GLYPH_INSQUARE))
|
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 };
|
enum eStereo { sOFF, sAnaglyph, sLR, sODS };
|
||||||
|
|
||||||
|
struct radarpoint {
|
||||||
|
hyperpoint h;
|
||||||
|
char glyph;
|
||||||
|
color_t color;
|
||||||
|
color_t line;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern vector<radarpoint> radarpoints;
|
||||||
|
|
||||||
struct videopar {
|
struct videopar {
|
||||||
ld scale, alpha, sspeed, mspeed, yshift, camera_angle;
|
ld scale, alpha, sspeed, mspeed, yshift, camera_angle;
|
||||||
ld ballangle, ballproj, euclid_to_sphere, twopoint_param, stretch, binary_width, fixed_facing_dir;
|
ld ballangle, ballproj, euclid_to_sphere, twopoint_param, stretch, binary_width, fixed_facing_dir;
|
||||||
int mobilecompasssize;
|
int mobilecompasssize;
|
||||||
|
int radarsize; // radar for 3D geometries
|
||||||
int aurastr, aurasmoothen;
|
int aurastr, aurasmoothen;
|
||||||
bool fixed_facing;
|
bool fixed_facing;
|
||||||
|
|
||||||
@ -2471,7 +2481,7 @@ namespace inv {
|
|||||||
void show();
|
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 initquickqueue();
|
||||||
void quickqueue();
|
void quickqueue();
|
||||||
|
Loading…
Reference in New Issue
Block a user