mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
realradius
This commit is contained in:
parent
d467b060bd
commit
800a37f646
@ -773,8 +773,16 @@ int colormix(int a, int b, int c) {
|
||||
|
||||
int rhypot(int a, int b) { return (int) sqrt(a*a - b*b); }
|
||||
|
||||
ld realradius() {
|
||||
ld vradius = vid.radius;
|
||||
if(sphere && vid.alphax > 1) vradius /= sqrt(vid.alphax*vid.alphax - 1);
|
||||
if(sphere && vid.alphax <= 1) vradius = 1e12; // use the following
|
||||
vradius = min<ld>(vradius, min(vid.xres, vid.yres) / 2);
|
||||
return vradius;
|
||||
}
|
||||
|
||||
void drawmessage(const string& s, int& y, int col) {
|
||||
int rrad = min(vid.radius, min(vid.xres, vid.yres) / 2);
|
||||
int rrad = (int) realradius();
|
||||
int space;
|
||||
if(y > vid.ycenter + rrad)
|
||||
space = vid.xres;
|
||||
|
@ -759,8 +759,9 @@ void mainloop() {
|
||||
void displayabutton(int px, int py, string s, int col) {
|
||||
// TMP
|
||||
int siz = vid.yres > vid.xres ? vid.fsize*2 : vid.fsize * 3/2;
|
||||
int vrx = min(vid.radius, vid.xres/2 - 40);
|
||||
int vry = min(vid.radius, min(vid.ycenter, vid.yres - vid.ycenter) - 20);
|
||||
int rad = (int) realradius();
|
||||
int vrx = min(rad, vid.xres/2 - 40);
|
||||
int vry = min(rad, min(vid.ycenter, vid.yres - vid.ycenter) - 20);
|
||||
int x = vid.xcenter + px * vrx;
|
||||
int y = vid.ycenter + py * (vry - siz/2);
|
||||
int vrr = int(hypot(vrx, vry) * sqrt(2.));
|
||||
|
@ -5048,8 +5048,6 @@ void drawmovestar(double dx, double dy) {
|
||||
|
||||
// old style joystick control
|
||||
|
||||
int realradius;
|
||||
|
||||
bool sidescreen;
|
||||
|
||||
bool dronemode;
|
||||
@ -5059,7 +5057,7 @@ void calcparam() {
|
||||
vid.xcenter = vid.xres / 2;
|
||||
vid.ycenter = vid.yres / 2;
|
||||
|
||||
realradius = min(vid.xcenter, vid.ycenter);
|
||||
int realradius = min(vid.xcenter, vid.ycenter);
|
||||
|
||||
vid.radius = int(vid.scale * vid.ycenter) - (ISANDROID ? 2 : ISIOS ? 40 : 40);
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace shmupballs {
|
||||
int xmove, xfire, yb, rad;
|
||||
|
||||
void calc() {
|
||||
rad = min(vid.radius, min(vid.xres, vid.yres) / 2) * (vid.mobilecompasssize ? vid.mobilecompasssize : 14) / 100;
|
||||
rad = int(realradius() * (vid.mobilecompasssize ? vid.mobilecompasssize : 14) / 100);
|
||||
xmove = max(vid.xcenter - vid.radius - rad, rad);
|
||||
xfire = min(vid.xcenter + vid.radius + rad, vid.xres - rad);
|
||||
yb = vid.ycenter + vid.radius - rad;
|
||||
|
Loading…
Reference in New Issue
Block a user