1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-17 11:38:05 +00:00

HUD elements, including the compass, now drawn correctly in all pmodels

This commit is contained in:
Zeno Rogue
2017-11-13 11:08:06 +01:00
parent 672f4d7b9e
commit 19f12e3068
9 changed files with 122 additions and 70 deletions

View File

@@ -399,7 +399,9 @@ void handleKeyNormal(int sym, int uni) {
if(!shmup::on)
multi::mousemovement(mouseover);
}
else mousemovement();
else if(handleCompass()) ;
else
mousemovement();
}
if(sym == SDLK_F1) gotoHelp(help);
@@ -791,3 +793,32 @@ void gmodekeys(int sym, int uni) {
}
}
bool haveMobileCompass() {
#if CAP_MOBILE
if(andmode || useRangedOrb) return false;
#else
if(forcetarget) return false;
#endif
return canmove && !shmup::on && vid.mobilecompasssize > 0 && size(screens) == 1;
}
bool handleCompass() {
if(!haveMobileCompass()) return false;
using namespace shmupballs;
int dx = mousex - xmove;
int dy = mousey - yb;
int h = hypot(dx, dy);
if(h < rad) {
if(h < rad*SKIPFAC) movepcto(MD_WAIT);
else {
double d = vid.revcontrol ? -1 : 1;
mouseh = hpxy(dx * d / rad, dy * d / rad);
mousemovement();
}
getcstat = 0;
return true;
}
return false;
}