2019-08-10 11:43:24 +00:00
|
|
|
// Hyperbolic Rogue -- Heads-Up Display
|
|
|
|
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
|
|
|
|
|
|
|
|
/** \file hud.cpp
|
|
|
|
* \brief Heads-Up display: items collected, monsters killed, radar, etc.
|
|
|
|
*/
|
2018-02-08 23:40:26 +00:00
|
|
|
|
2019-09-05 07:15:40 +00:00
|
|
|
#include "hyper.h"
|
2018-06-10 23:58:31 +00:00
|
|
|
namespace hr {
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX purehookset hooks_stats;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int monsterclass(eMonster m) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(isFriendly(m) || m == moTortoise) return 1;
|
|
|
|
else if(isMonsterPart(m)) return 2;
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int glyphclass(int i) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(i < ittypes) {
|
|
|
|
eItem it = eItem(i);
|
|
|
|
return itemclass(it) == IC_TREASURE ? 0 : 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
eMonster m = eMonster(i-ittypes);
|
|
|
|
return monsterclass(m) == 0 ? 2 : 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int subclass(int i) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(i < ittypes)
|
|
|
|
return itemclass(eItem(i));
|
|
|
|
else
|
|
|
|
return monsterclass(eMonster(i-ittypes));
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GLYPH_MARKTODO 1
|
|
|
|
#define GLYPH_MARKOVER 2
|
|
|
|
#define GLYPH_LOCAL 4
|
|
|
|
#define GLYPH_IMPORTANT 8
|
|
|
|
#define GLYPH_NONUMBER 16
|
|
|
|
#define GLYPH_DEMON 32
|
|
|
|
#define GLYPH_RUNOUT 64
|
|
|
|
#define GLYPH_INPORTRAIT 128
|
|
|
|
#define GLYPH_LOCAL2 256
|
|
|
|
#define GLYPH_TARGET 512
|
|
|
|
#define GLYPH_INSQUARE 1024
|
|
|
|
|
2019-08-09 21:24:33 +00:00
|
|
|
#if HDR
|
|
|
|
enum eGlyphsortorder {
|
|
|
|
gsoFirstTop, gsoFirstBottom,
|
|
|
|
gsoLastTop, gsoLastBottom,
|
|
|
|
gsoLand, gsoValue,
|
|
|
|
gsoMAX
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
EX eGlyphsortorder glyphsortorder;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int zero = 0;
|
|
|
|
|
|
|
|
int& ikmerge(int i) {
|
|
|
|
if(i < ittypes) return items[i];
|
|
|
|
else if(i == ittypes) return zero;
|
|
|
|
else return kills[i-ittypes];
|
|
|
|
}
|
|
|
|
|
2017-10-14 11:03:04 +00:00
|
|
|
bool ikappear(int i) {
|
|
|
|
if(i == itInventory && inv::on) return true;
|
|
|
|
return ikmerge(i);
|
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
const int glyphs = ittypes + motypes;
|
|
|
|
|
|
|
|
int gfirsttime[glyphs], glasttime[glyphs], gcopy[glyphs], ikland[glyphs];
|
|
|
|
int glyphorder[glyphs];
|
2017-08-06 12:50:16 +00:00
|
|
|
int glyphphase[glyphs];
|
|
|
|
int glyph_lastticks;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
void updatesort() {
|
|
|
|
for(int i=0; i<glyphs; i++) {
|
2017-08-06 12:50:16 +00:00
|
|
|
int ik = ikmerge(i);
|
2017-10-14 11:03:04 +00:00
|
|
|
if(ikappear(i) && gfirsttime[i] == 0)
|
2017-07-10 18:47:38 +00:00
|
|
|
gfirsttime[i] = ticks;
|
2017-08-06 12:50:16 +00:00
|
|
|
if(ik != gcopy[i])
|
|
|
|
gcopy[i] = ik, glasttime[i] = ticks;
|
|
|
|
int& gp = glyphphase[i];
|
|
|
|
if(ticks <= glasttime[i]+500)
|
|
|
|
gp += (ticks - glyph_lastticks);
|
2017-10-16 16:57:57 +00:00
|
|
|
else if((gp % 500) && ((i >= ittypes) || i == itTerra)) {
|
2017-08-06 12:50:16 +00:00
|
|
|
int a = gp;
|
|
|
|
gp += (ticks - glyph_lastticks);
|
|
|
|
if(a/500 != gp/500)
|
|
|
|
gp = gp/500*500;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
glyph_lastticks = ticks;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void preparesort() {
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int i=0; i<glyphs; i++) glyphorder[i] = i;
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(land_over); i++) {
|
2017-07-10 18:47:38 +00:00
|
|
|
eLand l = land_over[i];
|
|
|
|
ikland[treasureType(l)] = i+1;
|
|
|
|
for(int mi=0; mi<motypes; mi++)
|
|
|
|
if(isNative(l, eMonster(mi)))
|
|
|
|
ikland[mi+ittypes] = i+1;
|
|
|
|
}
|
|
|
|
glyphsortorder = gsoLand; updatesort();
|
|
|
|
glyphsortorder = gsoFirstTop;
|
|
|
|
}
|
|
|
|
|
|
|
|
int glyphsortkey = 0;
|
|
|
|
|
|
|
|
int glyphcorner(int i) {
|
|
|
|
if(i < ittypes)
|
2017-10-08 12:49:49 +00:00
|
|
|
return itemclass(eItem(i)) == IC_ORB ? 3 : 0;
|
2017-07-10 18:47:38 +00:00
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool glyphsort(int i, int j) {
|
|
|
|
if(subclass(i) != subclass(j))
|
|
|
|
return subclass(i) < subclass(j);
|
|
|
|
if(glyphsortorder == gsoFirstTop)
|
|
|
|
return gfirsttime[i] < gfirsttime[j];
|
|
|
|
if(glyphsortorder == gsoFirstBottom)
|
|
|
|
return gfirsttime[i] > gfirsttime[j];
|
|
|
|
if(glyphsortorder == gsoLastTop)
|
|
|
|
return glasttime[i] > glasttime[j];
|
|
|
|
if(glyphsortorder == gsoLastBottom)
|
|
|
|
return glasttime[i] < glasttime[j];
|
|
|
|
if(glyphsortorder == gsoValue)
|
|
|
|
return ikmerge(i) > ikmerge(j);
|
|
|
|
if(glyphsortorder == gsoLand)
|
|
|
|
return ikland[i] < ikland[j];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int glyphflags(int gid) {
|
|
|
|
int f = 0;
|
|
|
|
if(gid < ittypes) {
|
|
|
|
eItem i = eItem(gid);
|
|
|
|
if(itemclass(i) == IC_NAI) f |= GLYPH_NONUMBER;
|
|
|
|
if(isElementalShard(i)) {
|
|
|
|
f |= GLYPH_LOCAL | GLYPH_INSQUARE;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(i == localshardof(cwt.at->land)) f |= GLYPH_LOCAL2;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-08-17 22:46:45 +00:00
|
|
|
if(i == treasureType(cwt.at->land) || daily::on)
|
2017-07-10 18:47:38 +00:00
|
|
|
f |= GLYPH_LOCAL | GLYPH_LOCAL2 | GLYPH_IMPORTANT | GLYPH_INSQUARE;
|
|
|
|
if(i == itHolyGrail) {
|
2017-07-22 23:33:27 +00:00
|
|
|
if(items[i] >= 3 && !inv::on) f |= GLYPH_MARKOVER;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(itemclass(i) == IC_TREASURE) {
|
2017-07-22 23:33:27 +00:00
|
|
|
if(items[i] >= 25 && items[i] < 100 && !inv::on) f |= GLYPH_MARKOVER;
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(items[i] < 10) f |= GLYPH_MARKTODO;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
f |= GLYPH_IMPORTANT | GLYPH_INSQUARE;
|
|
|
|
if(itemclass(i) == IC_ORB && items[i] < 10) f |= GLYPH_RUNOUT;
|
|
|
|
}
|
|
|
|
if(i == orbToTarget) f |= GLYPH_TARGET;
|
|
|
|
f |= GLYPH_INPORTRAIT;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
eMonster m = eMonster(gid-ittypes);
|
|
|
|
if(m == moLesser) f |= GLYPH_IMPORTANT | GLYPH_DEMON | GLYPH_INPORTRAIT | GLYPH_INSQUARE;
|
2018-08-17 22:46:45 +00:00
|
|
|
int isnat = isNative(cwt.at->land, m);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(isnat) f |= GLYPH_LOCAL | GLYPH_IMPORTANT | GLYPH_INPORTRAIT | GLYPH_INSQUARE;
|
|
|
|
if(isnat == 2) f |= GLYPH_LOCAL2;
|
|
|
|
if(m == monsterToSummon) f |= GLYPH_TARGET;
|
|
|
|
}
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:39:36 +00:00
|
|
|
EX bool graphglyph() {
|
2019-08-15 13:05:43 +00:00
|
|
|
// if(GDIM == 3) return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
return vid.graphglyph == 2 || (vid.graphglyph == 1 && vid.monmode);
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
bool displayglyph(int cx, int cy, int buttonsize, char glyph, color_t color, int qty, int flags, int id) {
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
bool b =
|
|
|
|
mousex >= cx && mousex < cx+buttonsize && mousey >= cy-buttonsize/2 && mousey <= cy-buttonsize/2+buttonsize;
|
|
|
|
|
|
|
|
int glsize = buttonsize;
|
|
|
|
if(glyph == '%' || glyph == 'M' || glyph == 'W') glsize = glsize*4/5;
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
int d = ticks - glasttime[id];
|
|
|
|
double zoom = (d <= 250 && d >= 0) ? 1.25 - .001 * d : 1;
|
|
|
|
glsize = int(glsize * zoom);
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(graphglyph()) {
|
|
|
|
initquickqueue();
|
|
|
|
if(id >= ittypes) {
|
|
|
|
eMonster m = eMonster(id - ittypes);
|
2017-08-06 12:50:16 +00:00
|
|
|
double bsize = buttonsize * 2/3;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(m == moKrakenH) bsize /= 3;
|
|
|
|
if(m == moKrakenT || m == moDragonTail) bsize /= 2;
|
|
|
|
if(m == moSlime) bsize = (2*bsize+1)/3;
|
2017-08-06 12:50:16 +00:00
|
|
|
transmatrix V = atscreenpos(cx+buttonsize/2, cy, bsize*zoom);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(isWorm(m) && cgi.wormscale != 1)
|
2019-08-15 13:05:43 +00:00
|
|
|
for(int i=0; i<GDIM; i++)
|
2019-05-26 16:04:02 +00:00
|
|
|
V[i][i] /= cgi.wormscale;
|
2017-07-10 18:47:38 +00:00
|
|
|
int mcol = color;
|
|
|
|
mcol -= (color & 0xFCFCFC) >> 2;
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(m, NULL, V, mcol, glyphphase[id]/500.0, NOCOLOR);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
eItem it = eItem(id);
|
2017-08-06 12:50:16 +00:00
|
|
|
double bsize = buttonsize / 2;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(glyph =='*') bsize *= 2;
|
|
|
|
if(glyph == '$') bsize = (bsize*5+2)/3;
|
|
|
|
if(glyph == 'o') bsize = (bsize*3+1)/2;
|
|
|
|
if(glyph == 't') bsize = bsize*5/2;
|
2017-10-16 16:57:57 +00:00
|
|
|
if(glyph == '(') bsize = bsize*2.5;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(it == itWarning) bsize *= 2;
|
|
|
|
if(it == itBombEgg || it == itTrollEgg || it == itDodeca) bsize = bsize*3/2;
|
|
|
|
int icol = color;
|
|
|
|
icol -= (color & 0xFCFCFC) >> 2;
|
|
|
|
int ic = itemclass(it);
|
2017-08-06 12:50:16 +00:00
|
|
|
bsize = bsize * zoom;
|
|
|
|
transmatrix V = atscreenpos(cx+buttonsize/2, cy, bsize);
|
2017-10-16 16:57:57 +00:00
|
|
|
double t =
|
|
|
|
(ic == IC_ORB || ic == IC_NAI) ? ticks*2 :
|
|
|
|
((glyph == 't' && qty%5) || it == itOrbYendor) ? ticks/2 :
|
|
|
|
it == itTerra ? glyphphase[id] * 3 * M_PI + 900 * M_PI:
|
|
|
|
glyphphase[id] * 2;
|
|
|
|
drawItemType(it, NULL, V, icol, t, false);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
quickqueue();
|
|
|
|
}
|
|
|
|
else if(glyph == '*')
|
|
|
|
displaychr(cx + buttonsize/2, cy+buttonsize/4, 0, glsize*3/2, glyph, darkenedby(color, b?0:1));
|
|
|
|
else
|
|
|
|
displaychr(cx + buttonsize/2, cy, 0, glsize, glyph, darkenedby(color, b?0:1));
|
|
|
|
|
|
|
|
string fl = "";
|
|
|
|
string str = its(qty);
|
|
|
|
|
|
|
|
if(flags & GLYPH_TARGET) fl += "!";
|
|
|
|
if(flags & GLYPH_LOCAL2) fl += "+";
|
|
|
|
else if(flags & GLYPH_LOCAL) fl += "-";
|
|
|
|
if(flags & GLYPH_DEMON) fl += "X";
|
|
|
|
if(flags & GLYPH_MARKOVER) str += "!";
|
|
|
|
|
|
|
|
if(fl != "")
|
|
|
|
displaystr(cx + buttonsize, cy-buttonsize/2 + buttonsize/4, 0, buttonsize/2, fl, darkenedby(color, 0), 16);
|
|
|
|
|
|
|
|
if(flags & GLYPH_NONUMBER) str = "";
|
|
|
|
|
|
|
|
int bsize =
|
|
|
|
(qty < 10 && (flags & (GLYPH_MARKTODO | GLYPH_RUNOUT))) ? buttonsize*3/4 :
|
|
|
|
qty < 100 ? buttonsize / 2 :
|
|
|
|
buttonsize / 3;
|
2019-12-25 10:53:50 +00:00
|
|
|
|
|
|
|
if(id == moMutant + ittypes && clearing::imputed.nonzero()) {
|
2020-03-01 01:35:19 +00:00
|
|
|
bignum bn = clearing::imputed + qty;
|
|
|
|
str = short_form(bn);
|
2019-12-25 10:53:50 +00:00
|
|
|
bsize = buttonsize / 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(str != "") {
|
|
|
|
if(textwidth(bsize, str) < buttonsize)
|
|
|
|
displayfr(cx + buttonsize, cy + buttonsize/2 - bsize/2, 1, bsize, str, color, 16);
|
|
|
|
else
|
|
|
|
displayfr(cx, cy + buttonsize/2 - bsize/2, 1, bsize, str, color, 0);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void displayglyph2(int cx, int cy, int buttonsize, int i) {
|
|
|
|
|
|
|
|
char glyph = i < ittypes ? iinf[i].glyph : minf[i-ittypes].glyph;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t color = i < ittypes ? iinf[i].color : minf[i-ittypes].color;
|
2017-07-10 18:47:38 +00:00
|
|
|
int imp = glyphflags(i);
|
|
|
|
|
|
|
|
if(displayglyph(cx, cy, buttonsize, glyph, color, ikmerge(i), imp, i)) {
|
|
|
|
instat = true;
|
|
|
|
getcstat = SDLK_F1;
|
|
|
|
if(i < ittypes) {
|
|
|
|
eItem it = eItem(i);
|
|
|
|
int t = itemclass(it);
|
|
|
|
if(t == IC_TREASURE)
|
|
|
|
mouseovers = XLAT("treasure collected: %1", it);
|
|
|
|
if(t == IC_OTHER)
|
|
|
|
mouseovers = XLAT("objects found: %1", it);
|
|
|
|
if(t == IC_NAI)
|
2017-10-17 19:26:21 +00:00
|
|
|
mouseovers = XLATT1(it);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(t == IC_ORB)
|
|
|
|
mouseovers = XLAT("orb power: %1", eItem(i));
|
|
|
|
if(it == itGreenStone) {
|
|
|
|
mouseovers += XLAT(" (click to drop)");
|
|
|
|
getcstat = 'g';
|
|
|
|
}
|
2017-10-17 18:59:27 +00:00
|
|
|
if(it == itStrongWind) {
|
|
|
|
mouseovers += XLAT(" (click to use)");
|
|
|
|
getcstat = 't';
|
|
|
|
}
|
2017-07-12 16:03:53 +00:00
|
|
|
if(it == itInventory) {
|
|
|
|
mouseovers += XLAT(" (click to use)");
|
|
|
|
getcstat = 'i';
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(imp & GLYPH_LOCAL) mouseovers += XLAT(" (local treasure)");
|
|
|
|
help = generateHelpForItem(it);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
eMonster m = eMonster(i-ittypes);
|
|
|
|
if(isMonsterPart(m))
|
|
|
|
mouseovers = s0 + XLAT("parts destroyed: %1", m);
|
|
|
|
else if(isFriendly(m) && isNonliving(m))
|
|
|
|
mouseovers = s0 + XLAT("friends destroyed: %1", m);
|
|
|
|
else if(isFriendly(m))
|
|
|
|
mouseovers = s0 + XLAT("friends killed: %1", m);
|
|
|
|
else if(isNonliving(m))
|
|
|
|
mouseovers = s0 + XLAT("monsters destroyed: %1", m);
|
|
|
|
else if(m == moTortoise)
|
|
|
|
mouseovers = s0 + XLAT("animals killed: %1", m);
|
|
|
|
else
|
|
|
|
mouseovers = s0 + XLAT("monsters killed: %1", m);
|
|
|
|
if(imp & GLYPH_LOCAL2) mouseovers += XLAT(" (killing increases treasure spawn)");
|
|
|
|
else if(imp & GLYPH_LOCAL) mouseovers += XLAT(" (appears here)");
|
|
|
|
help = generateHelpForMonster(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool nohud, nomenukey;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX hookset<bool()> *hooks_prestats;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-07-23 14:08:08 +00:00
|
|
|
void drawMobileArrow(int i) {
|
|
|
|
|
|
|
|
int dir = i;
|
2018-08-17 22:46:45 +00:00
|
|
|
cell *c = cwt.at->move(i);
|
2018-07-23 14:08:08 +00:00
|
|
|
if(!c) return;
|
|
|
|
|
2019-11-22 13:25:13 +00:00
|
|
|
transmatrix T = currentmap->adj(cwt.at, i);
|
2017-11-13 10:08:06 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
// color_t col = getcs().uicolor;
|
2017-11-13 10:08:06 +00:00
|
|
|
// col -= (col & 0xFF) >> 1;
|
|
|
|
|
|
|
|
bool invalid = !legalmoves[dir];
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = cellcolor(c);
|
2017-11-13 10:08:06 +00:00
|
|
|
if(col == OUTLINE_NONE) col = 0xC0C0C0FF;
|
|
|
|
col -= (col & 0xFF) >> 1;
|
|
|
|
if(invalid) col -= (col & 0xFF) >> 1;
|
|
|
|
if(invalid) col -= (col & 0xFF) >> 1;
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
// transmatrix m2 = Id;
|
2018-07-23 14:08:08 +00:00
|
|
|
ld scale = vid.mobilecompasssize * (sphere ? 7 : euclid ? 6 : 5);
|
2017-11-13 10:08:06 +00:00
|
|
|
// m2[0][0] = scale; m2[1][1] = scale; m2[2][2] = 1;
|
2018-07-23 14:08:08 +00:00
|
|
|
|
2018-08-17 22:46:45 +00:00
|
|
|
transmatrix U = ggmatrix(cwt.at);
|
2018-07-23 14:08:08 +00:00
|
|
|
hyperpoint H = sphereflip * tC0(U);
|
|
|
|
transmatrix Centered = sphereflip * rgpushxto0(H);
|
|
|
|
|
|
|
|
hyperpoint P = inverse(Centered) * U * T * C0;
|
|
|
|
double alpha = atan2(P[1], P[0]);
|
2017-11-13 10:08:06 +00:00
|
|
|
|
|
|
|
using namespace shmupballs;
|
|
|
|
|
|
|
|
double dx = xmove + rad*(1+SKIPFAC-.2)/2 * cos(alpha);
|
|
|
|
double dy = yb + rad*(1+SKIPFAC-.2)/2 * sin(alpha);
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(atscreenpos(dx, dy, scale) * spin(-alpha), cgi.shArrow, col, PPR::MOBILE_ARROW);
|
2017-11-13 10:08:06 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-11-13 10:08:06 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool nofps = false;
|
2018-01-25 16:22:50 +00:00
|
|
|
|
2019-09-09 14:10:57 +00:00
|
|
|
EX color_t crosshair_color = 0xFFFFFFC0;
|
|
|
|
EX ld crosshair_size = 0;
|
|
|
|
|
2019-12-25 10:53:50 +00:00
|
|
|
EX bool long_kills;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawStats() {
|
2018-11-17 18:24:02 +00:00
|
|
|
if(nohud || vid.stereo_mode == sLR) return;
|
2018-07-09 16:39:34 +00:00
|
|
|
if(callhandlers(false, hooks_prestats)) return;
|
2018-09-23 11:48:59 +00:00
|
|
|
if(viewdists && show_distance_lists)
|
2018-09-12 02:23:15 +00:00
|
|
|
expansion.view_distances_dialog();
|
2018-11-17 18:24:02 +00:00
|
|
|
if(current_display->sidescreen) return;
|
2019-03-23 15:31:37 +00:00
|
|
|
|
2019-05-11 21:55:08 +00:00
|
|
|
first_cell_to_draw = true;
|
2019-03-23 15:31:37 +00:00
|
|
|
bool h = hide_player();
|
2017-11-13 10:08:06 +00:00
|
|
|
|
2019-09-09 13:31:49 +00:00
|
|
|
bool cornermode = (vid.xres > vid.yres * 85/100 && vid.yres > vid.xres * 85/100);
|
|
|
|
|
2019-10-28 16:26:59 +00:00
|
|
|
if(geometry == gRotSpace || geometry == gProduct) rots::draw_underlying(!cornermode);
|
2019-09-09 13:31:49 +00:00
|
|
|
|
2017-11-13 10:08:06 +00:00
|
|
|
{
|
2019-08-19 07:39:19 +00:00
|
|
|
dynamicval<eModel> pm(pmodel, flat_model());
|
|
|
|
glClear(GL_DEPTH_BUFFER_BIT);
|
2018-12-15 16:54:36 +00:00
|
|
|
// dynamicval<videopar> v(vid, vid);
|
|
|
|
// vid.alpha = vid.scale = 1;
|
|
|
|
dynamicval<ld> va(vid.alpha, 1);
|
|
|
|
dynamicval<ld> vs(vid.scale, 1);
|
2019-04-23 16:49:09 +00:00
|
|
|
dynamicval<ld> vc(vid.camera_angle, 0);
|
2019-08-19 12:48:12 +00:00
|
|
|
if(prod) vid.alpha = 30, vid.scale = 30;
|
2019-09-09 14:10:57 +00:00
|
|
|
|
|
|
|
auto& cd = current_display;
|
|
|
|
auto xc = cd->xcenter;
|
|
|
|
auto yc = cd->ycenter;
|
2018-12-15 16:54:36 +00:00
|
|
|
|
2019-04-23 13:03:17 +00:00
|
|
|
calcparam();
|
2019-09-09 13:31:49 +00:00
|
|
|
|
2019-09-09 14:10:57 +00:00
|
|
|
if(crosshair_color && crosshair_size > 0) {
|
|
|
|
initquickqueue();
|
|
|
|
vid.linewidth = 1;
|
|
|
|
queueline(tC0(atscreenpos(xc - crosshair_size, yc, 1)), tC0(atscreenpos(xc + crosshair_size, yc, 1)), crosshair_color).prio = PPR::SUPERLINE;
|
|
|
|
queueline(tC0(atscreenpos(xc, yc - crosshair_size, 1)), tC0(atscreenpos(xc, yc + crosshair_size, 1)), crosshair_color).prio = PPR::SUPERLINE;
|
|
|
|
quickqueue();
|
|
|
|
}
|
|
|
|
|
2019-03-23 15:31:37 +00:00
|
|
|
if(vid.radarsize > 0 && h)
|
2019-02-28 15:24:46 +00:00
|
|
|
#if CAP_RACING
|
2019-05-30 09:09:43 +00:00
|
|
|
if(!racing::on)
|
2019-02-28 15:24:46 +00:00
|
|
|
#endif
|
2019-05-30 09:09:43 +00:00
|
|
|
if(!peace::on)
|
|
|
|
if(!(cmode & sm::MISSION))
|
|
|
|
draw_radar(cornermode);
|
2017-11-13 10:08:06 +00:00
|
|
|
|
|
|
|
if(haveMobileCompass()) {
|
|
|
|
initquickqueue();
|
|
|
|
using namespace shmupballs;
|
|
|
|
calc();
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2017-11-13 10:08:06 +00:00
|
|
|
queuecircle(xmove, yb, rad, 0xFF0000FF);
|
|
|
|
queuecircle(xmove, yb, rad*SKIPFAC,
|
2020-01-18 15:03:32 +00:00
|
|
|
legalmoves[cwt.at->type] ? 0xFF0000FF : 0xFF000080
|
2017-11-13 10:08:06 +00:00
|
|
|
);
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int i=0; i<cwt.at->type; i++) drawMobileArrow(i);
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-11-13 10:08:06 +00:00
|
|
|
if(hypot(mousex-xmove, mousey-yb) <= rad) getcstat = '-';
|
|
|
|
quickqueue();
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-01-17 13:11:12 +00:00
|
|
|
if(racing::on)
|
2019-01-24 13:50:36 +00:00
|
|
|
#if CAP_RACING
|
2019-01-17 13:11:12 +00:00
|
|
|
racing::drawStats();
|
2019-01-24 13:50:36 +00:00
|
|
|
#else
|
|
|
|
{}
|
|
|
|
#endif
|
2019-02-28 15:24:46 +00:00
|
|
|
else if(cornermode) {
|
2017-07-10 18:47:38 +00:00
|
|
|
int bycorner[4];
|
|
|
|
for(int u=0; u<4; u++) bycorner[u] = 0;
|
2017-10-14 11:03:04 +00:00
|
|
|
for(int i=0; i<glyphs; i++) if(ikappear(i) && (glyphflags(i) & GLYPH_INSQUARE))
|
2017-07-10 18:47:38 +00:00
|
|
|
bycorner[glyphcorner(i)]++;
|
|
|
|
updatesort();
|
|
|
|
stable_sort(glyphorder, glyphorder+glyphs, glyphsort);
|
|
|
|
int rad = min(vid.xres, vid.yres) / 2;
|
2017-10-08 12:49:49 +00:00
|
|
|
for(int cor=0; cor<4; cor++) {
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int a=5; a<41; a++) {
|
|
|
|
int s = min(vid.xres, vid.yres) / a;
|
|
|
|
int spots = 0;
|
|
|
|
for(int u=vid.fsize; u<vid.xres/2-s; u += s)
|
|
|
|
for(int v=vid.fsize; v<vid.yres/2-s; v += s)
|
2018-08-01 02:01:16 +00:00
|
|
|
if(hypot(vid.xres/2-u-s, (vid.yres/2-v-s) / vid.stretch) > rad) {
|
2017-07-10 18:47:38 +00:00
|
|
|
spots++;
|
|
|
|
}
|
|
|
|
if(spots >= bycorner[cor] && spots >= 3) {
|
|
|
|
int next = 0;
|
|
|
|
vector<int> glyphstoshow;
|
|
|
|
for(int i=0; i<glyphs; i++) {
|
|
|
|
int g = glyphorder[i];
|
2017-10-14 11:03:04 +00:00
|
|
|
if(ikappear(g) && (glyphflags(g) & GLYPH_INSQUARE) && glyphcorner(g) == cor)
|
2017-07-10 18:47:38 +00:00
|
|
|
glyphstoshow.push_back(g);
|
|
|
|
}
|
|
|
|
for(int u=vid.fsize; u<vid.xres/2-s; u += s)
|
|
|
|
for(int v=vid.fsize; v<vid.yres/2-s; v += s)
|
2018-08-01 02:01:16 +00:00
|
|
|
if(hypot(vid.xres/2-u-s, (vid.yres/2-v-s) / vid.stretch) > rad) {
|
2018-06-22 12:47:24 +00:00
|
|
|
if(next >= isize(glyphstoshow)) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int cx = u;
|
|
|
|
int cy = v + s/2;
|
|
|
|
if(cor&1) cx = vid.xres-1-s-cx;
|
|
|
|
if(cor&2) cy = vid.yres-1-cy;
|
|
|
|
|
|
|
|
displayglyph2(cx, cy, s, glyphstoshow[next++]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-03 12:41:49 +00:00
|
|
|
else {
|
|
|
|
|
|
|
|
instat = false;
|
|
|
|
bool portrait = vid.xres < vid.yres;
|
|
|
|
int colspace = portrait ? (vid.yres - vid.xres - vid.fsize*3) : (vid.xres - vid.yres - 16) / 2;
|
|
|
|
int rowspace = portrait ? vid.xres - 16 : vid.yres - vid.fsize * (vid.msgleft ? 9 : 4);
|
|
|
|
int colid[4], rowid[4];
|
|
|
|
int maxbyclass[4];
|
|
|
|
for(int z=0; z<4; z++) maxbyclass[z] = 0;
|
|
|
|
for(int i=0; i<glyphs; i++) if(ikappear(i))
|
|
|
|
if(!portrait || (glyphflags(i) | GLYPH_INPORTRAIT))
|
|
|
|
maxbyclass[glyphclass(i)]++;
|
|
|
|
int buttonsize;
|
|
|
|
int columns, rows;
|
|
|
|
bool imponly = false;
|
|
|
|
int minsize = vid.fsize * (portrait ? 4 : 2);
|
|
|
|
rows = 0;
|
|
|
|
while((buttonsize = minsize - vid.killreduction)) {
|
|
|
|
columns = colspace / buttonsize;
|
|
|
|
rows = rowspace / buttonsize;
|
|
|
|
int coltaken = 0;
|
|
|
|
for(int z=0; z<4; z++) {
|
|
|
|
if(z == 2 && !portrait) {
|
|
|
|
if(coltaken > columns) { vid.killreduction++; continue; }
|
|
|
|
coltaken = 0;
|
|
|
|
}
|
|
|
|
colid[z] = coltaken, rowid[z] = 0,
|
|
|
|
coltaken += (maxbyclass[z] + rows-1) / rows;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-03 12:41:49 +00:00
|
|
|
if(coltaken > columns) { vid.killreduction++; continue; }
|
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2018-02-03 12:41:49 +00:00
|
|
|
if(buttonsize <= vid.fsize*3/4) {
|
|
|
|
imponly = true; buttonsize = minsize;
|
|
|
|
rows = rowspace / buttonsize; if(!rows) return;
|
|
|
|
colid[0] = 0; colid[2] = portrait ? 1 : 0;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-03 12:41:49 +00:00
|
|
|
updatesort();
|
|
|
|
stable_sort(glyphorder, glyphorder+glyphs, glyphsort);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-03 12:41:49 +00:00
|
|
|
for(int i0=0; i0<glyphs; i0++) {
|
|
|
|
int i = glyphorder[i0];
|
|
|
|
if(!ikappear(i)) continue;
|
|
|
|
int z = glyphclass(i);
|
|
|
|
int imp = glyphflags(i);
|
|
|
|
if(imponly) { z &=~1; if(!(imp & GLYPH_IMPORTANT)) continue; }
|
|
|
|
|
|
|
|
int cx, cy;
|
|
|
|
if(portrait)
|
|
|
|
cx = 8 + buttonsize * rowid[z], cy = vid.fsize*2 + buttonsize * (colid[z]) + buttonsize/2;
|
|
|
|
else
|
|
|
|
cx = 8 + buttonsize * (colid[z]), cy = vid.fsize * 3 + buttonsize * rowid[z];
|
|
|
|
|
|
|
|
if(!portrait && z < 2) cx = vid.xres - cx - buttonsize;
|
|
|
|
|
|
|
|
rowid[z]++; if(rowid[z] >= rows) rowid[z] = 0, colid[z]++;
|
|
|
|
|
|
|
|
displayglyph2(cx, cy, buttonsize, i);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-03 12:41:49 +00:00
|
|
|
}
|
2019-05-10 01:26:09 +00:00
|
|
|
glflush();
|
2019-04-23 13:03:17 +00:00
|
|
|
calcparam();
|
2018-02-03 12:41:49 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
string s0;
|
2018-11-24 02:26:07 +00:00
|
|
|
if(racing::on) {
|
|
|
|
#if CAP_RACING
|
2018-11-24 14:35:02 +00:00
|
|
|
using namespace racing;
|
2018-11-24 02:26:07 +00:00
|
|
|
color_t col;
|
2018-11-24 14:35:02 +00:00
|
|
|
if(ticks >= race_start_tick)
|
2018-11-24 02:26:07 +00:00
|
|
|
col = 0x00FF00;
|
2018-11-24 14:35:02 +00:00
|
|
|
else if(ticks >= race_start_tick - 2000)
|
2018-11-24 02:26:07 +00:00
|
|
|
col = 0xFFFF00;
|
|
|
|
else
|
|
|
|
col = 0xFF0000;
|
2018-11-24 14:35:02 +00:00
|
|
|
for(int i=0; i<multi::players; i++) if(race_finish_tick[i])
|
2018-11-24 02:26:07 +00:00
|
|
|
col = 0xFFFFFF;
|
|
|
|
|
|
|
|
dynamicval<int> x(vid.fsize, vid.fsize*2);
|
2019-01-07 03:51:24 +00:00
|
|
|
if(displayButtonS(vid.xres - 8, vid.fsize, racetimeformat(ticks - race_start_tick), col, 16, vid.fsize)) getcstat = 'o';
|
2018-11-24 14:35:02 +00:00
|
|
|
|
|
|
|
for(int i=0; i<multi::players; i++) {
|
|
|
|
if(race_finish_tick[i]) {
|
|
|
|
multi::cpid = i;
|
2019-06-01 18:03:03 +00:00
|
|
|
if(displayButtonS(vid.xres - 8, vid.fsize * (3+2*i), racetimeformat(race_finish_tick[i] - race_start_tick), (getcs().uicolor >> 8), 16, vid.fsize))
|
2019-01-07 03:51:24 +00:00
|
|
|
getcstat = 'o';
|
2018-11-24 14:35:02 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
int comp = get_percentage(i);
|
2019-06-01 18:03:03 +00:00
|
|
|
if(displayButtonS(vid.xres - 8, vid.fsize * (3+2*i), its(comp) + "%", (getcs().uicolor >> 8), 16, vid.fsize))
|
2019-01-07 03:51:24 +00:00
|
|
|
getcstat = 'o';
|
2018-11-24 14:35:02 +00:00
|
|
|
}
|
2019-06-01 18:03:03 +00:00
|
|
|
if(displayButtonS(vid.xres - 8, vid.fsize * (4+2*i), fts_fixed(shmup::pc[i]->vel * SCALE * 1000/600, 2), (getcs().uicolor >> 8), 16, vid.fsize))
|
|
|
|
getcstat = 'o';
|
2018-11-24 02:26:07 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if(!peace::on) {
|
2019-12-25 10:53:50 +00:00
|
|
|
string scoreline = XLAT("score: %1", its(gold()));
|
|
|
|
if(displayButtonS(vid.xres - 8, vid.fsize, scoreline, forecolor, 16, vid.fsize)) {
|
2017-08-13 19:13:51 +00:00
|
|
|
mouseovers = XLAT("Your total wealth"),
|
|
|
|
instat = true,
|
|
|
|
getcstat = SDLK_F1,
|
|
|
|
help = helptitle(XLAT("Your total wealth"), 0xFFD500) +
|
2017-07-10 18:47:38 +00:00
|
|
|
XLAT(
|
2017-08-13 19:13:51 +00:00
|
|
|
"The total value of the treasure you have collected.\n\n"
|
|
|
|
"Every world type contains a specific type of treasure, worth 1 $$$; "
|
|
|
|
"your goal is to collect as much treasure as possible, but every treasure you find "
|
|
|
|
"causes more enemies to hunt you in its native land.\n\n"
|
|
|
|
"Orbs of Yendor are worth 50 $$$ each.\n\n"
|
|
|
|
);
|
|
|
|
}
|
2019-12-25 10:53:50 +00:00
|
|
|
string s = XLAT("kills: %1", its(tkills()));
|
|
|
|
long_kills = false;
|
|
|
|
int siz = vid.fsize;
|
|
|
|
if(cwt.at->land == laClearing && clearing::imputed.approx_ld() >= 100000) {
|
|
|
|
long_kills = true;
|
|
|
|
s = XLAT("leaves cut: " + (bignum(kills[moMutant]) + clearing::imputed).get_str(200));
|
|
|
|
if(mouseovers == standard_help()) mouseovers = " ";
|
|
|
|
while(siz > 4 && textwidth(siz, s) > vid.xres - textwidth(vid.fsize, scoreline)) siz--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(displayButtonS(8, vid.fsize, s, forecolor, 0, siz)) {
|
|
|
|
instat = true;
|
|
|
|
getcstat = SDLK_F1;
|
|
|
|
if(long_kills) { mouseovers = " "; help = generateHelpForMonster(moMutant); }
|
|
|
|
else {
|
|
|
|
mouseovers = XLAT("Your total kills")+": " + its(tkills()),
|
|
|
|
help = helptitle(XLAT("Your total kills") + ": " + its(tkills()), 0x404040) +
|
|
|
|
XLAT(
|
|
|
|
"In most lands, more treasures are generated with each enemy native to this land you kill. "
|
|
|
|
"Moreover, 100 kills is a requirement to enter the Graveyard and the Hive.\n\n"
|
|
|
|
"Friendly creatures and parts of monsters (such as the Ivy) do appear in the list, "
|
|
|
|
"but are not counted in the total kill count.");
|
|
|
|
}
|
2017-08-13 19:13:51 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-01-25 16:22:50 +00:00
|
|
|
string vers = VER;
|
|
|
|
if(!nofps) vers += XLAT(" fps: ") + its(calcfps());
|
2019-06-06 17:37:17 +00:00
|
|
|
|
2019-06-28 07:48:34 +00:00
|
|
|
#if CAP_MEMORY_RESERVE
|
2019-06-06 17:37:17 +00:00
|
|
|
if(reserve_limit && reserve_count < reserve_limit) {
|
|
|
|
vers += " " + its(reserve_count) + "/" + its(reserve_limit) + " MB";
|
|
|
|
if(displayButtonS(4, vid.yres - 4 - vid.fsize/2, vers, 0xFF2020, 0, vid.fsize/2))
|
|
|
|
getcstat = PSEUDOKEY_MEMORY, instat = true;
|
|
|
|
}
|
2019-06-28 07:48:34 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if(displayButtonS(4, vid.yres - 4 - vid.fsize/2, vers, 0x202020, 0, vid.fsize/2)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
mouseovers = XLAT("frames per second"),
|
|
|
|
getcstat = SDLK_F1,
|
|
|
|
instat = true,
|
|
|
|
help =
|
|
|
|
helptitle(XLAT("frames per second"), 0xFF4040) +
|
|
|
|
XLAT(
|
|
|
|
"The higher the number, the smoother the animations in the game. "
|
|
|
|
"If you find that animations are not smooth enough, you can try "
|
|
|
|
"to change the options "
|
|
|
|
) +
|
2017-07-22 23:33:27 +00:00
|
|
|
#if ISIOS
|
2017-07-10 18:47:38 +00:00
|
|
|
XLAT(
|
|
|
|
"(in the MENU). You can reduce the sight range, this should make "
|
|
|
|
"the animations smoother.");
|
|
|
|
#else
|
|
|
|
XLAT(
|
|
|
|
"(press v) and change the wall/monster mode to ASCII, or change "
|
|
|
|
"the resolution.");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-05-10 01:26:09 +00:00
|
|
|
glflush();
|
2017-07-10 18:47:38 +00:00
|
|
|
achievement_display();
|
|
|
|
|
|
|
|
callhooks(hooks_stats);
|
|
|
|
}
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
}
|