2018-02-08 23:40:26 +00:00
|
|
|
// Hyperbolic Rogue -- main graphics file
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-02-08 23:40:26 +00:00
|
|
|
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
2016-08-26 09:58:03 +00:00
|
|
|
|
|
|
|
// basic graphics:
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
namespace hr {
|
|
|
|
|
2019-03-13 13:04:06 +00:00
|
|
|
int last_firelimit, firelimit;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int inmirrorcount = 0;
|
2017-07-16 21:00:55 +00:00
|
|
|
|
2019-08-09 21:24:33 +00:00
|
|
|
EX bool spatial_graphics;
|
|
|
|
EX bool wmspatial, wmescher, wmplain, wmblack, wmascii;
|
|
|
|
EX bool mmspatial, mmhigh, mmmon, mmitem;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int detaillevel = 0;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool first_cell_to_draw = true;
|
2019-04-15 21:29:07 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool in_perspective() {
|
2019-08-06 14:48:01 +00:00
|
|
|
return among(pmodel, mdPerspective, mdGeodesic);
|
2019-07-28 09:07:21 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool hide_player() {
|
2019-07-28 09:07:21 +00:00
|
|
|
return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && in_perspective() && (first_cell_to_draw || elliptic) && (WDIM == 3 || vid.camera == 0) && !inmirrorcount
|
2019-06-01 14:59:04 +00:00
|
|
|
#if CAP_RACING
|
2019-08-03 09:38:38 +00:00
|
|
|
&& !(racing::on && !racing::standard_centering && !racing::player_relative && !sol)
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
|
|
|
;
|
2019-03-09 14:31:02 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX hookset<bool(int sym, int uni)> *hooks_handleKey;
|
|
|
|
EX hookset<bool(cell *c, const transmatrix& V)> *hooks_drawcell;
|
|
|
|
EX purehookset hooks_frame, hooks_markers;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX ld animation_factor = 1;
|
|
|
|
EX int animation_lcm = 0;
|
2018-09-10 15:49:51 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX ld ptick(int period, ld phase IS(0)) {
|
2018-09-10 15:49:51 +00:00
|
|
|
if(animation_lcm) animation_lcm = animation_lcm * (period / gcd(animation_lcm, period));
|
|
|
|
return (ticks * animation_factor) / period + phase * 2 * M_PI;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX ld fractick(int period, ld phase IS(0)) {
|
2018-09-10 15:49:51 +00:00
|
|
|
ld t = ptick(period, phase) / 2 / M_PI;
|
|
|
|
t -= floor(t);
|
|
|
|
if(t<0) t++;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX ld sintick(int period, ld phase IS(0)) {
|
2018-09-10 15:49:51 +00:00
|
|
|
return sin(ptick(period, phase));
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX transmatrix spintick(int period, ld phase IS(0)) {
|
2018-09-10 15:49:51 +00:00
|
|
|
return spin(ptick(period, phase));
|
|
|
|
}
|
|
|
|
|
2016-08-26 09:58:03 +00:00
|
|
|
#define WOLNIEJ 1
|
2016-01-02 10:09:13 +00:00
|
|
|
#define BTOFF 0x404040
|
|
|
|
#define BTON 0xC0C000
|
|
|
|
|
2017-03-23 10:53:57 +00:00
|
|
|
// #define PANDORA
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-03-23 10:53:57 +00:00
|
|
|
int colorbar;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool inHighQual; // taking high quality screenshot
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool auraNOGL; // aura without GL
|
2015-08-08 13:57:52 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
int axestate;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int ticks;
|
2017-03-23 10:53:57 +00:00
|
|
|
int frameid;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-04-08 15:18:29 +00:00
|
|
|
bool camelotcheat;
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool nomap;
|
2017-04-08 15:18:29 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX eItem orbToTarget;
|
|
|
|
EX eMonster monsterToSummon;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int sightrange_bonus = 0;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX string mouseovers;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int darken = 0;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-03-23 10:53:57 +00:00
|
|
|
struct fallanim {
|
2017-08-06 12:50:16 +00:00
|
|
|
int t_mon, t_floor, pid;
|
2017-03-23 10:53:57 +00:00
|
|
|
eWall walltype;
|
|
|
|
eMonster m;
|
2017-08-06 12:50:16 +00:00
|
|
|
fallanim() { t_floor = 0; t_mon = 0; pid = 0; walltype = waNone; }
|
2017-03-23 10:53:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
map<cell*, fallanim> fallanims;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool doHighlight() {
|
2017-03-23 10:53:57 +00:00
|
|
|
return (hiliteclick && darken < 2) ? !mmhigh : mmhigh;
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int dlit;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
ld spina(cell *c, int dir) {
|
|
|
|
return 2 * M_PI * dir / c->type;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// cloak color
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int cloakcolor(int rtr) {
|
2017-07-10 18:47:38 +00:00
|
|
|
rtr -= 28;
|
|
|
|
rtr /= 2;
|
|
|
|
rtr %= 10;
|
|
|
|
if(rtr < 0) rtr += 10;
|
|
|
|
// rtr = time(NULL) % 10;
|
|
|
|
int cc[10] = {
|
|
|
|
0x8080FF, 0x80FFFF, 0x80FF80, 0xFF8080, 0xFF80FF, 0xFFFF80,
|
|
|
|
0xFFFFC0, 0xFFD500, 0x421C52, 0
|
|
|
|
};
|
|
|
|
return cc[rtr];
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int firegradient(double p) {
|
|
|
|
return gradient(0xFFFF00, 0xFF0000, 0, p, 1);
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int firecolor(int phase IS(0), int mul IS(1)) {
|
2018-09-10 15:56:37 +00:00
|
|
|
return gradient(0xFFFF00, 0xFF0000, -1, sintick(100*mul, phase/200./M_PI), 1);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int watercolor(int phase) {
|
2018-09-10 15:56:37 +00:00
|
|
|
return 0x0080C0FF + 256 * int(63 * sintick(50, phase/100./M_PI));
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int aircolor(int phase) {
|
2019-05-26 16:04:02 +00:00
|
|
|
return 0x8080FF00 | int(32 + 32 * sintick(200, phase * 1. / cgi.S21));
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int fghostcolor(cell *c) {
|
2018-09-10 15:49:51 +00:00
|
|
|
int phase = int(fractick(650, (int)(size_t)c) * 4000);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(phase < 1000) return gradient(0xFFFF80, 0xA0C0FF, 0, phase, 1000);
|
|
|
|
else if(phase < 2000) return gradient(0xA0C0FF, 0xFF80FF, 1000, phase, 2000);
|
|
|
|
else if(phase < 3000) return gradient(0xFF80FF, 0xFF8080, 2000, phase, 3000);
|
|
|
|
else if(phase < 4000) return gradient(0xFF8080, 0xFFFF80, 3000, phase, 4000);
|
|
|
|
return 0xFFD500;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int weakfirecolor(int phase) {
|
2018-09-10 15:56:37 +00:00
|
|
|
return gradient(0xFF8000, 0xFF0000, -1, sintick(500, phase/1000./M_PI), 1);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t fc(int ph, color_t col, int z) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbFire]) col = darkena(firecolor(ph), 0, 0xFF);
|
|
|
|
if(items[itOrbAether]) col = (col &~0XFF) | (col&0xFF) / 2;
|
|
|
|
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i))
|
|
|
|
if(items[itOrbFish] && isWatery(playerpos(i)) && z != 3) return watercolor(ph);
|
|
|
|
if(invismove)
|
|
|
|
col =
|
|
|
|
shmup::on ?
|
|
|
|
(col &~0XFF) | (int((col&0xFF) * .25))
|
2018-09-10 15:56:37 +00:00
|
|
|
: (col &~0XFF) | (int((col&0xFF) * (100+100*sintick(500)))/200);
|
2017-07-10 18:47:38 +00:00
|
|
|
return col;
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int lightat, safetyat;
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawLightning() { lightat = ticks; }
|
|
|
|
EX void drawSafety() { safetyat = ticks; }
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawShield(const transmatrix& V, eItem it) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_CURVE
|
2018-09-10 15:49:51 +00:00
|
|
|
float ds = ptick(300);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = iinf[it].color;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(it == itOrbShield && items[itOrbTime] && !orbused[it])
|
|
|
|
col = (col & 0xFEFEFE) / 2;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(sphere && cwt.at->land == laHalloween && !wmblack && !wmascii)
|
2017-07-10 18:47:38 +00:00
|
|
|
col = 0;
|
2019-05-26 16:04:02 +00:00
|
|
|
double d = it == itOrbShield ? cgi.hexf : cgi.hexf - .1;
|
2017-07-10 18:47:38 +00:00
|
|
|
int mt = sphere ? 7 : 5;
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 13:04:54 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queueball(V * zpush(cgi.GROIN1), cgi.human_height / 2, darkena(col, 0, 0xFF), itOrbShield);
|
2019-06-01 14:59:04 +00:00
|
|
|
#else
|
|
|
|
if(1) ;
|
|
|
|
#endif
|
2019-05-11 13:04:54 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
for(ld a=0; a<=cgi.S84*mt+1e-6; a+=pow(.5, vid.linequality))
|
|
|
|
curvepoint(V*xspinpush0(a * M_PI/cgi.S42, d + sin(ds + M_PI*2*a/4/mt)*.1));
|
2019-05-11 13:04:54 +00:00
|
|
|
queuecurve(darkena(col, 0, 0xFF), 0x8080808, PPR::LINE);
|
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawSpeed(const transmatrix& V) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_CURVE
|
2018-09-10 15:49:51 +00:00
|
|
|
ld ds = ptick(10);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbSpeed].color, 0, 0xFF);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
if(DIM == 3) queueball(V * zpush(cgi.GROIN1), cgi.human_height * 0.55, col, itOrbSpeed);
|
2019-06-01 14:59:04 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
for(int b=0; b<cgi.S84; b+=cgi.S14) {
|
2018-08-01 09:07:22 +00:00
|
|
|
PRING(a)
|
2019-05-26 16:04:02 +00:00
|
|
|
curvepoint(V*xspinpush0((ds+b+a) * M_PI/cgi.S42, cgi.hexf*a/cgi.S84));
|
2018-08-28 12:27:23 +00:00
|
|
|
queuecurve(col, 0x8080808, PPR::LINE);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int ctof(cell *c) {
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
if(IRREGULAR) return irr::ctof(c);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-28 15:17:34 +00:00
|
|
|
if(PURE) return 1;
|
2017-10-28 08:04:28 +00:00
|
|
|
// if(euclid) return 0;
|
2018-07-30 15:47:25 +00:00
|
|
|
if(!c) return 1;
|
2018-08-09 17:28:53 +00:00
|
|
|
if(binarytiling) return c->type == 7;
|
2017-10-28 08:04:28 +00:00
|
|
|
return ishept(c) ? 1 : 0;
|
|
|
|
// c->type == 6 ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ctof012(cell *c) {
|
|
|
|
return ishept(c)?1:ishex1(c)?0:2;
|
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawSafety(const transmatrix& V, int ct) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_QUEUE
|
2018-09-10 15:49:51 +00:00
|
|
|
ld ds = ptick(50);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(DIM == 3) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queueball(V * zpush(cgi.GROIN1), 2*cgi.hexf, col, itOrbSafety);
|
2019-06-01 14:59:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
for(int a=0; a<ct; a++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(V*xspinpush0((ds+a*cgi.S84/ct) * M_PI/cgi.S42, 2*cgi.hexf), V*xspinpush0((ds+(a+(ct-1)/2)*cgi.S84/ct) * M_PI / cgi.S42, 2*cgi.hexf), col, vid.linequality);
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawFlash(const transmatrix& V) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_CURVE
|
2018-09-10 15:49:51 +00:00
|
|
|
float ds = ptick(300);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbFlash].color, 0, 0xFF);
|
2017-07-10 18:47:38 +00:00
|
|
|
col &= ~1;
|
|
|
|
for(int u=0; u<5; u++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ld rad = cgi.hexf * (2.5 + .5 * sin(ds+u*.3));
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 13:04:54 +00:00
|
|
|
if(DIM == 3) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queueball(V * zpush(cgi.GROIN1), rad, col, itOrbFlash);
|
2019-05-11 13:04:54 +00:00
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#else
|
|
|
|
if(1) ;
|
|
|
|
#endif
|
2019-05-11 13:04:54 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
PRING(a) curvepoint(V*xspinpush0(a * M_PI / cgi.S42, rad));
|
2019-05-11 13:04:54 +00:00
|
|
|
queuecurve(col, 0x8080808, PPR::LINE);
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-15 08:51:46 +00:00
|
|
|
ld cheilevel(ld v) {
|
2019-05-26 16:04:02 +00:00
|
|
|
return cgi.FLOOR + (cgi.HEAD - cgi.FLOOR) * v;
|
2019-05-15 08:51:46 +00:00
|
|
|
}
|
|
|
|
|
2019-05-11 13:04:54 +00:00
|
|
|
transmatrix chei(const transmatrix V, int a, int b) {
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 13:04:54 +00:00
|
|
|
if(DIM == 2) return V;
|
2019-05-15 08:51:46 +00:00
|
|
|
return V * zpush(cheilevel((a+.5) / b));
|
2019-06-01 14:59:04 +00:00
|
|
|
#else
|
|
|
|
return V;
|
|
|
|
#endif
|
2019-05-11 13:04:54 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawLove(const transmatrix& V, int hdir) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_CURVE
|
2018-09-10 15:49:51 +00:00
|
|
|
float ds = ptick(300);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbLove].color, 0, 0xFF);
|
2017-07-10 18:47:38 +00:00
|
|
|
col &= ~1;
|
|
|
|
for(int u=0; u<5; u++) {
|
2018-08-01 09:07:22 +00:00
|
|
|
PRING(a) {
|
2019-05-26 16:04:02 +00:00
|
|
|
double d = (1 + cos(a * M_PI/cgi.S42)) / 2;
|
|
|
|
double z = a; if(z>cgi.S42) z = cgi.S84-z;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(z <= 10) d += (10-z) * (10-z) * (10-z) / 3000.;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
ld rad = cgi.hexf * (2.5 + .5 * sin(ds+u*.3)) * d;
|
2019-05-11 13:04:54 +00:00
|
|
|
transmatrix V1 = chei(V, u, 5);
|
2019-05-26 16:04:02 +00:00
|
|
|
curvepoint(V1*xspinpush0((cgi.S42+hdir+a-1) * M_PI/cgi.S42, rad));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-08-28 12:27:23 +00:00
|
|
|
queuecurve(col, 0x8080808, PPR::LINE);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-19 13:52:39 +00:00
|
|
|
void drawWinter(const transmatrix& V, ld hdir) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_QUEUE
|
2018-09-10 15:49:51 +00:00
|
|
|
float ds = ptick(300);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbWinter].color, 0, 0xFF);
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int u=0; u<20; u++) {
|
2018-08-19 13:52:39 +00:00
|
|
|
ld rad = sin(ds+u * 2 * M_PI / 20) * M_PI / S7;
|
2019-05-11 13:04:54 +00:00
|
|
|
transmatrix V1 = chei(V, u, 20);
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(V1*xspinpush0(M_PI+hdir+rad, cgi.hexf*.5), V1*xspinpush0(M_PI+hdir+rad, cgi.hexf*3), col, 2 + vid.linequality);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawLightning(const transmatrix& V) {
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_QUEUE
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbLightning].color, 0, 0xFF);
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int u=0; u<20; u++) {
|
|
|
|
ld leng = 0.5 / (0.1 + (rand() % 100) / 100.0);
|
2018-08-19 13:52:39 +00:00
|
|
|
ld rad = rand() % 1000;
|
2019-05-11 13:04:54 +00:00
|
|
|
transmatrix V1 = chei(V, u, 20);
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(V1*xspinpush0(rad, cgi.hexf*0.3), V1*xspinpush0(rad, cgi.hexf*leng), col, 2 + vid.linequality);
|
2017-07-04 13:38:33 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX ld displayspin(cell *c, int d) {
|
2019-02-17 17:28:20 +00:00
|
|
|
if(0);
|
|
|
|
#if CAP_ARCM
|
|
|
|
else if(archimedean) {
|
2018-08-29 02:28:34 +00:00
|
|
|
if(PURE) {
|
|
|
|
auto& t1 = arcm::current.get_triangle(c->master, d-1);
|
|
|
|
return -(t1.first + M_PI / c->type);
|
|
|
|
}
|
2018-08-30 00:11:43 +00:00
|
|
|
else if(DUAL) {
|
|
|
|
auto& t1 = arcm::current.get_triangle(c->master, 2*d);
|
|
|
|
return -t1.first;
|
|
|
|
}
|
2018-08-29 02:28:34 +00:00
|
|
|
else { /* BITRUNCATED */
|
|
|
|
auto& t1 = arcm::current.get_triangle(c->master, d);
|
|
|
|
return -t1.first;
|
|
|
|
}
|
2018-08-18 15:40:02 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(IRREGULAR) {
|
2018-07-16 18:05:23 +00:00
|
|
|
auto id = irr::cellindex[c];
|
|
|
|
auto& vs = irr::cells[id];
|
|
|
|
if(d < 0 || d >= c->type) return 0;
|
|
|
|
auto& p = vs.jpoints[vs.neid[d]];
|
2018-08-19 13:52:39 +00:00
|
|
|
return -atan2(p[1], p[0]);
|
2018-07-16 18:05:23 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_BT
|
2018-08-09 17:28:53 +00:00
|
|
|
else if(binarytiling) {
|
|
|
|
if(d == NODIR) return 0;
|
|
|
|
if(d == c->type-1) d++;
|
2018-08-22 09:21:58 +00:00
|
|
|
return -(d+2)*M_PI/4;
|
2018-08-09 17:28:53 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-18 15:35:39 +00:00
|
|
|
else if(masterless)
|
2018-08-19 13:52:39 +00:00
|
|
|
return - d * 2 * M_PI / c->type;
|
2017-03-23 10:53:57 +00:00
|
|
|
else
|
2018-08-19 13:52:39 +00:00
|
|
|
return M_PI - d * 2 * M_PI / c->type;
|
2017-10-28 23:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double hexshiftat(cell *c) {
|
2018-08-09 17:28:53 +00:00
|
|
|
if(binarytiling) return 0;
|
2019-05-26 16:04:02 +00:00
|
|
|
if(ctof(c) && S7==6 && S3 == 4 && BITRUNCATED) return cgi.hexshift + 2*M_PI/S7;
|
|
|
|
if(ctof(c) && (S7==8 || S7 == 4) && S3 == 3 && BITRUNCATED) return cgi.hexshift + 2*M_PI/S7;
|
|
|
|
if(cgi.hexshift && ctof(c)) return cgi.hexshift;
|
2017-10-28 23:57:34 +00:00
|
|
|
return 0;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX transmatrix ddspin(cell *c, int d, ld bonus IS(0)) {
|
2019-07-28 09:40:15 +00:00
|
|
|
if(WDIM == 3 && d < c->type) return rspintox(tC0(calc_relative_matrix(c->cmove(d), c, C0))) * cspin(2, 0, bonus);
|
2019-07-28 10:05:22 +00:00
|
|
|
if(WDIM == 2 && (binarytiling || penrose) && d < c->type) return spin(bonus) * rspintox(nearcorner(c, d));
|
2018-08-19 13:52:39 +00:00
|
|
|
return spin(displayspin(c, d) + bonus - hexshiftat(c));
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX transmatrix iddspin(cell *c, int d, ld bonus IS(0)) {
|
2019-07-28 09:40:15 +00:00
|
|
|
if(WDIM == 3 && d < c->type) return cspin(0, 2, bonus) * spintox(tC0(calc_relative_matrix(c->cmove(d), c, C0)));
|
2019-07-28 10:05:22 +00:00
|
|
|
if(WDIM == 2 && (binarytiling || penrose) && d < c->type) return spin(bonus) * spintox(nearcorner(c, d));
|
2018-08-19 13:52:39 +00:00
|
|
|
return spin(hexshiftat(c) - displayspin(c, d) + bonus);
|
2017-10-09 09:46:49 +00:00
|
|
|
}
|
|
|
|
|
2019-04-20 23:06:37 +00:00
|
|
|
#define UNTRANS (DIM == 3 ? 0x000000FF : 0)
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!onplayer && !items[itOrbEmpathy]) return;
|
|
|
|
if(items[itOrbShield] > (shmup::on ? 0 : ORBBASE)) drawShield(V, itOrbShield);
|
|
|
|
if(items[itOrbShell] > (shmup::on ? 0 : ORBBASE)) drawShield(V, itOrbShell);
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbSpeed]) drawSpeed(V);
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(onplayer && (items[itOrbSword] || items[itOrbSword2])) {
|
|
|
|
using namespace sword;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-08 16:33:08 +00:00
|
|
|
if(shmup::on && WDIM == 2) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbSword])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V*spin(shmup::pc[multi::cpid]->swordangle), (peace::on ? cgi.shMagicShovel : cgi.shMagicSword), darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sintick(200)));
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbSword2])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V*spin(shmup::pc[multi::cpid]->swordangle+M_PI), (peace::on ? cgi.shMagicShovel : cgi.shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sintick(200)));
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-09 16:38:23 +00:00
|
|
|
|
2019-06-24 20:28:20 +00:00
|
|
|
else if(WDIM == 3) {
|
2019-03-09 16:38:23 +00:00
|
|
|
#if CAP_SHAPES
|
2019-06-24 20:28:20 +00:00
|
|
|
transmatrix Vsword =
|
|
|
|
shmup::on ? V * shmup::swordmatrix[multi::cpid] * cspin(2, 0, M_PI/2)
|
|
|
|
: gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * sword::dir[multi::cpid].T;
|
|
|
|
|
2019-03-09 16:38:23 +00:00
|
|
|
if(items[itOrbSword])
|
2019-06-24 20:28:20 +00:00
|
|
|
queuepoly(Vsword * cspin(1,2, ticks / 150.), (peace::on ? cgi.shMagicShovel : cgi.shMagicSword), darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sintick(200)));
|
2019-03-09 16:38:23 +00:00
|
|
|
|
|
|
|
if(items[itOrbSword2])
|
2019-06-24 20:28:20 +00:00
|
|
|
queuepoly(Vsword * pispin * cspin(1,2, ticks / 150.), (peace::on ? cgi.shMagicShovel : cgi.shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sintick(200)));
|
2019-03-09 16:38:23 +00:00
|
|
|
#endif
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2015-08-08 13:57:52 +00:00
|
|
|
else {
|
2019-06-24 20:28:20 +00:00
|
|
|
int& ang = sword::dir[multi::cpid].angle;
|
2019-05-28 23:01:13 +00:00
|
|
|
ang %= sword::sword_angles;
|
2019-02-17 17:41:40 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_QUEUE || CAP_SHAPES
|
2018-08-30 16:11:41 +00:00
|
|
|
transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * ddspin(c,0,M_PI); // (IRREGULAR ? ddspin(c,0,M_PI) : spin(-hexshiftat(c)));
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2019-05-28 23:01:13 +00:00
|
|
|
|
|
|
|
int adj = 1 - ((sword_angles/cwt.at->type)&1);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-12-01 23:23:15 +00:00
|
|
|
#if CAP_QUEUE
|
2019-02-26 13:10:23 +00:00
|
|
|
if(!euclid) for(int a=0; a<sword_angles; a++) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(a == ang && items[itOrbSword]) continue;
|
2019-02-26 13:10:23 +00:00
|
|
|
if((a+sword_angles/2)%sword_angles == ang && items[itOrbSword2]) continue;
|
2019-06-24 20:28:20 +00:00
|
|
|
bool longer = sword::pos2(cwt.at, a-1) != sword::pos2(cwt.at, a+1);
|
2019-05-28 23:01:13 +00:00
|
|
|
if(sword_angles > 48 && !longer) continue;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(0xC0C0C0, 0, 0xFF);
|
2019-05-26 16:04:02 +00:00
|
|
|
ld l0 = PURE ? 0.6 * cgi.scalefactor : longer ? 0.36 : 0.4;
|
|
|
|
ld l1 = PURE ? 0.7 * cgi.scalefactor : longer ? 0.44 : 0.42;
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
hyperpoint h0 = DIM == 3 ? xpush(l0) * zpush(cgi.FLOOR - cgi.human_height/50) * C0 : xpush0(l0);
|
2019-05-28 23:01:13 +00:00
|
|
|
hyperpoint h1 = DIM == 3 ? xpush(l1) * zpush(cgi.FLOOR - cgi.human_height/50) * C0 : xpush0(l1);
|
2019-06-01 14:59:04 +00:00
|
|
|
#else
|
|
|
|
hyperpoint h0 = xpush0(l0);
|
|
|
|
hyperpoint h1 = xpush0(l1);
|
|
|
|
#endif
|
2019-05-28 23:01:13 +00:00
|
|
|
transmatrix T = Vnow*spin((sword_angles + (-adj-2*a)) * M_PI / sword_angles);
|
2019-05-11 13:19:32 +00:00
|
|
|
queueline(T*h0, T*h1, col, 1, PPR::SUPERLINE);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbSword])
|
2019-05-28 23:01:13 +00:00
|
|
|
queuepoly(Vnow*spin(M_PI+(-adj-2*ang)*M_PI/sword_angles), (peace::on ? cgi.shMagicShovel : cgi.shMagicSword), darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sintick(200)));
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(items[itOrbSword2])
|
2019-05-28 23:01:13 +00:00
|
|
|
queuepoly(Vnow*spin((-adj-2*ang)*M_PI/sword_angles), (peace::on ? cgi.shMagicShovel : cgi.shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sintick(200)));
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-28 08:04:28 +00:00
|
|
|
if(onplayer && items[itOrbSafety]) drawSafety(V, c->type);
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(onplayer && items[itOrbFlash]) drawFlash(V);
|
|
|
|
if(onplayer && items[itOrbLove]) drawLove(V, 0); // displaydir(c, cwt.spin));
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbWinter])
|
|
|
|
drawWinter(V, 0); // displaydir(c, cwt.spin));
|
|
|
|
|
|
|
|
if(onplayer && items[itOrbLightning]) drawLightning(V);
|
|
|
|
|
|
|
|
if(safetyat > 0) {
|
|
|
|
int tim = ticks - safetyat;
|
|
|
|
if(tim > 2500) safetyat = 0;
|
|
|
|
for(int u=tim; u<=2500; u++) {
|
|
|
|
if((u-tim)%250) continue;
|
2019-05-26 16:04:02 +00:00
|
|
|
ld rad = cgi.hexf * u / 250;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
2018-08-01 09:07:22 +00:00
|
|
|
PRING(a)
|
2019-05-26 16:04:02 +00:00
|
|
|
curvepoint(V*xspinpush0(a * M_PI / cgi.S42, rad));
|
2018-08-28 12:27:23 +00:00
|
|
|
queuecurve(col, 0, PPR::LINE);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawStunStars(const transmatrix& V, int t) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int i=0; i<3*t; i++) {
|
2018-09-10 15:49:51 +00:00
|
|
|
transmatrix V2 = V * spin(M_PI * 2 * i / (3*t) + ptick(200));
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
if(GDIM == 3) V2 = V2 * zpush(cgi.HEAD);
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V2, cgi.shFlailBall, 0xFFFFFFFF, PPR::STUNSTARS);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
namespace tortoise {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// small is 0 or 2
|
|
|
|
void draw(const transmatrix& V, int bits, int small, int stuntime) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t eyecolor = getBit(bits, tfEyeHue) ? 0xFF0000 : 0xC0C0C0;
|
|
|
|
color_t shellcolor = getBit(bits, tfShellHue) ? 0x00C040 : 0xA06000;
|
|
|
|
color_t scutecolor = getBit(bits, tfScuteHue) ? 0x00C040 : 0xA06000;
|
|
|
|
color_t skincolor = getBit(bits, tfSkinHue) ? 0x00C040 : 0xA06000;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(getBit(bits, tfShellSat)) shellcolor = gradient(shellcolor, 0xB0B0B0, 0, .5, 1);
|
|
|
|
if(getBit(bits, tfScuteSat)) scutecolor = gradient(scutecolor, 0xB0B0B0, 0, .5, 1);
|
|
|
|
if(getBit(bits, tfSkinSat)) skincolor = gradient(skincolor, 0xB0B0B0, 0, .5, 1);
|
|
|
|
if(getBit(bits, tfShellDark)) shellcolor = gradient(shellcolor, 0, 0, .5, 1);
|
|
|
|
if(getBit(bits, tfSkinDark)) skincolor = gradient(skincolor, 0, 0, .5, 1);
|
|
|
|
|
2017-12-01 23:23:15 +00:00
|
|
|
for(int i=0; i<12; i++) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col =
|
2017-07-10 18:47:38 +00:00
|
|
|
i == 0 ? shellcolor:
|
|
|
|
i < 8 ? scutecolor :
|
|
|
|
skincolor;
|
|
|
|
int b = getBit(bits, i);
|
|
|
|
int d = darkena(col, 0, 0xFF);
|
|
|
|
if(i >= 1 && i <= 7) if(b) { d = darkena(col, 1, 0xFF); b = 0; }
|
|
|
|
|
|
|
|
if(i >= 8 && i <= 11 && stuntime >= 3) continue;
|
2017-12-01 23:23:15 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shTortoise[i][b+small], d);
|
2017-07-10 18:47:38 +00:00
|
|
|
if((i >= 5 && i <= 7) || (i >= 9 && i <= 10))
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V * Mirror, cgi.shTortoise[i][b+small], d);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(i == 8) {
|
|
|
|
for(int k=0; k<stuntime; k++) {
|
|
|
|
eyecolor &= 0xFEFEFE;
|
|
|
|
eyecolor >>= 1;
|
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shTortoise[12][b+small], darkena(eyecolor, 0, 0xFF));
|
|
|
|
queuepoly(V * Mirror, cgi.shTortoise[12][b+small], darkena(eyecolor, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int getMatchColor(int bits) {
|
|
|
|
int mcol = 1;
|
|
|
|
double d = tortoise::getScent(bits);
|
|
|
|
|
|
|
|
if(d > 0) mcol = 0xFFFFFF;
|
|
|
|
else if(d < 0) mcol = 0;
|
|
|
|
|
|
|
|
int dd = 0xFF * (atan(fabs(d)/2) / (M_PI/2));
|
|
|
|
|
|
|
|
return gradient(0x487830, mcol, 0, dd, 0xFF);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
};
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
double footfun(double d) {
|
|
|
|
d -= floor(d);
|
|
|
|
return
|
|
|
|
d < .25 ? d :
|
|
|
|
d < .75 ? .5-d :
|
|
|
|
d-1;
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX bool ivoryz;
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
void animallegs(const transmatrix& V, eMonster mo, color_t col, double footphase) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
footphase /= SCALE;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool dog = mo == moRunDog;
|
|
|
|
bool bug = mo == moBug0 || mo == moMetalBeast;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(bug) footphase *= 2.5;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
double rightfoot = footfun(footphase / .4 / 2) / 4 * 2;
|
|
|
|
double leftfoot = footfun(footphase / .4 / 2 - (bug ? .5 : dog ? .1 : .25)) / 4 * 2;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(bug) rightfoot /= 2.5, leftfoot /= 2.5;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-02-28 02:38:22 +00:00
|
|
|
rightfoot *= SCALE;
|
|
|
|
leftfoot *= SCALE;
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!footphase) rightfoot = leftfoot = 0;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix VAML = mmscale(V, cgi.ALEG);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
hpcshape* sh[6][4] = {
|
2019-05-26 16:04:02 +00:00
|
|
|
{&cgi.shDogFrontPaw, &cgi.shDogRearPaw, &cgi.shDogFrontLeg, &cgi.shDogRearLeg},
|
|
|
|
{&cgi.shWolfFrontPaw, &cgi.shWolfRearPaw, &cgi.shWolfFrontLeg, &cgi.shWolfRearLeg},
|
|
|
|
{&cgi.shReptileFrontFoot, &cgi.shReptileRearFoot, &cgi.shReptileFrontLeg, &cgi.shReptileRearLeg},
|
|
|
|
{&cgi.shBugLeg, NULL, NULL, NULL},
|
|
|
|
{&cgi.shTrylobiteFrontClaw, &cgi.shTrylobiteRearClaw, &cgi.shTrylobiteFrontLeg, &cgi.shTrylobiteRearLeg},
|
|
|
|
{&cgi.shBullFrontHoof, &cgi.shBullRearHoof, &cgi.shBullFrontHoof, &cgi.shBullRearHoof},
|
2017-07-10 18:47:38 +00:00
|
|
|
};
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
hpcshape **x = sh[mo == moRagingBull ? 5 : mo == moBug0 ? 3 : mo == moMetalBeast ? 4 : mo == moRunDog ? 0 : mo == moReptile ? 2 : 1];
|
2019-06-01 14:59:04 +00:00
|
|
|
|
|
|
|
#if MAXMDIM >= 4
|
2019-05-16 15:22:04 +00:00
|
|
|
if(GDIM == 3) {
|
2019-05-24 21:50:06 +00:00
|
|
|
if(x[0]) queuepolyat(V * front_leg_move * cspin(0, 2, rightfoot / leg_length) * front_leg_move_inverse, *x[0], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[0]) queuepolyat(V * Mirror * front_leg_move * cspin(0, 2, leftfoot / leg_length) * front_leg_move_inverse, *x[0], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[1]) queuepolyat(V * rear_leg_move * cspin(0, 2, -rightfoot / leg_length) * rear_leg_move_inverse, *x[1], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[1]) queuepolyat(V * Mirror * rear_leg_move * cspin(0, 2, -leftfoot / leg_length) * rear_leg_move_inverse, *x[1], col, PPR::MONSTER_FOOT);
|
2019-05-16 15:22:04 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
2019-05-26 16:04:02 +00:00
|
|
|
if(WDIM == 2) V1 = V1 * zpush(cgi.GROIN);
|
2019-05-16 15:22:04 +00:00
|
|
|
Tright = V1 * cspin(0, 2, rightfoot/SCALE * 3);
|
|
|
|
Tleft = V1 * Mirror * cspin(2, 0, rightfoot/SCALE * 3);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(WDIM == 2) Tleft = Tleft * zpush(-cgi.GROIN), Tright = Tright * zpush(-cgi.GROIN);
|
2019-05-16 15:22:04 +00:00
|
|
|
*/
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
const transmatrix VL = mmscale(V, cgi.ALEG0);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-02-27 17:59:21 +00:00
|
|
|
if(x[0]) queuepolyat(VL * xpush(rightfoot), *x[0], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[0]) queuepolyat(VL * Mirror * xpush(leftfoot), *x[0], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[1]) queuepolyat(VL * xpush(-rightfoot), *x[1], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[1]) queuepolyat(VL * Mirror * xpush(-leftfoot), *x[1], col, PPR::MONSTER_FOOT);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-08-28 12:27:23 +00:00
|
|
|
if(x[2]) queuepolyat(VAML * xpush(rightfoot/2), *x[2], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[2]) queuepolyat(VAML * Mirror * xpush(leftfoot/2), *x[2], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[3]) queuepolyat(VAML * xpush(-rightfoot/2), *x[3], col, PPR::MONSTER_FOOT);
|
|
|
|
if(x[3]) queuepolyat(VAML * Mirror * xpush(-leftfoot/2), *x[3], col, PPR::MONSTER_FOOT);
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool noshadow;
|
2018-06-25 20:59:29 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-08-09 21:24:33 +00:00
|
|
|
EX void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio IS(PPR::MONSTER_SHADOW)) {
|
2019-05-13 07:34:22 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && bp.shs != bp.she) {
|
2019-05-13 11:18:55 +00:00
|
|
|
auto& p = queuepolyat(V, bp, 0x18, PPR::TRANSPARENT_SHADOW);
|
2019-05-13 07:34:22 +00:00
|
|
|
p.outline = 0;
|
|
|
|
p.subprio = -100;
|
|
|
|
p.offset = bp.shs;
|
|
|
|
p.cnt = bp.she - bp.shs;
|
|
|
|
p.flags &=~ POLY_TRIANGLES;
|
|
|
|
p.tinf = NULL;
|
|
|
|
return;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(mmspatial) {
|
2019-02-22 20:27:42 +00:00
|
|
|
if(model_needs_depth() || noshadow)
|
2017-07-10 18:47:38 +00:00
|
|
|
return; // shadows break the depth testing
|
2018-09-04 17:53:42 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
2017-07-10 18:47:38 +00:00
|
|
|
queuepolyat(V, bp, SHADOW_MON, prio);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-12-23 13:00:52 +00:00
|
|
|
transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, double footphase) {
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
#define VFOOT (DIM == 2 ? V : mmscale(V, cgi.LEG0))
|
|
|
|
#define VLEG mmscale(V, cgi.LEG)
|
|
|
|
#define VGROIN mmscale(V, cgi.GROIN)
|
|
|
|
#define VBODY mmscale(V, cgi.BODY)
|
|
|
|
#define VBODY1 mmscale(V, cgi.BODY1)
|
|
|
|
#define VBODY2 mmscale(V, cgi.BODY2)
|
|
|
|
#define VBODY3 mmscale(V, cgi.BODY3)
|
|
|
|
#define VNECK mmscale(V, cgi.NECK)
|
|
|
|
#define VHEAD mmscale(V, cgi.HEAD)
|
|
|
|
#define VHEAD1 mmscale(V, cgi.HEAD1)
|
|
|
|
#define VHEAD2 mmscale(V, cgi.HEAD2)
|
|
|
|
#define VHEAD3 mmscale(V, cgi.HEAD3)
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
#define VALEGS V
|
2019-05-26 16:04:02 +00:00
|
|
|
#define VABODY mmscale(V, cgi.ABODY)
|
|
|
|
#define VAHEAD mmscale(V, cgi.AHEAD)
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
#define VFISH V
|
2019-05-26 16:04:02 +00:00
|
|
|
#define VBIRD ((DIM == 3 || (where && bird_disruption(where))) ? (WDIM == 2 ? mmscale(V, cgi.BIRD) : V) : mmscale(V, cgi.BIRD + .05 * sintick(1000, (int) (size_t(where))/1000.)))
|
|
|
|
#define VGHOST mmscale(V, cgi.GHOST)
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
#define VSLIMEEYE mscale(V, cgi.FLATEYE)
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// if(!mmspatial && !footphase && who != moSkeleton) return;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
footphase /= SCALE;
|
2019-02-28 02:38:22 +00:00
|
|
|
double rightfoot = footfun(footphase / .4 / 2.5) / 4 * 2.5 * SCALE;
|
2018-12-23 13:00:52 +00:00
|
|
|
|
|
|
|
const double wobble = -1;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// todo
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-04-20 23:21:03 +00:00
|
|
|
if(detaillevel >= 2 && DIM == 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix VL = mmscale(V, cgi.LEG1);
|
|
|
|
queuepoly(VL * xpush(rightfoot*3/4), cgi.shHumanLeg, col);
|
|
|
|
queuepoly(VL * Mirror * xpush(-rightfoot*3/4), cgi.shHumanLeg, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-04-20 23:21:03 +00:00
|
|
|
if(DIM == 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix VL = mmscale(V, cgi.LEG);
|
|
|
|
queuepoly(VL * xpush(rightfoot/2), cgi.shHumanLeg, col);
|
|
|
|
queuepoly(VL * Mirror * xpush(-rightfoot/2), cgi.shHumanLeg, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-04-20 23:21:03 +00:00
|
|
|
if(detaillevel >= 2 && DIM == 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix VL = mmscale(V, cgi.LEG3);
|
|
|
|
queuepoly(VL * xpush(rightfoot/4), cgi.shHumanLeg, col);
|
|
|
|
queuepoly(VL * Mirror * xpush(-rightfoot/4), cgi.shHumanLeg, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-04-20 23:21:03 +00:00
|
|
|
transmatrix Tright, Tleft;
|
|
|
|
|
|
|
|
if(DIM == 2) {
|
|
|
|
Tright = VFOOT * xpush(rightfoot);
|
|
|
|
Tleft = VFOOT * Mirror * xpush(-rightfoot);
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-04-20 23:21:03 +00:00
|
|
|
else {
|
2019-05-11 21:52:37 +00:00
|
|
|
transmatrix V1 = V;
|
2019-05-26 16:04:02 +00:00
|
|
|
if(WDIM == 2) V1 = V1 * zpush(cgi.GROIN);
|
2019-05-16 15:22:04 +00:00
|
|
|
Tright = V1 * cspin(0, 2, rightfoot/ leg_length);
|
|
|
|
Tleft = V1 * Mirror * cspin(2, 0, rightfoot / leg_length);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(WDIM == 2) Tleft = Tleft * zpush(-cgi.GROIN), Tright = Tright * zpush(-cgi.GROIN);
|
2019-04-20 23:21:03 +00:00
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-04-20 23:21:03 +00:00
|
|
|
|
|
|
|
if(who == moWaterElemental && DIM == 2) {
|
2017-07-10 18:47:38 +00:00
|
|
|
double fishtail = footfun(footphase / .4) / 4 * 1.5;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VFOOT * xpush(fishtail), cgi.shFishTail, watercolor(100));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(who == moSkeleton) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Tright, cgi.shSkeletalFoot, col);
|
|
|
|
queuepoly(Tleft, cgi.shSkeletalFoot, col);
|
2018-12-23 13:00:52 +00:00
|
|
|
return spin(rightfoot * wobble);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(isTroll(who) || who == moMonkey || who == moYeti || who == moRatling || who == moRatlingAvenger || who == moGoblin) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Tright, cgi.shYetiFoot, col);
|
|
|
|
queuepoly(Tleft, cgi.shYetiFoot, col);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Tright, cgi.shHumanFoot, col);
|
|
|
|
queuepoly(Tleft, cgi.shHumanFoot, col);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2019-04-20 23:21:03 +00:00
|
|
|
if(DIM == 3 || !mmspatial) return spin(rightfoot * wobble);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(detaillevel >= 2 && who != moZombie)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mmscale(V, cgi.NECK1), cgi.shHumanNeck, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(detaillevel >= 1) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VGROIN, cgi.shHumanGroin, col);
|
|
|
|
if(who != moZombie) queuepoly(VNECK, cgi.shHumanNeck, col);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(detaillevel >= 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mmscale(V, cgi.GROIN1), cgi.shHumanGroin, col);
|
|
|
|
if(who != moZombie) queuepoly(mmscale(V, cgi.NECK3), cgi.shHumanNeck, col);
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2018-12-23 13:00:52 +00:00
|
|
|
|
|
|
|
return spin(rightfoot * wobble);
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool drawstar(cell *c) {
|
|
|
|
for(int t=0; t<c->type; t++)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c->move(t) && c->move(t)->wall != waSulphur && c->move(t)->wall != waSulphurC &&
|
|
|
|
c->move(t)->wall != waBarrier)
|
2017-07-10 18:47:38 +00:00
|
|
|
return false;
|
|
|
|
return true;
|
2017-05-27 19:40:40 +00:00
|
|
|
}
|
|
|
|
|
2018-08-28 11:45:11 +00:00
|
|
|
bool drawing_usershape_on(cell *c, mapeditor::eShapegroup sg) {
|
2018-08-31 18:59:58 +00:00
|
|
|
#if CAP_EDIT
|
2018-08-28 12:09:36 +00:00
|
|
|
return c && c == mapeditor::drawcell && mapeditor::drawcellShapeGroup() == sg;
|
2018-08-31 18:59:58 +00:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2018-08-28 11:45:11 +00:00
|
|
|
}
|
|
|
|
|
2019-05-24 19:42:30 +00:00
|
|
|
transmatrix radar_transform;
|
2019-05-15 09:16:35 +00:00
|
|
|
|
2019-05-30 08:43:17 +00:00
|
|
|
pair<bool, hyperpoint> makeradar(hyperpoint h) {
|
|
|
|
if(GDIM == 3 && WDIM == 2) h = radar_transform * h;
|
2019-05-24 19:42:30 +00:00
|
|
|
|
2019-05-11 13:47:34 +00:00
|
|
|
ld d = hdist0(h);
|
2019-07-31 15:32:44 +00:00
|
|
|
|
2019-08-06 10:00:46 +00:00
|
|
|
if(sol && nisot::geodesic_movement) {
|
|
|
|
h = nisot::inverse_exp(h, nisot::iLazy);
|
2019-07-31 15:32:44 +00:00
|
|
|
ld r = hypot_d(3, h);
|
|
|
|
if(r < 1) h = h * (atanh(r) / r);
|
|
|
|
else return {false, h};
|
|
|
|
}
|
2019-08-06 10:00:46 +00:00
|
|
|
if(nisot::local_perspective_used()) h = nisot::local_perspective * h;
|
2019-05-30 08:43:17 +00:00
|
|
|
|
2019-05-15 07:36:44 +00:00
|
|
|
if(WDIM == 3) {
|
2019-07-31 15:32:44 +00:00
|
|
|
if(d >= vid.radarrange) return {false, h};
|
|
|
|
if(d) h = h * (d / vid.radarrange / hypot_d(3, h));
|
2019-05-15 07:36:44 +00:00
|
|
|
}
|
|
|
|
else if(hyperbolic) {
|
2019-05-24 19:42:30 +00:00
|
|
|
for(int a=0; a<3; a++) h[a] = h[a] / (1 + h[3]);
|
2019-05-12 18:10:49 +00:00
|
|
|
}
|
2019-05-15 09:13:23 +00:00
|
|
|
else if(sphere) {
|
|
|
|
h[2] = h[3];
|
|
|
|
}
|
2019-05-15 07:36:44 +00:00
|
|
|
else {
|
2019-07-31 15:32:44 +00:00
|
|
|
if(d > vid.radarrange) return {false, h};
|
|
|
|
if(d) h = h * (d / (vid.radarrange + cgi.scalefactor/4) / hypot_d(3, h));
|
2019-05-15 07:36:44 +00:00
|
|
|
}
|
2019-05-30 08:43:17 +00:00
|
|
|
return {true, h};
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void addradar(const transmatrix& V, char ch, color_t col, color_t outline) {
|
2019-05-30 08:43:17 +00:00
|
|
|
hyperpoint h = tC0(V);
|
|
|
|
auto hp = makeradar(h);
|
|
|
|
if(hp.first)
|
|
|
|
radarpoints.emplace_back(radarpoint{hp.second, ch, col, outline});
|
|
|
|
}
|
|
|
|
|
|
|
|
void addradar(const hyperpoint h1, const hyperpoint h2, color_t col) {
|
|
|
|
auto hp1 = makeradar(h1);
|
|
|
|
auto hp2 = makeradar(h2);
|
|
|
|
if(hp1.first && hp2.first)
|
|
|
|
radarlines.emplace_back(radarline{hp1.second, hp2.second, col});
|
2019-02-28 15:24:46 +00:00
|
|
|
}
|
2019-05-11 13:47:34 +00:00
|
|
|
|
2019-02-28 15:24:46 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX transmatrix face_the_player(const transmatrix V) {
|
2019-03-23 15:26:53 +00:00
|
|
|
if(DIM == 2) return V;
|
2019-08-06 10:00:46 +00:00
|
|
|
if(nonisotropic) return V * cspin(0, 2, ptick(618, 0));
|
2019-03-23 15:26:53 +00:00
|
|
|
return rgpushxto0(tC0(V));
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX hpcshape& orbshape(eOrbshape s) {
|
2019-03-23 15:26:53 +00:00
|
|
|
switch(s) {
|
2019-05-26 16:04:02 +00:00
|
|
|
case osLove: return cgi.shLoveRing;
|
|
|
|
case osRanged: return cgi.shTargetRing;
|
|
|
|
case osOffensive: return cgi.shSawRing;
|
|
|
|
case osFriend: return cgi.shPeaceRing;
|
|
|
|
case osUtility: return cgi.shGearRing;
|
|
|
|
case osDirectional: return cgi.shSpearRing;
|
|
|
|
case osWarping: return cgi.shHeptaRing;
|
|
|
|
default: return cgi.shRing;
|
2019-03-23 15:26:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int pticks, bool hidden) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if !CAP_SHAPES
|
2017-12-01 23:23:15 +00:00
|
|
|
return it;
|
|
|
|
#else
|
2019-02-17 17:41:40 +00:00
|
|
|
char xch = iinf[it].glyph;
|
2018-09-10 15:49:51 +00:00
|
|
|
auto sinptick = [c, pticks] (int period) { return c ? sintick(period) : sin(animation_factor * pticks / period);};
|
|
|
|
auto spinptick = [c, pticks] (int period, ld phase=0) { return c ? spintick(period, phase) : spin((animation_factor * pticks + phase) / period); };
|
2017-10-28 08:04:28 +00:00
|
|
|
int ct6 = c ? ctof(c) : 1;
|
2017-07-10 18:47:38 +00:00
|
|
|
hpcshape *xsh =
|
2019-05-26 16:04:02 +00:00
|
|
|
(it == itPirate || it == itKraken) ? &cgi.shPirateX :
|
|
|
|
(it == itBuggy || it == itBuggy2) ? &cgi.shPirateX :
|
|
|
|
it == itHolyGrail ? &cgi.shGrail :
|
|
|
|
isElementalShard(it) ? &cgi.shElementalShard :
|
|
|
|
(it == itBombEgg || it == itTrollEgg) ? &cgi.shEgg :
|
|
|
|
it == itHunting ? &cgi.shTriangle :
|
|
|
|
it == itDodeca ? &cgi.shDodeca :
|
|
|
|
xch == '*' ? &cgi.shGem[ct6] :
|
|
|
|
xch == '(' ? &cgi.shKnife :
|
|
|
|
it == itShard ? &cgi.shMFloor.b[0] :
|
|
|
|
it == itTreat ? &cgi.shTreat :
|
|
|
|
it == itSlime ? &cgi.shEgg :
|
|
|
|
xch == '%' ? &cgi.shDaisy : xch == '$' ? &cgi.shStar : xch == ';' ? &cgi.shTriangle :
|
|
|
|
xch == '!' ? &cgi.shTriangle : it == itBone ? &cgi.shNecro : it == itStatue ? &cgi.shStatue :
|
|
|
|
it == itIvory ? &cgi.shFigurine :
|
|
|
|
xch == '?' ? &cgi.shBookCover :
|
|
|
|
it == itKey ? &cgi.shKey :
|
|
|
|
it == itRevolver ? &cgi.shGun :
|
2017-07-10 18:47:38 +00:00
|
|
|
NULL;
|
|
|
|
|
2019-02-28 15:24:46 +00:00
|
|
|
if(c && doHighlight())
|
|
|
|
poly_outline = kind_outline(it);
|
2019-04-07 01:07:39 +00:00
|
|
|
|
2019-02-28 15:24:46 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-24 19:42:43 +00:00
|
|
|
if(c && WDIM == 3) addradar(V, iinf[it].glyph, icol, kind_outline(it));
|
2019-02-28 15:24:46 +00:00
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2019-05-15 15:35:11 +00:00
|
|
|
if(DIM == 3 && mapeditor::drawUserShape(V, mapeditor::sgItem, it, darkena(icol, 0, 0xFF), c)) return false;
|
|
|
|
|
2019-07-28 09:07:21 +00:00
|
|
|
if(WDIM == 3 && c == viewctr.at->c7 && in_perspective() && hdist0(tC0(V)) < cgi.orbsize * 0.25) return false;
|
2019-05-15 15:35:11 +00:00
|
|
|
|
2019-02-22 20:29:01 +00:00
|
|
|
transmatrix Vit = V;
|
2019-06-24 11:46:10 +00:00
|
|
|
if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF);
|
|
|
|
if(DIM == 3 && c && it != itBabyTortoise) Vit = face_the_player(Vit);
|
2019-02-26 13:35:04 +00:00
|
|
|
// V * cspin(0, 2, ptick(618, 0));
|
2019-02-22 20:29:01 +00:00
|
|
|
|
2018-06-28 10:59:35 +00:00
|
|
|
if(c && conformal::includeHistory && conformal::infindhistory.count(c)) poly_outline = OUTLINE_DEAD;
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!mmitem && it) return true;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itSavedPrincess) {
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(moPrincess, c, V, icol, 0, icol);
|
2017-07-10 18:47:38 +00:00
|
|
|
return false;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itStrongWind) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vit * spinptick(750), cgi.shFan, darkena(icol, 0, 255));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itWarning) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vit * spinptick(750), cgi.shTriangle, darkena(icol, 0, 255));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itBabyTortoise) {
|
|
|
|
int bits = c ? tortoise::babymap[c] : tortoise::last;
|
|
|
|
int over = c && c->monst == moTortoise;
|
2019-05-26 16:04:02 +00:00
|
|
|
tortoise::draw(Vit * spinptick(5000) * ypush(cgi.crossf*.15), bits, over ? 4 : 2, 0);
|
|
|
|
// queuepoly(Vit, cgi.shHeptaMarker, darkena(tortoise::getMatchColor(bits), 0, 0xC0));
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itCompass) {
|
|
|
|
transmatrix V2;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_CRYSTAL
|
2018-12-25 22:54:34 +00:00
|
|
|
if(geometry == gCrystal) {
|
|
|
|
if(crystal::compass_probability <= 0) return true;
|
|
|
|
if(cwt.at->land == laCamelot && celldistAltRelative(cwt.at) < 0) crystal::used_compass_inside = true;
|
2018-12-03 22:03:35 +00:00
|
|
|
V2 = V * spin(crystal::compass_angle() + M_PI);
|
2018-12-25 22:54:34 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if(1) {
|
2018-12-03 22:03:35 +00:00
|
|
|
cell *c1 = c ? findcompass(c) : NULL;
|
|
|
|
if(c1) {
|
|
|
|
transmatrix P = ggmatrix(c1);
|
|
|
|
hyperpoint P1 = tC0(P);
|
|
|
|
|
|
|
|
if(isPlayerOn(c)) {
|
|
|
|
queuechr(P1, 2*vid.fsize, 'X', 0x10100 * int(128 + 100 * sintick(150)));
|
|
|
|
// queuestr(V, 1, its(compassDist(c)), 0x10101 * int(128 - 100 * sin(ticks / 150.)), 1);
|
|
|
|
queuestr(P1, vid.fsize, its(-compassDist(c)), 0x10101 * int(128 - 100 * sintick(150)));
|
2018-12-23 13:30:09 +00:00
|
|
|
addauraspecial(P1, 0xFF0000, 0);
|
2018-12-03 22:03:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
V2 = V * rspintox(inverse(V) * P1);
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2018-12-03 22:03:35 +00:00
|
|
|
else V2 = V;
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2019-03-04 16:57:54 +00:00
|
|
|
if(DIM == 3) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vit, cgi.shRing, 0xFFFFFFFF);
|
|
|
|
if(WDIM == 2) V2 = mscale(V2, cgi.STUFF);
|
2019-03-04 16:57:54 +00:00
|
|
|
V2 = V2 * cspin(1, 2, M_PI * sintick(100) / 39);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V2, cgi.shCompass3, 0xFF0000FF);
|
|
|
|
queuepoly(V2 * pispin, cgi.shCompass3, 0x000000FF);
|
2019-03-04 16:57:54 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(c) V2 = V2 * spin(M_PI * sintick(100) / 30);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V2, cgi.shCompass1, 0xFF8080FF);
|
|
|
|
queuepoly(V2, cgi.shCompass2, 0xFFFFFFFF);
|
|
|
|
queuepoly(V2, cgi.shCompass3, 0xFF0000FF);
|
|
|
|
queuepoly(V2 * pispin, cgi.shCompass3, 0x000000FF);
|
2019-03-04 16:57:54 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
xsh = NULL;
|
|
|
|
}
|
2017-04-14 18:12:23 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itPalace) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ld h = cgi.human_height;
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-25 01:36:48 +00:00
|
|
|
if(GDIM == 3 && WDIM == 2) {
|
|
|
|
dynamicval<qfloorinfo> qfi2(qfi, qfi);
|
|
|
|
transmatrix V2 = V * spin(ticks / 1500.);
|
|
|
|
/* divisors should be higher than in plate renderer */
|
2019-05-26 16:04:02 +00:00
|
|
|
qfi.fshape = &cgi.shMFloor2;
|
2019-05-25 01:36:48 +00:00
|
|
|
draw_shapevec(c, V2 * zpush(-h/30), qfi.fshape->levels[0], 0xFFD500FF, PPR::WALL);
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
qfi.fshape = &cgi.shMFloor3;
|
2019-05-25 01:36:48 +00:00
|
|
|
draw_shapevec(c, V2 * zpush(-h/25), qfi.fshape->levels[0], darkena(icol, 0, 0xFF), PPR::WALL);
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
qfi.fshape = &cgi.shMFloor4;
|
2019-05-25 01:36:48 +00:00
|
|
|
draw_shapevec(c, V2 * zpush(-h/20), qfi.fshape->levels[0], 0xFFD500FF, PPR::WALL);
|
|
|
|
}
|
2019-07-30 11:00:30 +00:00
|
|
|
else if(WDIM == 3 && c) {
|
2019-05-25 01:36:48 +00:00
|
|
|
transmatrix V2 = Vit * spin(ticks / 1500.);
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V2 * zpush(h/100), cgi.shMFloor3, 0xFFD500FF);
|
|
|
|
draw_floorshape(c, V2 * zpush(h/50), cgi.shMFloor4, darkena(icol, 0, 0xFF));
|
|
|
|
queuepoly(V2, cgi.shGem[ct6], 0xFFD500FF);
|
2019-05-25 01:36:48 +00:00
|
|
|
}
|
2019-07-30 11:00:30 +00:00
|
|
|
else if(WDIM == 3 && !c) {
|
|
|
|
queuepoly(Vit, cgi.shGem[ct6], 0xFFD500FF);
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2019-05-25 01:36:48 +00:00
|
|
|
transmatrix V2 = Vit * spin(ticks / 1500.);
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V2, cgi.shMFloor3, 0xFFD500FF);
|
|
|
|
draw_floorshape(c, V2, cgi.shMFloor4, darkena(icol, 0, 0xFF));
|
|
|
|
queuepoly(V2, cgi.shGem[ct6], 0xFFD500FF);
|
2019-05-25 01:36:48 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
xsh = NULL;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 16:49:57 +00:00
|
|
|
else if(mapeditor::drawUserShape(V, mapeditor::sgItem, it, darkena(icol, 0, 0xFF), c)) ;
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itRose) {
|
|
|
|
for(int u=0; u<4; u++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vit * spinptick(1500) * spin(2*M_PI / 3 / 4 * u), cgi.shRoseItem, darkena(icol, 0, hidden ? 0x30 : 0xA0));
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it == itBarrow && c) {
|
|
|
|
for(int i = 0; i<c->landparam; i++)
|
2019-02-22 20:29:01 +00:00
|
|
|
queuepolyat(Vit * spin(2 * M_PI * i / c->landparam) * xpush(.15) * spinptick(1500), *xsh, darkena(icol, 0, hidden ? 0x40 :
|
2017-07-10 18:47:38 +00:00
|
|
|
(highwall(c) && wmspatial) ? 0x60 : 0xFF),
|
2018-08-28 12:27:23 +00:00
|
|
|
PPR::HIDDEN);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
// queuepoly(Vit*spin(M_PI+(1-2*ang)*2*M_PI/cgi.S84), cgi.shMagicSword, darkena(0xC00000, 0, 0x80 + 0x70 * sin(ticks / 200.0)));
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
else if(xsh) {
|
|
|
|
if(it == itFireShard) icol = firecolor(100);
|
|
|
|
if(it == itWaterShard) icol = watercolor(100) >> 8;
|
|
|
|
|
|
|
|
if(it == itZebra) icol = 0xFFFFFF;
|
|
|
|
if(it == itLotus) icol = 0x101010;
|
2018-01-04 14:46:06 +00:00
|
|
|
if(it == itSwitch) icol = minf[active_switch()].color;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-22 20:29:01 +00:00
|
|
|
transmatrix V2 = Vit * spinptick(1500);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(xsh == &cgi.shBookCover && mmitem) {
|
2019-02-22 20:29:01 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V2 * cpush(2, 1e-3), cgi.shBook, 0x805020FF);
|
2019-02-22 20:29:01 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V2, cgi.shBook, 0x805020FF);
|
2019-02-22 20:29:01 +00:00
|
|
|
}
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2018-08-28 12:27:23 +00:00
|
|
|
PPR pr = PPR::ITEM;
|
2017-09-30 09:46:41 +00:00
|
|
|
int alpha = hidden ? (it == itKraken ? 0xC0 : 0x40) : 0xF0;
|
2018-08-28 12:27:23 +00:00
|
|
|
if(c && c->wall == waIcewall) pr = PPR::HIDDEN, alpha = 0x80;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-09-30 09:46:41 +00:00
|
|
|
queuepolyat(V2, *xsh, darkena(icol, 0, alpha), pr);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(it == itZebra)
|
2019-02-22 20:29:01 +00:00
|
|
|
queuepolyat(Vit * spinptick(1500, .5/(ct6+6)), *xsh, darkena(0x202020, 0, hidden ? 0x40 : 0xF0), PPR::ITEMb);
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 16:03:53 +00:00
|
|
|
else if(xch == 'o' || it == itInventory) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(it == itOrbFire) icol = firecolor(100);
|
2018-08-28 12:27:23 +00:00
|
|
|
PPR prio = PPR::ITEM;
|
2017-10-10 12:05:36 +00:00
|
|
|
bool inice = c && c->wall == waIcewall;
|
2018-08-28 12:27:23 +00:00
|
|
|
if(inice) prio = PPR::HIDDEN;
|
2017-10-17 11:13:36 +00:00
|
|
|
|
|
|
|
int icol1 = icol;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(it == itOrbFire) icol = firecolor(200);
|
|
|
|
if(it == itOrbFriend || it == itOrbDiscord) icol = 0xC0C0C0;
|
|
|
|
if(it == itOrbFrog) icol = 0xFF0000;
|
|
|
|
if(it == itOrbDash) icol = 0xFF0000;
|
|
|
|
if(it == itOrbFreedom) icol = 0xC0FF00;
|
|
|
|
if(it == itOrbAir) icol = 0xFFFFFF;
|
|
|
|
if(it == itOrbUndeath) icol = minf[moFriendlyGhost].color;
|
|
|
|
if(it == itOrbRecall) icol = 0x101010;
|
2018-01-03 20:49:14 +00:00
|
|
|
if(it == itOrbSlaying) icol = 0xFF0000;
|
2018-09-10 15:49:51 +00:00
|
|
|
color_t col = darkena(icol, 0, int(0x80 + 0x70 * sinptick(300)));
|
2018-01-03 20:49:14 +00:00
|
|
|
|
2017-10-17 11:13:36 +00:00
|
|
|
if(it == itOrbFish)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(Vit * spinptick(1500), cgi.shFishTail, col, PPR::ITEM_BELOW);
|
2017-10-17 11:13:36 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(Vit, cgi.shDisk, darkena(icol1, 0, inice ? 0x80 : hidden ? 0x20 : 0xC0), prio);
|
2019-03-23 15:26:53 +00:00
|
|
|
|
|
|
|
queuepolyat(Vit * spinptick(1500), orbshape(iinf[it].orbshape), col, prio);
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(it) return true;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
return false;
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-06-16 13:24:48 +00:00
|
|
|
color_t skincolor = 0xD0C080FF;
|
|
|
|
|
|
|
|
void humanoid_eyes(const transmatrix& V, color_t ecol, color_t hcol = skincolor) {
|
|
|
|
if(DIM == 3) {
|
|
|
|
queuepoly(VHEAD, cgi.shPHeadOnly, hcol);
|
|
|
|
queuepoly(VHEAD, cgi.shSkullEyes, ecol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-04 19:26:26 +00:00
|
|
|
void drawTerraWarrior(const transmatrix& V, int t, int hp, double footphase) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = linf[laTerracotta].color;
|
2017-10-04 19:26:26 +00:00
|
|
|
int bcol = darkena(false ? 0xC0B23E : col, 0, 0xFF);
|
2019-02-27 18:15:58 +00:00
|
|
|
const transmatrix VBS = otherbodyparts(V, bcol, moDesertman, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, bcol);
|
|
|
|
if(!peace::on) queuepoly(VBODY * VBS * Mirror, cgi.shPSword, darkena(0xC0C0C0, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shTerraArmor1, darkena(t > 0 ? 0x4040FF : col, 0, 0xFF));
|
|
|
|
if(hp >= 4) queuepoly(VBODY2 * VBS, cgi.shTerraArmor2, darkena(t > 1 ? 0xC00000 : col, 0, 0xFF));
|
|
|
|
if(hp >= 2) queuepoly(VBODY3 * VBS, cgi.shTerraArmor3, darkena(t > 2 ? 0x612600 : col, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shTerraHead, darkena(t > 4 ? 0x202020 : t > 3 ? 0x504040 : col, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shPFace, bcol);
|
2019-06-16 13:24:48 +00:00
|
|
|
humanoid_eyes(V, 0x400000FF, darkena(col, 0, 0xFF));
|
2017-09-30 09:46:41 +00:00
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2019-06-24 11:46:27 +00:00
|
|
|
void drawPlayer(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase, bool stop = false) {
|
2019-03-30 12:16:19 +00:00
|
|
|
charstyle& cs = getcs();
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mapeditor::drawplayer && !mapeditor::drawUserShape(V, mapeditor::sgPlayer, cs.charid, cs.skincolor, where)) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(cs.charid >= 8) {
|
|
|
|
/* famililar */
|
2019-06-24 11:46:27 +00:00
|
|
|
if(!mmspatial && !footphase) {
|
|
|
|
if(stop) return;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shWolfLegs, fc(150, cs.dresscolor, 4));
|
2019-06-24 11:46:27 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWolfBody);
|
2019-06-24 11:46:27 +00:00
|
|
|
if(stop) return;
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moWolf, fc(500, cs.dresscolor, 4), footphase);
|
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shWolfBody, fc(0, cs.skincolor, 0));
|
|
|
|
queuepoly(VAHEAD, cgi.shFamiliarHead, fc(500, cs.haircolor, 2));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(!shmup::on || shmup::curtime >= shmup::getPlayer()->nextshot) {
|
2019-05-12 19:09:27 +00:00
|
|
|
color_t col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.eyecolor, 3);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shFamiliarEye, col);
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, col);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(knighted)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shKnightCloak, darkena(cloakcolor(knighted), 1, 0xFF));
|
2018-12-23 13:00:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(tortoise::seek())
|
|
|
|
tortoise::draw(VABODY, tortoise::seekbits, 4, 0);
|
|
|
|
}
|
|
|
|
else if(cs.charid >= 6) {
|
|
|
|
/* dog */
|
2019-06-24 11:46:27 +00:00
|
|
|
if(!mmspatial && !footphase) {
|
|
|
|
if(stop) return;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogBody, fc(0, cs.skincolor, 0));
|
2019-06-24 11:46:27 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shDogTorso);
|
2019-06-24 11:46:27 +00:00
|
|
|
if(stop) return;
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moRunDog, fc(500, cs.dresscolor, 4), footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogTorso, fc(0, cs.skincolor, 0));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shDogHead, fc(150, cs.haircolor, 2));
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(!shmup::on || shmup::curtime >= shmup::getPlayer()->nextshot) {
|
2019-05-12 19:09:27 +00:00
|
|
|
color_t col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.eyecolor, 3);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shWolf1, col);
|
|
|
|
queuepoly(VAHEAD, cgi.shWolf2, col);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2017-12-03 19:10:42 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
color_t colnose = items[itOrbDiscord] ? watercolor(0) : fc(314, 0xFF, 3);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shWolf3, colnose);
|
2018-12-23 13:00:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(knighted)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shKnightCloak, darkena(cloakcolor(knighted), 1, 0xFF));
|
2018-12-23 13:00:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(tortoise::seek())
|
|
|
|
tortoise::draw(VABODY, tortoise::seekbits, 4, 0);
|
|
|
|
}
|
|
|
|
else if(cs.charid >= 4) {
|
|
|
|
/* cat */
|
2019-06-24 11:46:27 +00:00
|
|
|
if(!mmspatial && !footphase) {
|
|
|
|
if(stop) return;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shCatLegs, fc(500, cs.dresscolor, 4));
|
2019-06-24 11:46:27 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shCatBody);
|
2019-06-24 11:46:27 +00:00
|
|
|
if(stop) return;
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moRunDog, fc(500, cs.dresscolor, 4), footphase);
|
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shCatBody, fc(0, cs.skincolor, 0));
|
|
|
|
queuepoly(VAHEAD, cgi.shCatHead, fc(150, cs.haircolor, 2));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(!shmup::on || shmup::curtime >= shmup::getPlayer()->nextshot) {
|
2019-05-12 19:09:27 +00:00
|
|
|
color_t col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.eyecolor, 3);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD * xpush(.04), cgi.shWolf1, col);
|
|
|
|
queuepoly(VAHEAD * xpush(.04), cgi.shWolf2, col);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(knighted)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shKnightCloak, darkena(cloakcolor(knighted), 1, 0xFF));
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(tortoise::seek())
|
|
|
|
tortoise::draw(VABODY, tortoise::seekbits, 4, 0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* human */
|
2019-06-24 11:46:27 +00:00
|
|
|
ShadowV(V, (cs.charid&1) ? cgi.shFemaleBody : cgi.shPBody);
|
|
|
|
if(stop) return;
|
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = otherbodyparts(V, fc(0, cs.skincolor, 0), items[itOrbFish] ? moWaterElemental : moPlayer, footphase);
|
|
|
|
|
|
|
|
|
2019-06-24 11:46:27 +00:00
|
|
|
queuepoly(VBODY * VBS, (cs.charid&1) ? cgi.shFemaleBody : cgi.shPBody, fc(0, cs.skincolor, 0));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(cs.charid&1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY1 * VBS, cgi.shFemaleDress, fc(500, cs.dresscolor, 4));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(cs.charid == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shPrinceDress, fc(400, cs.dresscolor, 5));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(cs.charid == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shPrincessDress, fc(400, cs.dresscolor2, 5));
|
2017-10-12 10:05:12 +00:00
|
|
|
|
|
|
|
if(items[itOrbSide3])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, (cs.charid&1) ? cgi.shFerocityF : cgi.shFerocityM, fc(0, cs.skincolor, 0));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(items[itOrbHorns]) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shBullHead, items[itOrbDiscord] ? watercolor(0) : 0xFF000030);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shBullHorn, items[itOrbDiscord] ? watercolor(0) : 0xFF000040);
|
|
|
|
queuepoly(VBODY * VBS * Mirror, cgi.shBullHorn, items[itOrbDiscord] ? watercolor(0) : 0xFF000040);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-10-12 10:05:12 +00:00
|
|
|
if(items[itOrbSide1] && !shmup::on)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS * spin(-M_PI/24), cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, fc(314, cs.swordcolor, 3)); // 3 not colored
|
2017-10-12 10:05:12 +00:00
|
|
|
|
2019-02-27 18:15:58 +00:00
|
|
|
transmatrix VWPN = cs.lefthanded ? VBODY * VBS * Mirror : VBODY * VBS;
|
2018-11-10 17:32:55 +00:00
|
|
|
|
2019-01-07 03:55:21 +00:00
|
|
|
if(peace::on) ;
|
|
|
|
else if(racing::on) {
|
2019-03-30 12:16:19 +00:00
|
|
|
#if CAP_RACING
|
2019-01-07 03:55:21 +00:00
|
|
|
if(racing::trophy[multi::cpid])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cgi.shTrophy, racing::trophy[multi::cpid]);
|
2019-03-30 12:16:19 +00:00
|
|
|
#endif
|
2019-01-07 03:55:21 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(items[itOrbThorns])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cgi.shHedgehogBladePlayer, items[itOrbDiscord] ? watercolor(0) : 0x00FF00FF);
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(!shmup::on && items[itOrbDiscord])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, watercolor(0));
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(items[itRevolver])
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cgi.shGunInHand, fc(314, cs.swordcolor, 3)); // 3 not colored
|
2018-01-03 21:32:34 +00:00
|
|
|
else if(items[itOrbSlaying]) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cgi.shFlailTrunk, fc(314, cs.swordcolor, 3));
|
|
|
|
queuepoly(VWPN, cgi.shHammerHead, fc(314, cs.swordcolor, 3));
|
2018-01-03 21:32:34 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(!shmup::on)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, fc(314, cs.swordcolor, 3)); // 3 not colored
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(shmup::curtime >= shmup::getPlayer()->nextshot)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cgi.shPKnife, fc(314, cs.swordcolor, 3)); // 3 not colored
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(items[itOrbBeauty]) {
|
|
|
|
if(cs.charid&1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shFlowerHair, darkena(iinf[itOrbBeauty].color, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VWPN, cgi.shFlowerHand, darkena(iinf[itOrbBeauty].color, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(where && where->land == laWildWest) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shWestHat1, darkena(cs.swordcolor, 1, 0XFF));
|
|
|
|
queuepoly(VHEAD2, cgi.shWestHat2, darkena(cs.swordcolor, 0, 0XFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(cheater && !autocheat) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, (cs.charid&1) ? cgi.shGoatHead : cgi.shDemon, darkena(0xFFFF00, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
// queuepoly(V, shHood, darkena(0xFF00, 1, 0xFF));
|
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD, cgi.shPFace, fc(500, cs.skincolor, 1));
|
|
|
|
queuepoly(VHEAD1, (cs.charid&1) ? cgi.shFemaleHair : cgi.shPHead, fc(150, cs.haircolor, 2));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-12 19:09:27 +00:00
|
|
|
|
|
|
|
humanoid_eyes(V, cs.eyecolor, cs.skincolor);
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(knighted)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shKnightCloak, darkena(cloakcolor(knighted), 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(tortoise::seek())
|
2019-05-26 16:04:02 +00:00
|
|
|
tortoise::draw(VBODY * VBS * ypush(-cgi.crossf*.25), tortoise::seekbits, 4, 0);
|
2018-12-23 13:00:52 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int wingphase(int period, int phase IS(0)) {
|
2019-05-16 15:08:12 +00:00
|
|
|
ld t = fractick(period, phase);
|
2019-06-18 14:15:57 +00:00
|
|
|
const int WINGS2 = WINGS * 2;
|
|
|
|
int ti = int(t * WINGS2) % WINGS2;
|
|
|
|
if(ti > WINGS) ti = WINGS2 - ti;
|
2019-06-18 14:09:54 +00:00
|
|
|
return ti;
|
2019-05-16 15:08:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
transmatrix wingmatrix(int period, int phase = 0) {
|
|
|
|
ld t = fractick(period, phase) * 2 * M_PI;
|
|
|
|
transmatrix Vwing = Id;
|
|
|
|
Vwing[1][1] = .85 + .15 * sin(t);
|
|
|
|
return Vwing;
|
|
|
|
}
|
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
void drawMimic(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase) {
|
|
|
|
charstyle& cs = getcs();
|
|
|
|
|
2019-03-30 12:17:51 +00:00
|
|
|
if(mapeditor::drawUserShape(V, mapeditor::sgPlayer, cs.charid, darkena(col, 0, 0x80), where)) return;
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
if(cs.charid >= 8) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shWolfBody, darkena(col, 0, 0xC0));
|
|
|
|
ShadowV(V, cgi.shWolfBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
if(mmspatial || footphase)
|
|
|
|
animallegs(VALEGS, moWolf, darkena(col, 0, 0xC0), footphase);
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shWolfLegs, darkena(col, 0, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shFamiliarHead, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VAHEAD, cgi.shFamiliarEye, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, darkena(col, 0, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else if(cs.charid >= 6) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shDogBody);
|
|
|
|
queuepoly(VAHEAD, cgi.shDogHead, darkena(col, 0, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mmspatial || footphase) {
|
|
|
|
animallegs(VALEGS, moRunDog, darkena(col, 0, 0xC0), footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogTorso, darkena(col, 0, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogBody, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VABODY, cgi.shWolf1, darkena(col, 1, 0xC0));
|
|
|
|
queuepoly(VABODY, cgi.shWolf2, darkena(col, 1, 0xC0));
|
|
|
|
queuepoly(VABODY, cgi.shWolf3, darkena(col, 1, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else if(cs.charid >= 4) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shCatBody);
|
|
|
|
queuepoly(VABODY, cgi.shCatBody, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VAHEAD, cgi.shCatHead, darkena(col, 0, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mmspatial || footphase)
|
|
|
|
animallegs(VALEGS, moRunDog, darkena(col, 0, 0xC0), footphase);
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shCatLegs, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VAHEAD * xpush(.04), cgi.shWolf1, darkena(col, 1, 0xC0));
|
|
|
|
queuepoly(VAHEAD * xpush(.04), cgi.shWolf2, darkena(col, 1, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 0, 0x40), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, (cs.charid&1) ? cgi.shFemaleBody : cgi.shPBody, darkena(col, 0, 0X80));
|
2018-12-23 13:00:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(!shmup::on) {
|
|
|
|
bool emp = items[itOrbEmpathy] && m != moShadow;
|
|
|
|
if(items[itOrbThorns] && emp)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shHedgehogBladePlayer, darkena(col, 0, 0x40));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(items[itOrbSide1] && !shmup::on)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS * spin(-M_PI/24), cs.charid >= 2 ? cgi.shSabre : cgi.shPSword, darkena(col, 0, 0x40));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(items[itOrbSide3] && emp)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, (cs.charid&1) ? cgi.shFerocityF : cgi.shFerocityM, darkena(col, 0, 0x40));
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, (cs.charid >= 2 ? cgi.shSabre : cgi.shPSword), darkena(col, 0, 0XC0));
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
else if(!where || shmup::curtime >= shmup::getPlayer()->nextshot)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPKnife, darkena(col, 0, 0XC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
if(knighted)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY3 * VBS, cgi.shKnightCloak, darkena(col, 1, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, (cs.charid&1) ? cgi.shFemaleHair : cgi.shPHead, darkena(col, 1, 0XC0));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(col, 0, 0XC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(cs.charid&1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY1 * VBS, cgi.shFemaleDress, darkena(col, 1, 0XC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(cs.charid == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shPrinceDress, darkena(col, 1, 0XC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(cs.charid == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shPrincessDress, darkena(col, 1, 0XC0));
|
2019-05-20 13:28:20 +00:00
|
|
|
|
|
|
|
humanoid_eyes(V, 0xFF, darkena(col, 0, 0x40));
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t col, double footphase, color_t asciicol) {
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
#if MAXMDIM >= 4
|
2019-06-24 10:57:00 +00:00
|
|
|
if(DIM == 3 && m != moPlayer && asciicol != NOCOLOR)
|
|
|
|
addradar(V1, minf[m].glyph, asciicol, isFriendly(m) ? 0x00FF00FF : 0xFF0000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
char xch = minf[m].glyph;
|
2019-04-20 23:08:27 +00:00
|
|
|
|
|
|
|
transmatrix V = V1;
|
2019-06-17 10:35:31 +00:00
|
|
|
if(WDIM == 3 && (classflag(m) & CF_FACE_UP) && where) V = V1 * cspin(0, 2, M_PI/2);
|
|
|
|
|
2019-04-20 23:08:27 +00:00
|
|
|
// if(DIM == 3) V = V * cspin(0, 2, M_PI/2);
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
if(m == moTortoise && where && where->stuntime >= 3)
|
|
|
|
drawStunStars(V, where->stuntime-2);
|
|
|
|
else if (m == moTortoise || m == moPlayer || (where && !where->stuntime)) ;
|
|
|
|
else if(where && !(isMetalBeast(m) && where->stuntime == 1))
|
|
|
|
drawStunStars(V, where->stuntime);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mapeditor::drawUserShape(V, mapeditor::sgMonster, m, darkena(col, 0, 0xFF), where))
|
2018-08-27 17:27:35 +00:00
|
|
|
return false;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
switch(m) {
|
|
|
|
case moTortoise: {
|
|
|
|
int bits = where ? tortoise::getb(where) : tortoise::last;
|
|
|
|
tortoise::draw(V, bits, 0, where ? where->stuntime : 0);
|
|
|
|
if(tortoise::seek() && !tortoise::diff(bits) && where)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shRing, darkena(0xFFFFFF, 0, 0x80 + 0x70 * sintick(200)));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
case moPlayer:
|
|
|
|
drawPlayer(m, where, V, col, footphase);
|
|
|
|
return false;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-03-30 12:17:51 +00:00
|
|
|
case moMimic: case moShadow: case moIllusion:
|
2019-03-30 12:16:19 +00:00
|
|
|
drawMimic(m, where, V, col, footphase);
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case moBullet:
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shKnife);
|
|
|
|
queuepoly(VBODY * spin(-M_PI/4), cgi.shKnife, getcs().swordcolor);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
case moKnight: case moKnightMoved: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(0xC0C0A0, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, darkena(0xC0C0A0, 0, 0xC0));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(!racing::on)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPSword, darkena(0xFFFF00, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shKnightArmor, darkena(0xD0D0D0, 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
color_t col;
|
|
|
|
if(!eubinary && where && where->master->alt)
|
|
|
|
col = cloakcolor(roundTableRadius(where));
|
|
|
|
else
|
|
|
|
col = cloakcolor(newRoundTableRadius());
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shKnightCloak, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(0x703800, 1, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xC0C0A0, 0, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moGolem: case moGolemMoved: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 1, 0XC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, darkena(col, 0, 0XC0));
|
|
|
|
queuepoly(VHEAD, cgi.shGolemhead, darkena(col, 1, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xC0C000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moEvilGolem: case moIceGolem: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 2, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 0, 0XC0));
|
|
|
|
queuepoly(VHEAD, cgi.shGolemhead, darkena(col, 1, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFF0000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-10-14 17:29:20 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
case moFalsePrincess: case moRoseLady: case moRoseBeauty: {
|
|
|
|
princess:
|
|
|
|
bool girl = princessgender() == GEN_F;
|
|
|
|
bool evil = !isPrincess(m);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
int facecolor = evil ? 0xC0B090FF : 0xD0C080FF;
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, girl ? cgi.shFemaleBody : cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = otherbodyparts(V, facecolor, m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, girl ? cgi.shFemaleBody : cgi.shPBody, facecolor);
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moPrincessArmed)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS * Mirror, vid.cs.charid < 2 ? cgi.shSabre : cgi.shPSword, 0xFFFFFFFF);
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
if((m == moFalsePrincess || m == moRoseBeauty) && where && where->cpdist == 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPKnife, 0xFFFFFFFF);
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moRoseLady) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPKnife, 0xFFFFFFFF);
|
|
|
|
queuepoly(VBODY * VBS * Mirror, cgi.shPKnife, 0xFFFFFFFF);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(girl) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY1 * VBS, cgi.shFemaleDress, evil ? 0xC000C0FF : 0x00C000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
if(vid.cs.charid < 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shPrincessDress, (evil ? 0xC040C0C0 : 0x8080FFC0) | UNTRANS);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(vid.cs.charid < 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY1 * VBS, cgi.shPrinceDress, evil ? 0x802080FF : 0x404040FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moRoseLady) {
|
2019-05-26 16:04:02 +00:00
|
|
|
// queuepoly(V, girl ? cgi.shGoatHead : cgi.shDemon, 0x800000FF);
|
2019-05-12 18:11:05 +00:00
|
|
|
// make her hair a bit darker to stand out in 3D
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, girl ? cgi.shFemaleHair : cgi.shPHead, evil ? 0x500050FF : DIM == 3 ? 0x666A64FF : 0x332A22FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else if(m == moRoseBeauty) {
|
|
|
|
if(girl) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shBeautyHair, 0xF0A0D0FF);
|
|
|
|
queuepoly(VHEAD2, cgi.shFlowerHair, 0xC00000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shPHead, 0xF0A0D0FF);
|
|
|
|
queuepoly(VBS, cgi.shFlowerHand, 0xC00000FF);
|
|
|
|
queuepoly(VBODY2 * VBS, cgi.shSuspenders, 0xC00000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, girl ? cgi.shFemaleHair : cgi.shPHead,
|
2019-03-30 12:16:19 +00:00
|
|
|
evil ? 0xC00000FF : 0x332A22FF);
|
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD, cgi.shPFace, facecolor);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, evil ? 0x0000C0FF : 0x00C000FF, facecolor);
|
2019-04-03 18:32:14 +00:00
|
|
|
return false;
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case moWolf: case moRedFox: case moWolfMoved: case moLavaWolf: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWolfBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mmspatial || footphase)
|
|
|
|
animallegs(VALEGS, moWolf, darkena(col, 0, 0xFF), footphase);
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shWolfLegs, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VABODY, cgi.shWolfBody, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moRedFox) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shFoxTail1, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VABODY, cgi.shFoxTail2, darkena(0xFFFFFF, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shWolfHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shWolfEyes, darkena(col, 3, 0xFF));
|
2019-05-11 13:11:55 +00:00
|
|
|
if(DIM == 3) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shFamiliarEye, 0xFF);
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, 0xFF);
|
2019-05-11 13:11:55 +00:00
|
|
|
}
|
2019-04-03 18:32:14 +00:00
|
|
|
return false;
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
case moReptile: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shReptileBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moReptile, darkena(col, 0, 0xFF), footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shReptileBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shReptileHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shReptileEye, darkena(col, 3, 0xFF));
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shReptileEye, darkena(col, 3, 0xFF));
|
|
|
|
queuepoly(VABODY, cgi.shReptileTail, darkena(col, 2, 0xFF));
|
2019-04-03 18:32:14 +00:00
|
|
|
return false;
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
case moSalamander: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shReptileBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moReptile, darkena(0xD00000, 1, 0xFF), footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shReptileBody, darkena(0xD00000, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shReptileHead, darkena(0xD00000, 1, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shReptileEye, darkena(0xD00000, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shReptileEye, darkena(0xD00000, 0, 0xFF));
|
|
|
|
queuepoly(VABODY, cgi.shReptileTail, darkena(0xD08000, 0, 0xFF));
|
2019-04-03 18:32:14 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moVineBeast: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWolfBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mmspatial || footphase)
|
|
|
|
animallegs(VALEGS, moWolf, 0x00FF00FF, footphase);
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shWolfLegs, 0x00FF00FF);
|
|
|
|
queuepoly(VABODY, cgi.shWolfBody, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shWolfHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shWolfEyes, 0xFF0000FF);
|
2019-04-03 18:32:14 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moMouse: case moMouseMoved: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shMouse, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VALEGS, cgi.shMouseLegs, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VALEGS, cgi.shMouseEyes, 0xFF);
|
2019-04-03 18:32:14 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moRunDog: case moHunterDog: case moHunterGuard: case moHunterChanging: case moFallingDog: {
|
|
|
|
if(!mmspatial && !footphase)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogBody, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shDogTorso);
|
|
|
|
queuepoly(VABODY, cgi.shDogTorso, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moRunDog, m == moFallingDog ? 0xFFFFFFFF : darkena(col, 0, 0xFF), footphase);
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shDogHead, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
dynamicval<color_t> dp(poly_outline);
|
|
|
|
int eyecolor = 0x202020;
|
|
|
|
bool redeyes = false;
|
|
|
|
if(m == moHunterDog) eyecolor = 0xFF0000, redeyes = true;
|
|
|
|
if(m == moHunterGuard) eyecolor = 0xFF6000, redeyes = true;
|
|
|
|
if(m == moHunterChanging) eyecolor = 0xFFFF00, redeyes = true;
|
|
|
|
int eyes = darkena(eyecolor, 0, 0xFF);
|
|
|
|
|
|
|
|
if(redeyes) poly_outline = eyes;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shWolf1, eyes).flags |= POLY_FORCEWIDE;
|
|
|
|
queuepoly(VAHEAD, cgi.shWolf2, eyes).flags |= POLY_FORCEWIDE;
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shWolf3, darkena(m == moRunDog ? 0x202020 : 0x000000, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moOrangeDog: {
|
|
|
|
if(!mmspatial && !footphase)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogBody, darkena(0xFFFFFF, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shDogTorso);
|
2019-06-01 17:50:17 +00:00
|
|
|
if(GDIM == 2) queuepoly(VABODY, cgi.shDogTorso, darkena(0xFFFFFF, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
animallegs(VALEGS, moRunDog, darkena(0xFFFFFF, 0, 0xFF), footphase);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shDogHead, darkena(0xFFFFFF, 0, 0xFF));
|
2019-06-01 17:50:17 +00:00
|
|
|
queuepoly(VABODY, cgi.shDogStripes, GDIM == 2 ? darkena(0x303030, 0, 0xFF) : 0xFFFFFFFF);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shWolf1, darkena(0x202020, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shWolf2, darkena(0x202020, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shWolf3, darkena(0x202020, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
2019-03-30 12:17:51 +00:00
|
|
|
case moShark: case moGreaterShark: case moCShark:
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VFISH, cgi.shShark, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
|
2019-03-30 12:17:51 +00:00
|
|
|
case moEagle: case moParrot: case moBomberbird: case moAlbatross:
|
2019-03-30 12:16:19 +00:00
|
|
|
case moTameBomberbird: case moWindCrow: case moTameBomberbirdMoved:
|
2019-04-22 12:41:14 +00:00
|
|
|
case moSandBird: case moAcidBird: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shEagle);
|
|
|
|
auto& sh = DIM == 3 ? cgi.shAnimatedEagle[wingphase(200)] : cgi.shEagle;
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moParrot && DIM == 3)
|
2019-04-22 12:41:14 +00:00
|
|
|
queuepolyat(VBIRD, sh, darkena(col, 0, 0xFF), PPR::SUPERLINE);
|
2019-03-30 12:16:19 +00:00
|
|
|
else
|
2019-04-22 12:41:14 +00:00
|
|
|
queuepoly(VBIRD, sh, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2019-04-22 12:41:14 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moSparrowhawk: case moWestHawk: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shHawk);
|
|
|
|
auto& sh = DIM == 3 ? cgi.shAnimatedHawk[wingphase(200)] : cgi.shHawk;
|
2019-05-16 15:08:12 +00:00
|
|
|
queuepoly(VBIRD, sh, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moButterfly: {
|
2019-05-16 15:08:12 +00:00
|
|
|
transmatrix Vwing = wingmatrix(100);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V * Vwing, cgi.shButterflyWing);
|
2019-05-16 15:08:12 +00:00
|
|
|
if(DIM == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBIRD * Vwing, cgi.shButterflyWing, darkena(col, 0, 0xFF));
|
2019-05-16 15:08:12 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBIRD, cgi.shAnimatedButterfly[wingphase(100)], darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBIRD, cgi.shButterflyBody, darkena(col, 2, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moGadfly: {
|
2019-05-16 15:08:12 +00:00
|
|
|
transmatrix Vwing = wingmatrix(100);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V * Vwing, cgi.shGadflyWing);
|
|
|
|
queuepoly(VBIRD * Vwing, DIM == 2 ? cgi.shGadflyWing : cgi.shAnimatedGadfly[wingphase(100)], darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBIRD, cgi.shGadflyBody, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VBIRD, cgi.shGadflyEye, darkena(col, 2, 0xFF));
|
|
|
|
queuepoly(VBIRD * Mirror, cgi.shGadflyEye, darkena(col, 2, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moVampire: case moBat: {
|
|
|
|
// vampires have no shadow and no mirror images
|
2019-05-26 16:04:02 +00:00
|
|
|
if(m == moBat) ShadowV(V, cgi.shBatWings);
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moBat || !inmirrorcount) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBIRD, DIM == 2 ? cgi.shBatWings : cgi.shAnimatedBat[wingphase(100)], darkena(0x303030, 0, 0xFF));
|
|
|
|
queuepoly(VBIRD, DIM == 2 ? cgi.shBatBody : cgi.shAnimatedBat2[wingphase(100)], darkena(0x606060, 0, 0xFF));
|
|
|
|
}
|
|
|
|
/* queuepoly(V, cgi.shBatMouth, darkena(0xC00000, 0, 0xFF));
|
|
|
|
queuepoly(V, cgi.shBatFang, darkena(0xFFC0C0, 0, 0xFF));
|
|
|
|
queuepoly(V*Mirror, cgi.shBatFang, darkena(0xFFC0C0, 0, 0xFF));
|
|
|
|
queuepoly(V, cgi.shBatEye, darkena(00000000, 0, 0xFF));
|
|
|
|
queuepoly(V*Mirror, cgi.shBatEye, darkena(00000000, 0, 0xFF)); */
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moGargoyle: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shGargoyleWings);
|
|
|
|
queuepoly(VBIRD, DIM == 2 ? cgi.shGargoyleWings : cgi.shAnimatedGargoyle[wingphase(300)], darkena(col, 0, 0xD0));
|
|
|
|
queuepoly(VBIRD, DIM == 2 ? cgi.shGargoyleBody : cgi.shAnimatedGargoyle2[wingphase(300)], darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moZombie: {
|
|
|
|
int c = darkena(col, where && where->land == laHalloween ? 1 : 0, 0xFF);
|
|
|
|
const transmatrix VBS = otherbodyparts(V, c, m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, c);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moTerraWarrior: {
|
|
|
|
drawTerraWarrior(V, 7, (where ? where->hitpoints : 7), footphase);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moVariantWarrior: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(0xFFD500, 0, 0xF0));
|
|
|
|
if(!peace::on) queuepoly(VBS, cgi.shPSword, 0xFFFF00FF);
|
|
|
|
queuepoly(VHEAD, cgi.shHood, 0x008000FF);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFFFF00FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moDesertman: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 0, 0xC0));
|
|
|
|
if(!peace::on) queuepoly(VBS, cgi.shPSword, 0xFFFF00FF);
|
|
|
|
queuepoly(VHEAD, cgi.shHood, 0xD0D000C0 | UNTRANS);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x301800FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moMonk: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shRaiderBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shRaiderBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shRaiderShirt, darkena(col, 2, 0xFF));
|
|
|
|
if(!peace::on) queuepoly(VBODY * VBS, cgi.shPKnife, 0xFFC0C0C0);
|
|
|
|
queuepoly(VBODY2 * VBS, cgi.shRaiderArmor, darkena(col, 1, 0xFF));
|
|
|
|
queuepolyat(VBODY3 * VBS, cgi.shRatCape2, darkena(col, 2, 0xFF), PPR::MONSTER_ARMOR0);
|
|
|
|
queuepoly(VHEAD1, cgi.shRaiderHelmet, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xC0C0A0, 0, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moCrusher: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shRaiderBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shRaiderBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shRaiderShirt, darkena(col, 2, 0xFF));
|
|
|
|
queuepoly(VBODY2 * VBS, cgi.shRaiderArmor, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VBODY * VBS, cgi.shFlailTrunk, darkena(col, 1, 0XFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shHammerHead, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shRaiderHelmet, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xC0C0A0, 0, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moPair: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shRaiderBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shRaiderBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shRaiderShirt, darkena(col, 2, 0xFF));
|
|
|
|
queuepoly(VBODY2 * VBS, cgi.shRaiderArmor, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VBODY * VBS, cgi.shPickAxe, darkena(0xA0A0A0, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shRaiderHelmet, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xC0C0A0, 0, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moAltDemon: case moHexDemon: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shRaiderBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shRaiderBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shRaiderShirt, darkena(col, 2, 0xFF));
|
|
|
|
queuepoly(VBODY2 * VBS, cgi.shRaiderArmor, darkena(col, 1, 0xFF));
|
|
|
|
if(!peace::on) queuepoly(VBODY * VBS, cgi.shPSword, 0xFFD0D0D0);
|
|
|
|
queuepoly(VHEAD1, cgi.shRaiderHelmet, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xC0C0A0, 0, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moSkeleton: {
|
2018-12-23 13:00:52 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(0xFFFFFF, 0, 0xFF), moSkeleton, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shSkeletonBody, darkena(0xFFFFFF, 0, 0xFF));
|
|
|
|
if(DIM == 2) queuepoly(VHEAD, cgi.shSkull, darkena(0xFFFFFF, 0, 0xFF));
|
|
|
|
if(DIM == 2) queuepoly(VHEAD1, cgi.shSkullEyes, 0x000000FF);
|
2019-05-13 12:22:20 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF, 0xFFFFFFFF);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shSkeletonBody);
|
|
|
|
queuepoly(VBS, cgi.shSabre, 0xFFFFFFFF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moPalace: case moFatGuard: case moVizier: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-02-27 18:15:58 +00:00
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(0xFFD500, 0, 0xFF), m, footphase);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(m == moFatGuard) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shFatBody, darkena(0xC06000, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
col = 0xFFFFFF;
|
|
|
|
if(!where || where->hitpoints >= 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY1 * VBS, cgi.shKnightCloak, darkena(0xFFC0C0, 1, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, darkena(0xFFD500, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shKnightArmor, m == moVizier ? 0xC000C0FF :
|
2017-07-10 18:47:38 +00:00
|
|
|
darkena(0x00C000, 1, 0xFF));
|
|
|
|
if(where && where->hitpoints >= 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY2 * VBS, cgi.shKnightCloak, m == moVizier ? 0x800080Ff :
|
2017-07-10 18:47:38 +00:00
|
|
|
darkena(0x00FF00, 1, 0xFF));
|
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shTurban1, darkena(col, 1, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!where || where->hitpoints >= 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD2, cgi.shTurban2, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY * VBS, cgi.shSabre, 0xFFFFFFFF);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x301800FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moCrystalSage: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, 0xFFFFFFFF, m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, 0xFFFFFFFF);
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, 0xFFFFFFFF);
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, 0xFFFFFFFF);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFFFFFFFF, 0xC0C0C0FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
case moHedge: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBS, cgi.shHedgehogBlade, 0xC0C0C0FF);
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, 0x804000FF);
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, 0xF09000FF);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x00D000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moYeti: case moMonkey: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shYeti, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(col, 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moResearcher: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(0xFFFF00, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD, cgi.shAztecHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shAztecCap, darkena(0xC000C0, 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moFamiliar: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWolfBody);
|
|
|
|
queuepoly(VABODY, cgi.shWolfBody, darkena(0xA03000, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(mmspatial || footphase)
|
|
|
|
animallegs(VALEGS, moWolf, darkena(0xC04000, 0, 0xFF), footphase);
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VALEGS, cgi.shWolfLegs, darkena(0xC04000, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shFamiliarHead, darkena(0xC04000, 0, 0xFF));
|
|
|
|
// queuepoly(V, cgi.shCatLegs, darkena(0x902000, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(true) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shFamiliarEye, darkena(0xFFFF000, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shFamiliarEye, darkena(0xFFFF000, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2017-05-28 22:16:17 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
case moRanger: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 0, 0xC0));
|
|
|
|
if(!peace::on) queuepoly(VBS, cgi.shPSword, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shArmor, darkena(col, 1, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moNarciss: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shFlowerHand, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBS, cgi.shPBody, 0xFFE080FF);
|
|
|
|
if(!peace::on) queuepoly(VBS, cgi.shPKnife, 0xC0C0C0FF);
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, 0xFFE080FF);
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, 0x806A00FF);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moMirrorSpirit: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0x90), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 0, 0x90));
|
|
|
|
if(!peace::on) queuepoly(VBS * Mirror, cgi.shPSword, darkena(col, 0, 0xD0));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(col, 1, 0x90));
|
|
|
|
queuepoly(VHEAD2, cgi.shPFace, darkena(col, 1, 0x90));
|
|
|
|
queuepoly(VHEAD, cgi.shArmor, darkena(col, 0, 0xC0));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFFFFFFFF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moJiangshi: {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shJiangShi);
|
2019-06-24 10:59:28 +00:00
|
|
|
auto z2 = WDIM == 3 ? 0 : GDIM == 3 ? -abs(sin(footphase * M_PI * 2)) * cgi.human_height/3 : geom3::lev_to_factor(abs(sin(footphase * M_PI * 2)) * cgi.human_height);
|
2019-03-30 12:16:19 +00:00
|
|
|
auto V0 = V;
|
|
|
|
auto V = mmscale(V0, z2);
|
|
|
|
otherbodyparts(V, darkena(col, 0, 0xFF), m, m == moJiangshi ? 0 : footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY, cgi.shJiangShi, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1, cgi.shJiangShiDress, darkena(0x202020, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shTerraHead, darkena(0x101010, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shPFace, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD2, cgi.shJiangShiCap1, darkena(0x800000, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD3, cgi.shJiangShiCap2, darkena(0x400000, 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moGhost: case moSeep: case moFriendlyGhost: {
|
|
|
|
if(m == moFriendlyGhost) col = fghostcolor(where);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(VGHOST, cgi.shGhost, darkena(col, 0, m == moFriendlyGhost ? 0xC0 : 0x80), DIM == 3 ? PPR::SUPERLINE : cgi.shGhost.prio);
|
|
|
|
queuepolyat(VGHOST, cgi.shGhostEyes, 0xFF, DIM == 3 ? PPR::SUPERLINE : cgi.shEyes.prio);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moVineSpirit: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VGHOST, cgi.shGhost, 0xD0D0D0C0 | UNTRANS);
|
|
|
|
queuepolyat(VGHOST, cgi.shGhostEyes, 0xFF0000FF, DIM == 3 ? PPR::SUPERLINE : cgi.shGhostEyes.prio);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moFireFairy: {
|
|
|
|
col = firecolor(0);
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shFemaleBody);
|
|
|
|
queuepoly(VBS, cgi.shFemaleBody, darkena(col, 0, 0XC0));
|
|
|
|
queuepoly(VHEAD, cgi.shWitchHair, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shPFace, darkena(col, 0, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, darkena(col, 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moSlime: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VFISH, cgi.shSlime, darkena(col, 0, 0x80));
|
|
|
|
queuepoly(VSLIMEEYE, cgi.shSlimeEyes, 0xFF);
|
2019-04-05 12:41:21 +00:00
|
|
|
return false;
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2019-04-05 12:41:21 +00:00
|
|
|
|
2019-03-30 12:16:19 +00:00
|
|
|
case moKrakenH: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VFISH, cgi.shKrakenHead, darkena(col, 0, 0xD0));
|
|
|
|
queuepoly(VFISH, cgi.shKrakenEye, 0xFFFFFFC0 | UNTRANS);
|
|
|
|
queuepoly(VFISH, cgi.shKrakenEye2, 0xC0);
|
|
|
|
queuepoly(VFISH * Mirror, cgi.shKrakenEye, 0xFFFFFFC0 | UNTRANS);
|
|
|
|
queuepoly(VFISH * Mirror, cgi.shKrakenEye2, 0xC0);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moKrakenT: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VFISH, cgi.shSeaTentacle, darkena(col, 0, 0xD0));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moCultist: case moPyroCultist: case moCultistLeader: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 0, 0xC0));
|
|
|
|
if(!peace::on) queuepoly(VBS, cgi.shPSword, darkena(col, 2, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shHood, darkena(col, 1, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x00FF00FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moPirate: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(0x404040, 0, 0xFF));
|
|
|
|
queuepoly(VBS, cgi.shPirateHook, darkena(0xD0D0D0, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xFFFF80, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shEyepatch, darkena(0, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD2, cgi.shPirateHood, darkena(col, 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moRatling: case moRatlingAvenger: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shYeti);
|
|
|
|
queuepoly(VLEG, cgi.shRatTail, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY * VBS, cgi.shYeti, darkena(col, 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
float t = sintick(1000, where ? where->cpdist*M_PI : 0);
|
|
|
|
int eyecol = t > 0.92 ? 0xFF0000 : 0;
|
|
|
|
|
2019-05-12 18:11:17 +00:00
|
|
|
if(DIM == 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD, cgi.shRatHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shWolf1, darkena(eyecol, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shWolf2, darkena(eyecol, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shWolf3, darkena(0x202020, 0, 0xFF));
|
|
|
|
if(m == moRatlingAvenger) queuepoly(VHEAD1, cgi.shRatCape1, 0x303030FF);
|
2019-05-12 18:11:17 +00:00
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-12 18:11:17 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix V1 = V * zpush(cgi.AHEAD - zc(0.4) - zc(0.98) + cgi.HEAD); // * cpush(0, cgi.scalefactor * (-0.1));
|
|
|
|
queuepoly(V1, cgi.shRatHead, darkena(col, 0, 0xFF));
|
2019-05-24 21:49:23 +00:00
|
|
|
|
|
|
|
/*
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V1, cgi.shFamiliarEye, darkena(eyecol, 0, 0xFF));
|
|
|
|
queuepoly(V1 * Mirror, cgi.shFamiliarEye, darkena(eyecol, 0, 0xFF));
|
|
|
|
queuepoly(V1, cgi.shWolfEyes, darkena(col, 3, 0xFF));
|
2019-05-24 21:49:23 +00:00
|
|
|
*/
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V1, cgi.shRatEye1, darkena(eyecol, 0, 0xFF));
|
|
|
|
queuepoly(V1, cgi.shRatEye2, darkena(eyecol, 0, 0xFF));
|
|
|
|
queuepoly(V1, cgi.shRatEye3, darkena(0x202020, 0, 0xFF));
|
|
|
|
if(m == moRatlingAvenger) queuepoly(V1, cgi.shRatCape1, 0x303030FF);
|
2019-05-12 18:11:17 +00:00
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moRatlingAvenger) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBODY1 * VBS, cgi.shRatCape2, 0x484848FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moViking: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, darkena(0xE00000, 0, 0xFF));
|
|
|
|
if(!peace::on) queuepoly(VBODY * VBS, cgi.shPSword, darkena(0xD0D0D0, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shKnightCloak, darkena(0x404040, 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shVikingHelmet, darkena(0xC0C0C0, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xFFFF80, 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moOutlaw: {
|
|
|
|
const transmatrix VBS = otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBODY * VBS, cgi.shPBody, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VBODY1 * VBS, cgi.shKnightCloak, darkena(col, 1, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shWestHat1, darkena(col, 2, 0XFF));
|
|
|
|
queuepoly(VHEAD2, cgi.shWestHat2, darkena(col, 1, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(0xFFFF80, 0, 0xFF));
|
|
|
|
queuepoly(VBODY * VBS, cgi.shGunInHand, darkena(col, 1, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moNecromancer: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shPBody);
|
|
|
|
queuepoly(VBS, cgi.shPBody, 0xC00000C0 | UNTRANS);
|
|
|
|
queuepoly(VHEAD, cgi.shHood, darkena(col, 1, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFF0000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moDraugr: {
|
2019-04-20 23:06:37 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, 0x483828D0 | UNTRANS, m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shPBody, 0x483828D0 | UNTRANS);
|
|
|
|
queuepoly(VBS, cgi.shPSword, 0xFFFFD0A0 | UNTRANS);
|
|
|
|
queuepoly(VHEAD, cgi.shPHead, 0x483828D0 | UNTRANS);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFF0000FF, 0x483828FF);
|
2019-05-26 16:04:02 +00:00
|
|
|
// queuepoly(V, cgi.shSkull, 0xC06020D0);
|
|
|
|
//queuepoly(V, cgi.shSkullEyes, 0x000000D0);
|
|
|
|
// queuepoly(V, cgi.shWightCloak, 0xC0A080A0);
|
2019-03-30 12:16:19 +00:00
|
|
|
int b = where ? where->cpdist : 0;
|
|
|
|
b--;
|
|
|
|
if(b < 0) b = 0;
|
|
|
|
if(b > 6) b = 6;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shWightCloak, (0x605040A0 | UNTRANS) + 0x10101000 * b);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moVoidBeast: {
|
2019-04-20 23:06:37 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, 0x080808D0 | UNTRANS, m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shPBody, 0x080808D0 | UNTRANS);
|
|
|
|
queuepoly(VHEAD, cgi.shPHead, 0x080808D0 | UNTRANS);
|
|
|
|
queuepoly(VHEAD, cgi.shWightCloak, 0xFF0000A0 | UNTRANS);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFF0000FF, 0x080808FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moGoblin: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shYeti);
|
|
|
|
queuepoly(VBS, cgi.shYeti, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD, cgi.shArmor, darkena(col, 1, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x800000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moLancer: case moFlailer: case moMiner: {
|
|
|
|
transmatrix V2 = V;
|
|
|
|
if(m == moLancer)
|
|
|
|
V2 = V * spin((where && where->type == 6) ? -M_PI/3 : -M_PI/2 );
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vh = mmscale(V2, cgi.HEAD);
|
|
|
|
transmatrix Vb = mmscale(V2, cgi.BODY);
|
2019-03-30 12:16:19 +00:00
|
|
|
Vb = Vb * otherbodyparts(V2, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V2, cgi.shPBody);
|
|
|
|
queuepoly(Vb, cgi.shPBody, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(Vh, m == moFlailer ? cgi.shArmor : cgi.shHood, darkena(col, 1, 0XFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moMiner)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vb, cgi.shPickAxe, darkena(0xC0C0C0, 0, 0XFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moLancer)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vb, cgi.shPike, darkena(col, 0, 0XFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
if(m == moFlailer) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vb, cgi.shFlailBall, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(Vb, cgi.shFlailChain, darkena(col, 1, 0XFF));
|
|
|
|
queuepoly(Vb, cgi.shFlailTrunk, darkena(col, 0, 0XFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moTroll: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shYeti);
|
|
|
|
queuepoly(VBS, cgi.shYeti, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(col, 1, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(col, 2, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x004000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moFjordTroll: case moForestTroll: case moStormTroll: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shYeti);
|
|
|
|
queuepoly(VBS, cgi.shYeti, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(col, 1, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(col, 2, 0XFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x004000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moDarkTroll: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shYeti);
|
|
|
|
queuepoly(VBS, cgi.shYeti, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(col, 1, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, 0xFFFFFF80 | UNTRANS);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moRedTroll: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shYeti);
|
|
|
|
queuepoly(VBS, cgi.shYeti, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD1, cgi.shPHead, darkena(0xFF8000, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, 0xFFFFFF80 | UNTRANS);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moEarthElemental: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWaterElemental);
|
|
|
|
queuepoly(VBS, cgi.shWaterElemental, darkena(col, 0, 0xC0));
|
|
|
|
queuepoly(VHEAD1, cgi.shFemaleHair, darkena(col, 0, 0XFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, 0xF0000080 | UNTRANS);
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xD0D000FF, darkena(col, 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moWaterElemental: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, watercolor(50), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWaterElemental);
|
|
|
|
queuepoly(VBS, cgi.shWaterElemental, watercolor(0));
|
|
|
|
queuepoly(VHEAD1, cgi.shFemaleHair, watercolor(100));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, watercolor(200));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x0000FFFF, watercolor(150));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moFireElemental: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(firecolor(50), 0, 0xFF), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWaterElemental);
|
|
|
|
queuepoly(VBS, cgi.shWaterElemental, darkena(firecolor(0), 0, 0xFF));
|
|
|
|
queuepoly(VHEAD1, cgi.shFemaleHair, darkena(firecolor(100), 0, 0xFF));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(firecolor(200), 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, darkena(firecolor(200), 0, 0xFF), darkena(firecolor(50), 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moAirElemental: {
|
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0x40), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shWaterElemental);
|
|
|
|
queuepoly(VBS, cgi.shWaterElemental, darkena(col, 0, 0x80));
|
|
|
|
queuepoly(VHEAD1, cgi.shFemaleHair, darkena(col, 0, 0x80));
|
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(col, 0, 0x80));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFFFFFFFF, darkena(col, 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moWorm: case moWormwait: case moHexSnake: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shWormHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepolyat(V, cgi.shWormEyes, 0xFF, PPR::ONTENTACLE_EYES);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moDragonHead: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shDragonHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepolyat(V, cgi.shDragonEyes, 0xFF, PPR::ONTENTACLE_EYES);
|
2019-03-30 12:16:19 +00:00
|
|
|
int noscolor = 0xFF0000FF;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shDragonNostril, noscolor);
|
|
|
|
queuepoly(V * Mirror, cgi.shDragonNostril, noscolor);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moDragonTail: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shDragonSegment, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
case moTentacle: case moTentaclewait: case moTentacleEscaping: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shTentHead, darkena(col, 0, 0xFF));
|
|
|
|
ShadowV(V, cgi.shTentHead, PPR::GIANTSHADOW);
|
2019-03-30 12:16:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
2019-03-30 16:51:37 +00:00
|
|
|
|
|
|
|
case moAsteroid: {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shAsteroid[1], darkena(col, 0, 0xFF));
|
2019-03-30 16:51:37 +00:00
|
|
|
return false;
|
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
default: ;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
if(isPrincess(m)) goto princess;
|
|
|
|
|
|
|
|
else if(isBull(m)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shBullBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
int hoofcol = darkena(gradient(0, col, 0, .65, 1), 0, 0xFF);
|
|
|
|
if(mmspatial || footphase)
|
|
|
|
animallegs(VALEGS, moRagingBull, hoofcol, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shBullBody, darkena(gradient(0, col, 0, .80, 1), 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shBullHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD, cgi.shBullHorn, darkena(0xFFFFFF, 0, 0xFF));
|
|
|
|
queuepoly(VAHEAD * Mirror, cgi.shBullHorn, darkena(0xFFFFFF, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
|
|
|
|
else if(isBug(m)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shBugBody);
|
2019-03-30 12:16:19 +00:00
|
|
|
if(!mmspatial && !footphase)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shBugBody, darkena(col, 0, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
else {
|
|
|
|
animallegs(VALEGS, moBug0, darkena(col, 0, 0xFF), footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shBugAntenna, darkena(col, 1, 0xFF));
|
2019-03-30 12:16:19 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shBugArmor, darkena(col, 1, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-01-04 14:46:06 +00:00
|
|
|
else if(isSwitch(m)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VFISH, cgi.shJelly, darkena(col, 0, 0xD0));
|
|
|
|
queuepolyat(VBODY, cgi.shJelly, darkena(col, 0, 0xD0), PPR::MONSTER_BODY);
|
|
|
|
queuepolyat(VHEAD, cgi.shJelly, darkena(col, 0, 0xD0), PPR::MONSTER_HEAD);
|
|
|
|
queuepolyat(VHEAD, cgi.shSlimeEyes, 0xFF, PPR::MONSTER_HEAD);
|
2018-01-04 14:46:06 +00:00
|
|
|
}
|
2019-03-30 12:16:19 +00:00
|
|
|
else if(isDemon(m)) {
|
2018-12-23 13:00:52 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 0, 0xC0), m, footphase);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shPBody, darkena(col, 1, 0xC0));
|
|
|
|
ShadowV(V, cgi.shPBody);
|
2017-07-10 18:47:38 +00:00
|
|
|
int acol = col;
|
|
|
|
if(xch == 'D') acol = 0xD0D0D0;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD, cgi.shDemon, darkena(acol, 0, 0xFF));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0xFF0000FF, 0xC00000FF);
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2017-12-30 14:12:15 +00:00
|
|
|
else if(isMagneticPole(m)) {
|
|
|
|
if(m == moNorthPole)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(VBODY * spin(M_PI), cgi.shTentacle, 0x000000C0, PPR::TENTACLE1);
|
|
|
|
queuepolyat(VBODY, cgi.shDisk, darkena(col, 0, 0xFF), PPR::MONSTER_BODY);
|
2017-12-30 14:12:15 +00:00
|
|
|
}
|
2018-10-25 00:43:14 +00:00
|
|
|
else if(isMetalBeast(m) || m == moBrownBug) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shTrylobite);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!mmspatial)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shTrylobite, darkena(col, 1, 0xC0));
|
2017-03-23 10:53:57 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VABODY, cgi.shTrylobiteBody, darkena(col, 1, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
animallegs(VALEGS, moMetalBeast, darkena(col, 1, 0xFF), footphase);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
int acol = col;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VAHEAD, cgi.shTrylobiteHead, darkena(acol, 0, 0xFF));
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(isWitch(m)) {
|
2018-12-23 13:00:52 +00:00
|
|
|
const transmatrix VBS = VBODY * otherbodyparts(V, darkena(col, 1, 0xFF), m, footphase);
|
2017-07-10 18:47:38 +00:00
|
|
|
int cc = 0xFF;
|
2018-09-10 15:49:51 +00:00
|
|
|
if(m == moWitchGhost) cc = 0x85 + 120 * sintick(160);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(m == moWitchWinter && where) drawWinter(V, 0);
|
|
|
|
if(m == moWitchFlash && where) drawFlash(V);
|
|
|
|
if(m == moWitchSpeed && where) drawSpeed(V);
|
|
|
|
if(m == moWitchFire) col = firecolor(0);
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(V, cgi.shFemaleBody);
|
|
|
|
queuepoly(VBS, cgi.shFemaleBody, darkena(col, 0, cc));
|
|
|
|
// queuepoly(cV2, ct, cgi.shPSword, darkena(col, 0, 0XFF));
|
|
|
|
// queuepoly(V, cgi.shHood, darkena(col, 0, 0XC0));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(m == moWitchFire) col = firecolor(100);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD1, cgi.shWitchHair, darkena(col, 1, cc));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(m == moWitchFire) col = firecolor(200);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VHEAD, cgi.shPFace, darkena(col, 0, cc));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(m == moWitchFire) col = firecolor(300);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(VBS, cgi.shWitchDress, darkena(col, 1, 0XC0));
|
2019-05-12 18:08:42 +00:00
|
|
|
humanoid_eyes(V, 0x000000FF);
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
// just for the HUD glyphs...
|
2019-03-30 12:16:19 +00:00
|
|
|
else if(isAnyIvy(m)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shILeaf[0], darkena(col, 0, 0xFF));
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else return true;
|
|
|
|
|
|
|
|
return false;
|
2017-12-01 23:23:15 +00:00
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-06-24 10:57:00 +00:00
|
|
|
bool drawMonsterTypeDH(eMonster m, cell *where, const transmatrix& V, color_t col, bool dh, ld footphase, color_t asciicol) {
|
2018-09-04 17:53:42 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, poly_outline);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(dh) {
|
|
|
|
poly_outline = OUTLINE_DEAD;
|
|
|
|
darken++;
|
|
|
|
}
|
2019-06-24 10:57:00 +00:00
|
|
|
bool b = drawMonsterType(m,where,V,col, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(dh) {
|
|
|
|
darken--;
|
|
|
|
}
|
|
|
|
return b;
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX transmatrix playerV;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool applyAnimation(cell *c, transmatrix& V, double& footphase, int layer) {
|
|
|
|
if(!animations[layer].count(c)) return false;
|
|
|
|
animation& a = animations[layer][c];
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int td = ticks - a.ltick;
|
|
|
|
ld aspd = td / 1000.0 * exp(vid.mspeed);
|
2018-01-25 16:19:50 +00:00
|
|
|
ld R;
|
|
|
|
again:
|
|
|
|
|
|
|
|
if(a.attacking == 1)
|
|
|
|
R = hdist(tC0(a.attackat), tC0(a.wherenow));
|
|
|
|
else
|
|
|
|
R = hdist0(tC0(a.wherenow));
|
2017-07-10 18:47:38 +00:00
|
|
|
aspd *= (1+R+(shmup::on?1:0));
|
|
|
|
|
|
|
|
if(R < aspd || std::isnan(R) || std::isnan(aspd) || R > 10) {
|
2018-01-25 16:19:50 +00:00
|
|
|
if(a.attacking == 1) { a.attacking = 2; goto again; }
|
2017-07-10 18:47:38 +00:00
|
|
|
animations[layer].erase(c);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else {
|
2018-01-25 16:19:50 +00:00
|
|
|
if(a.attacking == 1)
|
|
|
|
a.wherenow = a.wherenow * rspintox(tC0(inverse(a.wherenow) * a.attackat));
|
|
|
|
else
|
|
|
|
a.wherenow = a.wherenow * rspintox(tC0(inverse(a.wherenow)));
|
2017-07-10 18:47:38 +00:00
|
|
|
a.wherenow = a.wherenow * xpush(aspd);
|
|
|
|
fixmatrix(a.wherenow);
|
2018-01-25 16:19:50 +00:00
|
|
|
a.footphase += a.attacking == 2 ? -aspd : aspd;
|
2017-07-10 18:47:38 +00:00
|
|
|
footphase = a.footphase;
|
|
|
|
V = V * a.wherenow;
|
2019-05-15 12:19:19 +00:00
|
|
|
if(a.mirrored) V = V * Mirror;
|
2018-01-25 16:19:50 +00:00
|
|
|
if(a.attacking == 2) V = V * pispin;
|
2019-04-20 23:08:27 +00:00
|
|
|
// if(DIM == 3) V = V * cspin(0, 2, M_PI/2);
|
2017-07-10 18:47:38 +00:00
|
|
|
a.ltick = ticks;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
double chainAngle(cell *c, transmatrix& V, cell *c2, double dft, const transmatrix &Vwhere) {
|
|
|
|
if(!gmatrix0.count(c2)) return dft;
|
2017-07-10 18:47:38 +00:00
|
|
|
hyperpoint h = C0;
|
|
|
|
if(animations[LAYER_BIG].count(c2)) h = animations[LAYER_BIG][c2].wherenow * h;
|
2018-09-10 16:46:27 +00:00
|
|
|
h = inverse(V) * Vwhere * calc_relative_matrix(c2, c, C0) * h;
|
2017-07-10 18:47:38 +00:00
|
|
|
return atan2(h[1], h[0]);
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// equivalent to V = V * spin(-chainAngle(c,V,c2,dft));
|
2018-08-19 13:52:39 +00:00
|
|
|
bool chainAnimation(cell *c, transmatrix& V, cell *c2, int i, ld bonus, const transmatrix &Vwhere, ld& length) {
|
2017-07-22 23:33:27 +00:00
|
|
|
if(!gmatrix0.count(c2)) {
|
2018-08-19 13:52:39 +00:00
|
|
|
V = V * ddspin(c,i,bonus);
|
2018-01-11 22:18:02 +00:00
|
|
|
length = cellgfxdist(c,i);
|
2017-07-10 18:47:38 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
hyperpoint h = C0;
|
|
|
|
if(animations[LAYER_BIG].count(c2)) h = animations[LAYER_BIG][c2].wherenow * h;
|
2018-09-10 16:46:27 +00:00
|
|
|
h = inverse(V) * Vwhere * calc_relative_matrix(c2, c, C0) * h;
|
2018-01-11 22:18:02 +00:00
|
|
|
length = hdist0(h);
|
2017-07-10 18:47:38 +00:00
|
|
|
V = V * rspintox(h);
|
|
|
|
return true;
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// push down the queue after q-th element, `down` absolute units down,
|
|
|
|
// based on cell c and transmatrix V
|
|
|
|
// do change the zoom factor? do change the priorities?
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2019-08-09 21:39:36 +00:00
|
|
|
EX int cellcolor(cell *c) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(isPlayerOn(c) || isFriendly(c)) return OUTLINE_FRIEND;
|
|
|
|
if(noHighlight(c->monst)) return OUTLINE_NONE;
|
|
|
|
if(c->monst) return OUTLINE_ENEMY;
|
|
|
|
|
|
|
|
if(c->wall == waMirror) return c->land == laMirror ? OUTLINE_TREASURE : OUTLINE_ORB;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->item) {
|
|
|
|
int k = itemclass(c->item);
|
|
|
|
if(k == IC_TREASURE)
|
|
|
|
return OUTLINE_TREASURE;
|
|
|
|
else if(k == IC_ORB)
|
|
|
|
return OUTLINE_ORB;
|
|
|
|
else
|
|
|
|
return OUTLINE_OTHER;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
return OUTLINE_NONE;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-01-11 22:18:02 +00:00
|
|
|
int taildist(cell *c) {
|
|
|
|
int s = 0;
|
|
|
|
while(s < 1000 && c->mondir != NODIR && isWorm(c->monst)) {
|
2018-08-17 22:46:45 +00:00
|
|
|
s++; c = c->move(c->mondir);
|
2018-01-11 22:18:02 +00:00
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
int last_wormsegment = -1;
|
2019-01-06 01:40:45 +00:00
|
|
|
vector<vector< function<void()> > > wormsegments;
|
2018-01-11 22:18:02 +00:00
|
|
|
|
2019-01-06 01:40:45 +00:00
|
|
|
void add_segment(int d, const function<void()>& s) {
|
2018-06-22 12:47:24 +00:00
|
|
|
if(isize(wormsegments) <= d) wormsegments.resize(d+1);
|
2018-01-11 22:18:02 +00:00
|
|
|
last_wormsegment = max(last_wormsegment, d);
|
|
|
|
wormsegments[d].push_back(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void drawWormSegments() {
|
|
|
|
for(int i=0; i<=last_wormsegment; i++) {
|
|
|
|
for(auto& f: wormsegments[i]) f();
|
|
|
|
wormsegments[i].clear();
|
|
|
|
}
|
|
|
|
last_wormsegment = -1;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool dont_face_pc = false;
|
2018-01-30 23:10:44 +00:00
|
|
|
|
2019-06-24 10:57:00 +00:00
|
|
|
bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool mirrored, color_t asciicol) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-06-28 10:59:35 +00:00
|
|
|
bool darkhistory = conformal::includeHistory && conformal::inkillhistory.count(c);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(doHighlight())
|
|
|
|
poly_outline =
|
|
|
|
(isPlayerOn(c) || isFriendly(c)) ? OUTLINE_FRIEND :
|
|
|
|
noHighlight(c->monst) ? OUTLINE_NONE :
|
|
|
|
OUTLINE_ENEMY;
|
|
|
|
|
|
|
|
bool nospins = false, nospinb = false;
|
|
|
|
double footphaseb = 0, footphase = 0;
|
|
|
|
|
|
|
|
transmatrix Vs = Vparam; nospins = applyAnimation(c, Vs, footphase, LAYER_SMALL);
|
2017-07-22 23:33:27 +00:00
|
|
|
transmatrix Vb = Vparam; nospinb = applyAnimation(c, Vb, footphaseb, LAYER_BIG);
|
2017-07-10 18:47:38 +00:00
|
|
|
// nospin = true;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
eMonster m = c->monst;
|
2019-03-30 12:35:03 +00:00
|
|
|
|
2019-05-15 12:19:19 +00:00
|
|
|
bool half_elliptic = elliptic && GDIM == 3 && WDIM == 2;
|
|
|
|
|
2019-03-30 12:35:03 +00:00
|
|
|
if(!m) ;
|
2019-05-15 10:41:02 +00:00
|
|
|
|
2019-05-15 12:19:19 +00:00
|
|
|
else if(half_elliptic && mirrored != c->monmirror && !isMimic(m)) ;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-03-30 12:35:03 +00:00
|
|
|
else if(isAnyIvy(c) || isWorm(c)) {
|
2019-02-27 13:43:42 +00:00
|
|
|
|
2018-06-17 10:15:46 +00:00
|
|
|
if((m == moHexSnake || m == moHexSnakeTail) && c->hitpoints == 2) {
|
2018-01-05 14:49:50 +00:00
|
|
|
int d = c->mondir;
|
|
|
|
if(d == NODIR)
|
|
|
|
forCellIdEx(c2, i, c)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(among(c2->monst, moHexSnakeTail, moHexSnake) && c2->mondir == c->c.spin(i))
|
2018-01-05 14:49:50 +00:00
|
|
|
d = i;
|
2018-01-06 22:39:10 +00:00
|
|
|
if(d == NODIR) { d = hrand(c->type); createMov(c, d); }
|
2017-12-05 18:43:45 +00:00
|
|
|
int c1 = nestcolors[pattern_threecolor(c)];
|
2018-08-17 22:46:45 +00:00
|
|
|
int c2 = nestcolors[pattern_threecolor(c->move(d))];
|
2017-12-05 18:43:45 +00:00
|
|
|
col = (c1 + c2); // sum works because they are dark and should be brightened
|
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(isDragon(c->monst) && c->stuntime == 0) col = 0xFF6000;
|
|
|
|
|
2019-05-12 18:10:49 +00:00
|
|
|
if(DIM == 3)
|
2019-06-24 10:57:00 +00:00
|
|
|
addradar(Vparam, minf[m].glyph, asciicol, isFriendly(m) ? 0x00FF00FF : 0xFF0000FF);
|
2019-05-11 13:20:34 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
transmatrix Vb0 = Vb;
|
2019-05-09 22:53:07 +00:00
|
|
|
if(c->mondir != NODIR && DIM == 3 && isAnyIvy(c)) {
|
2019-02-26 21:08:33 +00:00
|
|
|
queueline(tC0(Vparam), Vparam * tC0(calc_relative_matrix(c->move(c->mondir), c, C0)), (col << 8) + 0xFF, 0);
|
|
|
|
}
|
|
|
|
else if(c->mondir != NODIR) {
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(mmmon) {
|
2018-01-11 22:18:02 +00:00
|
|
|
ld length;
|
2018-08-17 22:46:45 +00:00
|
|
|
// cell *c2 = c->move(c->mondir);
|
2018-01-11 22:18:02 +00:00
|
|
|
if(nospinb)
|
2018-08-17 22:46:45 +00:00
|
|
|
chainAnimation(c, Vb, c->move(c->mondir), c->mondir, 0, Vparam, length);
|
2018-01-11 22:18:02 +00:00
|
|
|
else {
|
2017-07-10 18:47:38 +00:00
|
|
|
Vb = Vb * ddspin(c, c->mondir);
|
2018-01-11 22:18:02 +00:00
|
|
|
length = cellgfxdist(c, c->mondir);
|
|
|
|
}
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
|
|
|
|
2018-08-28 11:45:11 +00:00
|
|
|
if(mapeditor::drawUserShape(Vb, mapeditor::sgMonster, c->monst, (col << 8) + 0xFF, c))
|
2018-08-27 17:27:35 +00:00
|
|
|
return false;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(isIvy(c) || isMutantIvy(c) || c->monst == moFriendlyIvy)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vb, cgi.shIBranch, (col << 8) + 0xFF);
|
2018-01-11 22:18:02 +00:00
|
|
|
/* else if(c->monst < moTentacle && wormstyle == 0) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ShadowV(Vb, cgi.shTentacleX, PPR::GIANTSHADOW);
|
|
|
|
queuepoly(mmscale(Vb, cgi.ABODY), cgi.shTentacleX, 0xFF);
|
|
|
|
queuepoly(mmscale(Vb, cgi.ABODY), cgi.shTentacle, (col << 8) + 0xFF);
|
2018-01-11 22:18:02 +00:00
|
|
|
} */
|
|
|
|
// else if(c->monst < moTentacle) {
|
|
|
|
// }
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->monst == moDragonHead || c->monst == moDragonTail) {
|
|
|
|
char part = dragon::bodypart(c, dragon::findhead(c));
|
|
|
|
if(part != '2') {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mmscale(Vb, cgi.ABODY), cgi.shDragonSegment, darkena(col, 0, 0xFF));
|
|
|
|
ShadowV(Vb, cgi.shDragonSegment, PPR::GIANTSHADOW);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(c->monst == moTentacleGhost) {
|
|
|
|
hyperpoint V0 = conformal::on ? tC0(Vs) : inverse(cwtV) * tC0(Vs);
|
|
|
|
hyperpoint V1 = spintox(V0) * V0;
|
|
|
|
Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin;
|
2019-06-24 10:57:55 +00:00
|
|
|
drawMonsterType(moGhost, c, Vs, col, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
col = minf[moTentacletail].color;
|
|
|
|
}
|
2018-01-11 22:18:02 +00:00
|
|
|
/*
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mmscale(Vb, cgi.ABODY), cgi.shTentacleX, 0xFFFFFFFF);
|
|
|
|
queuepoly(mmscale(Vb, cgi.ABODY), cgi.shTentacle, (col << 8) + 0xFF);
|
|
|
|
ShadowV(Vb, cgi.shTentacleX, PPR::GIANTSHADOW);
|
2018-01-11 22:18:02 +00:00
|
|
|
*/
|
|
|
|
bool hexsnake = c->monst == moHexSnake || c->monst == moHexSnakeTail;
|
|
|
|
bool thead = c->monst == moTentacle || c->monst == moTentaclewait || c->monst == moTentacleEscaping;
|
2019-05-26 16:04:02 +00:00
|
|
|
hpcshape& sh = hexsnake ? cgi.shWormSegment : cgi.shSmallWormSegment;
|
2018-01-11 22:18:02 +00:00
|
|
|
ld wav = hexsnake ? 0 :
|
|
|
|
c->monst < moTentacle ? 1/1.5 :
|
|
|
|
1;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col0 = col;
|
2018-01-11 22:18:02 +00:00
|
|
|
if(c->monst == moWorm || c->monst == moWormwait)
|
|
|
|
col0 = minf[moWormtail].color;
|
|
|
|
else if(thead)
|
|
|
|
col0 = minf[moTentacletail].color;
|
|
|
|
add_segment(taildist(c), [=] () {
|
|
|
|
for(int i=11; i>=0; i--) {
|
|
|
|
if(i < 3 && (c->monst == moTentacle || c->monst == moTentaclewait)) continue;
|
2019-05-11 13:20:34 +00:00
|
|
|
transmatrix Vbx = Vb;
|
|
|
|
if(WDIM == 2) Vbx = Vbx * spin(sin(M_PI * i / 6.) * wav / (i+.1));
|
|
|
|
Vbx = Vbx * xpush(length * (i) / 12.0);
|
2018-01-11 22:18:02 +00:00
|
|
|
// transmatrix Vbx2 = Vnext * xpush(length2 * i / 6.0);
|
|
|
|
// Vbx = Vbx * rspintox(inverse(Vbx) * Vbx2 * C0) * pispin;
|
2018-08-28 12:27:23 +00:00
|
|
|
ShadowV(Vbx, sh, PPR::GIANTSHADOW);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mmscale(Vbx, cgi.ABODY), sh, (col0 << 8) + 0xFF);
|
2018-01-11 22:18:02 +00:00
|
|
|
}
|
|
|
|
});
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
else {
|
2018-08-19 13:52:39 +00:00
|
|
|
int hdir = displayspin(c, c->mondir);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(0x606020, 0, 0xFF);
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int u=-1; u<=1; u++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(Vparam*xspinpush0(hdir+M_PI/2, u*cgi.crossf/5), Vparam*xspinpush(hdir, cgi.crossf)*xspinpush0(hdir+M_PI/2, u*cgi.crossf/5), col, 2 + vid.linequality);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(mmmon) {
|
2019-03-30 12:35:03 +00:00
|
|
|
if(isAnyIvy(c)) {
|
2019-02-26 21:08:33 +00:00
|
|
|
if(DIM == 3) {
|
|
|
|
hyperpoint V0 = tC0(Vb);
|
|
|
|
transmatrix Vs = rspintox(V0) * xpush(hdist0(V0)) * cspin(0, 2, -M_PI/2);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vs, cgi.shILeaf[1], darkena(col, 0, 0xFF));
|
2019-02-26 21:08:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mmscale(Vb, cgi.ABODY), cgi.shILeaf[ctof(c)], darkena(col, 0, 0xFF));
|
|
|
|
ShadowV(Vb, cgi.shILeaf[ctof(c)], PPR::GIANTSHADOW);
|
2019-02-26 21:08:33 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(m == moWorm || m == moWormwait || m == moHexSnake) {
|
|
|
|
Vb = Vb * pispin;
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vbh = mmscale(Vb, cgi.AHEAD);
|
|
|
|
queuepoly(Vbh, cgi.shWormHead, darkena(col, 0, 0xFF));
|
|
|
|
queuepolyat(Vbh, cgi.shWormEyes, 0xFF, PPR::ONTENTACLE_EYES);
|
|
|
|
ShadowV(Vb, cgi.shWormHead, PPR::GIANTSHADOW);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(m == moDragonHead) {
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vbh = mmscale(Vb, cgi.AHEAD);
|
|
|
|
ShadowV(Vb, cgi.shDragonHead, PPR::GIANTSHADOW);
|
|
|
|
queuepoly(Vbh, cgi.shDragonHead, darkena(col, c->hitpoints?0:1, 0xFF));
|
|
|
|
queuepolyat(Vbh/* * pispin */, cgi.shDragonEyes, 0xFF, PPR::ONTENTACLE_EYES);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int noscolor = (c->hitpoints == 1 && c->stuntime ==1) ? 0xFF0000FF : 0xFF;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vbh, cgi.shDragonNostril, noscolor);
|
|
|
|
queuepoly(Vbh * Mirror, cgi.shDragonNostril, noscolor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(m == moTentacle || m == moTentaclewait || m == moTentacleEscaping) {
|
|
|
|
Vb = Vb * pispin;
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vbh = mmscale(Vb, cgi.AHEAD);
|
|
|
|
queuepoly(Vbh, cgi.shTentHead, darkena(col, 0, 0xFF));
|
|
|
|
ShadowV(Vb, cgi.shTentHead, PPR::GIANTSHADOW);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(m == moDragonTail) {
|
|
|
|
cell *c2 = NULL;
|
|
|
|
for(int i=0; i<c->type; i++)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c->move(i) && isDragon(c->move(i)->monst) && c->move(i)->mondir == c->c.spin(i))
|
|
|
|
c2 = c->move(i);
|
2017-07-10 18:47:38 +00:00
|
|
|
int nd = neighborId(c, c2);
|
|
|
|
char part = dragon::bodypart(c, dragon::findhead(c));
|
|
|
|
if(part == 't') {
|
|
|
|
if(nospinb) {
|
2018-01-11 22:18:02 +00:00
|
|
|
ld length;
|
|
|
|
chainAnimation(c, Vb, c2, nd, 0, Vparam, length);
|
2017-07-10 18:47:38 +00:00
|
|
|
Vb = Vb * pispin;
|
|
|
|
}
|
|
|
|
else {
|
2018-08-19 13:52:39 +00:00
|
|
|
Vb = Vb0 * ddspin(c, nd, M_PI);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vbb = mmscale(Vb, cgi.ABODY);
|
|
|
|
queuepoly(Vbb, cgi.shDragonTail, darkena(col, c->hitpoints?0:1, 0xFF));
|
|
|
|
ShadowV(Vb, cgi.shDragonTail, PPR::GIANTSHADOW);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(true) {
|
|
|
|
if(nospinb) {
|
2018-01-11 22:18:02 +00:00
|
|
|
ld length;
|
|
|
|
chainAnimation(c, Vb, c2, nd, 0, Vparam, length);
|
2017-07-10 18:47:38 +00:00
|
|
|
Vb = Vb * pispin;
|
2018-08-19 13:52:39 +00:00
|
|
|
double ang = chainAngle(c, Vb, c->move(c->mondir), displayspin(c, c->mondir) - displayspin(c, nd), Vparam);
|
2017-07-10 18:47:38 +00:00
|
|
|
ang /= 2;
|
|
|
|
Vb = Vb * spin(M_PI-ang);
|
|
|
|
}
|
|
|
|
else {
|
2018-08-19 13:52:39 +00:00
|
|
|
ld hdir0 = displayspin(c, nd) + M_PI;
|
|
|
|
ld hdir1 = displayspin(c, c->mondir);
|
|
|
|
while(hdir1 > hdir0 + M_PI) hdir1 -= 2*M_PI;
|
|
|
|
while(hdir1 < hdir0 - M_PI) hdir1 += 2*M_PI;
|
|
|
|
Vb = Vb0 * spin((hdir0 + hdir1)/2 + M_PI);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vbb = mmscale(Vb, cgi.ABODY);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(part == 'l' || part == '2') {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vbb, cgi.shDragonLegs, darkena(col, c->hitpoints?0:1, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vbb, cgi.shDragonWings, darkena(col, c->hitpoints?0:1, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2017-12-05 18:43:45 +00:00
|
|
|
else {
|
2018-01-11 22:18:02 +00:00
|
|
|
if(c->monst == moTentacletail && c->mondir == NODIR) {
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-06-17 17:35:57 +00:00
|
|
|
queuepoly(DIM == 3 ? mmscale(Vb, cgi.ABODY) : Vb, cgi.shWormSegment, darkena(col, 0, 0xFF));
|
2018-01-11 22:18:02 +00:00
|
|
|
}
|
|
|
|
else if(c->mondir == NODIR) {
|
|
|
|
bool hexsnake = c->monst == moHexSnake || c->monst == moHexSnakeTail;
|
|
|
|
cell *c2 = NULL;
|
|
|
|
for(int i=0; i<c->type; i++)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c->move(i) && isWorm(c->move(i)->monst) && c->move(i)->mondir == c->c.spin(i))
|
|
|
|
c2 = c->move(i);
|
2018-01-11 22:18:02 +00:00
|
|
|
int nd = neighborId(c, c2);
|
|
|
|
if(nospinb) {
|
|
|
|
ld length;
|
|
|
|
chainAnimation(c, Vb, c2, nd, 0, Vparam, length);
|
|
|
|
Vb = Vb * pispin;
|
|
|
|
}
|
|
|
|
else {
|
2018-08-19 13:52:39 +00:00
|
|
|
Vb = Vb0 * ddspin(c, nd, M_PI);
|
2018-01-11 22:18:02 +00:00
|
|
|
}
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vbb = mmscale(Vb, cgi.ABODY) * pispin;
|
|
|
|
hpcshape& sh = hexsnake ? cgi.shWormTail : cgi.shSmallWormTail;
|
2018-01-11 22:18:02 +00:00
|
|
|
queuepoly(Vbb, sh, darkena(col, 0, 0xFF));
|
2018-08-28 12:27:23 +00:00
|
|
|
ShadowV(Vb, sh, PPR::GIANTSHADOW);
|
2018-01-11 22:18:02 +00:00
|
|
|
}
|
2017-12-05 18:43:45 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!mmmon) return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(isMimic(c)) {
|
2017-07-22 23:33:27 +00:00
|
|
|
int xdir = 0, copies = 1;
|
|
|
|
if(c->wall == waMirrorWall) {
|
|
|
|
xdir = mirror::mirrordir(c);
|
|
|
|
copies = 2;
|
|
|
|
if(xdir == -1) copies = 6, xdir = 0;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-08-17 22:46:45 +00:00
|
|
|
for(auto& m: mirror::mirrors) if(c == m.second.at)
|
2017-07-22 23:33:27 +00:00
|
|
|
for(int d=0; d<copies; d++) {
|
|
|
|
multi::cpid = m.first;
|
|
|
|
auto cw = m.second;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(d&1) cw = cw.mirrorat(xdir);
|
2018-03-24 11:59:01 +00:00
|
|
|
if(d>=2) cw += 2;
|
|
|
|
if(d>=4) cw += 2;
|
2017-07-22 23:33:27 +00:00
|
|
|
transmatrix Vs = Vparam;
|
|
|
|
bool mirr = cw.mirrored;
|
2019-05-15 12:19:19 +00:00
|
|
|
if(mirrored != mirr && half_elliptic) continue;
|
2018-08-21 13:37:59 +00:00
|
|
|
transmatrix T = Id;
|
|
|
|
nospins = applyAnimation(cwt.at, T, footphase, LAYER_SMALL);
|
|
|
|
if(nospins)
|
|
|
|
Vs = Vs * ddspin(c, cw.spin, 0) * iddspin(cwt.at, cwt.spin, 0) * T;
|
|
|
|
else
|
|
|
|
Vs = Vs * ddspin(c, cw.spin, 0);
|
2017-07-22 23:33:27 +00:00
|
|
|
if(mirr) Vs = Vs * Mirror;
|
|
|
|
if(inmirrorcount&1) mirr = !mirr;
|
|
|
|
col = mirrorcolor(geometry == gElliptic ? det(Vs) < 0 : mirr);
|
2019-05-11 13:21:48 +00:00
|
|
|
if(!mouseout() && !nospins && GDIM == 2) {
|
2018-08-21 13:37:59 +00:00
|
|
|
hyperpoint P2 = Vs * inverse(cwtV) * mouseh;
|
|
|
|
queuechr(P2, 10, 'x', 0xFF00);
|
|
|
|
}
|
2017-07-22 23:33:27 +00:00
|
|
|
if(!nospins && flipplayer) Vs = Vs * pispin;
|
|
|
|
if(mmmon) {
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(moMimic, c, Vs, col, footphase, asciicol);
|
2017-07-22 23:33:27 +00:00
|
|
|
drawPlayerEffects(Vs, c, false);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
return !mmmon;
|
|
|
|
}
|
|
|
|
|
2019-03-30 12:35:03 +00:00
|
|
|
else if(!mmmon) return true;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
// illusions face randomly
|
|
|
|
|
|
|
|
else if(c->monst == moIllusion) {
|
|
|
|
multi::cpid = 0;
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vs = Vs * Mirror;
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(c->monst, c, Vs, col, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
drawPlayerEffects(Vs, c, false);
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// wolves face the heat
|
|
|
|
|
|
|
|
else if(c->monst == moWolf && c->cpdist > 1) {
|
|
|
|
if(!nospins) {
|
|
|
|
int d = 0;
|
|
|
|
double bheat = -999;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i) && HEAT(c->move(i)) > bheat) {
|
|
|
|
bheat = HEAT(c->move(i));
|
2017-07-10 18:47:38 +00:00
|
|
|
d = i;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2019-04-20 23:08:27 +00:00
|
|
|
Vs = Vs * ddspin(c, d, 0);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vs = Vs * Mirror;
|
2019-06-24 10:57:00 +00:00
|
|
|
return drawMonsterTypeDH(m, c, Vs, col, darkhistory, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->monst == moKrakenT) {
|
|
|
|
if(c->hitpoints == 0) col = 0x404040;
|
|
|
|
if(nospinb) {
|
2018-01-11 22:18:02 +00:00
|
|
|
ld length;
|
2018-08-17 22:46:45 +00:00
|
|
|
chainAnimation(c, Vb, c->move(c->mondir), c->mondir, 0, Vparam, length);
|
2017-07-10 18:47:38 +00:00
|
|
|
Vb = Vb * pispin;
|
2019-05-26 16:04:02 +00:00
|
|
|
Vb = Vb * xpush(cgi.tentacle_length - cellgfxdist(c, c->mondir));
|
2018-05-04 00:47:33 +00:00
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(NONSTDVAR) {
|
2018-08-17 22:46:45 +00:00
|
|
|
transmatrix T = calc_relative_matrix(c->move(c->mondir), c, c->mondir);
|
2019-05-26 16:04:02 +00:00
|
|
|
Vb = Vb * T * rspintox(tC0(inverse(T))) * xpush(cgi.tentacle_length);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-04-03 21:39:18 +00:00
|
|
|
else {
|
2018-08-19 13:52:39 +00:00
|
|
|
Vb = Vb * ddspin(c, c->mondir, M_PI);
|
2019-05-26 16:04:02 +00:00
|
|
|
Vb = Vb * xpush(cgi.tentacle_length - cellgfxdist(c, c->mondir));
|
2018-04-03 21:39:18 +00:00
|
|
|
}
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vb = Vb * Mirror;
|
2018-05-04 00:47:33 +00:00
|
|
|
|
2018-08-18 15:35:39 +00:00
|
|
|
// if(ctof(c) && !masterless) Vb = Vb * xpush(hexhexdist - hcrossf);
|
2019-05-26 16:04:02 +00:00
|
|
|
// return (!BITRUNCATED) ? tessf * gp::scale : (c->type == 6 && (i&1)) ? hexhexdist : cgi.crossf;
|
2019-06-24 10:57:00 +00:00
|
|
|
return drawMonsterTypeDH(m, c, Vb, col, darkhistory, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-01-05 13:18:14 +00:00
|
|
|
// golems, knights, and hyperbugs don't face the player (mondir-controlled)
|
|
|
|
// also whatever in the lineview mode, and whatever in the quotient geometry
|
|
|
|
|
2019-03-30 12:35:03 +00:00
|
|
|
else if((hasFacing(c) && c->mondir != NODIR) || conformal::on || quotient || euwrap || dont_face_pc) {
|
2018-01-05 13:18:14 +00:00
|
|
|
if(c->monst == moKrakenH) Vs = Vb, nospins = nospinb;
|
2019-03-12 01:41:44 +00:00
|
|
|
if(!nospins && c->mondir < c->type) Vs = Vs * ddspin(c, c->mondir, M_PI);
|
2018-01-05 13:18:14 +00:00
|
|
|
if(c->monst == moPair) Vs = Vs * xpush(-.12);
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vs = Vs * Mirror;
|
2018-01-05 13:18:14 +00:00
|
|
|
if(isFriendly(c)) drawPlayerEffects(Vs, c, false);
|
2019-06-24 10:57:00 +00:00
|
|
|
return drawMonsterTypeDH(m, c, Vs, col, darkhistory, footphase, asciicol);
|
2018-01-05 13:18:14 +00:00
|
|
|
}
|
|
|
|
|
2019-03-30 12:35:03 +00:00
|
|
|
else {
|
2017-07-10 18:47:38 +00:00
|
|
|
// other monsters face the player
|
|
|
|
|
|
|
|
if(!nospins) {
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 2) {
|
2019-02-26 20:11:50 +00:00
|
|
|
hyperpoint V0 = inverse(cwtV) * tC0(Vs);
|
|
|
|
hyperpoint V1 = spintox(V0) * V0;
|
|
|
|
|
|
|
|
Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
hyperpoint V0 = inverse(cwtV) * tC0(Vs);
|
2019-04-20 23:08:27 +00:00
|
|
|
Vs = cwtV * rspintox(V0) * xpush(hdist0(V0)) * cspin(0, 2, -M_PI);
|
2019-02-26 20:11:50 +00:00
|
|
|
// cwtV * rgpushxto0(inverse(cwtV) * tC0(Vs));
|
|
|
|
}
|
2017-10-15 22:15:54 +00:00
|
|
|
if(c->monst == moHunterChanging)
|
2019-05-08 16:33:08 +00:00
|
|
|
Vs = Vs * cspin(WDIM-2, WDIM-1, M_PI);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-15 12:19:19 +00:00
|
|
|
if(c->monmirror) Vs = Vs * Mirror;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(c->monst == moShadow)
|
|
|
|
multi::cpid = c->hitpoints;
|
|
|
|
|
2019-06-24 10:57:00 +00:00
|
|
|
return drawMonsterTypeDH(m, c, Vs, col, darkhistory, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
for(int i=0; i<numplayers(); i++) if(c == playerpos(i) && !shmup::on && mapeditor::drawplayer &&
|
|
|
|
!(hardcore && !canmove)) {
|
2019-05-15 10:41:02 +00:00
|
|
|
bool mirr = multi::players > 1 ? multi::player[i].mirrored : cwt.mirrored;
|
2019-05-15 12:19:19 +00:00
|
|
|
if(half_elliptic && mirr != mirrored) continue;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!nospins) {
|
|
|
|
Vs = playerV;
|
|
|
|
if(multi::players > 1 ? multi::flipped[i] : flipplayer) Vs = Vs * pispin;
|
|
|
|
}
|
2018-06-17 15:51:26 +00:00
|
|
|
else {
|
|
|
|
if(mirr) Vs = Vs * Mirror;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
shmup::cpid = i;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
drawPlayerEffects(Vs, c, true);
|
|
|
|
if(!mmmon) return true;
|
|
|
|
|
2019-03-09 14:31:02 +00:00
|
|
|
if(hide_player()) {
|
2019-05-11 17:42:30 +00:00
|
|
|
first_cell_to_draw = false;
|
2019-06-24 11:46:27 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3)
|
|
|
|
drawPlayer(moPlayer, c, Vs, col, footphase, true);
|
2019-02-26 11:25:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(isWorm(m)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ld depth = geom3::factor_to_lev(wormhead(c) == c ? cgi.AHEAD : cgi.ABODY);
|
2017-07-10 18:47:38 +00:00
|
|
|
footphase = 0;
|
|
|
|
int q = ptds.size();
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(moPlayer, c, Vs, col, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
pushdown(c, q, Vs, -depth, true, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(mmmon)
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(moPlayer, c, Vs, col, footphase, asciicol);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2019-03-30 12:17:51 +00:00
|
|
|
return false;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX cell *straightDownSeek;
|
|
|
|
EX hyperpoint straightDownPoint;
|
|
|
|
EX ld straightDownSpeed;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
#define AURA 180
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-12-01 23:23:15 +00:00
|
|
|
array<array<int,4>,AURA+1> aurac;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool haveaura() {
|
2017-11-13 00:28:56 +00:00
|
|
|
if(!(vid.aurastr>0 && !svg::in && (auraNOGL || vid.usingGL))) return false;
|
2018-03-26 17:06:47 +00:00
|
|
|
if(sphere && mdAzimuthalEqui()) return true;
|
2018-10-26 19:05:35 +00:00
|
|
|
if(among(pmodel, mdJoukowsky, mdJoukowskyInverted) && hyperbolic && conformal::model_transition < 1)
|
|
|
|
return true;
|
2017-11-13 00:28:56 +00:00
|
|
|
return pmodel == mdDisk && (!sphere || vid.alpha > 10) && !euclid;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
vector<pair<int, int> > auraspecials;
|
|
|
|
|
|
|
|
int auramemo;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void clearaura() {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!haveaura()) return;
|
|
|
|
for(int a=0; a<AURA; a++) for(int b=0; b<4; b++)
|
|
|
|
aurac[a][b] = 0;
|
2017-08-06 12:50:16 +00:00
|
|
|
auraspecials.clear();
|
|
|
|
auramemo = 128 * 128 / vid.aurastr;
|
|
|
|
}
|
|
|
|
|
2018-10-26 19:05:35 +00:00
|
|
|
void apply_joukowsky_aura(hyperpoint& h) {
|
|
|
|
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && conformal::model_transition < 1;
|
|
|
|
if(joukowsky) {
|
|
|
|
hyperpoint ret;
|
|
|
|
applymodel(h, ret);
|
|
|
|
h = ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void addauraspecial(hyperpoint h, color_t col, int dir) {
|
2017-08-06 12:50:16 +00:00
|
|
|
if(!haveaura()) return;
|
2018-10-26 19:05:35 +00:00
|
|
|
apply_joukowsky_aura(h);
|
2018-12-22 21:39:33 +00:00
|
|
|
int r = int(2*AURA + dir + atan2(h[1], h[0]) * AURA / 2 / M_PI) % AURA;
|
2017-08-06 12:50:16 +00:00
|
|
|
auraspecials.emplace_back(r, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void addaura(hyperpoint h, color_t col, int fd) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!haveaura()) return;
|
2018-10-26 19:05:35 +00:00
|
|
|
apply_joukowsky_aura(h);
|
|
|
|
|
|
|
|
int r = int(2*AURA + atan2(h[1], h[0]) * AURA / 2 / M_PI) % AURA;
|
2017-08-06 12:50:16 +00:00
|
|
|
aurac[r][3] += auramemo << fd;
|
2017-07-10 18:47:38 +00:00
|
|
|
col = darkened(col);
|
|
|
|
aurac[r][0] += (col>>16)&255;
|
|
|
|
aurac[r][1] += (col>>8)&255;
|
|
|
|
aurac[r][2] += (col>>0)&255;
|
|
|
|
}
|
|
|
|
|
|
|
|
void sumaura(int v) {
|
|
|
|
int auc[AURA];
|
|
|
|
for(int t=0; t<AURA; t++) auc[t] = aurac[t][v];
|
|
|
|
int val = 0;
|
|
|
|
if(vid.aurasmoothen < 1) vid.aurasmoothen = 1;
|
|
|
|
if(vid.aurasmoothen > AURA) vid.aurasmoothen = AURA;
|
|
|
|
int SMO = vid.aurasmoothen;
|
|
|
|
for(int t=0; t<SMO; t++) val += auc[t];
|
|
|
|
for(int t=0; t<AURA; t++) {
|
|
|
|
int tt = (t + SMO/2) % AURA;
|
|
|
|
aurac[tt][v] = val;
|
|
|
|
val -= auc[t];
|
|
|
|
val += auc[(t+SMO) % AURA];
|
|
|
|
}
|
|
|
|
aurac[AURA][v] = aurac[0][v];
|
|
|
|
}
|
2018-02-11 18:08:17 +00:00
|
|
|
|
|
|
|
vector<glhr::colored_vertex> auravertices;
|
2018-02-10 17:21:19 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawaura() {
|
|
|
|
if(!haveaura()) return;
|
2018-11-17 18:24:02 +00:00
|
|
|
if(vid.stereo_mode) return;
|
|
|
|
double rad = current_display->radius;
|
2018-03-26 17:06:47 +00:00
|
|
|
if(sphere && !mdAzimuthalEqui()) rad /= sqrt(vid.alpha*vid.alpha - 1);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
for(int v=0; v<4; v++) sumaura(v);
|
2017-08-06 12:50:16 +00:00
|
|
|
for(auto& p: auraspecials) {
|
|
|
|
int r = p.first;
|
|
|
|
aurac[r][3] = auramemo;
|
2018-12-23 13:30:09 +00:00
|
|
|
for(int k=0; k<3; k++) aurac[r][k] = (p.second >> (16-8*k)) & 255;
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_SDL || CAP_GL
|
2019-05-04 16:28:03 +00:00
|
|
|
ld bak[3];
|
2017-07-10 18:47:38 +00:00
|
|
|
bak[0] = ((backcolor>>16)&255)/255.;
|
|
|
|
bak[1] = ((backcolor>>8)&255)/255.;
|
|
|
|
bak[2] = ((backcolor>>0)&255)/255.;
|
2017-07-22 23:33:27 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_SDL
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!vid.usingGL) {
|
|
|
|
SDL_LockSurface(s);
|
|
|
|
for(int y=0; y<vid.yres; y++)
|
|
|
|
for(int x=0; x<vid.xres; x++) {
|
2017-04-04 09:13:15 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
ld hx = (x * 1. - current_display->xcenter) / rad;
|
|
|
|
ld hy = (y * 1. - current_display->ycenter) / rad / vid.stretch;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(vid.camera_angle) camrotate(hx, hy);
|
|
|
|
|
|
|
|
ld fac = sqrt(hx*hx+hy*hy);
|
|
|
|
if(fac < 1) continue;
|
|
|
|
ld dd = log((fac - .99999) / .00001);
|
|
|
|
ld cmul = 1 - dd/10.;
|
|
|
|
if(cmul>1) cmul=1;
|
|
|
|
if(cmul<0) cmul=0;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
ld alpha = AURA * atan2(hx,hy) / (2 * M_PI);
|
|
|
|
if(alpha<0) alpha += AURA;
|
|
|
|
if(alpha >= AURA) alpha -= AURA;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int rm = int(alpha);
|
2019-05-04 16:28:03 +00:00
|
|
|
ld fr = alpha-rm;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(rm<0 || rm >= AURA) continue;
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t& p = qpixel(s, x, y);
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int c=0; c<3; c++) {
|
2019-05-04 16:28:03 +00:00
|
|
|
ld c1 = aurac[rm][2-c] / (aurac[rm][3]+.1);
|
|
|
|
ld c2 = aurac[rm+1][2-c] / (aurac[rm+1][3]+.1);
|
2017-07-10 18:47:38 +00:00
|
|
|
const ld one = 1;
|
|
|
|
part(p, c) = int(255 * min(one, bak[2-c] + cmul * ((c1 + fr * (c2-c1) - bak[2-c]))));
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
SDL_UnlockSurface(s);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_GL
|
2017-07-10 18:47:38 +00:00
|
|
|
float cx[AURA+1][11][5];
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
double facs[11] = {1, 1.01, 1.02, 1.04, 1.08, 1.70, 1.95, 1.5, 2, 6, 10};
|
|
|
|
double cmul[11] = {1, .8, .7, .6, .5, .16, .12, .08, .07, .06, 0};
|
|
|
|
double d2[11] = {0, 2, 4, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10};
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int d=0; d<11; d++) {
|
|
|
|
double dd = d2[d];
|
|
|
|
cmul[d] = (1- dd/10.);
|
|
|
|
facs[d] = .99999 + .00001 * exp(dd);
|
|
|
|
}
|
|
|
|
facs[10] = 10;
|
2018-02-08 23:29:20 +00:00
|
|
|
cmul[1] = cmul[0];
|
2018-10-26 19:05:35 +00:00
|
|
|
|
|
|
|
bool inversion = vid.alpha <= -1 || pmodel == mdJoukowsky;
|
|
|
|
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && conformal::model_transition < 1;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int r=0; r<=AURA; r++) for(int z=0; z<11; z++) {
|
|
|
|
float rr = (M_PI * 2 * r) / AURA;
|
2018-10-26 19:05:35 +00:00
|
|
|
float rad0 = inversion ? rad / facs[z] : rad * facs[z];
|
2017-07-10 18:47:38 +00:00
|
|
|
int rm = r % AURA;
|
2018-10-26 19:05:35 +00:00
|
|
|
ld c = cos(rr);
|
|
|
|
ld s = sin(rr);
|
|
|
|
|
|
|
|
if(joukowsky) {
|
|
|
|
ld c1 = c, s1 = s;
|
2018-10-28 01:12:04 +00:00
|
|
|
if(inversion)
|
|
|
|
conformal::apply_orientation(s1, c1);
|
|
|
|
else
|
|
|
|
conformal::apply_orientation(c1, s1);
|
2018-10-26 19:05:35 +00:00
|
|
|
|
|
|
|
ld& mt = conformal::model_transition;
|
|
|
|
ld mt2 = 1 - mt;
|
|
|
|
|
|
|
|
ld m = sqrt(c1*c1 + s1*s1 / mt2 / mt2);
|
|
|
|
m *= 2;
|
|
|
|
if(inversion) rad0 /= m;
|
|
|
|
else rad0 *= m;
|
|
|
|
}
|
|
|
|
|
|
|
|
cx[r][z][0] = rad0 * c;
|
|
|
|
cx[r][z][1] = rad0 * s * vid.stretch;
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int u=0; u<3; u++)
|
|
|
|
cx[r][z][u+2] = bak[u] + (aurac[rm][u] / (aurac[rm][3]+.1) - bak[u]) * cmul[z];
|
|
|
|
}
|
|
|
|
|
2018-02-11 18:08:17 +00:00
|
|
|
auravertices.clear();
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int r=0; r<AURA; r++) for(int z=0;z<10;z++) {
|
2018-02-11 18:08:17 +00:00
|
|
|
for(int c=0; c<6; c++) {
|
|
|
|
int br = (c == 1 || c == 3 || c == 5) ? r+1 : r;
|
|
|
|
int bz = (c == 2 || c == 4 || c == 5) ? z+1 : z;
|
|
|
|
auravertices.emplace_back(
|
|
|
|
cx[br][bz][0], cx[br][bz][1], cx[br][bz][2], cx[br][bz][3], cx[br][bz][4]
|
|
|
|
);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2018-09-04 21:27:27 +00:00
|
|
|
glflush();
|
2019-04-29 08:52:41 +00:00
|
|
|
dynamicval<eModel> p(pmodel, DIM == 2 && pmodel == mdDisk ? mdDisk : mdUnchanged);
|
2019-04-23 13:03:17 +00:00
|
|
|
current_display->set_all(0);
|
2018-11-17 16:59:57 +00:00
|
|
|
glhr::switch_mode(glhr::gmVarColored, glhr::shader_projection::standard);
|
2018-02-20 10:30:39 +00:00
|
|
|
glhr::id_modelview();
|
2018-02-11 18:08:17 +00:00
|
|
|
glhr::prepare(auravertices);
|
2018-03-24 14:15:30 +00:00
|
|
|
glhr::set_depthtest(false);
|
2018-06-22 12:47:24 +00:00
|
|
|
glDrawArrays(GL_TRIANGLES, 0, isize(auravertices));
|
2017-07-10 18:47:38 +00:00
|
|
|
#endif
|
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// int fnt[100][7];
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool bugsNearby(cell *c, int dist = 2) {
|
|
|
|
if(!(havewhat&HF_BUG)) return false;
|
|
|
|
if(isBug(c)) return true;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(dist) for(int t=0; t<c->type; t++) if(c->move(t) && bugsNearby(c->move(t), dist-1)) return true;
|
2017-07-10 18:47:38 +00:00
|
|
|
return false;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX colortable minecolors = {
|
2017-07-10 18:47:38 +00:00
|
|
|
0xFFFFFF, 0xF0, 0xF060, 0xF00000,
|
2019-04-08 12:56:46 +00:00
|
|
|
0x60, 0x600000, 0x00C0C0, 0x000000, 0x808080, 0xFFD500
|
2017-07-10 18:47:38 +00:00
|
|
|
};
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX colortable distcolors = {
|
2017-07-10 18:47:38 +00:00
|
|
|
0xFFFFFF, 0xF0, 0xF060, 0xF00000,
|
|
|
|
0xA0A000, 0xA000A0, 0x00A0A0, 0xFFD500
|
|
|
|
};
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
const char* minetexts[8] = {
|
|
|
|
"No mines next to you.",
|
|
|
|
"A mine is next to you!",
|
|
|
|
"Two mines next to you!",
|
|
|
|
"Three mines next to you!",
|
|
|
|
"Four mines next to you!",
|
|
|
|
"Five mines next to you!",
|
|
|
|
"Six mines next to you!",
|
|
|
|
"Seven mines next to you!"
|
|
|
|
};
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int countMinesAround(cell *c) {
|
2017-07-10 18:47:38 +00:00
|
|
|
int mines = 0;
|
2019-04-08 12:58:54 +00:00
|
|
|
for(cell *c2: adj_minefield_cells(c))
|
|
|
|
if(c2->wall == waMineMine)
|
2017-07-10 18:47:38 +00:00
|
|
|
mines++;
|
|
|
|
return mines;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) {
|
2018-08-28 15:17:34 +00:00
|
|
|
if(NONSTDVAR || binarytiling) return Id;
|
2018-08-19 13:52:39 +00:00
|
|
|
transmatrix V = ddspin(c, si.dir, M_PI);
|
2018-08-20 00:03:43 +00:00
|
|
|
if(si.reflect) V = V * Mirror;
|
|
|
|
return V * iddspin(c, 0, M_PI);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-09-27 19:52:13 +00:00
|
|
|
transmatrix applyDowndir(cell *c, const cellfunction& cf) {
|
2018-08-19 13:52:39 +00:00
|
|
|
return ddspin(c, patterns::downdir(c, cf), M_PI);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-09-27 19:52:13 +00:00
|
|
|
void set_towerfloor(cell *c, const cellfunction& cf = coastvalEdge) {
|
2017-10-30 18:12:33 +00:00
|
|
|
if(weirdhyperbolic || sphere) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2018-05-07 18:13:56 +00:00
|
|
|
return;
|
2017-10-30 18:12:33 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
int j = -1;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-08-18 15:35:39 +00:00
|
|
|
if(masterless) j = 10;
|
2018-09-27 19:52:13 +00:00
|
|
|
else if(cf(c) > 1) {
|
2017-07-10 18:47:38 +00:00
|
|
|
int i = towerval(c, cf);
|
|
|
|
if(i == 4) j = 0;
|
|
|
|
if(i == 5) j = 1;
|
|
|
|
if(i == 6) j = 2;
|
|
|
|
if(i == 8) j = 3;
|
|
|
|
if(i == 9) j = 4;
|
|
|
|
if(i == 10) j = 5;
|
|
|
|
if(i == 13) j = 6;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(PURE) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(i == 7) j = 7;
|
|
|
|
if(i == 11) j = 8;
|
|
|
|
if(i == 15) j = 9;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(j >= 0)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(applyDowndir(c, cf), cgi.shTower[j]);
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->wall != waLadder)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shMFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
void set_zebrafloor(cell *c) {
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(masterless) { set_floor(cgi.shTower[10]); return; }
|
2017-10-29 09:52:02 +00:00
|
|
|
if(weirdhyperbolic) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor); return;
|
2017-10-29 09:52:02 +00:00
|
|
|
}
|
2017-05-28 22:16:17 +00:00
|
|
|
|
2018-08-28 02:05:32 +00:00
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int j;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(PURE) j = 4;
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(si.id >=4 && si.id < 16) j = 2;
|
|
|
|
else if(si.id >= 16 && si.id < 28) j = 1;
|
|
|
|
else if(si.id >= 28 && si.id < 40) j = 3;
|
2017-07-10 18:47:38 +00:00
|
|
|
else j = 0;
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(applyPatterndir(c, si), cgi.shZebra[j]);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
void set_maywarp_floor(cell *c);
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
int chasmg;
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
void set_reptile_floor(cell *c, const transmatrix& V, color_t col, bool nodetails = false) {
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-12-27 21:10:50 +00:00
|
|
|
auto si =
|
|
|
|
euclid6 ?
|
2017-12-29 12:32:29 +00:00
|
|
|
patterns::getpatterninfo(c, patterns::PAT_COLORING, patterns::SPF_CHANGEROT)
|
2017-12-27 21:10:50 +00:00
|
|
|
:
|
|
|
|
patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int j;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!wmescher) j = 4;
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(!BITRUNCATED) j = 0;
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(si.id < 4) j = 0;
|
|
|
|
else if(si.id >=4 && si.id < 16) j = 1;
|
|
|
|
else if(si.id >= 16 && si.id < 28) j = 2;
|
|
|
|
else if(si.id >= 28 && si.id < 40) j = 3;
|
2017-07-10 18:47:38 +00:00
|
|
|
else j = 4;
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2017-12-27 21:10:50 +00:00
|
|
|
if(euclid6) j = 0;
|
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
transmatrix D = applyPatterndir(c, si);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-06-03 13:37:35 +00:00
|
|
|
if(wmescher && (stdhyperbolic || euclid6))
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(D, cgi.shReptile[j][0]);
|
2018-05-07 18:13:56 +00:00
|
|
|
else set_maywarp_floor(c);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
if(nodetails) return;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int dcol = 0;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int ecol = -1;
|
|
|
|
|
|
|
|
if(isReptile(c->wall)) {
|
|
|
|
unsigned char wp = c->wparam;
|
|
|
|
if(wp == 1)
|
|
|
|
ecol = 0xFFFF00;
|
|
|
|
else if(wp <= 5)
|
|
|
|
ecol = 0xFF0000;
|
|
|
|
else
|
|
|
|
ecol = 0;
|
2018-09-10 15:49:51 +00:00
|
|
|
if(ecol) ecol = gradient(0, ecol, -1, sintick(30), 1);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(ecol == -1 || ecol == 0) dcol = darkena(col, 1, 0xFF);
|
|
|
|
else dcol = darkena(ecol, 0, 0x80);
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
dynamicval<color_t> p(poly_outline,
|
2017-07-10 18:47:38 +00:00
|
|
|
doHighlight() && ecol != -1 && ecol != 0 ? OUTLINE_ENEMY : OUTLINE_DEFAULT);
|
|
|
|
|
|
|
|
if(!chasmg) {
|
|
|
|
if(wmescher)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V*D, cgi.shReptile[j][1], dcol);
|
2017-07-10 18:47:38 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V, cgi.shMFloor, dcol);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(ecol != -1) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V*D, cgi.shReptile[j][2], (ecol << 8) + 0xFF);
|
|
|
|
queuepoly(V*D, cgi.shReptile[j][3], (ecol << 8) + 0xFF);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
void draw_reptile(cell *c, const transmatrix &V, color_t col) {
|
2018-05-07 18:13:56 +00:00
|
|
|
auto qfib = qfi;
|
|
|
|
set_reptile_floor(c, V, col, chasmg == 2);
|
|
|
|
draw_qfi(c, V, col);
|
|
|
|
qfi = qfib;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_emeraldfloor(cell *c) {
|
2019-05-10 00:46:16 +00:00
|
|
|
if(!masterless && BITRUNCATED && GDIM == 2) {
|
2018-08-28 02:05:32 +00:00
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_EMERALD, patterns::SPF_SYM0123);
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
int j = -1;
|
|
|
|
|
|
|
|
if(si.id == 8) j = 0;
|
|
|
|
else if(si.id == 12) j = 1;
|
|
|
|
else if(si.id == 16) j = 2;
|
|
|
|
else if(si.id == 20) j = 3;
|
|
|
|
else if(si.id == 28) j = 4;
|
|
|
|
else if(si.id == 36) j = 5;
|
|
|
|
|
|
|
|
if(j >= 0) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(applyPatterndir(c, si), cgi.shEmeraldFloor[j]);
|
2017-12-09 07:06:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shCaveFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void viewBuggyCells(cell *c, transmatrix V) {
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(buggycells); i++)
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c == buggycells[i]) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shPirateX, 0xC000C080);
|
2017-07-10 18:47:38 +00:00
|
|
|
return;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(buggycells); i++) {
|
2017-07-10 18:47:38 +00:00
|
|
|
cell *c1 = buggycells[i];
|
2018-08-17 22:46:45 +00:00
|
|
|
cell *cf = cwt.at;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
while(cf != c1) {
|
|
|
|
cf = pathTowards(cf, c1);
|
|
|
|
if(cf == c) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shMineMark[1], 0xC000C0D0);
|
2017-07-10 18:47:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawMovementArrows(cell *c, transmatrix V) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(viewdists) return;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int d=0; d<8; d++) {
|
|
|
|
|
|
|
|
movedir md = vectodir(spin(-d * M_PI/4) * tC0(pushone()));
|
|
|
|
int u = md.d;
|
2018-03-24 11:59:01 +00:00
|
|
|
cellwalker xc = cwt + u + wstep;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(xc.at == c) {
|
2018-07-23 14:07:27 +00:00
|
|
|
transmatrix fixrot = sphereflip * rgpushxto0(sphereflip * tC0(V));
|
2017-07-10 18:47:38 +00:00
|
|
|
// make it more transparent
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = getcs().uicolor;
|
2017-07-10 18:47:38 +00:00
|
|
|
col -= (col & 0xFF) >> 1;
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(fixrot * spin(-d * M_PI/4), cgi.shArrow, col);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-12-16 23:04:59 +00:00
|
|
|
if((c->type & 1) && (isStunnable(c->monst) || isPushable(c->wall))) {
|
2017-07-10 18:47:38 +00:00
|
|
|
transmatrix Centered = rgpushxto0(tC0(cwtV));
|
|
|
|
int sd = md.subdir;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(inverse(Centered) * rgpushxto0(Centered * tC0(V)) * rspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2), cgi.shArrow, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-06-17 15:51:26 +00:00
|
|
|
else if(!confusingGeometry()) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int celldistAltPlus(cell *c) { return 1000000 + celldistAlt(c); }
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool drawstaratvec(double dx, double dy) {
|
|
|
|
return dx*dx+dy*dy > .05;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int reptilecolor(cell *c) {
|
2018-08-30 14:08:05 +00:00
|
|
|
int i;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-08-30 14:08:05 +00:00
|
|
|
if(archimedean)
|
|
|
|
i = c->master->rval0 & 3;
|
|
|
|
else {
|
2018-08-31 02:18:58 +00:00
|
|
|
i = zebra40(c);
|
2018-08-30 14:08:05 +00:00
|
|
|
|
|
|
|
if(!masterless) {
|
|
|
|
if(i >= 4 && i < 16) i = 0;
|
|
|
|
else if(i >= 16 && i < 28) i = 1;
|
|
|
|
else if(i >= 28 && i < 40) i = 2;
|
|
|
|
else i = 3;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t fcoltab[4] = {0xe3bb97, 0xc2d1b0, 0xebe5cb, 0xA0A0A0};
|
2017-07-10 18:47:38 +00:00
|
|
|
return fcoltab[i];
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
ld wavefun(ld x) {
|
|
|
|
return sin(x);
|
|
|
|
/* x /= (2*M_PI);
|
|
|
|
x -= (int) x;
|
|
|
|
if(x > .5) return (x-.5) * 2;
|
|
|
|
else return 0; */
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-11-08 15:21:33 +00:00
|
|
|
colortable nestcolors = { 0x800000, 0x008000, 0x000080, 0x404040, 0x700070, 0x007070, 0x707000, 0x606060 };
|
2017-12-05 18:43:45 +00:00
|
|
|
|
2018-11-08 20:56:06 +00:00
|
|
|
color_t floorcolors[landtypes];
|
|
|
|
|
|
|
|
void init_floorcolors() {
|
|
|
|
for(int i=0; i<landtypes; i++)
|
|
|
|
floorcolors[i] = linf[i].color;
|
|
|
|
|
|
|
|
floorcolors[laDesert] = 0xEDC9AF;
|
|
|
|
floorcolors[laKraken] = 0x20A020;
|
|
|
|
floorcolors[laDocks] = 0x202020;
|
|
|
|
floorcolors[laCA] = 0x404040;
|
|
|
|
floorcolors[laMotion] = 0xF0F000;
|
|
|
|
floorcolors[laGraveyard] = 0x107010;
|
|
|
|
floorcolors[laWineyard] = 0x006000;
|
|
|
|
floorcolors[laLivefjord] = 0x306030;
|
|
|
|
|
|
|
|
floorcolors[laMinefield] = 0x80A080;
|
|
|
|
floorcolors[laCaribbean] = 0x006000;
|
|
|
|
|
|
|
|
floorcolors[laAlchemist] = 0x202020;
|
|
|
|
|
|
|
|
floorcolors[laRlyeh] = 0x004080;
|
|
|
|
floorcolors[laHell] = 0xC00000;
|
|
|
|
floorcolors[laCrossroads] = 0xFF0000;
|
|
|
|
floorcolors[laJungle] = 0x008000;
|
|
|
|
|
|
|
|
floorcolors[laZebra] = 0xE0E0E0;
|
|
|
|
|
|
|
|
floorcolors[laCaves] = 0x202020;
|
|
|
|
floorcolors[laEmerald] = 0x202020;
|
|
|
|
floorcolors[laDeadCaves] = 0x202020;
|
|
|
|
|
|
|
|
floorcolors[laPalace] = 0x806020;
|
|
|
|
|
|
|
|
floorcolors[laHunting] = 0x40E0D0 / 2;
|
|
|
|
|
|
|
|
floorcolors[laBlizzard] = 0x5050C0;
|
|
|
|
floorcolors[laCocytus] = 0x80C0FF;
|
|
|
|
floorcolors[laIce] = 0x8080FF;
|
|
|
|
floorcolors[laCamelot] = 0xA0A0A0;
|
|
|
|
|
|
|
|
floorcolors[laOvergrown] = 0x00C020;
|
|
|
|
floorcolors[laClearing] = 0x60E080;
|
|
|
|
floorcolors[laHaunted] = 0x609F60;
|
|
|
|
|
|
|
|
floorcolors[laMirror] = floorcolors[laMirrorWall] = floorcolors[laMirrorOld] = 0x808080;
|
|
|
|
}
|
|
|
|
|
2019-03-09 22:55:03 +00:00
|
|
|
color_t magma_color(int id) {
|
|
|
|
if(id == 95/4-1) return 0x200000;
|
|
|
|
else if(id == 95/4) return 0x100000;
|
|
|
|
else if(id < 48/4) return gradient(0xF0F000, 0xF00000, 0, id, 48/4);
|
|
|
|
else if(id < 96/4) return gradient(0xF00000, 0x400000, 48/4, id, 95/4-2);
|
|
|
|
else return winf[waMagma].color;
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
void setcolors(cell *c, color_t& wcol, color_t& fcol) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
wcol = fcol = winf[c->wall].color;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-12-11 17:59:35 +00:00
|
|
|
if(c->wall == waMineMine)
|
|
|
|
wcol = fcol = winf[waMineUnknown].color;
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
// water colors
|
|
|
|
if(isWateryOrBoat(c) || c->wall == waReptileBridge) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->land == laOcean)
|
2019-02-17 17:33:15 +00:00
|
|
|
fcol =
|
|
|
|
#if CAP_FIELD
|
|
|
|
(c->landparam > 25 && !chaosmode) ? (
|
|
|
|
0x90 + 8 * sintick(1000, windmap::windcodes[windmap::getId(c)] / 256.)
|
|
|
|
) :
|
|
|
|
#endif
|
2018-09-10 15:49:51 +00:00
|
|
|
0x1010C0 + int(32 * sintick(500, (chaosmode ? c->CHAOSPARAM : c->landparam)*.75/M_PI));
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->land == laOceanWall)
|
|
|
|
fcol = 0x2020FF;
|
2019-01-11 01:25:54 +00:00
|
|
|
else if(c->land == laVariant)
|
|
|
|
fcol = 0x002090 + 15 * sintick(300, 0);
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->land == laKraken) {
|
|
|
|
fcol = 0x0000A0;
|
2018-05-04 10:49:50 +00:00
|
|
|
int mafcol = (kraken_pseudohept(c) ? 64 : 8);
|
2017-07-10 18:47:38 +00:00
|
|
|
/* bool nearshore = false;
|
|
|
|
for(int i=0; i<c->type; i++)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c->move(i)->wall != waSea && c->move(i)->wall != waBoat)
|
2017-07-10 18:47:38 +00:00
|
|
|
nearshore = true;
|
|
|
|
if(nearshore) mafcol += 30; */
|
2018-09-10 15:49:51 +00:00
|
|
|
fcol = fcol + mafcol * (4+sintick(500, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*.75/M_PI))/5;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-12-29 00:10:47 +00:00
|
|
|
else if(c->land == laDocks) {
|
|
|
|
fcol = 0x0000A0;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->land == laAlchemist)
|
|
|
|
fcol = 0x900090;
|
|
|
|
else if(c->land == laWhirlpool)
|
2018-09-10 15:49:51 +00:00
|
|
|
fcol = 0x0000C0 + int(32 * sintick(200, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*.75/M_PI));
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->land == laLivefjord)
|
|
|
|
fcol = 0x000080;
|
2019-04-16 22:42:51 +00:00
|
|
|
else if(isWarpedType(c->land))
|
2018-09-10 15:49:51 +00:00
|
|
|
fcol = 0x0000C0 + int((warptype(c)?30:-30) * sintick(600));
|
2017-07-10 18:47:38 +00:00
|
|
|
else
|
|
|
|
fcol = wcol;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
// floor colors for all the lands
|
|
|
|
else switch(c->land) {
|
|
|
|
case laBurial: case laTrollheim: case laBarrier: case laOceanWall:
|
|
|
|
case laCrossroads2: case laCrossroads3: case laCrossroads4: case laCrossroads5:
|
|
|
|
case laRose: case laPower: case laWildWest: case laHalloween: case laRedRock:
|
2017-10-30 08:05:16 +00:00
|
|
|
case laDragon: case laStorms: case laTerracotta: case laMercuryRiver:
|
2018-11-08 20:56:06 +00:00
|
|
|
case laDesert: case laKraken: case laDocks: case laCA:
|
|
|
|
case laMotion: case laGraveyard: case laWineyard: case laLivefjord:
|
|
|
|
case laRlyeh: case laHell: case laCrossroads: case laJungle:
|
|
|
|
case laAlchemist:
|
|
|
|
fcol = floorcolors[c->land]; break;
|
2017-10-30 08:05:16 +00:00
|
|
|
|
2019-02-17 17:37:23 +00:00
|
|
|
#if CAP_COMPLEX2
|
2018-12-16 23:04:59 +00:00
|
|
|
case laVariant: {
|
|
|
|
int b = getBits(c);
|
|
|
|
fcol = 0x404040;
|
|
|
|
for(int a=0; a<21; a++)
|
|
|
|
if((b >> a) & 1)
|
|
|
|
fcol += variant_features[a].color_change;
|
|
|
|
if(c->wall == waAncientGrave)
|
|
|
|
wcol = 0x080808;
|
|
|
|
else if(c->wall == waFreshGrave)
|
|
|
|
wcol = 0x202020;
|
|
|
|
break;
|
|
|
|
}
|
2019-02-17 17:37:23 +00:00
|
|
|
#endif
|
2018-12-16 23:04:59 +00:00
|
|
|
|
2018-01-03 20:51:11 +00:00
|
|
|
case laRuins:
|
2018-01-04 17:26:38 +00:00
|
|
|
fcol = pseudohept(c) ? 0xC0E0C0 : 0x40A040;
|
2018-01-03 20:49:14 +00:00
|
|
|
break;
|
|
|
|
|
2017-10-30 08:05:16 +00:00
|
|
|
case laDual:
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-10-30 08:05:16 +00:00
|
|
|
if(c->landparam == 2) fcol = 0x40FF00;
|
|
|
|
if(c->landparam == 3) fcol = 0xC0FF00;
|
|
|
|
break;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2018-11-11 15:40:22 +00:00
|
|
|
#if CAP_COMPLEX2
|
2018-11-08 20:56:06 +00:00
|
|
|
case laBrownian: {
|
|
|
|
using brownian::level;
|
|
|
|
fcol = wcol =
|
2018-12-25 11:49:54 +00:00
|
|
|
/*
|
2018-11-08 20:56:06 +00:00
|
|
|
c->landparam == 0 ? 0x0000F0 :
|
|
|
|
c->landparam < level ? gradient(0x002000, 0xFFFFFF, 1, c->landparam, level-1) :
|
|
|
|
c->landparam < 2 * level ? 0xFFFF80 :
|
|
|
|
c->landparam < 3 * level ? 0xFF8000 :
|
2018-12-25 11:49:54 +00:00
|
|
|
0xC00000; */
|
|
|
|
|
|
|
|
c->landparam == 0 ? 0x0000F0 : brownian::get_color(c->landparam);
|
2018-05-04 00:43:25 +00:00
|
|
|
break;
|
2018-10-25 00:43:14 +00:00
|
|
|
}
|
2018-11-11 15:40:22 +00:00
|
|
|
#endif
|
2018-05-04 00:43:25 +00:00
|
|
|
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2017-10-08 09:12:03 +00:00
|
|
|
case laVolcano: {
|
2017-10-11 20:16:07 +00:00
|
|
|
int id = lavatide(c, -1)/4;
|
2019-03-09 22:55:03 +00:00
|
|
|
if(c->wall == waMagma)
|
|
|
|
fcol = wcol = magma_color(id);
|
2017-10-14 23:16:01 +00:00
|
|
|
else if(c->wall == waNone) {
|
2017-10-08 09:12:03 +00:00
|
|
|
fcol = wcol = 0x404040;
|
|
|
|
if(id == 255/4) fcol = 0xA0A040;
|
|
|
|
if(id == 255/4-1) fcol = 0x606040;
|
|
|
|
}
|
|
|
|
/* {
|
|
|
|
if(id/4 == 255/4) fd = 0;
|
|
|
|
if(id/4 == 95/4-1 || id/4 == 255/4-1) fd = 1;
|
|
|
|
} */
|
|
|
|
break;
|
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
case laMinefield:
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waMineMine && ((cmode & sm::MAP) || !canmove))
|
|
|
|
fcol = wcol = 0xFF4040;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laCaribbean:
|
|
|
|
if(c->wall != waCIsland && c->wall != waCIsland2)
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laReptile:
|
|
|
|
fcol = reptilecolor(c);
|
|
|
|
break;
|
2018-11-08 20:56:06 +00:00
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
case laCaves: case laEmerald: case laDeadCaves:
|
|
|
|
fcol = 0x202020;
|
|
|
|
if(c->land == laEmerald)
|
|
|
|
if(c->wall == waCavefloor || c->wall == waCavewall) {
|
|
|
|
fcol = wcol = gradient(winf[waCavefloor].color, 0xFF00, 0, 0.5, 1);
|
|
|
|
if(c->wall == waCavewall) wcol = 0xC0FFC0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case laMirror: case laMirrorWall: case laMirrorOld:
|
2018-11-08 20:56:06 +00:00
|
|
|
if(c->land == laMirrorWall) fcol = floorcolors[laMirror];
|
|
|
|
else fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
break;
|
|
|
|
case laDryForest:
|
|
|
|
fcol = gradient(0x008000, 0x800000, 0, c->landparam, 10);
|
|
|
|
break;
|
|
|
|
case laMountain:
|
2018-08-17 11:29:00 +00:00
|
|
|
if(eubinary || sphere || c->master->alt)
|
2017-08-06 12:50:16 +00:00
|
|
|
fcol = celldistAlt(c) & 1 ? 0x604020 : 0x302010;
|
|
|
|
else fcol = 0;
|
|
|
|
if(c->wall == waPlatform) wcol = 0xF0F0A0;
|
|
|
|
break;
|
|
|
|
case laCanvas:
|
|
|
|
fcol = c->landparam;
|
2019-02-26 13:56:07 +00:00
|
|
|
if(c->wall == waWaxWall) wcol = c->landparam;
|
2017-08-06 12:50:16 +00:00
|
|
|
break;
|
|
|
|
case laPalace:
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waClosedGate || c->wall == waOpenGate)
|
|
|
|
fcol = wcol;
|
|
|
|
break;
|
|
|
|
case laElementalWall:
|
|
|
|
fcol = (linf[c->barleft].color>>1) + (linf[c->barright].color>>1);
|
|
|
|
break;
|
|
|
|
case laZebra:
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waTrapdoor) fcol = 0x808080;
|
|
|
|
break;
|
|
|
|
case laHive:
|
|
|
|
fcol = linf[c->land].color;
|
|
|
|
if(c->wall == waWaxWall) wcol = c->landparam;
|
|
|
|
if(items[itOrbInvis] && c->wall == waNone && c->landparam)
|
|
|
|
fcol = gradient(fcol, 0xFF0000, 0, c->landparam, 100);
|
|
|
|
if(c->bardir == NOBARRIERS && c->barleft)
|
|
|
|
fcol = minf[moBug0+c->barright].color;
|
|
|
|
break;
|
2017-12-30 14:12:15 +00:00
|
|
|
case laSwitch:
|
|
|
|
fcol = minf[passive_switch].color;
|
|
|
|
break;
|
2017-08-06 12:50:16 +00:00
|
|
|
case laTortoise:
|
|
|
|
fcol = tortoise::getMatchColor(getBits(c));
|
|
|
|
if(c->wall == waBigTree) wcol = 0x709000;
|
|
|
|
else if(c->wall == waSmallTree) wcol = 0x905000;
|
|
|
|
break;
|
|
|
|
case laOvergrown: case laClearing:
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waSmallTree) wcol = 0x008060;
|
|
|
|
else if(c->wall == waBigTree) wcol = 0x0080C0;
|
|
|
|
break;
|
|
|
|
case laTemple: {
|
2018-08-09 17:28:53 +00:00
|
|
|
int d = showoff ? 0 : (eubinary||c->master->alt) ? celldistAlt(c) : 99;
|
2017-08-06 12:50:16 +00:00
|
|
|
if(chaosmode)
|
|
|
|
fcol = 0x405090;
|
|
|
|
else if(d % TEMPLE_EACH == 0)
|
|
|
|
fcol = gradient(0x304080, winf[waColumn].color, 0, 0.5, 1);
|
|
|
|
// else if(c->type == 7)
|
|
|
|
// wcol = 0x707070;
|
|
|
|
else if(d% 2 == -1)
|
|
|
|
fcol = 0x304080;
|
|
|
|
else
|
|
|
|
fcol = 0x405090;
|
|
|
|
break;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
case laWhirlwind:
|
|
|
|
if(c->land == laWhirlwind) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t wcol[4] = {0x404040, 0x404080, 0x2050A0, 0x5050C0};
|
2017-08-06 12:50:16 +00:00
|
|
|
fcol = wcol[whirlwind::fzebra3(c)];
|
|
|
|
}
|
|
|
|
break;
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2017-10-10 12:24:39 +00:00
|
|
|
case laHunting:
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-09-30 09:46:41 +00:00
|
|
|
if(pseudohept(c)) fcol = fcol * 3/4;
|
|
|
|
break;
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
case laIvoryTower:
|
|
|
|
fcol = 0x10101 * (32 + (c->landparam&1) * 32) - 0x000010;
|
|
|
|
break;
|
|
|
|
|
2018-12-21 13:41:23 +00:00
|
|
|
case laWestWall:
|
2018-12-25 18:25:09 +00:00
|
|
|
fcol = 0x10101 * ((c->landparam&1) * 32) + floorcolors[c->land];
|
2018-12-21 13:41:23 +00:00
|
|
|
break;
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
case laDungeon: {
|
|
|
|
int lp = c->landparam % 5;
|
|
|
|
// xcol = (c->landparam&1) ? 0xD00000 : 0x00D000;
|
|
|
|
int lps[5] = { 0x402000, 0x302000, 0x202000, 0x282000, 0x382000 };
|
|
|
|
fcol = lps[lp];
|
|
|
|
if(c->wall == waClosedGate)
|
|
|
|
fcol = wcol = 0xC0C0C0;
|
|
|
|
if(c->wall == waOpenGate)
|
|
|
|
fcol = wcol = 0x404040;
|
|
|
|
if(c->wall == waPlatform)
|
|
|
|
fcol = wcol = 0xDFB520;
|
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
case laEndorian: {
|
2018-04-11 16:01:39 +00:00
|
|
|
int clev = pd_from->land == laEndorian ? edgeDepth(pd_from) : 0;
|
2017-08-06 12:50:16 +00:00
|
|
|
// xcol = (c->landparam&1) ? 0xD00000 : 0x00D000;
|
|
|
|
fcol = 0x10101 * (32 + (c->landparam&1) * 32) - 0x000010;
|
2018-04-04 15:59:59 +00:00
|
|
|
int ed = edgeDepth(c);
|
2018-04-11 11:16:40 +00:00
|
|
|
int sr = get_sightrange_ambush();
|
2018-04-11 16:01:39 +00:00
|
|
|
|
|
|
|
if(clev == UNKNOWN || ed == UNKNOWN)
|
|
|
|
fcol = 0x0000D0;
|
|
|
|
else {
|
|
|
|
while(ed > clev + sr) ed -= 2;
|
|
|
|
while(ed < clev - sr) ed += 2;
|
2019-05-05 15:36:36 +00:00
|
|
|
fcol = gradient(fcol, 0x0000D0, clev-sr, ed, clev+sr);
|
2018-04-11 16:01:39 +00:00
|
|
|
}
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waTrunk) fcol = winf[waTrunk].color;
|
|
|
|
|
|
|
|
if(c->wall == waCanopy || c->wall == waSolidBranch || c->wall == waWeakBranch) {
|
|
|
|
fcol = winf[waCanopy].color;
|
|
|
|
if(c->landparam & 1) fcol = gradient(0, fcol, 0, .75, 1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2017-08-06 12:50:16 +00:00
|
|
|
case laPrairie:
|
|
|
|
if(prairie::isriver(c)) {
|
|
|
|
fcol = ((c->LHU.fi.rval & 1) ? 0x402000: 0x503000);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fcol = 0x004000 + 0x001000 * c->LHU.fi.walldist;
|
|
|
|
fcol += 0x10000 * (255 - 511 / (1 + max((int) c->LHU.fi.flowerdist, 1)));
|
|
|
|
// fcol += 0x1 * (511 / (1 + max((int) c->LHU.fi.walldist2, 1)));
|
|
|
|
}
|
|
|
|
break;
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
case laCamelot: {
|
2018-08-17 11:29:00 +00:00
|
|
|
int d = showoff ? 0 : ((eubinary||c->master->alt) ? celldistAltRelative(c) : 0);
|
2017-08-06 12:50:16 +00:00
|
|
|
#if CAP_TOUR
|
|
|
|
if(!tour::on) camelotcheat = false;
|
|
|
|
if(camelotcheat)
|
|
|
|
fcol = (d&1) ? 0xC0C0C0 : 0x606060;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if(d < 0) {
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[c->land];
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// a nice floor pattern
|
|
|
|
int v = emeraldval(c);
|
|
|
|
int v0 = (v&~3);
|
|
|
|
bool sw = (v&1);
|
|
|
|
if(v0 == 8 || v0 == 12 || v0 == 20 || v0 == 40 || v0 == 36 || v0 == 24)
|
|
|
|
sw = !sw;
|
|
|
|
if(sw)
|
|
|
|
fcol = 0xC0C0C0;
|
|
|
|
else
|
|
|
|
fcol = 0xA0A0A0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-09-30 09:46:41 +00:00
|
|
|
case laIce: case laCocytus: case laBlizzard:
|
2019-03-23 15:26:53 +00:00
|
|
|
if(useHeatColoring(c)) {
|
2017-08-06 12:50:16 +00:00
|
|
|
float h = HEAT(c);
|
2018-11-08 20:56:06 +00:00
|
|
|
eLand l = c->land;
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2018-11-08 20:56:06 +00:00
|
|
|
color_t colorN04 = l == laCocytus ? 0x4080FF : 0x4040FF;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t colorN10 = 0x0000FF;
|
2018-11-08 20:56:06 +00:00
|
|
|
color_t color0 = floorcolors[c->land];
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t color02 = 0xFFFFFF;
|
|
|
|
color_t color06 = 0xFF0000;
|
|
|
|
color_t color08 = 0xFFFF00;
|
2017-09-30 09:46:41 +00:00
|
|
|
|
|
|
|
if(h < -1)
|
|
|
|
wcol = colorN10;
|
|
|
|
else if(h < -0.4)
|
|
|
|
wcol = gradient(colorN04, colorN10 , -0.4, h, -1);
|
2017-08-06 12:50:16 +00:00
|
|
|
else if(h < 0)
|
2017-09-30 09:46:41 +00:00
|
|
|
wcol = gradient(color0, colorN04, 0, h, -0.4);
|
2017-08-06 12:50:16 +00:00
|
|
|
else if(h < 0.2)
|
2017-09-30 09:46:41 +00:00
|
|
|
wcol = gradient(color0, color02, 0, h, 0.2);
|
2017-08-06 12:50:16 +00:00
|
|
|
// else if(h < 0.4)
|
|
|
|
// wcol = gradient(0xFFFFFF, 0xFFFF00, 0.2, h, 0.4);
|
|
|
|
else if(h < 0.6)
|
2017-09-30 09:46:41 +00:00
|
|
|
wcol = gradient(color02, color06, 0.2, h, 0.6);
|
2017-08-06 12:50:16 +00:00
|
|
|
else if(h < 0.8)
|
2017-09-30 09:46:41 +00:00
|
|
|
wcol = gradient(color06, color08, 0.6, h, 0.8);
|
2017-08-06 12:50:16 +00:00
|
|
|
else
|
2017-09-30 09:46:41 +00:00
|
|
|
wcol = color08;
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waFrozenLake)
|
|
|
|
fcol = wcol;
|
|
|
|
else
|
|
|
|
fcol = (wcol & 0xFEFEFE) >> 1;
|
|
|
|
if(c->wall == waLake)
|
|
|
|
fcol = wcol = (wcol & 0xFCFCFC) >> 2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laOcean:
|
|
|
|
if(chaosmode)
|
|
|
|
fcol = gradient(0xD0A090, 0xD0D020, 0, c->CHAOSPARAM, 30);
|
|
|
|
else
|
|
|
|
fcol = gradient(0xD0D090, 0xD0D020, -1, sin((double) c->landparam), 1);
|
|
|
|
break;
|
2017-12-05 18:43:45 +00:00
|
|
|
|
|
|
|
case laSnakeNest: {
|
|
|
|
int fv = pattern_threecolor(c);
|
|
|
|
fcol = nestcolors[fv&7];
|
|
|
|
if(realred(c->wall))
|
|
|
|
wcol = fcol * (4 + snakelevel(c)) / 4;
|
|
|
|
break;
|
|
|
|
}
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
if(isElemental(c->land)) fcol = linf[c->land].color;
|
2019-04-16 22:42:51 +00:00
|
|
|
if(isWarpedType(c->land)) {
|
2017-12-18 20:15:03 +00:00
|
|
|
fcol = warptype(c) ? 0x80C080 : 0xA06020;
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->wall == waSmallTree) wcol = 0x608000;
|
|
|
|
}
|
|
|
|
if(isHaunted(c->land)) {
|
|
|
|
int itcolor = 0;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i) && c->move(i)->item)
|
2017-08-06 12:50:16 +00:00
|
|
|
itcolor = 1;
|
|
|
|
if(c->item) itcolor |= 2;
|
2018-11-08 20:56:06 +00:00
|
|
|
fcol = floorcolors[laHaunted] + 0x202020 * itcolor;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
forCellEx(c2, c) if(c2->monst == moFriendlyGhost)
|
2018-09-10 15:49:51 +00:00
|
|
|
fcol = gradient(fcol, fghostcolor(c2), 0, .25, 1);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
if(c->monst == moFriendlyGhost)
|
2018-09-10 15:49:51 +00:00
|
|
|
fcol = gradient(fcol, fghostcolor(c), 0, .5, 1);
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
if(c->wall == waSmallTree) wcol = 0x004000;
|
|
|
|
else if(c->wall == waBigTree) wcol = 0x008000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if(c->land == laCaribbean && (c->wall == waCIsland || c->wall == waCIsland2))
|
|
|
|
fcol = wcol = winf[c->wall].color; */
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
switch(c->wall) {
|
|
|
|
case waSulphur: case waSulphurC: case waPlatform: case waMercury: case waDock:
|
|
|
|
case waAncientGrave: case waFreshGrave: case waThumperOn: case waThumperOff: case waBonfireOff:
|
2018-12-16 23:04:59 +00:00
|
|
|
case waRoundTable: case waExplosiveBarrel:
|
2018-02-05 00:17:11 +00:00
|
|
|
// floors become fcol
|
|
|
|
fcol = wcol;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waDeadTroll2: case waPetrifiedBridge: case waPetrified: {
|
|
|
|
eMonster m = eMonster(c->wparam);
|
|
|
|
if(c->wall == waPetrified || c->wall == waPetrifiedBridge)
|
|
|
|
wcol = gradient(wcol, minf[m].color, 0, .2, 1);
|
|
|
|
if(c->wall == waPetrified || isTroll(m)) if(!(m == moForestTroll && c->land == laOvergrown))
|
|
|
|
wcol = gradient(wcol, minf[m].color, 0, .4, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waFloorA: case waFloorB: // isAlch
|
2018-06-28 10:59:35 +00:00
|
|
|
if(c->item && !(conformal::includeHistory && conformal::infindhistory.count(c)))
|
2018-02-05 00:17:11 +00:00
|
|
|
fcol = wcol = iinf[c->item].color;
|
|
|
|
else
|
|
|
|
fcol = wcol;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waBoat:
|
|
|
|
if(wmascii) wcol = 0xC06000;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waEternalFire:
|
|
|
|
fcol = wcol = weakfirecolor(1500);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waFire: case waPartialFire: case waBurningDock:
|
|
|
|
fcol = wcol = firecolor(100);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waDeadfloor: case waCavefloor:
|
|
|
|
fcol = wcol;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waNone:
|
|
|
|
if(c->land == laNone)
|
|
|
|
wcol = fcol = 0x101010;
|
|
|
|
if(c->land == laHive)
|
|
|
|
wcol = fcol;
|
|
|
|
break;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waMineUnknown: case waMineMine:
|
|
|
|
if(mineMarkedSafe(c))
|
|
|
|
fcol = wcol = gradient(wcol, 0x40FF40, 0, 0.2, 1);
|
|
|
|
else if(mineMarked(c))
|
2018-09-10 15:49:51 +00:00
|
|
|
fcol = wcol = gradient(wcol, 0xFF4040, -1, sintick(100), 1);
|
2018-02-05 00:17:11 +00:00
|
|
|
// fallthrough
|
|
|
|
|
|
|
|
case waMineOpen:
|
2017-08-18 00:07:56 +00:00
|
|
|
fcol = wcol;
|
2018-02-05 00:17:11 +00:00
|
|
|
if(wmblack || wmascii) fcol >>= 1, wcol >>= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waCavewall:
|
|
|
|
if(c->land != laEmerald) fcol = winf[waCavefloor].color;
|
|
|
|
break;
|
2019-02-28 16:06:53 +00:00
|
|
|
|
|
|
|
case waEditStatue:
|
|
|
|
if(c->land == laCanvas) wcol = c->landparam;
|
|
|
|
else wcol = (0x125628 * c->wparam) & 0xFFFFFF;
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2017-08-18 00:07:56 +00:00
|
|
|
}
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2017-10-08 09:12:03 +00:00
|
|
|
/* if(false && isAlch2(c, true)) {
|
2017-10-11 20:16:07 +00:00
|
|
|
int id = lavatide(c, -1);
|
2017-09-30 09:46:41 +00:00
|
|
|
if(id < 96)
|
|
|
|
wcol = gradient(0x800000, 0xFF0000, 0, id, 96);
|
|
|
|
else
|
|
|
|
wcol = gradient(0x00FF00, 0xFFFF00, 96, id, 255);
|
|
|
|
fcol = wcol;
|
2017-10-08 09:12:03 +00:00
|
|
|
} */
|
2017-08-18 00:07:56 +00:00
|
|
|
|
2019-05-20 16:57:48 +00:00
|
|
|
if(WDIM == 2) {
|
2019-03-02 00:52:31 +00:00
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd == 1)
|
|
|
|
wcol = gradient(0x804060, wcol, 0,1,3),
|
|
|
|
fcol = gradient(0x804060, fcol, 0,1,3);
|
|
|
|
if(rd == 2)
|
|
|
|
wcol = gradient(0x804060, wcol, 0,2,3),
|
|
|
|
fcol = gradient(0x804060, fcol, 0,2,3);
|
|
|
|
}
|
2017-04-08 15:18:29 +00:00
|
|
|
|
2018-06-29 11:14:49 +00:00
|
|
|
if(items[itRevolver] && !shmup::on) {
|
|
|
|
bool inrange = c->mpdist <= GUNRANGE;
|
|
|
|
if(inrange) {
|
|
|
|
inrange = false;
|
|
|
|
for(int i=0; i<numplayers(); i++) for(cell *c1: gun_targets(playerpos(i))) if(c1 == c) inrange = true;
|
|
|
|
}
|
|
|
|
if(!inrange)
|
|
|
|
fcol = gradient(fcol, 0, 0, 25, 100),
|
|
|
|
wcol = gradient(wcol, 0, 0, 25, 100);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(highwall(c) && !wmspatial)
|
|
|
|
fcol = wcol;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(wmascii && (c->wall == waNone || isWatery(c))) wcol = fcol;
|
|
|
|
|
|
|
|
if(!wmspatial && snakelevel(c) && !realred(c->wall)) fcol = wcol;
|
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
if(c->wall == waGlass && !wmspatial) fcol = wcol;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool noAdjacentChasms(cell *c) {
|
|
|
|
forCellEx(c2, c) if(c2->wall == waChasm) return false;
|
|
|
|
return true;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 10:46:40 +00:00
|
|
|
// does the current geometry allow nice duals
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool has_nice_dual() {
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
if(IRREGULAR) return irr::bitruncations_performed > 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_ARCM
|
2018-08-20 15:26:29 +00:00
|
|
|
if(archimedean) return geosupport_football() >= 2;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-20 15:26:29 +00:00
|
|
|
if(binarytiling) return false;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(BITRUNCATED) return true;
|
2018-07-10 19:55:54 +00:00
|
|
|
if(a4) return false;
|
2018-08-28 15:17:34 +00:00
|
|
|
if((S7 & 1) == 0) return true;
|
|
|
|
if(PURE) return false;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-04-09 15:40:12 +00:00
|
|
|
return (gp::param.first + gp::param.second * 2) % 3 == 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2018-04-04 10:46:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// does the current geometry allow nice duals
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool is_nice_dual(cell *c) {
|
2018-04-04 10:46:40 +00:00
|
|
|
return c->land == laDual && has_nice_dual();
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool use_swapped_duals() {
|
2018-08-28 15:17:34 +00:00
|
|
|
return (masterless && !a4) || GOLDBERG;
|
2018-04-04 10:46:40 +00:00
|
|
|
}
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-09-04 17:53:42 +00:00
|
|
|
void floorShadow(cell *c, const transmatrix& V, color_t col) {
|
2019-02-22 20:27:42 +00:00
|
|
|
if(model_needs_depth() || noshadow)
|
2017-07-10 18:47:38 +00:00
|
|
|
return; // shadows break the depth testing
|
2018-09-04 17:53:42 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
2018-05-07 18:13:56 +00:00
|
|
|
if(qfi.shape) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V * qfi.spin * cgi.shadowmulmatrix, *qfi.shape, col, PPR::WALLSHADOW);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-08-27 17:27:35 +00:00
|
|
|
else if(qfi.usershape >= 0)
|
2019-05-26 16:04:02 +00:00
|
|
|
mapeditor::drawUserShape(V * qfi.spin * cgi.shadowmulmatrix, mapeditor::sgFloor, qfi.usershape, col, c, PPR::WALLSHADOW);
|
2018-08-18 16:01:41 +00:00
|
|
|
else
|
2018-08-28 12:27:23 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, col, PPR::WALLSHADOW);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
void set_maywarp_floor(cell *c) {
|
|
|
|
bool warp = isWarped(c);
|
2018-08-20 13:24:44 +00:00
|
|
|
if(warp && !shmup::on && geosupport_football() == 2) {
|
2018-08-20 15:30:36 +00:00
|
|
|
if(!stdhyperbolic) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTriheptaFloor);
|
2018-08-20 15:30:36 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-08-28 02:05:32 +00:00
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_TYPES, 0);
|
2018-05-07 18:13:56 +00:00
|
|
|
if(si.id == 0 || si.id == 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTriheptaFloor);
|
2018-08-20 15:30:36 +00:00
|
|
|
else if(si.id >= 14)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2018-05-07 18:13:56 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(applyPatterndir(c, si), cgi.shTriheptaSpecial[si.id]);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
else if(is_nice_dual(c)) set_floor(cgi.shBigTriangle);
|
|
|
|
else set_floor(cgi.shFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
void escherSidewall(cell *c, int sidepar, const transmatrix& V, color_t col) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(sidepar >= SIDE_SLEV && sidepar <= SIDE_SLEV+2) {
|
|
|
|
int sl = sidepar - SIDE_SLEV;
|
|
|
|
for(int z=1; z<=4; z++) if(z == 1 || (z == 4 && detaillevel == 2))
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_qfi(c, mscale(V, zgrad0(cgi.slev * sl, cgi.slev * (sl+1), z, 4)), col, PPR::REDWALL-4+z+4*sl);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(sidepar == SIDE_WALL) {
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++)
|
2018-08-28 12:27:23 +00:00
|
|
|
draw_qfi(c, mscale(V, zgrad0(0, geom3::actual_wall_height(), z, layers)), col, PPR::WALL3+z-layers);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(sidepar == SIDE_LAKE) {
|
|
|
|
const int layers = 1 << (detaillevel-1);
|
|
|
|
if(detaillevel) for(int z=0; z<layers; z++)
|
2019-05-29 14:27:24 +00:00
|
|
|
draw_qfi(c, mscale(V, zgrad0(-vid.lake_top, 0, z, layers)), col, PPR::FLOOR+z-layers);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(sidepar == SIDE_LTOB) {
|
|
|
|
const int layers = 1 << (detaillevel-1);
|
|
|
|
if(detaillevel) for(int z=0; z<layers; z++)
|
2019-05-29 14:27:24 +00:00
|
|
|
draw_qfi(c, mscale(V, zgrad0(-vid.lake_bottom, -vid.lake_top, z, layers)), col, PPR::INLAKEWALL+z-layers);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(sidepar == SIDE_BTOI) {
|
|
|
|
const int layers = 1 << detaillevel;
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_qfi(c, mscale(V, cgi.INFDEEP), col, PPR::MINUSINF);
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int z=1; z<layers; z++)
|
2019-05-29 14:27:24 +00:00
|
|
|
draw_qfi(c, mscale(V, zgrad0(-vid.lake_bottom, -vid.lake_top, -z, 1)), col, PPR::LAKEBOTTOM+z-layers);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, color_t col) {
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(!qfi.fshape || !qfi.fshape->is_plain || !cgi.validsidepar[sidepar] || qfi.usershape >= 0) if(GDIM == 2) {
|
2018-05-07 18:13:56 +00:00
|
|
|
escherSidewall(c, sidepar, V, col);
|
|
|
|
return true;
|
2017-10-29 22:54:26 +00:00
|
|
|
}
|
2019-05-10 00:52:04 +00:00
|
|
|
if(!qfi.fshape) return true;
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(qfi.fshape == &cgi.shBigTriangle && pseudohept(c->move(i))) return false;
|
|
|
|
if(qfi.fshape == &cgi.shTriheptaFloor && !pseudohept(c) && !pseudohept(c->move(i))) return false;
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2018-08-28 11:45:11 +00:00
|
|
|
PPR prio;
|
2018-08-28 12:27:23 +00:00
|
|
|
/* if(mirr) prio = PPR::GLASS - 2;
|
|
|
|
else */ if(sidepar == SIDE_WALL) prio = PPR::WALL3 - 2;
|
|
|
|
else if(sidepar == SIDE_WTS3) prio = PPR::WALL3 - 2;
|
|
|
|
else if(sidepar == SIDE_LAKE) prio = PPR::LAKEWALL;
|
|
|
|
else if(sidepar == SIDE_LTOB) prio = PPR::INLAKEWALL;
|
|
|
|
else if(sidepar == SIDE_BTOI) prio = PPR::BELOWBOTTOM;
|
|
|
|
else prio = PPR::REDWALL-2+4*(sidepar-SIDE_SLEV);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-07-25 10:24:02 +00:00
|
|
|
dynamicval<bool> ncor(approx_nearcorner, true);
|
2017-07-10 18:47:38 +00:00
|
|
|
transmatrix V2 = V * ddspin(c, i);
|
2018-07-16 18:05:23 +00:00
|
|
|
|
2019-07-25 10:24:02 +00:00
|
|
|
if(binarytiling || archimedean || NONSTDVAR || penrose) {
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2018-08-30 14:09:16 +00:00
|
|
|
if(archimedean && !PURE)
|
|
|
|
i = (i + arcm::parent_index_of(c->master)/DUALMUL + MODFIXER) % c->type;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-05-07 18:13:56 +00:00
|
|
|
draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio);
|
|
|
|
return false;
|
|
|
|
}
|
2017-10-29 22:54:26 +00:00
|
|
|
|
2019-07-22 09:21:27 +00:00
|
|
|
queuepolyat(V2, qfi.fshape->side[sidepar][shvid(c)], col, prio);
|
2018-05-07 18:13:56 +00:00
|
|
|
return false;
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool openorsafe(cell *c) {
|
|
|
|
return c->wall == waMineOpen || mineMarkedSafe(c);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
#define Dark(x) darkena(x,0,0xFF)
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 21:39:36 +00:00
|
|
|
EX color_t stdgridcolor = 0x202020FF;
|
2019-03-08 21:40:34 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int gridcolor(cell *c1, cell *c2) {
|
2017-07-12 17:50:39 +00:00
|
|
|
if(cmode & sm::DRAW) return Dark(forecolor);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!c2)
|
|
|
|
return 0x202020 >> darken;
|
|
|
|
int rd1 = rosedist(c1), rd2 = rosedist(c2);
|
|
|
|
if(rd1 != rd2) {
|
|
|
|
int r = rd1+rd2;
|
|
|
|
if(r == 1) return Dark(0x802020);
|
|
|
|
if(r == 3) return Dark(0xC02020);
|
|
|
|
if(r == 2) return Dark(0xF02020);
|
2017-06-18 16:51:46 +00:00
|
|
|
}
|
2019-05-21 23:13:54 +00:00
|
|
|
if(chasmgraph(c1) != chasmgraph(c2) && c1->land != laAsteroids && c2->land != laAsteroids)
|
2017-07-10 18:47:38 +00:00
|
|
|
return Dark(0x808080);
|
2017-12-21 14:14:54 +00:00
|
|
|
if(c1->land == laAlchemist && c2->land == laAlchemist && c1->wall != c2->wall && !c1->item && !c2->item)
|
2017-07-10 18:47:38 +00:00
|
|
|
return Dark(0xC020C0);
|
|
|
|
if((c1->land == laWhirlpool || c2->land == laWhirlpool) && (celldistAlt(c1) != celldistAlt(c2)))
|
|
|
|
return Dark(0x2020A0);
|
|
|
|
if(c1->land == laMinefield && c2->land == laMinefield && (openorsafe(c1) != openorsafe(c2)))
|
|
|
|
return Dark(0xA0A0A0);
|
2019-03-08 21:40:34 +00:00
|
|
|
if(!darken) return stdgridcolor;
|
2017-07-10 18:47:38 +00:00
|
|
|
return Dark(0x202020);
|
2017-06-18 16:51:46 +00:00
|
|
|
}
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, bool repriority) {
|
2019-05-08 18:40:41 +00:00
|
|
|
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-08 18:40:41 +00:00
|
|
|
if(GDIM == 3) {
|
|
|
|
for(int i=q; i<isize(ptds); i++) {
|
|
|
|
auto pp = dynamic_cast<dqi_poly*> (&*ptds[q++]);
|
|
|
|
if(!pp) continue;
|
|
|
|
auto& ptd = *pp;
|
2019-05-08 23:39:32 +00:00
|
|
|
ptd.V = ptd.V * zpush(+down);
|
2019-05-08 18:40:41 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// since we might be changing priorities, we have to make sure that we are sorting correctly
|
|
|
|
if(down > 0 && repriority) {
|
|
|
|
int qq = q+1;
|
2018-06-22 12:47:24 +00:00
|
|
|
while(qq < isize(ptds))
|
2018-09-04 17:53:42 +00:00
|
|
|
if(qq > q && ptds[qq]->prio < ptds[qq-1]->prio) {
|
2017-07-10 18:47:38 +00:00
|
|
|
swap(ptds[qq], ptds[qq-1]);
|
|
|
|
qq--;
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else qq++;
|
2017-06-18 16:51:46 +00:00
|
|
|
}
|
|
|
|
|
2018-06-22 12:47:24 +00:00
|
|
|
while(q < isize(ptds)) {
|
2018-09-04 17:53:42 +00:00
|
|
|
auto pp = dynamic_cast<dqi_poly*> (&*ptds[q++]);
|
|
|
|
if(!pp) continue;
|
|
|
|
auto& ptd = *pp;
|
|
|
|
|
|
|
|
double z2;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
double z = zlevel(tC0(ptd.V));
|
|
|
|
double lev = geom3::factor_to_lev(z);
|
|
|
|
double nlev = lev - down;
|
|
|
|
|
|
|
|
double xyscale = rezoom ? geom3::scale_at_lev(lev) / geom3::scale_at_lev(nlev) : 1;
|
|
|
|
z2 = geom3::lev_to_factor(nlev);
|
|
|
|
double zscale = z2 / z;
|
|
|
|
|
|
|
|
// xyscale = xyscale + (zscale-xyscale) * (1+sin(ticks / 1000.0)) / 2;
|
|
|
|
|
|
|
|
ptd.V = xyzscale( V, xyscale*zscale, zscale)
|
|
|
|
* inverse(V) * ptd.V;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
if(!repriority) ;
|
2019-05-29 14:27:24 +00:00
|
|
|
else if(nlev < -vid.lake_bottom-1e-3) {
|
2018-09-04 17:53:42 +00:00
|
|
|
ptd.prio = PPR::BELOWBOTTOM_FALLANIM;
|
|
|
|
if(c->wall != waChasm)
|
|
|
|
ptd.color = 0; // disappear!
|
|
|
|
}
|
2019-05-29 14:27:24 +00:00
|
|
|
else if(nlev < -vid.lake_top-1e-3)
|
2018-09-04 17:53:42 +00:00
|
|
|
ptd.prio = PPR::INLAKEWALL_FALLANIM;
|
|
|
|
else if(nlev < 0)
|
|
|
|
ptd.prio = PPR::LAKEWALL_FALLANIM;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// 1 : (floor, water); 2 : (water, bottom); 4 : (bottom, inf)
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int shallow(cell *c) {
|
|
|
|
if(cellUnstable(c)) return 0;
|
|
|
|
else if(
|
|
|
|
c->wall == waReptile) return 1;
|
|
|
|
else if(c->wall == waReptileBridge ||
|
|
|
|
c->wall == waGargoyleFloor ||
|
|
|
|
c->wall == waGargoyleBridge ||
|
|
|
|
c->wall == waTempFloor ||
|
|
|
|
c->wall == waTempBridge ||
|
2017-09-03 10:01:31 +00:00
|
|
|
c->wall == waPetrifiedBridge ||
|
2017-07-10 18:47:38 +00:00
|
|
|
c->wall == waFrozenLake)
|
|
|
|
return 5;
|
|
|
|
return 7;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool allemptynear(cell *c) {
|
|
|
|
if(c->wall) return false;
|
|
|
|
forCellEx(c2, c) if(c2->wall) return false;
|
|
|
|
return true;
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
|
|
|
|
2017-10-09 11:00:08 +00:00
|
|
|
static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030};
|
|
|
|
static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080};
|
2017-10-28 23:57:34 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool bright;
|
2018-03-25 16:33:21 +00:00
|
|
|
|
2017-10-17 10:54:59 +00:00
|
|
|
// how much to darken
|
|
|
|
int getfd(cell *c) {
|
2018-03-25 16:33:21 +00:00
|
|
|
if(bright) return 0;
|
2019-06-13 15:25:11 +00:00
|
|
|
if(among(c->land, laAlchemist, laHell, laVariant) && WDIM == 2 && GDIM == 3) return 0;
|
2017-10-17 10:54:59 +00:00
|
|
|
switch(c->land) {
|
|
|
|
case laRedRock:
|
|
|
|
case laReptile:
|
|
|
|
case laCanvas:
|
|
|
|
return 0;
|
2017-12-05 18:43:45 +00:00
|
|
|
|
|
|
|
case laSnakeNest:
|
|
|
|
return realred(c->wall) ? 0 : 1;
|
2017-10-17 10:54:59 +00:00
|
|
|
|
|
|
|
case laTerracotta:
|
|
|
|
case laMercuryRiver:
|
2017-10-17 18:41:17 +00:00
|
|
|
return (c->wall == waMercury && wmspatial) ? 0 : 1;
|
2017-10-17 10:54:59 +00:00
|
|
|
|
|
|
|
case laKraken:
|
2017-12-29 00:10:47 +00:00
|
|
|
case laDocks:
|
2017-10-17 10:54:59 +00:00
|
|
|
case laBurial:
|
|
|
|
case laIvoryTower:
|
|
|
|
case laDungeon:
|
|
|
|
case laMountain:
|
|
|
|
case laEndorian:
|
|
|
|
case laCaribbean:
|
|
|
|
case laWhirlwind:
|
|
|
|
case laRose:
|
|
|
|
case laWarpSea:
|
|
|
|
case laTortoise:
|
|
|
|
case laDragon:
|
|
|
|
case laHalloween:
|
|
|
|
case laHunting:
|
|
|
|
case laOcean:
|
|
|
|
case laLivefjord:
|
|
|
|
case laWhirlpool:
|
|
|
|
case laAlchemist:
|
|
|
|
case laIce:
|
|
|
|
case laGraveyard:
|
|
|
|
case laBlizzard:
|
|
|
|
case laRlyeh:
|
|
|
|
case laTemple:
|
|
|
|
case laWineyard:
|
|
|
|
case laDeadCaves:
|
|
|
|
case laPalace:
|
|
|
|
case laCA:
|
2017-10-30 08:05:16 +00:00
|
|
|
case laDual:
|
2018-10-25 00:43:14 +00:00
|
|
|
case laBrownian:
|
2017-10-17 10:54:59 +00:00
|
|
|
return 1;
|
|
|
|
|
2019-01-11 01:25:54 +00:00
|
|
|
case laVariant:
|
|
|
|
if(isWateryOrBoat(c)) return 1;
|
|
|
|
return 2;
|
|
|
|
|
2017-10-17 10:54:59 +00:00
|
|
|
case laTrollheim:
|
|
|
|
default:
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
2017-12-05 18:43:45 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
int getSnakelevColor(cell *c, int i, int last, int fd, color_t wcol) {
|
|
|
|
color_t col;
|
2017-12-05 18:43:45 +00:00
|
|
|
if(c->wall == waTower)
|
|
|
|
col = 0xD0D0D0-i*0x101010;
|
|
|
|
else if(c->land == laSnakeNest)
|
|
|
|
return darkena(nestcolors[pattern_threecolor(c)] * (5 + i) / 4, 0, 0xFF);
|
2019-02-17 17:37:23 +00:00
|
|
|
#if CAP_COMPLEX2
|
2018-12-25 11:49:54 +00:00
|
|
|
else if(c->land == laBrownian)
|
|
|
|
col = brownian::get_color(c->landparam % brownian::level + (i+1) * brownian::level);
|
2019-02-17 17:37:23 +00:00
|
|
|
#endif
|
2017-12-05 18:43:45 +00:00
|
|
|
else if(i == last-1)
|
|
|
|
col = wcol;
|
|
|
|
else
|
|
|
|
col = winf[waRed1+i].color;
|
|
|
|
return darkena(col, fd, 0xFF);
|
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-09-04 17:53:42 +00:00
|
|
|
void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int ct6, int fd) {
|
2019-05-08 16:33:08 +00:00
|
|
|
|
|
|
|
if(DIM == 3 && WDIM == 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
if(!qfi.fshape) qfi.fshape = &cgi.shFullFloor;
|
2019-05-09 23:24:16 +00:00
|
|
|
if(conegraph(c)) {
|
2019-05-12 18:10:01 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->cone[0], darkena(wcol, 0, 0xFF), PPR::WALL);
|
2019-05-13 11:39:43 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
2019-05-09 23:24:16 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-05-24 23:36:22 +00:00
|
|
|
if(c->wall == waClosedGate) {
|
|
|
|
int hdir = 0;
|
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i)->wall == waClosedGate)
|
|
|
|
hdir = i;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V * ddspin(c, hdir, M_PI), cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
2019-05-24 23:36:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-05-08 16:33:08 +00:00
|
|
|
color_t wcol0 = wcol;
|
|
|
|
color_t wcol2 = gradient(0, wcol0, 0, .8, 1);
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol, 0, 0xFF), PPR::WALL);
|
|
|
|
forCellIdEx(c2, i, c)
|
2019-05-24 23:36:22 +00:00
|
|
|
if(!highwall(c2) || conegraph(c2) || c2->wall == waClosedGate)
|
2019-05-08 16:33:08 +00:00
|
|
|
placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, fd, 255));
|
2019-05-13 11:39:43 +00:00
|
|
|
|
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
2019-05-08 16:33:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
zcol = wcol;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t wcol0 = wcol;
|
2018-02-05 00:17:11 +00:00
|
|
|
int starcol = wcol;
|
|
|
|
if(c->wall == waWarpGate) starcol = 0;
|
|
|
|
if(c->wall == waVinePlant) starcol = 0x60C000;
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t wcol2 = gradient(0, wcol0, 0, .8, 1);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
if(c->wall == waClosedGate) {
|
|
|
|
int hdir = 0;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i)->wall == waClosedGate)
|
2018-02-05 00:17:11 +00:00
|
|
|
hdir = i;
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix V2 = mscale(V, wmspatial?cgi.WALL:1) * ddspin(c, hdir, M_PI);
|
|
|
|
queuepolyat(V2, cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
2018-02-05 00:17:11 +00:00
|
|
|
starcol = 0;
|
|
|
|
}
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
hpcshape& shThisWall = isGrave(c->wall) ? cgi.shCross : cgi.shWall[ct6];
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
if(conegraph(c)) {
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++) {
|
2018-04-23 10:34:14 +00:00
|
|
|
double zg = zgrad0(0, geom3::actual_wall_height(), z, layers);
|
2018-05-07 18:13:56 +00:00
|
|
|
draw_qfi(c, xyzscale(V, zg*(layers-z)/layers, zg),
|
2018-08-28 12:27:23 +00:00
|
|
|
darkena(gradient(0, wcol, -layers, z, layers), 0, 0xFF), PPR::WALL3+z-layers+2);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
2018-05-07 18:13:56 +00:00
|
|
|
floorShadow(c, V, SHADOW_WALL);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(true) {
|
|
|
|
if(!wmspatial) {
|
|
|
|
if(starcol) queuepoly(V, shThisWall, darkena(starcol, 0, 0xFF));
|
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vdepth = mscale(V, cgi.WALL);
|
2018-02-05 00:17:11 +00:00
|
|
|
int alpha = 0xFF;
|
|
|
|
if(c->wall == waIcewall)
|
|
|
|
alpha = 0xC0;
|
|
|
|
|
|
|
|
if(starcol && !(wmescher && c->wall == waPlatform))
|
2018-08-28 12:27:23 +00:00
|
|
|
queuepolyat(Vdepth, shThisWall, darkena(starcol, 0, 0xFF), PPR::WALL3A);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2018-08-28 12:27:23 +00:00
|
|
|
draw_qfi(c, Vdepth, darkena(wcol0, fd, alpha), PPR::WALL3);
|
2018-05-07 18:13:56 +00:00
|
|
|
floorShadow(c, V, SHADOW_WALL);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
if(c->wall == waCamelot) {
|
|
|
|
forCellIdEx(c2, i, c) {
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_SLEV, V, darkena(wcol2, fd, alpha))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
forCellIdEx(c2, i, c) {
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_SLEV+1, V, darkena(wcol2, fd, alpha))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
forCellIdEx(c2, i, c) {
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_SLEV+2, V, darkena(wcol2, fd, alpha))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
forCellIdEx(c2, i, c) {
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_WTS3, V, darkena(wcol2, fd, alpha))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
if(!highwall(c2) || conegraph(c2)) {
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, fd, alpha))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
bool just_gmatrix;
|
2018-04-04 10:46:40 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
int colorhash(color_t i) {
|
2018-08-30 17:14:04 +00:00
|
|
|
return (i * 0x471211 + i*i*0x124159 + i*i*i*0x982165) & 0xFFFFFF;
|
|
|
|
}
|
|
|
|
|
2018-12-23 02:14:48 +00:00
|
|
|
void draw_gravity_particles(cell *c, const transmatrix V) {
|
|
|
|
int u = (int)(size_t)(c);
|
|
|
|
u = ((u * 137) + (u % 1000) * 51) % 1000;
|
2019-01-03 02:20:02 +00:00
|
|
|
int tt = ticks + u; fractick(ticks, 900);
|
2018-12-23 02:14:48 +00:00
|
|
|
ld r0 = (tt % 900) / 1100.;
|
|
|
|
ld r1 = (tt % 900 + 200) / 1100.;
|
|
|
|
|
|
|
|
const color_t grav_normal_color = 0x808080FF;
|
|
|
|
const color_t antigrav_color = 0xF04040FF;
|
|
|
|
const color_t levitate_color = 0x40F040FF;
|
|
|
|
|
2019-05-15 08:51:46 +00:00
|
|
|
auto levf = [] (ld l) {
|
|
|
|
return DIM == 3 ? cheilevel(l) : 1 + (1-l) * 1;
|
|
|
|
};
|
2018-12-23 02:14:48 +00:00
|
|
|
|
2019-05-15 08:51:46 +00:00
|
|
|
if(spatial_graphics || (WDIM == 2 && GDIM == 3)) {
|
2018-12-23 02:14:48 +00:00
|
|
|
|
|
|
|
switch(gravity_state) {
|
|
|
|
case gsNormal:
|
|
|
|
for(int i=0; i<6; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix T = V * spin(i*degree*60) * xpush(cgi.crossf/3);
|
2019-05-15 08:51:46 +00:00
|
|
|
queueline(mmscale(T, levf(r0)) * C0, mmscale(T, levf(r1)) * C0, grav_normal_color);
|
2018-12-23 02:14:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsAnti:
|
|
|
|
for(int i=0; i<6; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix T = V * spin(i*degree*60) * xpush(cgi.crossf/3);
|
2019-05-15 08:51:46 +00:00
|
|
|
queueline(mmscale(T, levf(r0)) * C0, mmscale(T, levf(r1)) * C0, antigrav_color);
|
2018-12-23 02:14:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsLevitation:
|
|
|
|
for(int i=0; i<6; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix T0 = V * spin(i*degree*60 + tt/60. * degree) * xpush(cgi.crossf/3);
|
|
|
|
transmatrix T1 = V * spin(i*degree*60 + (tt/60. + 30) * degree) * xpush(cgi.crossf/3);
|
2019-05-15 08:51:46 +00:00
|
|
|
ld lv = levf(DIM == 3 ? (i+0.5)/6 : 0.5);
|
|
|
|
queueline(mmscale(T0, lv) * C0, mmscale(T1, lv) * C0, levitate_color);
|
2018-12-23 02:14:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
switch(gravity_state) {
|
|
|
|
case gsNormal:
|
|
|
|
for(int i=0; i<6; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix T0 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * (1-r0));
|
|
|
|
transmatrix T1 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * (1-r1));
|
2018-12-23 02:14:48 +00:00
|
|
|
queueline(T0 * C0, T1 * C0, grav_normal_color);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsAnti:
|
|
|
|
for(int i=0; i<6; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix T0 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * r0);
|
|
|
|
transmatrix T1 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * r1);
|
2018-12-23 02:14:48 +00:00
|
|
|
queueline(T0 * C0, T1 * C0, antigrav_color);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsLevitation:
|
|
|
|
for(int i=0; i<6; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix T0 = V * spin(i*degree*60 + tt/60. * degree) * xpush(cgi.crossf/3);
|
|
|
|
transmatrix T1 = V * spin(i*degree*60 + (tt/60. + 30) * degree) * xpush(cgi.crossf/3);
|
2018-12-23 02:14:48 +00:00
|
|
|
queueline(T0 * C0, T1 * C0, levitate_color);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-27 13:43:42 +00:00
|
|
|
bool isWall3(cell *c, color_t& wcol) {
|
|
|
|
if(isWall(c)) return true;
|
2019-02-27 17:37:26 +00:00
|
|
|
if(c->wall == waChasm && c->land == laMemory) { wcol = 0x606000; return true; }
|
2019-02-27 13:43:42 +00:00
|
|
|
if(c->wall == waInvisibleFloor) return false;
|
2019-02-27 15:36:56 +00:00
|
|
|
// if(chasmgraph(c)) return true;
|
2019-03-02 00:19:52 +00:00
|
|
|
if(among(c->wall, waMirror, waCloud, waMineUnknown, waMineMine)) return true;
|
2019-02-27 13:43:42 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-03-09 22:55:03 +00:00
|
|
|
bool isSulphuric(eWall w) { return among(w, waSulphur, waSulphurC); }
|
2019-03-04 17:01:48 +00:00
|
|
|
|
2019-03-10 17:38:55 +00:00
|
|
|
// 'land color', but a bit twisted for Alchemist Lab
|
|
|
|
color_t lcolor(cell *c) {
|
|
|
|
if(isAlch(c->wall) && !c->item) return winf[c->wall].color;
|
|
|
|
return floorcolors[c->land];
|
|
|
|
}
|
|
|
|
|
2019-03-13 13:04:06 +00:00
|
|
|
color_t transcolor(cell *c, cell *c2, color_t wcol) {
|
2019-03-10 17:38:55 +00:00
|
|
|
color_t dummy;
|
|
|
|
if(isWall3(c2, dummy)) return 0;
|
2019-04-13 11:30:09 +00:00
|
|
|
if(c->land != c2->land && c->land != laNone && c2->land != laNone) {
|
2019-03-10 17:38:55 +00:00
|
|
|
if(c>c2) return 0;
|
2019-05-11 15:21:17 +00:00
|
|
|
if(c->land == laBarrier) return darkena3(lcolor(c2), 0, 0x40);
|
|
|
|
if(c2->land == laBarrier) return darkena3(lcolor(c), 0, 0x40);
|
|
|
|
return darkena3(gradient(lcolor(c), lcolor(c2), 0, 1, 2), 0, 0x40);
|
2019-03-09 22:55:03 +00:00
|
|
|
}
|
2019-07-30 11:01:41 +00:00
|
|
|
if(sol && c->land == laWineyard && c2->master->distance < c->master->distance)
|
|
|
|
return 0x00800040;
|
2019-04-20 23:06:37 +00:00
|
|
|
if(isAlch(c) && !c->item && (c2->item || !isAlch(c2))) return darkena3(winf[c->wall].color, 0, 0x40);
|
2019-03-09 22:55:03 +00:00
|
|
|
if(c->wall == c2->wall) return 0;
|
2019-04-20 23:06:37 +00:00
|
|
|
if(isFire(c) && !isFire(c2)) return darkena3(wcol, 0, 0x30);
|
|
|
|
if(c->wall == waLadder) return darkena3(wcol, 0, 0x30);
|
2019-03-09 22:55:03 +00:00
|
|
|
|
2019-03-10 17:38:55 +00:00
|
|
|
if(c->wall == waChasm && c2->wall != waChasm) return 0x606060A0;
|
|
|
|
if(isWateryOrBoat(c) && !isWateryOrBoat(c2)) return 0x0000C060;
|
2019-04-20 23:06:37 +00:00
|
|
|
if(isSulphuric(c->wall) && !isSulphuric(c2->wall)) return darkena3(winf[c->wall].color, 0, 0x40);
|
2019-03-23 21:25:35 +00:00
|
|
|
if(among(c->wall, waCanopy, waSolidBranch, waWeakBranch) && !among(c2->wall, waCanopy, waSolidBranch, waWeakBranch)) return 0x00C00060;
|
2019-04-20 23:06:37 +00:00
|
|
|
if(c->wall == waFloorA && c2->wall == waFloorB && !c->item && !c2->item) return darkena3(0xFF00FF, 0, 0x80);
|
2019-08-07 22:20:02 +00:00
|
|
|
if(realred(c->wall) || realred(c2->wall)) {
|
2019-03-09 22:55:03 +00:00
|
|
|
int l = snakelevel(c) - snakelevel(c2);
|
2019-04-20 23:06:37 +00:00
|
|
|
if(l > 0) return darkena3(floorcolors[laRedRock], 0, 0x30 * l);
|
2019-03-09 22:55:03 +00:00
|
|
|
}
|
2019-08-07 22:20:02 +00:00
|
|
|
if(among(c->wall, waRubble, waDeadfloor2) && !snakelevel(c2)) return darkena3(winf[c->wall].color, 0, 0x40);
|
2019-04-20 23:06:37 +00:00
|
|
|
if(c->wall == waMagma && c2->wall != waMagma) return darkena3(magma_color(lavatide(c, -1)/4), 0, 0x80);
|
2019-03-09 22:55:03 +00:00
|
|
|
return 0;
|
2019-03-04 17:01:48 +00:00
|
|
|
}
|
|
|
|
|
2019-02-27 15:29:30 +00:00
|
|
|
// how much should be the d-th wall darkened in 3D
|
|
|
|
int get_darkval(int d) {
|
2019-03-02 23:43:31 +00:00
|
|
|
const int darkval_hbt[9] = {0,2,2,0,6,6,8,8,0};
|
|
|
|
const int darkval_s12[12] = {0,1,2,3,4,5,0,1,2,3,4,5};
|
2019-03-01 17:53:20 +00:00
|
|
|
const int darkval_e6[6] = {0,4,6,0,4,6};
|
|
|
|
const int darkval_e12[12] = {0,4,6,0,4,6,0,4,6,0,4,6};
|
|
|
|
const int darkval_e14[14] = {0,0,0,4,6,4,6,0,0,0,6,4,6,4};
|
2019-03-13 12:12:49 +00:00
|
|
|
const int darkval_hh[14] = {0,0,0,1,1,1,2,2,2,3,3,3,1,0};
|
|
|
|
const int darkval_hrec[7] = {0,0,2,4,2,4,0};
|
2019-07-25 21:08:04 +00:00
|
|
|
const int darkval_sol[8] = {0,2,4,4,0,2,4,4};
|
2019-07-25 10:24:02 +00:00
|
|
|
const int darkval_penrose[12] = {0, 2, 0, 2, 4, 4, 6, 6, 6, 6, 6, 6};
|
2019-08-06 19:01:37 +00:00
|
|
|
const int darkval_nil[8] = {6,6,0,3,6,6,0,3};
|
2019-03-02 23:43:31 +00:00
|
|
|
if(sphere) return darkval_s12[d];
|
2019-03-01 17:53:20 +00:00
|
|
|
if(euclid && S7 == 6) return darkval_e6[d];
|
|
|
|
if(euclid && S7 == 12) return darkval_e12[d];
|
|
|
|
if(euclid && S7 == 14) return darkval_e14[d];
|
2019-03-13 12:12:49 +00:00
|
|
|
if(geometry == gHoroHex) return darkval_hh[d];
|
|
|
|
if(geometry == gHoroRec) return darkval_hrec[d];
|
2019-07-25 10:24:02 +00:00
|
|
|
if(penrose) return darkval_penrose[d];
|
2019-07-25 21:08:04 +00:00
|
|
|
if(sol) return darkval_sol[d];
|
2019-03-02 23:43:31 +00:00
|
|
|
if(binarytiling) return darkval_hbt[d];
|
|
|
|
if(hyperbolic && S7 == 6) return darkval_e6[d];
|
|
|
|
if(hyperbolic && S7 == 12) return darkval_s12[d];
|
2019-08-06 19:01:37 +00:00
|
|
|
if(nil) return darkval_nil[d];
|
2019-03-02 23:43:31 +00:00
|
|
|
return 0;
|
2019-02-27 15:29:30 +00:00
|
|
|
}
|
|
|
|
|
2019-03-24 00:27:23 +00:00
|
|
|
void drawBoat(cell *c, const transmatrix*& Vboat, transmatrix& Vboat0, transmatrix& V) {
|
2019-03-04 17:02:38 +00:00
|
|
|
double footphase;
|
2019-05-09 23:51:50 +00:00
|
|
|
if(WDIM == 3 && c == cwt.at && hide_player()) return;
|
2019-03-04 17:02:38 +00:00
|
|
|
bool magical = items[itOrbWater] && (isPlayerOn(c) || (isFriendly(c) && items[itOrbEmpathy]));
|
|
|
|
int outcol = magical ? watercolor(0) : 0xC06000FF;
|
|
|
|
int incol = magical ? 0x0060C0FF : 0x804000FF;
|
|
|
|
bool nospin = false;
|
|
|
|
|
2019-05-09 23:28:18 +00:00
|
|
|
if(WDIM == 3) {
|
2019-03-04 17:02:38 +00:00
|
|
|
Vboat0 = V;
|
|
|
|
nospin = c->wall == waBoat && applyAnimation(c, Vboat0, footphase, LAYER_BOAT);
|
2019-03-23 15:30:46 +00:00
|
|
|
if(!nospin) Vboat0 = face_the_player(V);
|
2019-03-04 17:02:38 +00:00
|
|
|
else Vboat0 = cspin(0, 2, M_PI) * Vboat0;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mscale(Vboat0, cgi.scalefactor/2), cgi.shBoatOuter, outcol, PPR::BOATLEV2);
|
|
|
|
queuepolyat(mscale(Vboat0, cgi.scalefactor/2-0.01), cgi.shBoatInner, incol, PPR::BOATLEV2);
|
2019-03-04 17:02:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Vboat = &(Vboat0 = *Vboat);
|
|
|
|
if(wmspatial && c->wall == waBoat) {
|
|
|
|
nospin = c->wall == waBoat && applyAnimation(c, Vboat0, footphase, LAYER_BOAT);
|
|
|
|
if(!nospin) Vboat0 = Vboat0 * ddspin(c, c->mondir, M_PI);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(Vboat0, cgi.shBoatOuter, outcol, PPR::BOATLEV);
|
2019-03-04 17:02:38 +00:00
|
|
|
Vboat = &(Vboat0 = V);
|
|
|
|
}
|
|
|
|
if(c->wall == waBoat) {
|
|
|
|
nospin = applyAnimation(c, Vboat0, footphase, LAYER_BOAT);
|
|
|
|
}
|
|
|
|
if(!nospin)
|
|
|
|
Vboat0 = Vboat0 * ddspin(c, c->mondir, M_PI);
|
|
|
|
else {
|
|
|
|
transmatrix Vx;
|
|
|
|
if(applyAnimation(c, Vx, footphase, LAYER_SMALL))
|
|
|
|
animations[LAYER_SMALL][c].footphase = 0;
|
|
|
|
}
|
2019-05-09 23:28:18 +00:00
|
|
|
if(wmspatial && GDIM == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mscale(Vboat0, (cgi.LAKE+1)/2), cgi.shBoatOuter, outcol, PPR::BOATLEV2);
|
|
|
|
queuepoly(Vboat0, cgi.shBoatOuter, outcol);
|
|
|
|
queuepoly(Vboat0, cgi.shBoatInner, incol);
|
2019-03-04 17:02:38 +00:00
|
|
|
}
|
|
|
|
|
2019-05-05 15:37:51 +00:00
|
|
|
void shmup_gravity_floor(cell *c) {
|
|
|
|
if(DIM == 2 && cellEdgeUnstable(c))
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shMFloor);
|
2019-05-05 15:37:51 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFullFloor);
|
2019-05-05 15:37:51 +00:00
|
|
|
}
|
|
|
|
|
2019-05-09 15:02:50 +00:00
|
|
|
ld mousedist(transmatrix T) {
|
|
|
|
if(GDIM == 2) return intval(mouseh, tC0(T));
|
2019-05-26 16:04:02 +00:00
|
|
|
hyperpoint T1 = tC0(mscale(T, cgi.FLOOR));
|
2019-07-31 14:14:01 +00:00
|
|
|
if(mouseaim_sensitivity) return sqhypot_d(2, T1) + (point_behind(T1) ? 1e10 : 0);
|
2019-05-09 15:02:50 +00:00
|
|
|
hyperpoint h1;
|
|
|
|
applymodel(T1, h1);
|
|
|
|
h1 = h1 - hpxy((mousex - current_display->xcenter) / current_display->radius, (mousey - current_display->ycenter) / current_display->radius);
|
2019-07-31 14:14:01 +00:00
|
|
|
return sqhypot_d(2, h1) + (point_behind(T1) ? 1e10 : 0);
|
2019-05-09 15:02:50 +00:00
|
|
|
}
|
|
|
|
|
2019-05-11 13:06:48 +00:00
|
|
|
vector<hyperpoint> clipping_planes;
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int noclipped;
|
2019-05-11 13:06:48 +00:00
|
|
|
|
|
|
|
void make_clipping_planes() {
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 13:06:48 +00:00
|
|
|
clipping_planes.clear();
|
2019-07-31 11:21:33 +00:00
|
|
|
if(sphere) return;
|
2019-05-11 13:06:48 +00:00
|
|
|
auto add_clipping_plane = [] (ld x1, ld y1, ld x2, ld y2) {
|
|
|
|
ld z1 = 1, z2 = 1;
|
|
|
|
hyperpoint sx = point3(y1 * z2 - y2 * z1, z1 * x2 - z2 * x1, x1 * y2 - x2 * y1);
|
|
|
|
sx /= hypot_d(3, sx);
|
|
|
|
sx[3] = 0;
|
2019-08-06 10:00:46 +00:00
|
|
|
if(nisot::local_perspective_used()) sx = inverse(nisot::local_perspective) * sx;
|
2019-05-11 13:06:48 +00:00
|
|
|
clipping_planes.push_back(sx);
|
|
|
|
};
|
|
|
|
ld tx = current_display->tanfov;
|
|
|
|
ld ty = tx * current_display->ysize / current_display->xsize;
|
|
|
|
add_clipping_plane(+tx, +ty, -tx, +ty);
|
|
|
|
add_clipping_plane(-tx, +ty, -tx, -ty);
|
|
|
|
add_clipping_plane(-tx, -ty, +tx, -ty);
|
|
|
|
add_clipping_plane(+tx, -ty, +tx, +ty);
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-05-11 13:06:48 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void gridline(const transmatrix& V1, const hyperpoint h1, const transmatrix& V2, const hyperpoint h2, color_t col, int prec) {
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 17:43:46 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ld eps = cgi.human_height/100;
|
|
|
|
queueline(V1*orthogonal_move(h1,cgi.FLOOR+eps), V2*orthogonal_move(h2,cgi.FLOOR+eps), col, prec);
|
|
|
|
queueline(V1*orthogonal_move(h1,cgi.WALL-eps), V2*orthogonal_move(h2,cgi.WALL-eps), col, prec);
|
2019-05-11 17:43:46 +00:00
|
|
|
}
|
|
|
|
else
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-05-21 23:13:02 +00:00
|
|
|
queueline(V1*h1, V2*h2, col, prec);
|
2019-05-11 21:53:16 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void gridline(const transmatrix& V, const hyperpoint h1, const hyperpoint h2, color_t col, int prec) {
|
2019-05-21 23:13:02 +00:00
|
|
|
gridline(V, h1, V, h2, col, prec);
|
2019-05-11 17:43:46 +00:00
|
|
|
}
|
|
|
|
|
2019-05-30 08:43:17 +00:00
|
|
|
void radar_grid(cell *c, const transmatrix& V) {
|
|
|
|
for(int t=0; t<c->type; t++)
|
|
|
|
if(c->move(t) && c->move(t) < c)
|
|
|
|
addradar(V*get_corner_position(c, t%c->type), V*get_corner_position(c, (t+1)%c->type), gridcolor(c, c->move(t)));
|
|
|
|
}
|
|
|
|
|
2019-07-25 10:19:52 +00:00
|
|
|
int wall_offset(cell *c) {
|
2019-07-25 10:24:02 +00:00
|
|
|
if(penrose && kite::getshape(c->master) == kite::pKite) return 10;
|
2019-07-25 10:19:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-05-11 17:43:46 +00:00
|
|
|
void draw_grid_at(cell *c, const transmatrix& V) {
|
|
|
|
dynamicval<ld> lw(vid.linewidth, vid.linewidth);
|
|
|
|
|
2019-07-13 12:37:30 +00:00
|
|
|
vid.linewidth *= vid.multiplier_grid;
|
2019-05-26 16:04:02 +00:00
|
|
|
vid.linewidth *= cgi.scalefactor;
|
2019-05-11 17:43:46 +00:00
|
|
|
|
|
|
|
// sphere: 0.3948
|
|
|
|
// sphere heptagonal: 0.5739
|
|
|
|
// sphere trihepta: 0.3467
|
|
|
|
|
|
|
|
// hyper trihepta: 0.2849
|
|
|
|
// hyper heptagonal: 0.6150
|
|
|
|
// hyper: 0.3798
|
|
|
|
|
|
|
|
int prec = sphere ? 3 : 1;
|
|
|
|
prec += vid.linequality;
|
|
|
|
|
|
|
|
if(0);
|
|
|
|
#if MAXMDIM == 4
|
|
|
|
else if(WDIM == 3) {
|
2019-07-25 10:19:52 +00:00
|
|
|
int ofs = wall_offset(c);
|
2019-05-11 17:43:46 +00:00
|
|
|
for(int t=0; t<c->type; t++) {
|
|
|
|
if(!c->move(t)) continue;
|
2019-07-23 13:06:03 +00:00
|
|
|
if(binarytiling && !sol && !among(t, 5, 6, 8)) continue;
|
2019-05-11 17:43:46 +00:00
|
|
|
if(!binarytiling && c->move(t) < c) continue;
|
|
|
|
dynamicval<color_t> g(poly_outline, gridcolor(c, c->move(t)));
|
2019-07-25 10:19:52 +00:00
|
|
|
queuepoly(V, cgi.shWireframe3D[ofs + t], 0);
|
2019-05-11 17:43:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if CAP_BT
|
|
|
|
else if(binarytiling && WDIM == 2) {
|
|
|
|
ld yx = log(2) / 2;
|
|
|
|
ld yy = yx;
|
|
|
|
ld xx = 1 / sqrt(2)/2;
|
|
|
|
queueline(V * binary::get_horopoint(-yy, xx), V * binary::get_horopoint(yy, 2*xx), gridcolor(c, c->move(binary::bd_right)), prec);
|
|
|
|
auto horizontal = [&] (ld y, ld x1, ld x2, int steps, int dir) {
|
|
|
|
if(vid.linequality > 0) steps <<= vid.linequality;
|
|
|
|
if(vid.linequality < 0) steps >>= -vid.linequality;
|
|
|
|
for(int i=0; i<=steps; i++) curvepoint(V * binary::get_horopoint(y, x1 + (x2-x1) * i / steps));
|
|
|
|
queuecurve(gridcolor(c, c->move(dir)), 0, PPR::LINE);
|
|
|
|
};
|
|
|
|
horizontal(yy, 2*xx, xx, 4, binary::bd_up_right);
|
|
|
|
horizontal(yy, xx, -xx, 8, binary::bd_up);
|
|
|
|
horizontal(yy, -xx, -2*xx, 4, binary::bd_up_left);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if(isWarped(c) && has_nice_dual()) {
|
2019-06-17 08:59:02 +00:00
|
|
|
if(pseudohept(c)) for(int t=0; t<c->type; t++) if(isWarped(c->move(t)))
|
2019-05-11 17:43:46 +00:00
|
|
|
gridline(V, get_warp_corner(c, t%c->type), get_warp_corner(c, (t+1)%c->type), gridcolor(c, c->move(t)), prec);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(int t=0; t<c->type; t++)
|
2019-06-17 08:59:02 +00:00
|
|
|
if(c->move(t) && (c->move(t) < c || isWarped(c->move(t))))
|
2019-05-11 17:43:46 +00:00
|
|
|
gridline(V, get_corner_position(c, t%c->type), get_corner_position(c, (t+1)%c->type), gridcolor(c, c->move(t)), prec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-13 11:18:55 +00:00
|
|
|
void queue_transparent_wall(const transmatrix& V, hpcshape& sh, color_t color) {
|
|
|
|
auto& poly = queuepolyat(V, sh, color, PPR::TRANSPARENT_WALL);
|
|
|
|
hyperpoint h = V * sh.intester;
|
2019-07-28 09:07:21 +00:00
|
|
|
if(in_perspective())
|
2019-05-13 11:18:55 +00:00
|
|
|
poly.subprio = int(hdist0(h) * 100000);
|
|
|
|
else {
|
|
|
|
hyperpoint h2;
|
|
|
|
applymodel(h, h2);
|
|
|
|
poly.subprio = int(h2[2] * 100000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-20 11:40:56 +00:00
|
|
|
int ceiling_category(cell *c) {
|
|
|
|
switch(c->land) {
|
|
|
|
case laNone:
|
|
|
|
case laMemory:
|
|
|
|
case laMirrorWall2:
|
|
|
|
case laMirrored:
|
|
|
|
case laMirrored2:
|
|
|
|
case landtypes:
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* starry levels */
|
|
|
|
case laIce:
|
|
|
|
case laCrossroads:
|
|
|
|
case laCrossroads2:
|
|
|
|
case laCrossroads3:
|
|
|
|
case laCrossroads4:
|
|
|
|
case laCrossroads5:
|
|
|
|
case laJungle:
|
|
|
|
case laGraveyard:
|
|
|
|
case laMotion:
|
|
|
|
case laRedRock:
|
|
|
|
case laZebra:
|
|
|
|
case laHunting:
|
|
|
|
case laEAir:
|
|
|
|
case laStorms:
|
|
|
|
case laMountain:
|
|
|
|
case laHaunted:
|
|
|
|
case laHauntedWall:
|
|
|
|
case laHauntedBorder:
|
|
|
|
case laWhirlwind:
|
|
|
|
case laBurial:
|
|
|
|
case laHalloween:
|
|
|
|
case laReptile:
|
|
|
|
case laVolcano:
|
|
|
|
case laBlizzard:
|
|
|
|
case laDual:
|
|
|
|
case laWestWall:
|
|
|
|
case laAsteroids:
|
|
|
|
return 1;
|
|
|
|
|
2019-06-01 17:26:02 +00:00
|
|
|
case laPower:
|
2019-05-20 11:40:56 +00:00
|
|
|
case laWineyard:
|
|
|
|
case laDesert:
|
|
|
|
case laAlchemist:
|
|
|
|
case laDryForest:
|
|
|
|
case laCaribbean:
|
|
|
|
case laMinefield:
|
|
|
|
case laOcean:
|
|
|
|
case laWhirlpool:
|
|
|
|
case laLivefjord:
|
|
|
|
case laEWater:
|
|
|
|
case laOceanWall:
|
|
|
|
case laWildWest:
|
|
|
|
case laOvergrown:
|
|
|
|
case laClearing:
|
|
|
|
case laRose:
|
|
|
|
case laWarpCoast:
|
|
|
|
case laWarpSea:
|
|
|
|
case laEndorian:
|
|
|
|
case laTortoise:
|
|
|
|
case laPrairie:
|
2019-06-01 15:01:04 +00:00
|
|
|
case laDragon:
|
2019-05-20 11:40:56 +00:00
|
|
|
case laSnakeNest:
|
|
|
|
case laDocks:
|
|
|
|
case laKraken:
|
|
|
|
case laBrownian:
|
2019-06-01 15:01:04 +00:00
|
|
|
case laHell:
|
2019-06-13 15:25:11 +00:00
|
|
|
case laVariant:
|
2019-05-20 11:40:56 +00:00
|
|
|
return 2;
|
|
|
|
|
|
|
|
case laBarrier:
|
|
|
|
case laCaves:
|
|
|
|
case laMirror:
|
|
|
|
case laMirrorOld:
|
|
|
|
case laCocytus:
|
|
|
|
case laEmerald:
|
|
|
|
case laDeadCaves:
|
|
|
|
case laHive:
|
|
|
|
case laCamelot:
|
|
|
|
case laIvoryTower:
|
|
|
|
case laEFire:
|
|
|
|
case laEEarth:
|
|
|
|
case laElementalWall:
|
|
|
|
case laCanvas:
|
|
|
|
case laTrollheim:
|
|
|
|
case laDungeon:
|
|
|
|
case laBull:
|
|
|
|
case laCA:
|
|
|
|
case laMirrorWall:
|
|
|
|
case laTerracotta:
|
|
|
|
case laMercuryRiver:
|
|
|
|
case laMagnetic:
|
|
|
|
case laSwitch:
|
|
|
|
return 3;
|
|
|
|
|
2019-05-24 23:36:49 +00:00
|
|
|
case laPalace:
|
2019-05-25 01:37:27 +00:00
|
|
|
case laPrincessQuest:
|
2019-05-20 11:40:56 +00:00
|
|
|
default:
|
|
|
|
return 4;
|
2019-06-17 17:36:29 +00:00
|
|
|
|
|
|
|
case laRuins:
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
case laTemple:
|
|
|
|
case laRlyeh:
|
|
|
|
return 7;
|
2019-05-20 11:40:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ld camera_level;
|
|
|
|
|
2019-05-21 23:14:39 +00:00
|
|
|
int get_skybrightness(int mul = 1) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ld s = 1 - mul * (camera_level - cgi.WALL) / -2;
|
2019-05-20 11:40:56 +00:00
|
|
|
if(s > 1) return 255;
|
|
|
|
if(s < 0) return 0;
|
|
|
|
return int(s * 255);
|
|
|
|
}
|
|
|
|
|
2019-06-07 15:53:17 +00:00
|
|
|
dqi_sky *sky;
|
2019-06-01 15:01:04 +00:00
|
|
|
|
|
|
|
void prepare_sky() {
|
|
|
|
sky = NULL;
|
|
|
|
if(euclid) {
|
|
|
|
if(WDIM == 3 || GDIM == 2) return;
|
|
|
|
transmatrix T = ggmatrix(currentmap->gamestart());
|
|
|
|
T = gpushxto0(tC0(T)) * T;
|
|
|
|
queuepoly(T, cgi.shEuclideanSky, 0x0044e4FF);
|
|
|
|
queuepolyat(T * zpush(cgi.SKY+0.5) * xpush(cgi.SKY+0.5), cgi.shSun, 0xFFFF00FF, PPR::SKY);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sky = &queuea<dqi_sky> (PPR::SKY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void dqi_sky::draw() {
|
|
|
|
|
2019-07-03 05:51:30 +00:00
|
|
|
if(!vid.usingGL || sky.empty()) return;
|
2019-06-01 15:01:04 +00:00
|
|
|
vector<glhr::colored_vertex> skyvertices;
|
|
|
|
|
|
|
|
int sk = get_skybrightness();
|
|
|
|
|
|
|
|
unordered_map<cell*, color_t> colors;
|
|
|
|
#ifdef USE_UNORDERED_MAP
|
|
|
|
colors.reserve(isize(sky));
|
|
|
|
#endif
|
|
|
|
for(sky_item& si: sky) colors[si.c] = darkena(gradient(0, si.color, 0, sk, 255), 0, 0xFF);
|
|
|
|
|
|
|
|
hyperpoint skypoint = cpush0(2, cgi.SKY);
|
|
|
|
|
|
|
|
vector<glhr::colored_vertex> this_poly;
|
2019-06-25 09:23:01 +00:00
|
|
|
|
|
|
|
// I am not sure why, but extra projection martix introduced in stereo
|
|
|
|
// causes some vertices to not be drawn. Thus we apply separately
|
|
|
|
transmatrix Tsh = Id;
|
|
|
|
if(global_projection)
|
|
|
|
Tsh = xpush(vid.ipd * global_projection/2);
|
2019-06-01 15:01:04 +00:00
|
|
|
|
|
|
|
for(sky_item& si: sky) {
|
|
|
|
auto c = si.c;
|
|
|
|
for(int i=0; i<c->type; i++) {
|
|
|
|
|
|
|
|
if(1) {
|
|
|
|
cellwalker cw0(c, i);
|
|
|
|
cellwalker cw = cw0;
|
|
|
|
do {
|
|
|
|
cw += wstep; cw++;
|
|
|
|
if(cw.at < c || !colors.count(si.c)) goto next;
|
|
|
|
}
|
|
|
|
while(cw != cw0);
|
|
|
|
|
|
|
|
this_poly.clear();
|
|
|
|
|
2019-06-25 09:23:01 +00:00
|
|
|
transmatrix T1 = Tsh * si.T;
|
2019-06-01 15:01:04 +00:00
|
|
|
do {
|
|
|
|
this_poly.emplace_back(T1 * skypoint, colors[cw.at]);
|
|
|
|
T1 = T1 * cellrelmatrix(cw.at, cw.spin);
|
|
|
|
cw += wstep; cw++;
|
|
|
|
}
|
|
|
|
while(cw != cw0);
|
|
|
|
|
|
|
|
int k = isize(this_poly);
|
|
|
|
for(int j=2; j<k; j++) {
|
|
|
|
skyvertices.push_back(this_poly[0]);
|
|
|
|
skyvertices.push_back(this_poly[j-1]);
|
|
|
|
skyvertices.push_back(this_poly[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
next: ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(auto& v: skyvertices) for(int i=0; i<3; i++) v.color[i] *= 2;
|
2019-06-24 12:42:43 +00:00
|
|
|
|
|
|
|
for(int ed = current_display->stereo_active() ? -1 : 0; ed<2; ed+=2) {
|
|
|
|
if(global_projection && global_projection != ed) continue;
|
|
|
|
glhr::switch_mode(glhr::gmVarColored, glhr::new_shader_projection);
|
|
|
|
current_display->set_all(ed);
|
2019-06-25 09:23:01 +00:00
|
|
|
if(global_projection)
|
|
|
|
glhr::projection_multiply(glhr::tmtogl(xpush(-vid.ipd * global_projection/2)));
|
|
|
|
glapplymatrix(Id);
|
2019-06-24 12:42:43 +00:00
|
|
|
glhr::prepare(skyvertices);
|
|
|
|
glhr::set_fogbase(1.0 + 5 / sightranges[geometry]);
|
|
|
|
glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE);
|
|
|
|
glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW && prio != PPR::EUCLIDEAN_SKY);
|
|
|
|
glDrawArrays(GL_TRIANGLES, 0, isize(skyvertices));
|
|
|
|
}
|
2019-05-28 23:06:01 +00:00
|
|
|
}
|
|
|
|
|
2019-06-17 17:36:29 +00:00
|
|
|
color_t skycolor(cell *c) {
|
|
|
|
int cd = (euclid || stdhyperbolic) ? getCdata(c, 1) : 0;
|
|
|
|
int z = (cd * 5) & 127;
|
|
|
|
if(z >= 64) z = 127 - z;
|
|
|
|
if(c->land == laHell)
|
|
|
|
return z < 32 ? gradient(0x400000, 0xFF0000, 0, z, 32) : gradient(0xFF0000, 0xFFFF00, 32, z, 63);
|
|
|
|
else
|
|
|
|
return gradient(0x4040FF, 0xFFFFFF, 0, z, 63);
|
|
|
|
}
|
|
|
|
|
2019-05-20 11:40:56 +00:00
|
|
|
void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& wcol) {
|
|
|
|
|
|
|
|
if(pmodel != mdPerspective || sphere) return;
|
|
|
|
|
|
|
|
switch(ceiling_category(c)) {
|
|
|
|
/* ceilingless levels */
|
|
|
|
case 1: {
|
2019-05-28 23:06:01 +00:00
|
|
|
if(euclid) return;
|
2019-05-20 11:40:56 +00:00
|
|
|
if(fieldpattern::fieldval_uniq(c) % 3 == 0) {
|
2019-06-07 15:51:50 +00:00
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
2019-05-20 11:40:56 +00:00
|
|
|
}
|
2019-06-07 15:53:17 +00:00
|
|
|
if(sky) sky->sky.emplace_back(sky_item{c, V, 0x00000F});
|
2019-05-21 23:14:39 +00:00
|
|
|
if(c->land == laAsteroids) {
|
|
|
|
if(fieldpattern::fieldval_uniq(c) % 9 < 3) {
|
2019-06-07 15:51:50 +00:00
|
|
|
queuepolyat(V * zpush(-1-cgi.SKY), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
2019-05-21 23:14:39 +00:00
|
|
|
}
|
2019-06-01 15:01:04 +00:00
|
|
|
int sk = get_skybrightness(-1);
|
2019-05-26 16:04:02 +00:00
|
|
|
auto sky = draw_shapevec(c, V * MirrorZ, cgi.shFullFloor.levels[SIDE_SKY], 0x000000FF + 0x100 * (sk/17), PPR::SKY);
|
2019-05-21 23:14:39 +00:00
|
|
|
if(sky) sky->tinf = NULL, sky->flags |= POLY_INTENSE;
|
|
|
|
}
|
2019-05-20 11:40:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2: {
|
2019-05-28 23:06:01 +00:00
|
|
|
if(euclid) return;
|
2019-05-20 11:40:56 +00:00
|
|
|
color_t col;
|
2019-06-01 15:01:04 +00:00
|
|
|
|
|
|
|
switch(c->land) {
|
|
|
|
case laWineyard:
|
|
|
|
col = 0x4040FF;
|
|
|
|
if(emeraldval(c) / 4 == 11) {
|
2019-06-07 15:51:50 +00:00
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shSun, 0xFFFF00FF, PPR::SKY);
|
2019-06-01 15:01:04 +00:00
|
|
|
}
|
|
|
|
break;
|
2019-06-01 17:26:02 +00:00
|
|
|
|
|
|
|
case laPower:
|
|
|
|
col = c->landparam ? 0xFF2010 : 0x000020;
|
|
|
|
break;
|
2019-06-01 15:01:04 +00:00
|
|
|
|
|
|
|
case laDesert:
|
|
|
|
case laRedRock:
|
|
|
|
col = 0x4040FF;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laAlchemist:
|
|
|
|
col = fcol;
|
|
|
|
break;
|
|
|
|
|
2019-06-13 15:25:11 +00:00
|
|
|
case laVariant: {
|
|
|
|
int b = getBits(c);
|
|
|
|
col = 0x404040;
|
|
|
|
for(int a=0; a<21; a++)
|
|
|
|
if((b >> a) & 1)
|
|
|
|
col += variant_features[a].color_change;
|
|
|
|
col = col & 0x00FF00;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-06-01 15:01:04 +00:00
|
|
|
case laDragon:
|
|
|
|
col = c->wall == waChasm ? 0xFFFFFF : 0x4040FF;
|
|
|
|
break;
|
|
|
|
|
2019-06-17 17:36:29 +00:00
|
|
|
default:
|
|
|
|
col = skycolor(c);
|
2019-05-20 11:40:56 +00:00
|
|
|
}
|
2019-06-07 15:53:17 +00:00
|
|
|
if(sky) sky->sky.emplace_back(c, V, col);
|
2019-05-20 11:40:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3: {
|
2019-06-07 15:53:17 +00:00
|
|
|
if(sky) sky->sky.emplace_back(c, V, 0);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(camera_level <= cgi.WALL) return;
|
2019-06-24 11:57:10 +00:00
|
|
|
if(c->land == laMercuryRiver) fcol = linf[laTerracotta].color, fd = 1;
|
2019-06-03 12:48:03 +00:00
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(fcol, fd, 0xFF), PPR::WALL);
|
2019-05-20 11:40:56 +00:00
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
if(ceiling_category(c2) != 3) {
|
|
|
|
color_t wcol2 = gradient(0, wcol, 0, .8, 1);
|
2019-06-07 15:51:50 +00:00
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
2019-05-20 11:40:56 +00:00
|
|
|
placeSidewall(c, i, SIDE_SKY, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2019-05-24 23:36:49 +00:00
|
|
|
|
|
|
|
case 4: {
|
2019-06-07 15:53:17 +00:00
|
|
|
if(sky) sky->sky.emplace_back(c, V, 0x00000F);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(camera_level <= cgi.HIGH2) return;
|
2019-05-24 23:36:49 +00:00
|
|
|
auto ispal = [&] (cell *c0) { return c0->land == laPalace && among(c0->wall, waPalace, waClosedGate, waOpenGate); };
|
|
|
|
color_t wcol2 = 0xFFD500;
|
|
|
|
if(ispal(c)) {
|
|
|
|
forCellIdEx(c2, i, c) if(!ispal(c2))
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bool window = false;
|
2019-05-25 01:37:45 +00:00
|
|
|
forCellIdEx(c2, i, c) if(c2->wall == waPalace && ispal(c->cmodmove(i+1)) && ispal(c->cmodmove(i-1))) window = true;
|
2019-06-03 12:48:03 +00:00
|
|
|
if(qfi.fshape && !window) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(fcol, fd, 0xFF), PPR::WALL);
|
2019-05-24 23:36:49 +00:00
|
|
|
if(window)
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
}
|
2019-06-03 12:48:03 +00:00
|
|
|
if(among(c->wall, waClosedGate, waOpenGate) && qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], 0x202020FF, PPR::WALL);
|
2019-05-28 23:06:01 +00:00
|
|
|
if(euclid) return;
|
2019-05-24 23:36:49 +00:00
|
|
|
|
|
|
|
if(true) {
|
2019-05-28 23:59:01 +00:00
|
|
|
queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
2019-05-24 23:36:49 +00:00
|
|
|
}
|
2019-05-25 01:37:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-06-17 17:36:29 +00:00
|
|
|
case 6: {
|
|
|
|
if(sky) sky->sky.emplace_back(c, V, skycolor(c));
|
|
|
|
if(camera_level <= cgi.HIGH2) return;
|
|
|
|
color_t wcol2 = winf[waRuinWall].color;
|
|
|
|
if(c->landparam == 1)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam != 1)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam != 2)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam == 2)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam == 0)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
if(c->landparam == 1)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 7: {
|
|
|
|
if(sky) sky->sky.emplace_back(c, V, 0x00000F);
|
2019-06-17 23:38:11 +00:00
|
|
|
if(fieldpattern::fieldval_uniq(c) % 5 < 2) {
|
2019-06-17 17:36:29 +00:00
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
|
|
|
}
|
|
|
|
if(camera_level <= cgi.HIGH2) return;
|
|
|
|
color_t wcol2 = winf[waColumn].color;
|
|
|
|
if(c->landparam == 1)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam != 1)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam != 2)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam == 2)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam == 0)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
if(c->landparam == 1)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-05-25 01:37:27 +00:00
|
|
|
case 5: {
|
2019-06-07 15:53:17 +00:00
|
|
|
if(sky) sky->sky.emplace_back(c, V, 0x00000F);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(camera_level <= cgi.WALL) return;
|
2019-05-25 01:37:27 +00:00
|
|
|
|
|
|
|
if(pseudohept(c)) {
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(fcol, fd, 0xFF));
|
|
|
|
}
|
2019-06-03 12:48:03 +00:00
|
|
|
else if(qfi.fshape)
|
2019-05-25 01:37:27 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(fcol, fd, 0xFF), PPR::WALL);
|
|
|
|
|
2019-05-28 23:06:01 +00:00
|
|
|
if(euclid) return;
|
2019-05-25 01:37:27 +00:00
|
|
|
if(true) {
|
2019-05-28 23:59:01 +00:00
|
|
|
queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
2019-05-25 01:37:27 +00:00
|
|
|
}
|
2019-05-24 23:36:49 +00:00
|
|
|
}
|
2019-05-20 11:40:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-16 15:41:37 +00:00
|
|
|
void drawcell_in_radar(cell *c, transmatrix V) {
|
|
|
|
#if CAP_SHMUP
|
|
|
|
if(shmup::on) {
|
|
|
|
pair<shmup::mit, shmup::mit> p =
|
|
|
|
shmup::monstersAt.equal_range(c);
|
|
|
|
for(shmup::mit it = p.first; it != p.second; it++) {
|
|
|
|
shmup::monster* m = it->second;
|
|
|
|
addradar(V*m->at, minf[m->type].glyph, minf[m->type].color, 0xFF0000FF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if(c->monst)
|
|
|
|
addradar(V, minf[c->monst].glyph, minf[c->monst].color, isFriendly(c->monst) ? 0x00FF00FF : 0xFF0000FF);
|
|
|
|
else if(c->item && !itemHiddenFromSight(c))
|
|
|
|
addradar(V, iinf[c->item].glyph, iinf[c->item].color, kind_outline(c->item));
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-05-16 15:41:37 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
2019-07-28 09:17:25 +00:00
|
|
|
|
|
|
|
PROD( if(product::pmap) { product::drawcell_stack(c, V, spinv, mirrored); return; } )
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2018-11-01 17:59:25 +00:00
|
|
|
cells_drawn++;
|
|
|
|
|
2018-01-05 16:30:03 +00:00
|
|
|
#if CAP_TEXTURE
|
2017-12-21 13:05:07 +00:00
|
|
|
if(texture::saving) {
|
2018-03-17 20:12:46 +00:00
|
|
|
texture::config.apply(c, V, 0xFFFFFFFF);
|
2018-06-17 10:03:05 +00:00
|
|
|
draw_qfi(c, V, 0xFFFFFFFF);
|
2017-12-21 13:05:07 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-01-03 14:12:45 +00:00
|
|
|
|
|
|
|
if((cmode & sm::DRAW) && texture::config.tstate == texture::tsActive && !mouseout() && c)
|
|
|
|
mapeditor::draw_texture_ghosts(c, V);
|
2018-01-05 16:30:03 +00:00
|
|
|
#endif
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
bool orig = false;
|
|
|
|
if(!inmirrorcount) {
|
|
|
|
transmatrix& gm = gmatrix[c];
|
|
|
|
orig =
|
2019-02-21 17:46:53 +00:00
|
|
|
gm[DIM][DIM] == 0 ? true :
|
2019-04-15 21:29:07 +00:00
|
|
|
euwrap ? hdist0(tC0(gm)) >= hdist0(tC0(V)) :
|
2019-02-21 17:46:53 +00:00
|
|
|
sphereflipped() ? fabs(gm[DIM][DIM]-1) <= fabs(V[DIM][DIM]-1) :
|
|
|
|
fabs(gm[DIM][DIM]-1) >= fabs(V[DIM][DIM]-1) - 1e-8;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
if(orig) gm = V;
|
|
|
|
}
|
2018-05-07 18:13:56 +00:00
|
|
|
if(just_gmatrix) return;
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-08-06 10:00:46 +00:00
|
|
|
if(WDIM == 3 && pmodel == mdPerspective && !nil) {
|
2019-05-11 13:06:48 +00:00
|
|
|
hyperpoint H = tC0(V);
|
2019-05-26 16:04:02 +00:00
|
|
|
for(hyperpoint& cpoint: clipping_planes) if((H|cpoint) < -sin_auto(cgi.corner_bonus)) {
|
2019-05-16 15:41:37 +00:00
|
|
|
drawcell_in_radar(c, V);
|
2019-05-11 13:06:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
noclipped++;
|
|
|
|
}
|
2019-08-06 18:55:41 +00:00
|
|
|
if(pmodel == mdGeodesic && sol) {
|
2019-07-31 11:21:33 +00:00
|
|
|
hyperpoint H = tC0(V);
|
2019-08-06 18:55:41 +00:00
|
|
|
if(abs(H[0]) <= 3 && abs(H[1]) <= 3 && abs(H[2]) <= 3 ) ;
|
2019-07-31 11:21:33 +00:00
|
|
|
else {
|
2019-08-06 10:00:46 +00:00
|
|
|
hyperpoint H2 = nisot::inverse_exp(H, nisot::iLazy);
|
2019-07-31 11:21:33 +00:00
|
|
|
for(hyperpoint& cpoint: clipping_planes) if((H2|cpoint) < -.2) return;
|
|
|
|
}
|
|
|
|
noclipped++;
|
|
|
|
}
|
2019-08-06 18:55:41 +00:00
|
|
|
if(pmodel == mdGeodesic && nil) {
|
|
|
|
hyperpoint H = tC0(V);
|
|
|
|
if(abs(H[0]) <= 3 && abs(H[1]) <= 3 && abs(H[2]) <= 3 ) ;
|
|
|
|
else {
|
|
|
|
hyperpoint H2 = nisot::inverse_exp(H, nisot::iLazy);
|
|
|
|
for(hyperpoint& cpoint: clipping_planes) if((H2|cpoint) < -2) return;
|
|
|
|
}
|
|
|
|
noclipped++;
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2018-05-07 18:13:56 +00:00
|
|
|
ivoryz = isGravityLand(c->land);
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-11-03 18:20:54 +00:00
|
|
|
// if(behindsphere(V)) return;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-07-07 09:05:48 +00:00
|
|
|
if(callhandlers(false, hooks_drawcell, c, V)) return;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
ld dist0 = hdist0(tC0(V)) - 1e-6;
|
2018-11-01 17:59:25 +00:00
|
|
|
if(vid.use_smart_range) detaillevel = 2;
|
2019-05-29 14:27:24 +00:00
|
|
|
else if(dist0 < vid.highdetail) detaillevel = 2;
|
|
|
|
else if(dist0 < vid.middetail) detaillevel = 1;
|
2017-07-10 18:47:38 +00:00
|
|
|
else detaillevel = 0;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
#ifdef BUILDZEBRA
|
|
|
|
if(c->type == 6 && c->tmp > 0) {
|
|
|
|
int i = c->tmp;
|
|
|
|
zebra(cellwalker(c, i&15), 1, i>>4, "", 0);
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
c->item = eItem(c->heat / 4);
|
|
|
|
buildAutomatonRule(c);
|
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
viewBuggyCells(c,V);
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-05-08 16:33:08 +00:00
|
|
|
if(conformal::on || inHighQual || WDIM == 3 || sightrange_bonus > gamerange_bonus) checkTide(c);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// save the player's view center
|
|
|
|
if(isPlayerOn(c) && !shmup::on) {
|
|
|
|
playerfound = true;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::players > 1) {
|
|
|
|
for(int i=0; i<numplayers(); i++)
|
|
|
|
if(playerpos(i) == c) {
|
2019-04-20 23:08:27 +00:00
|
|
|
playerV = V * ddspin(c, multi::player[i].spin, 0);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
|
|
|
if(multi::player[i].mirrored == mirrored)
|
|
|
|
multi::whereis[i] = playerV;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-04-20 23:08:27 +00:00
|
|
|
playerV = V * ddspin(c, cwt.spin, 0);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(cwt.mirrored) playerV = playerV * Mirror;
|
|
|
|
if(orig) cwtV = playerV;
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(1) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-05-09 15:02:50 +00:00
|
|
|
ld dist = mousedist(V);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
if(inmirrorcount) ;
|
2019-05-09 15:02:50 +00:00
|
|
|
else if(WDIM == 3) ;
|
|
|
|
else if(dist < modist) {
|
2017-07-10 18:47:38 +00:00
|
|
|
modist2 = modist; mouseover2 = mouseover;
|
2019-05-09 15:02:50 +00:00
|
|
|
modist = dist;
|
2017-07-10 18:47:38 +00:00
|
|
|
mouseover = c;
|
|
|
|
}
|
2019-05-09 15:02:50 +00:00
|
|
|
else if(dist < modist2) {
|
|
|
|
modist2 = dist;
|
2017-07-10 18:47:38 +00:00
|
|
|
mouseover2 = c;
|
|
|
|
}
|
2017-07-16 21:00:55 +00:00
|
|
|
|
2019-08-02 15:33:42 +00:00
|
|
|
if(!masterless) {
|
2019-05-09 15:02:50 +00:00
|
|
|
double dfc = euclid ? intval(tC0(V), C0) : V[GDIM][GDIM];
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(dfc < centdist) {
|
|
|
|
centdist = dfc;
|
2017-12-28 15:46:10 +00:00
|
|
|
centerover = cellwalker(c, spinv, mirrored);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int orbrange = (items[itRevolver] ? 3 : 2);
|
|
|
|
|
|
|
|
if(c->cpdist <= orbrange) if(multi::players > 1 || multi::alwaysuse)
|
|
|
|
for(int i=0; i<multi::players; i++) if(multi::playerActive(i)) {
|
2019-05-09 15:02:50 +00:00
|
|
|
double dfc = intval(tC0(V), tC0(multi::crosscenter[i]));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(dfc < multi::ccdist[i] && celldistance(playerpos(i), c) <= orbrange) {
|
|
|
|
multi::ccdist[i] = dfc;
|
|
|
|
multi::ccat[i] = c;
|
|
|
|
}
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
if(inmirror(c)) {
|
|
|
|
if(inmirrorcount >= 10) return;
|
|
|
|
cellwalker cw(c, 0, mirrored);
|
|
|
|
cw = mirror::reflect(cw);
|
|
|
|
int cmc = (cw.mirrored == mirrored) ? 2 : 1;
|
|
|
|
inmirrorcount += cmc;
|
2019-06-17 08:59:36 +00:00
|
|
|
if(vid.grid) draw_grid_at(c, V);
|
2017-07-16 21:00:55 +00:00
|
|
|
if(cw.mirrored != mirrored) V = V * Mirror;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(cw.spin) V = V * spin(2*M_PI*cw.spin/cw.at->type);
|
|
|
|
drawcell(cw.at, V, 0, cw.mirrored);
|
2017-07-16 21:00:55 +00:00
|
|
|
inmirrorcount -= cmc;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
// color_t col = 0xFFFFFF - 0x20 * c->maxdist - 0x2000 * c->cpdist;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2018-07-10 21:03:02 +00:00
|
|
|
if(!buggyGeneration && c->mpdist > 8 && !cheater && !autocheat) return; // not yet generated
|
2017-09-03 10:01:31 +00:00
|
|
|
/* if(!buggyGeneration && c->mpdist > 7 && !cheater) {
|
|
|
|
int cd = c->mpdist;
|
|
|
|
string label = its(cd);
|
|
|
|
int dc = distcolors[cd&7];
|
|
|
|
queuestr(V, (cd > 9 ? .6 : 1) * .2, label, 0xFF000000 + dc, 1);
|
|
|
|
} */
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-12 17:50:39 +00:00
|
|
|
if(c->land == laNone && (cmode & sm::MAP)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shTriangle, 0xFF0000FF);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
char ch = winf[c->wall].glyph;
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t wcol, fcol, asciicol;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
setcolors(c, wcol, fcol);
|
2017-10-30 22:58:18 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
if(inmirror(c)) {
|
|
|
|
// for debugging
|
|
|
|
if(c->land == laMirrored) fcol = 0x008000;
|
|
|
|
if(c->land == laMirrorWall2) fcol = 0x800000;
|
|
|
|
if(c->land == laMirrored2) fcol = 0x000080;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int k=0; k<inmirrorcount; k++)
|
|
|
|
wcol = gradient(wcol, 0xC0C0FF, 0, 0.2, 1),
|
|
|
|
fcol = gradient(fcol, 0xC0C0FF, 0, 0.2, 1);
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// addaura(tC0(V), wcol);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t zcol = fcol;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(peace::on && peace::hint && c->land != laTortoise) {
|
|
|
|
int d =
|
|
|
|
(c->land == laCamelot || (c->land == laCaribbean && celldistAlt(c) <= 0) || (c->land == laPalace && celldistAlt(c))) ? celldistAlt(c):
|
|
|
|
celldist(c);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int dc =
|
2018-09-10 15:49:51 +00:00
|
|
|
0x10101 * (127 + int(127 * sintick(200, d*.75/M_PI)));
|
2017-07-10 18:47:38 +00:00
|
|
|
wcol = gradient(wcol, dc, 0, .3, 1);
|
|
|
|
fcol = gradient(fcol, dc, 0, .3, 1);
|
|
|
|
}
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
if(c->land == laMirrored || c->land == laMirrorWall2 || c->land == laMirrored2) {
|
|
|
|
string label = its(c->landparam);
|
|
|
|
queuestr(V, 1 * .2, label, 0xFFFFFFFF, 1);
|
|
|
|
}
|
2018-09-21 17:51:13 +00:00
|
|
|
|
|
|
|
if(viewdists) do_viewdist(c, V, wcol, fcol);
|
2018-09-13 18:38:06 +00:00
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
if(cmode & sm::TORUSCONFIG) {
|
|
|
|
using namespace torusconfig;
|
2017-12-28 15:46:10 +00:00
|
|
|
string label;
|
|
|
|
bool small;
|
|
|
|
if(tmflags() & TF_SINGLE) {
|
|
|
|
int cd = torus_cx * dx + torus_cy * newdy;
|
|
|
|
cd %= newqty; if(cd<0) cd += newqty;
|
|
|
|
label = its(cd);
|
|
|
|
small = cd;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
small = true;
|
|
|
|
label = its(torus_cx) + "," + its(torus_cy);
|
|
|
|
}
|
|
|
|
queuestr(V, small ? .2 : .6, label, small ? 0xFFFFFFD0 : 0xFFFF0040, 1);
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
asciicol = wcol;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-05-13 06:59:53 +00:00
|
|
|
if(c->wall == waThumperOn && DIM == 2) {
|
2018-09-10 15:49:51 +00:00
|
|
|
ld ds = fractick(160);
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int u=0; u<5; u++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
ld rad = cgi.hexf * (.3 * (u + ds));
|
|
|
|
int tcol = darkena(gradient(forecolor, backcolor, 0, rad, 1.5 * cgi.hexf), 0, 0xFF);
|
2018-08-01 09:07:22 +00:00
|
|
|
PRING(a)
|
2019-05-26 16:04:02 +00:00
|
|
|
curvepoint(V*xspinpush0(a * M_PI / cgi.S42, rad));
|
2018-08-28 12:27:23 +00:00
|
|
|
queuecurve(tcol, 0, PPR::LINE);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
// bool dothept = false;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
/* if(pseudohept(c) && vid.darkhepta) {
|
|
|
|
col = gradient(0, col, 0, 0.75, 1);
|
|
|
|
} */
|
|
|
|
|
|
|
|
eItem it = c->item;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool hidden = itemHidden(c);
|
|
|
|
bool hiddens = itemHiddenFromSight(c);
|
|
|
|
|
2018-06-28 10:59:35 +00:00
|
|
|
if(conformal::includeHistory && conformal::infindhistory.count(c)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
hidden = true;
|
|
|
|
hiddens = false;
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 17:50:39 +00:00
|
|
|
if(hiddens && !(cmode & sm::MAP))
|
2017-07-10 18:47:38 +00:00
|
|
|
it = itNone;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int icol = 0, moncol = 0xFF00FF;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-06-17 08:59:48 +00:00
|
|
|
if(it) {
|
2017-07-10 18:47:38 +00:00
|
|
|
ch = iinf[it].glyph, asciicol = icol = iinf[it].color;
|
2019-06-17 08:59:48 +00:00
|
|
|
|
|
|
|
if(it == itCompass && isPlayerOn(c)) {
|
|
|
|
cell *c1 = c ? findcompass(c) : NULL;
|
|
|
|
if(c1) {
|
|
|
|
transmatrix P = ggmatrix(c1);
|
|
|
|
hyperpoint P1 = tC0(P);
|
|
|
|
|
|
|
|
queuechr(P1, 2*vid.fsize, 'X', 0x10100 * int(128 + 100 * sintick(150)));
|
|
|
|
queuestr(P1, vid.fsize, its(-compassDist(c)), 0x10101 * int(128 - 100 * sintick(150)));
|
|
|
|
addauraspecial(P1, 0xFF0000, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->monst) {
|
|
|
|
ch = minf[c->monst].glyph, moncol = minf[c->monst].color;
|
2019-06-17 09:00:01 +00:00
|
|
|
if(c->monst == moMimic) {
|
|
|
|
int all = 0, mirr = 0;
|
|
|
|
for(auto& m: mirror::mirrors) if(c == m.second.at) {
|
|
|
|
all++;
|
|
|
|
if(m.second.mirrored) mirr++;
|
|
|
|
}
|
|
|
|
if(all == 1) moncol = mirrorcolor(mirr);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->monst == moMutant) {
|
|
|
|
// root coloring
|
|
|
|
if(c->stuntime != mutantphase)
|
|
|
|
moncol =
|
|
|
|
gradient(0xC00030, 0x008000, 0, (c->stuntime-mutantphase) & 15, 15);
|
|
|
|
}
|
|
|
|
if(isMetalBeast(c->monst) && c->stuntime)
|
|
|
|
moncol >>= 1;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->monst == moSlime) {
|
|
|
|
moncol = winf[c->wall].color;
|
|
|
|
moncol |= (moncol>>1);
|
|
|
|
}
|
|
|
|
|
|
|
|
asciicol = moncol;
|
2017-04-04 09:13:15 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(isDragon(c->monst) || isKraken(c->monst)) if(!c->hitpoints)
|
|
|
|
asciicol = 0x505050;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->monst == moTortoise)
|
|
|
|
asciicol = tortoise::getMatchColor(tortoise::getb(c));
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->monst != moMutant) for(int k=0; k<c->stuntime; k++)
|
|
|
|
asciicol = ((asciicol & 0xFEFEFE) >> 1) + 0x101010;
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->cpdist == 0 && mapeditor::drawplayer) {
|
|
|
|
ch = '@';
|
|
|
|
if(!mmitem) asciicol = moncol = cheater ? 0xFF3030 : 0xD0D0D0;
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->ligon) {
|
|
|
|
int tim = ticks - lightat;
|
|
|
|
if(tim > 1000) tim = 800;
|
|
|
|
if(elec::havecharge && tim > 400) tim = 400;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int t=0; t<c->type; t++) if(c->move(t) && c->move(t)->ligon) {
|
2018-08-19 13:52:39 +00:00
|
|
|
ld hdir = displayspin(c, t);
|
2017-07-10 18:47:38 +00:00
|
|
|
int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF);
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(V*chei(xspinpush(ticks * M_PI / cgi.S42, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(xspinpush(hdir, cgi.crossf), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-28 08:04:28 +00:00
|
|
|
int ctype = c->type;
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-10-28 08:04:28 +00:00
|
|
|
int ct6 = ctof(c);
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
bool error = false;
|
2019-05-12 18:10:49 +00:00
|
|
|
bool onradar = true;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
chasmg = chasmgraph(c);
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-10-17 10:54:59 +00:00
|
|
|
int fd = getfd(c);
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-08-27 17:27:35 +00:00
|
|
|
int flooralpha = 255;
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2019-01-14 21:56:52 +00:00
|
|
|
#if CAP_EDIT && CAP_TEXTURE
|
2019-01-03 14:15:36 +00:00
|
|
|
if((cmode & sm::DRAW) && mapeditor::drawcell && mapeditor::drawcellShapeGroup() == mapeditor::sgFloor && texture::config.tstate != texture::tsActive)
|
2018-08-27 17:27:35 +00:00
|
|
|
flooralpha = 0xC0;
|
2018-08-31 18:59:58 +00:00
|
|
|
#endif
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2017-10-08 09:12:03 +00:00
|
|
|
if(c->wall == waMagma) fd = 0;
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
2018-08-28 12:27:23 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int sl = snakelevel(c);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
transmatrix Vd0, Vboat0;
|
2017-07-10 18:47:38 +00:00
|
|
|
const transmatrix *Vdp =
|
2019-05-09 23:03:53 +00:00
|
|
|
WDIM == 3 ? &V:
|
|
|
|
!wmspatial ? &V :
|
2019-05-26 16:04:02 +00:00
|
|
|
sl ? &(Vd0= mscale(V, DIM == 3 ? cgi.SLEV[sl] - cgi.FLOOR : cgi.SLEV[sl])) :
|
|
|
|
(highwall(c) && GDIM == 2) ? &(Vd0= mscale(V, (1+cgi.WALL)/2)) :
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-05-26 16:04:02 +00:00
|
|
|
(chasmg==1) ? &(Vd0 = mscale(V, DIM == 3 ? cgi.LAKE - cgi.FLOOR : cgi.LAKE)) :
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
&V;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-02-17 17:41:40 +00:00
|
|
|
transmatrix Vf0;
|
2019-05-26 16:04:02 +00:00
|
|
|
const transmatrix& Vf = (chasmg && wmspatial) ? (Vf0=mscale(V, cgi.BOTTOM)) : V;
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
const transmatrix *Vboat = &(*Vdp);
|
|
|
|
|
2018-07-09 18:38:20 +00:00
|
|
|
shmup::drawMonster(V, c, Vboat, Vboat0, Vdp);
|
2017-06-18 16:51:46 +00:00
|
|
|
|
2018-08-28 12:27:23 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
2019-02-17 17:41:40 +00:00
|
|
|
if(!wmascii) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-08-31 18:59:58 +00:00
|
|
|
#if CAP_EDIT
|
|
|
|
auto si = patterns::getpatterninfo0(c);
|
2018-08-28 11:45:11 +00:00
|
|
|
if(drawing_usershape_on(c, mapeditor::sgFloor))
|
2018-08-27 17:27:35 +00:00
|
|
|
mapeditor::drawtrans = V * applyPatterndir(c, si);
|
2018-08-31 18:59:58 +00:00
|
|
|
#endif
|
2018-08-27 17:27:35 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-02-17 17:41:40 +00:00
|
|
|
// floor
|
|
|
|
bool eoh = euclid || !BITRUNCATED;
|
|
|
|
|
2019-06-01 18:41:09 +00:00
|
|
|
if(DIM == 2 && (c->land != laRose || chaosmode)) {
|
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd == 1)
|
|
|
|
draw_floorshape(c, mmscale(V, cgi.SLEV[2]), cgi.shRoseFloor, 0x80406040, PPR::LIZEYE);
|
|
|
|
if(rd == 2)
|
|
|
|
draw_floorshape(c, mmscale(V, cgi.SLEV[2]), cgi.shRoseFloor, 0x80406080, PPR::LIZEYE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(c->wall == waChasm) {
|
2018-02-05 00:17:11 +00:00
|
|
|
zcol = 0;
|
|
|
|
int rd = rosedist(c);
|
2019-06-01 18:41:09 +00:00
|
|
|
if(DIM == 2) {
|
2019-06-01 18:19:35 +00:00
|
|
|
if(rd == 1)
|
|
|
|
draw_floorshape(c, V, cgi.shRoseFloor, 0x80406020);
|
|
|
|
if(rd == 2)
|
|
|
|
draw_floorshape(c, V, cgi.shRoseFloor, 0x80406040);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->land == laZebra) fd++;
|
|
|
|
if(c->land == laHalloween && !wmblack) {
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vdepth = wmspatial ? mscale(V, cgi.BOTTOM) : V;
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_shapevec(c, V, cgi.shFullFloor.levels[SIDE_LAKE], darkena(firecolor(0, 10), 0, 0xDF), PPR::TRANSPARENT_LAKE);
|
2019-05-09 23:02:10 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, Vdepth, cgi.shFullFloor, darkena(firecolor(0, 10), 0, 0xDF), PPR::LAKEBOTTOM);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_EDIT
|
2018-08-30 17:14:04 +00:00
|
|
|
else if(mapeditor::haveUserShape(mapeditor::sgFloor, si.id)) {
|
|
|
|
qfi.usershape = si.id;
|
2018-08-27 17:27:35 +00:00
|
|
|
qfi.spin = applyPatterndir(c, si);
|
|
|
|
}
|
2019-02-09 13:22:05 +00:00
|
|
|
#endif
|
2018-05-07 18:13:56 +00:00
|
|
|
|
|
|
|
else if(patterns::whichShape == '7')
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shBigHepta);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
else if(patterns::whichShape == '8')
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTriheptaFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
else if(patterns::whichShape == '6')
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shBigTriangle);
|
2018-06-25 21:01:39 +00:00
|
|
|
|
2019-01-28 20:41:43 +00:00
|
|
|
else if(among(patterns::whichShape, '9', '^'))
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFullFloor);
|
2017-12-09 01:20:10 +00:00
|
|
|
|
2017-12-21 10:36:07 +00:00
|
|
|
#if CAP_TEXTURE
|
2019-04-12 13:18:16 +00:00
|
|
|
else if(DIM == 2 && texture::config.apply(c, Vf, darkena(fcol, fd, 0xFF))) ;
|
2017-12-21 10:36:07 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
else if(c->land == laMirrorWall) {
|
|
|
|
int d = mirror::mirrordir(c);
|
|
|
|
bool onleft = c->type == 7;
|
|
|
|
if(c->type == 7 && c->barleft == laMirror)
|
|
|
|
onleft = !onleft;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c->type == 6 && d != -1 && c->move(d)->barleft == laMirror)
|
2017-07-16 21:00:55 +00:00
|
|
|
onleft = !onleft;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(PURE) onleft = !onleft;
|
2017-07-16 21:00:55 +00:00
|
|
|
|
|
|
|
if(d == -1) {
|
2018-08-17 22:46:45 +00:00
|
|
|
for(d=0; d<c->type; d++)
|
|
|
|
if(c->move(d) && c->modmove(d+1) && c->move(d)->land == laMirrorWall && c->modmove(d+1)->land == laMirrorWall)
|
2017-07-16 21:00:55 +00:00
|
|
|
break;
|
|
|
|
qfi.spin = ddspin(c, d, 0);
|
2018-08-17 22:46:45 +00:00
|
|
|
transmatrix V2 = V * qfi.spin;
|
|
|
|
if(!wmblack) for(int d=0; d<c->type; d++) {
|
2017-07-16 21:00:55 +00:00
|
|
|
inmirrorcount+=d;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V2 * spin(d*M_PI/S3), cgi.shHalfFloor[2], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
if(GDIM == 3 && camera_level > cgi.WALL && pmodel == mdPerspective)
|
|
|
|
queuepolyat(V2 * spin(d*M_PI/S3), cgi.shHalfFloor[5], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2017-07-16 21:00:55 +00:00
|
|
|
inmirrorcount-=d;
|
2017-07-22 23:33:27 +00:00
|
|
|
}
|
2019-05-09 19:53:00 +00:00
|
|
|
if(GDIM == 3) {
|
|
|
|
for(int d=0; d<6; d++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queue_transparent_wall(V2 * spin(d*M_PI/S3), cgi.shHalfMirror[2], 0xC0C0C080);
|
2019-05-09 19:53:00 +00:00
|
|
|
}
|
|
|
|
else if(wmspatial) {
|
2017-07-22 23:33:27 +00:00
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mscale(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), cgi.shHalfMirror[2], 0xC0C0C080, PPR::WALL3+z-layers);
|
2017-07-16 21:00:55 +00:00
|
|
|
}
|
2017-07-22 23:33:27 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V2, cgi.shHalfMirror[2], 0xC0C0C080, PPR::WALL3);
|
2017-07-16 21:00:55 +00:00
|
|
|
}
|
|
|
|
else {
|
2018-08-19 13:52:39 +00:00
|
|
|
qfi.spin = ddspin(c, d, M_PI);
|
2017-07-16 21:00:55 +00:00
|
|
|
transmatrix V2 = V * qfi.spin;
|
2017-07-22 23:33:27 +00:00
|
|
|
if(!wmblack) {
|
|
|
|
inmirrorcount++;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mirrorif(V2, !onleft), cgi.shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
if(GDIM == 3 && camera_level > cgi.WALL && pmodel == mdPerspective)
|
|
|
|
queuepolyat(mirrorif(V2, !onleft), cgi.shHalfFloor[ct6+3], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2017-07-22 23:33:27 +00:00
|
|
|
inmirrorcount--;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mirrorif(V2, onleft), cgi.shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
if(GDIM == 3 && camera_level > cgi.WALL && pmodel == mdPerspective)
|
|
|
|
queuepolyat(mirrorif(V2, onleft), cgi.shHalfFloor[ct6+3], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2017-07-22 23:33:27 +00:00
|
|
|
}
|
|
|
|
|
2019-05-13 11:18:55 +00:00
|
|
|
if(GDIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queue_transparent_wall(V2, cgi.shHalfMirror[ct6], 0xC0C0C080);
|
2019-05-09 19:53:00 +00:00
|
|
|
else if(wmspatial) {
|
2017-07-22 23:33:27 +00:00
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mscale(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), cgi.shHalfMirror[ct6], 0xC0C0C080, PPR::WALL3+z-layers);
|
2017-07-22 23:33:27 +00:00
|
|
|
}
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V2, cgi.shHalfMirror[ct6], 0xC0C0C080, PPR::WALL3);
|
2017-07-16 21:00:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(c->land == laWineyard && cellHalfvine(c)) {
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int i =-1;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int t=0;t<6; t++) if(c->move(t) && c->move(t)->wall == c->wall)
|
2017-07-10 18:47:38 +00:00
|
|
|
i = t;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2018-08-19 13:52:39 +00:00
|
|
|
qfi.spin = ddspin(c, i, M_PI/S3);
|
2017-07-10 18:47:38 +00:00
|
|
|
transmatrix V2 = V * qfi.spin;
|
|
|
|
|
2019-05-20 11:39:32 +00:00
|
|
|
if(wmspatial && wmescher && GDIM == 2) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shSemiFeatherFloor[0]);
|
2017-07-10 18:47:38 +00:00
|
|
|
int dk = 1;
|
|
|
|
int vcol = winf[waVinePlant].color;
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_qfi(c, mscale(V2, cgi.WALL), darkena(vcol, dk, 0xFF), PPR::WALL3A);
|
2018-05-07 18:13:56 +00:00
|
|
|
escherSidewall(c, SIDE_WALL, V2, darkena(gradient(0, vcol, 0, .8, 1), dk, 0xFF));
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V2, cgi.shSemiFeatherFloor[1], darkena(fcol, dk, 0xFF));
|
|
|
|
set_floor(cgi.shFeatherFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2019-05-20 11:39:32 +00:00
|
|
|
else if(wmspatial || GDIM == 3) {
|
2019-05-26 16:04:02 +00:00
|
|
|
floorshape& shar = *((wmplain || GDIM == 3) ? (floorshape*)&cgi.shFloor : (floorshape*)&cgi.shFeatherFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
set_floor(shar);
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int vcol = winf[waVinePlant].color;
|
|
|
|
int vcol2 = gradient(0, vcol, 0, .8, 1);
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vdepth = mscale(V2, cgi.WALL);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(DIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A);
|
|
|
|
{dynamicval<color_t> p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), cgi.shSemiFloorShadow, SHADOW_WALL, DIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW); }
|
|
|
|
auto& side = queuepolyat(V2, cgi.shSemiFloorSide[SIDE_WALL], darkena(vcol, fd, 0xFF), PPR::WALL3A-2+away(V2));
|
|
|
|
if(DIM == 3 && qfi.fshape) side.tinf = &floor_texture_vertices[shar.id];
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) {
|
2017-07-10 18:47:38 +00:00
|
|
|
int dis = i-j;
|
|
|
|
dis %= 6;
|
|
|
|
if(dis<0) dis += 6;
|
|
|
|
if(dis != 1 && dis != 5) continue;
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, j, SIDE_WALL, V, darkena(vcol2, fd, 0xFF))) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
hpcshape *shar = cgi.shSemiFeatherFloor;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(wmblack) shar = cgi.shSemiBFloor;
|
|
|
|
if(wmplain) shar = cgi.shSemiFloor;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
queuepoly(V2, shar[0], darkena(winf[waVinePlant].color, fd, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
set_floor(qfi.spin, shar[1]);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
else if(c->land == laReptile || c->wall == waReptile)
|
|
|
|
set_reptile_floor(c, Vf, fcol);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
else if(wmblack == 1 && c->wall == waMineOpen && vid.grid)
|
|
|
|
;
|
|
|
|
|
|
|
|
else if(wmblack) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shBFloor[ct6]);
|
2017-07-10 18:47:38 +00:00
|
|
|
int rd = rosedist(c);
|
2019-08-07 22:20:14 +00:00
|
|
|
if(WDIM == 2 && rd == 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vf, cgi.shHeptaMarker, darkena(fcol, 0, 0x80));
|
2019-08-07 22:20:14 +00:00
|
|
|
else if(WDIM == 2 && rd == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vf, cgi.shHeptaMarker, darkena(fcol, 0, 0x40));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
else if(isWarped(c) || is_nice_dual(c))
|
|
|
|
set_maywarp_floor(c);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(wmplain) {
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-04-16 22:42:51 +00:00
|
|
|
else if(randomPatternsMode && c->land != laBarrier && !isWarpedType(c->land)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
int j = (randompattern[c->land]/5) % 15;
|
|
|
|
int k = randompattern[c->land] % RPV_MODULO;
|
|
|
|
int k7 = randompattern[c->land] % 7;
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
if(k == RPV_ZEBRA && k7 < 2) set_zebrafloor(c);
|
|
|
|
else if(k == RPV_EMERALD && k7 == 0) set_emeraldfloor(c);
|
|
|
|
else if(k == RPV_CYCLE && k7 < 4) set_towerfloor(c, celldist);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
else switch(j) {
|
2019-05-26 16:04:02 +00:00
|
|
|
case 0: set_floor(cgi.shCloudFloor); break;
|
|
|
|
case 1: set_floor(cgi.shFeatherFloor); break;
|
|
|
|
case 2: set_floor(cgi.shStarFloor); break;
|
|
|
|
case 3: set_floor(cgi.shTriFloor); break;
|
|
|
|
case 4: set_floor(cgi.shSStarFloor); break;
|
|
|
|
case 5: set_floor(cgi.shOverFloor); break;
|
|
|
|
case 6: set_floor(cgi.shFeatherFloor); break;
|
|
|
|
case 7: set_floor(cgi.shDemonFloor); break;
|
|
|
|
case 8: set_floor(cgi.shCrossFloor); break;
|
|
|
|
case 9: set_floor(cgi.shMFloor); break;
|
|
|
|
case 10: set_floor(cgi.shCaveFloor); break;
|
|
|
|
case 11: set_floor(cgi.shPowerFloor); break;
|
|
|
|
case 12: set_floor(cgi.shDesertFloor); break;
|
|
|
|
case 13: set_floor(cgi.shChargedFloor); break;
|
|
|
|
case 14: set_floor(cgi.shLavaFloor); break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// else if(c->land == laPrairie && !eoh && allemptynear(c) && fieldpattern::getflowerdist(c) <= 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
// queuepoly(Vf, cgi.shLeafFloor[ct6], darkena(fcol, fd, 0xFF));
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
/* else if(c->land == laPrairie && prairie::isriver(c))
|
2018-09-27 19:52:13 +00:00
|
|
|
|
|
|
|
set_towerfloor(Vf, c, darkena(fcol, fd, 0xFF),
|
2017-07-10 18:47:38 +00:00
|
|
|
prairie::isleft(c) ? river::towerleft : river::towerright); */
|
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
else switch(c->land) {
|
|
|
|
case laPrairie:
|
2018-05-07 18:13:56 +00:00
|
|
|
case laAlchemist:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shCloudFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
case laJungle:
|
2018-02-05 00:17:11 +00:00
|
|
|
case laWineyard:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFeatherFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laZebra:
|
2018-05-07 18:13:56 +00:00
|
|
|
set_zebrafloor(c);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laMountain:
|
2019-05-09 23:02:10 +00:00
|
|
|
if(shmup::on || DIM == 3)
|
2019-05-05 15:37:51 +00:00
|
|
|
shmup_gravity_floor(c);
|
|
|
|
else
|
|
|
|
set_towerfloor(c, euclid ? celldist : c->master->alt ? celldistAltPlus : celldist);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laEmerald:
|
2018-05-07 18:13:56 +00:00
|
|
|
set_emeraldfloor(c);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laRlyeh:
|
|
|
|
case laTemple:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTriFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laVolcano:
|
2018-12-25 18:25:09 +00:00
|
|
|
case laVariant:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shLavaFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laRose:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shRoseFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laTortoise:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTurtleFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laBurial: case laRuins:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shBarrowFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laTrollheim:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTrollFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
/*case laMountain:
|
2018-05-07 18:13:56 +00:00
|
|
|
set_floor(FEATHERFLOOR);
|
2018-02-05 00:17:11 +00:00
|
|
|
break; */
|
|
|
|
|
|
|
|
case laGraveyard:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shCrossFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laMotion:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shMFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laWhirlwind:
|
2018-05-07 18:13:56 +00:00
|
|
|
case laEFire: case laEAir: case laEWater: case laEEarth: case laElementalWall:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shNewFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laHell:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shDemonFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laIce: case laBlizzard:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shStarFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laSwitch:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shSwitchFloor);
|
2019-05-10 00:42:08 +00:00
|
|
|
if(ctof(c) && STDVAR && !archimedean && !binarytiling && GDIM == 2) for(int i=0; i<c->type; i++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Vf * ddspin(c, i, M_PI/S7) * xpush(cgi.rhexf), cgi.shSwitchDisk, darkena(minf[active_switch()].color, fd, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laStorms:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shChargedFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laWildWest:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shSStarFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laPower:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shPowerFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case laCaves:
|
2018-05-07 18:13:56 +00:00
|
|
|
case laLivefjord:
|
|
|
|
case laDeadCaves:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shCaveFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
case laDryForest:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(DIM == 3 ? cgi.shFeatherFloor : cgi.shDesertFloor);
|
2019-03-16 21:17:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laDesert:
|
2018-05-07 18:13:56 +00:00
|
|
|
case laRedRock: case laSnakeNest:
|
|
|
|
case laCocytus:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shDesertFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case laBull:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shButterflyFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laCaribbean: case laOcean: case laOceanWall: case laWhirlpool:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shCloudFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laKraken:
|
|
|
|
case laDocks:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFullFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
case laPalace: case laTerracotta:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shPalaceFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
case laDragon:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shDragonFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
2018-05-07 18:13:56 +00:00
|
|
|
case laOvergrown: case laClearing: case laHauntedWall: case laHaunted: case laHauntedBorder:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shOverFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case laMercuryRiver: {
|
2019-06-24 11:57:26 +00:00
|
|
|
if(eoh || DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2017-10-17 10:54:59 +00:00
|
|
|
else {
|
2018-02-05 00:17:11 +00:00
|
|
|
int bridgedir = -1;
|
|
|
|
if(c->type == 6) {
|
|
|
|
for(int i=1; i<c->type; i+=2)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(pseudohept(c->modmove(i-1)) && c->modmove(i-1)->land == laMercuryRiver)
|
|
|
|
if(pseudohept(c->modmove(i+1)) && c->modmove(i+1)->land == laMercuryRiver)
|
2018-02-05 00:17:11 +00:00
|
|
|
bridgedir = i;
|
|
|
|
}
|
|
|
|
if(bridgedir == -1)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shPalaceFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
else {
|
|
|
|
transmatrix bspin = ddspin(c, bridgedir);
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(bspin, cgi.shMercuryBridge[0]);
|
2018-02-05 00:17:11 +00:00
|
|
|
// only needed in one direction
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c < c->move(bridgedir)) {
|
2018-02-05 00:17:11 +00:00
|
|
|
bspin = Vf * bspin;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(bspin, cgi.shMercuryBridge[1], darkena(fcol, fd+1, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
if(wmspatial) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mscale(bspin, cgi.LAKE), cgi.shMercuryBridge[1], darkena(gradient(0, winf[waMercury].color, 0, 0.8,1), 0, 0x80), PPR::LAKELEV);
|
|
|
|
queuepolyat(mscale(bspin, cgi.BOTTOM), cgi.shMercuryBridge[1], darkena(0x202020, 0, 0xFF), PPR::LAKEBOTTOM);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
2017-10-17 18:41:17 +00:00
|
|
|
}
|
2017-10-17 10:54:59 +00:00
|
|
|
}
|
|
|
|
}
|
2018-02-11 22:30:00 +00:00
|
|
|
break;
|
2017-10-17 10:54:59 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
case laHive:
|
|
|
|
if(c->wall != waFloorB && c->wall != waFloorA && c->wall != waMirror && c->wall != waCloud) {
|
2018-05-07 18:13:56 +00:00
|
|
|
fd = 1;
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2019-05-09 23:02:10 +00:00
|
|
|
if(c->wall != waMirror && c->wall != waCloud && DIM == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V, cgi.shMFloor, darkena(fcol, 2, 0xFF), PPR::FLOORa);
|
2019-05-09 23:02:10 +00:00
|
|
|
if(c->wall != waMirror && c->wall != waCloud && DIM == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, darkena(fcol, fcol==wcol ? 1 : 2, 0xFF), PPR::FLOORb);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laEndorian:
|
2019-05-09 23:02:10 +00:00
|
|
|
if(shmup::on || DIM == 3)
|
2019-05-05 15:37:51 +00:00
|
|
|
shmup_gravity_floor(c);
|
|
|
|
|
|
|
|
else if(c->wall == waTrunk)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
else if(c->wall == waCanopy || c->wall == waSolidBranch || c->wall == waWeakBranch)
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFeatherFloor);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
else
|
2018-05-07 18:13:56 +00:00
|
|
|
set_towerfloor(c);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
2018-12-25 18:25:09 +00:00
|
|
|
case laIvoryTower: case laDungeon: case laWestWall:
|
2019-05-09 23:02:10 +00:00
|
|
|
if(shmup::on || DIM == 3)
|
2019-05-05 15:37:51 +00:00
|
|
|
shmup_gravity_floor(c);
|
|
|
|
else
|
|
|
|
set_towerfloor(c);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2018-10-25 00:43:14 +00:00
|
|
|
|
|
|
|
case laBrownian:
|
|
|
|
if(among(c->wall, waSea, waBoat))
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shCloudFloor);
|
2018-10-25 00:43:14 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shTrollFloor);
|
2018-10-25 00:43:14 +00:00
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
default:
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-05-07 18:13:56 +00:00
|
|
|
|
|
|
|
// actually draw the floor
|
|
|
|
|
|
|
|
if(chasmg == 2) ;
|
2018-08-21 22:26:50 +00:00
|
|
|
else if(chasmg && wmspatial && detaillevel == 0) {
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd, 0x80), PPR::LAKELEV);
|
|
|
|
else
|
|
|
|
draw_qfi(c, (*Vdp), darkena(fcol, fd, 0x80), PPR::LAKELEV);
|
2018-08-21 22:26:50 +00:00
|
|
|
}
|
2018-05-07 18:13:56 +00:00
|
|
|
else if(chasmg && wmspatial) {
|
2018-08-21 22:26:50 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = c->land == laCocytus ? 0x080808FF : 0x101010FF;
|
2018-05-07 18:13:56 +00:00
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
if(qfi.fshape == &cgi.shCloudFloor)
|
|
|
|
set_floor(cgi.shCloudSeabed);
|
|
|
|
else if(qfi.fshape == &cgi.shLavaFloor)
|
|
|
|
set_floor(cgi.shLavaSeabed);
|
|
|
|
else if(qfi.fshape == &cgi.shFloor)
|
|
|
|
set_floor(cgi.shFullFloor);
|
|
|
|
else if(qfi.fshape == &cgi.shCaveFloor)
|
|
|
|
set_floor(cgi.shCaveSeabed);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LTOB], col, PPR::LAKEBOTTOM);
|
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_qfi(c, mscale(V, cgi.BOTTOM), col, PPR::LAKEBOTTOM);
|
2018-05-07 18:13:56 +00:00
|
|
|
|
|
|
|
int fd0 = fd ? fd-1 : 0;
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
2019-05-13 11:18:55 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd0, 0x80), PPR::TRANSPARENT_LAKE);
|
2019-05-08 16:33:08 +00:00
|
|
|
else
|
|
|
|
draw_qfi(c, (*Vdp), darkena(fcol, fd0, 0x80), PPR::LAKELEV);
|
2018-05-07 18:13:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-01-28 20:41:43 +00:00
|
|
|
if(patterns::whichShape == '^') poly_outline = darkena(fcol, fd, flooralpha);
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[0], darkena(fcol, fd, 255), PPR::FLOOR);
|
|
|
|
else
|
|
|
|
draw_qfi(c, V, darkena(fcol, fd, flooralpha));
|
2018-05-07 18:13:56 +00:00
|
|
|
}
|
|
|
|
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-20 11:40:56 +00:00
|
|
|
// draw the ceiling
|
2019-05-20 16:57:48 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3) {
|
2019-05-20 11:40:56 +00:00
|
|
|
draw_ceiling(c, V, fd, fcol, wcol);
|
2019-05-20 16:57:48 +00:00
|
|
|
|
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd) {
|
|
|
|
dynamicval<qfloorinfo> qfi2(qfi, qfi);
|
2019-05-26 16:04:02 +00:00
|
|
|
qfi.fshape = &cgi.shRoseFloor;
|
2019-05-20 16:57:48 +00:00
|
|
|
int t = isize(ptds);
|
|
|
|
color_t rcol;
|
|
|
|
if(rd == 1) rcol = 0x80406040;
|
|
|
|
if(rd == 2) rcol = 0x80406080;
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
if(rosedist(c2) < rd)
|
|
|
|
placeSidewall(c, i, SIDE_WALL, V, rcol);
|
|
|
|
for(int i=t; i<isize(ptds); i++) {
|
|
|
|
auto p = dynamic_cast<dqi_poly*>(&*(ptds[i]));
|
|
|
|
if(p) p->prio = PPR::TRANSPARENT_WALL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-05-20 16:57:48 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// walls
|
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_EDIT
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-12-09 02:48:30 +00:00
|
|
|
if(patterns::displaycodes) {
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
auto si = patterns::getpatterninfo0(c);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-08-20 13:24:44 +00:00
|
|
|
for(int i=(si.dir + MODFIXER) % si.symmetries; i<c->type; i += si.symmetries) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V * ddspin(c, i) * (si.reflect?Mirror:Id), cgi.shAsymmetric, darkena(0x000000, 0, 0xC0));
|
2017-12-14 01:53:29 +00:00
|
|
|
si.dir += si.symmetries;
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-08-30 17:14:04 +00:00
|
|
|
string label = its(si.id & 255);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = forecolor ^ colorhash(si.id >> 8);
|
2018-08-30 17:14:04 +00:00
|
|
|
queuestr(V, .5, label, 0xFF000000 + col);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-07-12 17:50:39 +00:00
|
|
|
if((cmode & sm::NUMBER) && (dialog::editingDetail())) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col =
|
2019-05-29 14:27:24 +00:00
|
|
|
dist0 < vid.highdetail ? 0xFF80FF80 :
|
|
|
|
dist0 >= vid.middetail ? 0xFFFF8080 :
|
2017-07-10 18:47:38 +00:00
|
|
|
0XFFFFFF80;
|
|
|
|
#if 1
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shHeptaMarker, darkena(col & 0xFFFFFF, 0, 0xFF));
|
2017-07-10 18:47:38 +00:00
|
|
|
#else
|
|
|
|
char buf[64];
|
|
|
|
sprintf(buf, "%3.1f", float(dist0));
|
|
|
|
|
|
|
|
|
|
|
|
queuestr(V, .6, buf, col);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if(realred(c->wall) && !wmspatial) {
|
|
|
|
int s = snakelevel(c);
|
2019-05-26 16:04:02 +00:00
|
|
|
if(s >= 1) draw_floorshape(c, V, cgi.shRedRockFloor[0], getSnakelevColor(c, 0, 7, fd, wcol));
|
|
|
|
if(s >= 2) draw_floorshape(c, V, cgi.shRedRockFloor[1], getSnakelevColor(c, 1, 7, fd, wcol));
|
|
|
|
if(s >= 3) draw_floorshape(c, V, cgi.shRedRockFloor[2], getSnakelevColor(c, 2, 7, fd, wcol));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(c->wall == waTower && !wmspatial) {
|
2018-05-07 18:13:56 +00:00
|
|
|
fcol = 0xE8E8E8;
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shMFloor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2019-08-07 22:20:14 +00:00
|
|
|
if(WDIM == 2 && pseudohept(c) && (
|
2017-07-10 18:47:38 +00:00
|
|
|
c->land == laRedRock ||
|
|
|
|
vid.darkhepta ||
|
2018-08-28 15:17:34 +00:00
|
|
|
(c->land == laClearing && !BITRUNCATED))) {
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3 && WDIM == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly((*Vdp)*zpush(cgi.FLOOR), cgi.shHeptaMarker, wmblack ? 0x80808080 : 0x00000080);
|
2019-05-09 23:02:10 +00:00
|
|
|
else
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly((*Vdp), cgi.shHeptaMarker, wmblack ? 0x80808080 : 0x00000080);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-06-28 10:59:35 +00:00
|
|
|
if(conformal::includeHistory && conformal::inmovehistory.count(c))
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly((*Vdp), cgi.shHeptaMarker, 0x000000C0);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
char xch = winf[c->wall].glyph;
|
|
|
|
|
2019-05-06 23:08:49 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) {
|
2019-03-04 17:01:48 +00:00
|
|
|
color_t dummy;
|
2019-07-25 10:19:52 +00:00
|
|
|
int ofs = wall_offset(c);
|
2019-02-27 13:43:42 +00:00
|
|
|
if(isWall3(c, wcol)) {
|
2019-04-12 13:18:16 +00:00
|
|
|
color_t wcol2 = wcol;
|
2019-05-06 23:08:49 +00:00
|
|
|
#if CAP_TEXTURE
|
2019-04-12 13:18:16 +00:00
|
|
|
if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol);
|
2019-05-06 23:08:49 +00:00
|
|
|
#endif
|
2019-04-12 13:18:16 +00:00
|
|
|
|
2019-02-27 13:43:42 +00:00
|
|
|
int d = (wcol & 0xF0F0F0) >> 4;
|
2019-05-06 23:08:49 +00:00
|
|
|
|
2019-02-24 21:12:32 +00:00
|
|
|
for(int a=0; a<c->type; a++)
|
2019-07-23 13:08:07 +00:00
|
|
|
if(c->move(a) && !isWall3(c->move(a), dummy)) {
|
2019-08-06 10:00:46 +00:00
|
|
|
if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !nonisotropic) {
|
2019-05-11 15:21:41 +00:00
|
|
|
if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue;
|
|
|
|
else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue;
|
2019-05-13 11:19:25 +00:00
|
|
|
else if(c->move(a)->master->distance > c->master->distance && c->master->distance > viewctr.at->distance && !quotient) continue;
|
2019-05-11 15:21:41 +00:00
|
|
|
}
|
2019-07-31 10:18:53 +00:00
|
|
|
else if(sol && in_perspective()) {
|
2019-07-31 09:48:38 +00:00
|
|
|
ld b = vid.binary_width * log(2) / 2;
|
|
|
|
const ld l = log(2) / 2;
|
|
|
|
switch(a) {
|
2019-07-31 12:04:31 +00:00
|
|
|
case 0: if(V[0][GDIM] >= b) continue; break;
|
|
|
|
case 1: if(V[1][GDIM] >= b) continue; break;
|
|
|
|
case 2: case 3: if (pmodel == mdPerspective && V[2][GDIM] >= l) continue; break;
|
|
|
|
case 4: if(V[0][GDIM] <= -b) continue; break;
|
|
|
|
case 5: if(V[1][GDIM] <= -b) continue; break;
|
|
|
|
case 6: case 7: if (pmodel == mdPerspective && V[2][GDIM] <= -l) continue; break;
|
2019-07-31 09:48:38 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-11 17:46:34 +00:00
|
|
|
if(qfi.fshape && wmescher) {
|
2019-07-25 10:19:52 +00:00
|
|
|
auto& poly = queuepoly(V, cgi.shWall3D[ofs + a], darkena(wcol2 - d * get_darkval(a), 0, 0xFF));
|
2019-06-28 07:58:22 +00:00
|
|
|
#if CAP_TEXTURE
|
2019-04-12 13:18:16 +00:00
|
|
|
if(texture::config.tstate == texture::tsActive && isize(texture::config.tinf3.tvertices)) {
|
|
|
|
poly.tinf = &texture::config.tinf3;
|
|
|
|
poly.offset_texture = 0;
|
|
|
|
}
|
2019-06-28 07:58:22 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2019-05-26 16:04:02 +00:00
|
|
|
poly.tinf = &floor_texture_vertices[qfi.fshape->id];
|
2019-04-12 13:18:16 +00:00
|
|
|
poly.offset_texture = 0;
|
|
|
|
}
|
2019-02-22 20:13:33 +00:00
|
|
|
}
|
2019-03-11 17:46:34 +00:00
|
|
|
else
|
2019-07-25 10:19:52 +00:00
|
|
|
queuepoly(V, cgi.shPlainWall3D[ofs + a], darkena(wcol2 - d * get_darkval(a), 0, 0xFF));
|
2019-02-22 20:13:33 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-09 22:55:03 +00:00
|
|
|
else {
|
|
|
|
for(int a=0; a<c->type; a++) if(c->move(a)) {
|
2019-03-13 13:04:06 +00:00
|
|
|
color_t t = transcolor(c, c->move(a), wcol);
|
2019-03-10 17:38:55 +00:00
|
|
|
if(t) {
|
|
|
|
t = t - get_darkval(a) * ((t & 0xF0F0F000) >> 4);
|
2019-07-25 10:19:52 +00:00
|
|
|
queue_transparent_wall(V, cgi.shPlainWall3D[ofs + a], t);
|
2019-03-10 17:38:55 +00:00
|
|
|
}
|
2019-02-26 19:19:19 +00:00
|
|
|
}
|
2019-03-24 00:27:23 +00:00
|
|
|
if(among(c->wall, waBoat, waStrandedBoat)) drawBoat(c, Vboat, V, V);
|
2019-03-09 22:55:03 +00:00
|
|
|
else if(isFire(c)) {
|
2019-03-13 13:04:06 +00:00
|
|
|
static int r = 0;
|
|
|
|
r += ticks - lastt;
|
|
|
|
int each = 5 + last_firelimit;
|
|
|
|
while(r >= each) {
|
2019-03-09 22:55:03 +00:00
|
|
|
drawParticleSpeed(c, wcol, 75 + rand() % 75);
|
2019-03-13 13:04:06 +00:00
|
|
|
r -= each;
|
2019-03-09 22:55:03 +00:00
|
|
|
}
|
2019-03-13 13:04:06 +00:00
|
|
|
firelimit++;
|
2019-03-09 22:55:03 +00:00
|
|
|
}
|
|
|
|
else if(c->wall == waMineOpen) {
|
2019-08-06 14:48:01 +00:00
|
|
|
if(pmodel == mdGeodesic && hdist0(tC0(V)) < 1e-3) {
|
2019-07-30 11:00:47 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
int mines = countMinesAround(c);
|
|
|
|
if(mines >= 10)
|
|
|
|
queuepoly(face_the_player(V), cgi.shBigMineMark[0], darkena(minecolors[(mines/10)%10], 0, 0xFF));
|
|
|
|
queuepoly(face_the_player(V), cgi.shMineMark[0], darkena(minecolors[mines%10], 0, 0xFF));
|
|
|
|
}
|
2019-03-09 22:55:03 +00:00
|
|
|
}
|
|
|
|
|
2019-08-07 22:20:02 +00:00
|
|
|
else if(winf[c->wall].glyph == '.' || among(c->wall, waFloorA, waFloorB, waChasm, waLadder, waCanopy, waRed1, waRed2, waRed3, waRubble, waDeadfloor2) || isWatery(c) || isSulphuric(c->wall)) ;
|
2019-03-23 21:25:35 +00:00
|
|
|
|
|
|
|
else if(c->wall == waBigBush || c->wall == waSolidBranch)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(face_the_player(V), cgi.shSolidBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
2019-03-23 21:25:35 +00:00
|
|
|
|
|
|
|
else if(c->wall == waSmallBush || c->wall == waWeakBranch)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(face_the_player(V), cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
2019-03-23 21:25:35 +00:00
|
|
|
|
2019-03-09 22:55:03 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(face_the_player(V), chasmgraph(c) ? cgi.shSawRing : cgi.shRing, darkena(wcol, 0, 0xFF));
|
2019-02-26 19:19:19 +00:00
|
|
|
}
|
2019-03-02 00:52:31 +00:00
|
|
|
|
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd == 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x804060, 0, 0xFF));
|
2019-03-02 00:52:31 +00:00
|
|
|
if(rd == 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x402030, 0, 0xFF));
|
2019-02-22 20:13:33 +00:00
|
|
|
}
|
2019-05-06 23:08:49 +00:00
|
|
|
#else
|
|
|
|
if(0) ;
|
|
|
|
#endif
|
2019-02-22 20:13:33 +00:00
|
|
|
|
|
|
|
else switch(c->wall) {
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
case waBigBush:
|
|
|
|
if(detaillevel >= 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mmscale(V, zgrad0(0, cgi.slev, 1, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL);
|
2018-02-05 00:17:11 +00:00
|
|
|
if(detaillevel >= 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mmscale(V, cgi.SLEV[1]) * pispin, cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+1);
|
2018-02-05 00:17:11 +00:00
|
|
|
if(detaillevel >= 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mmscale(V, zgrad0(0, cgi.slev, 3, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL+2);
|
|
|
|
queuepolyat(mmscale(V, cgi.SLEV[2]), cgi.shSolidBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waSmallBush:
|
|
|
|
if(detaillevel >= 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mmscale(V, zgrad0(0, cgi.slev, 1, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL);
|
2018-02-05 00:17:11 +00:00
|
|
|
if(detaillevel >= 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mmscale(V, cgi.SLEV[1]) * pispin, cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+1);
|
2018-02-05 00:17:11 +00:00
|
|
|
if(detaillevel >= 2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mmscale(V, zgrad0(0, cgi.slev, 3, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL+2);
|
|
|
|
queuepolyat(mmscale(V, cgi.SLEV[2]), cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waSolidBranch:
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(DIM == 3 ? mscale(V, cgi.BODY) : V, cgi.shSolidBranch, darkena(wcol, 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waWeakBranch:
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(DIM == 3 ? mscale(V, cgi.BODY) : V, cgi.shWeakBranch, darkena(wcol, 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waLadder:
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3) {
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_shapevec(c, V * zpush(-cgi.human_height/20), cgi.shMFloor.levels[0], 0x804000FF, PPR::FLOOR+1);
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2019-05-09 23:02:10 +00:00
|
|
|
}
|
|
|
|
else if(euclid) {
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V, cgi.shMFloor, 0x804000FF);
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, 0x000000FF);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V, cgi.shFloor, 0x804000FF, PPR::FLOOR+1);
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, 0x000000FF, PPR::FLOOR+2);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waReptileBridge: {
|
2017-07-10 18:47:38 +00:00
|
|
|
Vboat = &(Vboat0 = V);
|
2018-02-05 00:17:11 +00:00
|
|
|
dynamicval<qfloorinfo> qfi2(qfi, qfi);
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = reptilecolor(c);
|
2018-02-05 00:17:11 +00:00
|
|
|
chasmg = 0;
|
2018-05-07 18:13:56 +00:00
|
|
|
set_reptile_floor(c, V, col);
|
|
|
|
draw_qfi(c, V, col);
|
2018-02-05 00:17:11 +00:00
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_LAKE, V, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
chasmg = 1;
|
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
case waTerraWarrior:
|
|
|
|
drawTerraWarrior(V, randterra ? (c->landparam & 7) : (5 - (c->landparam & 7)), 7, 0);
|
|
|
|
break;
|
|
|
|
|
2019-03-04 17:02:38 +00:00
|
|
|
case waBoat: case waStrandedBoat:
|
|
|
|
drawBoat(c, Vboat, Vboat0, V);
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waBigStatue: {
|
|
|
|
transmatrix V2 = V;
|
|
|
|
double footphase;
|
|
|
|
applyAnimation(c, V2, footphase, LAYER_BOAT);
|
|
|
|
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V2, cgi.shStatue,
|
2018-02-05 00:17:11 +00:00
|
|
|
darkena(winf[c->wall].color, 0, 0xFF),
|
2018-08-28 12:27:23 +00:00
|
|
|
PPR::BIGSTATUE
|
2018-02-05 00:17:11 +00:00
|
|
|
);
|
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waSulphurC: {
|
|
|
|
if(drawstar(c)) {
|
|
|
|
zcol = wcol;
|
|
|
|
if(wmspatial)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(mscale(V, cgi.HELLSPIKE), cgi.shGiantStar[ct6], darkena(wcol, 0, 0x40), PPR::HELLSPIKE);
|
2018-02-05 00:17:11 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shGiantStar[ct6], darkena(wcol, 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
case waTrapdoor:
|
|
|
|
if(c->land == laZebra) break;
|
|
|
|
/* fallthrough */
|
|
|
|
|
|
|
|
case waClosePlate: case waOpenPlate: {
|
|
|
|
transmatrix V2 = V;
|
2018-12-16 23:04:59 +00:00
|
|
|
if(wmescher && geosupport_football() == 2 && pseudohept(c) && c->land == laPalace) V2 = V * spin(M_PI / c->type);
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3) {
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_shapevec(c, V2 * zpush(-cgi.human_height/40), cgi.shMFloor.levels[0], darkena(winf[c->wall].color, 0, 0xFF));
|
|
|
|
draw_shapevec(c, V2 * zpush(-cgi.human_height/35), cgi.shMFloor2.levels[0], (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF));
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2019-05-09 23:02:10 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V2, cgi.shMFloor, darkena(winf[c->wall].color, 0, 0xFF));
|
|
|
|
draw_floorshape(c, V2, cgi.shMFloor2, (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF));
|
2019-05-09 23:02:10 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waFrozenLake: case waLake: case waCamelotMoat:
|
|
|
|
case waSea: case waOpenGate: case waBubble: case waDock:
|
2018-10-25 00:43:14 +00:00
|
|
|
case waSulphur: case waMercury:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waNone:
|
|
|
|
if(c->land == laBrownian) goto wa_default;
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waRose: {
|
|
|
|
zcol = wcol;
|
|
|
|
wcol <<= 1;
|
|
|
|
if(c->cpdist > 5)
|
|
|
|
wcol = 0xC0C0C0;
|
|
|
|
else if(rosephase == 7)
|
|
|
|
wcol = 0xFF0000;
|
|
|
|
else
|
|
|
|
wcol = gradient(wcol, 0xC00000, 0, rosephase, 6);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shThorns, 0xC080C0FF);
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
for(int u=0; u<4; u+=2)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V * spin(2*M_PI / 3 / 4 * u), cgi.shRose, darkena(wcol, 0, 0xC0));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waRoundTable:
|
|
|
|
if(wmspatial) goto wa_default;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waMirrorWall:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waGlass:
|
|
|
|
if(wmspatial) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = winf[waGlass].color;
|
2018-02-05 00:17:11 +00:00
|
|
|
int dcol = darkena(col, 0, 0x80);
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vdepth = mscale((*Vdp), cgi.WALL);
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_shapevec(c, V, cgi.shMFloor.levels[SIDE_WALL], dcol, PPR::WALL);
|
2019-05-09 23:02:10 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, Vdepth, cgi.shMFloor, dcol, PPR::WALL); // GLASS
|
2018-05-07 18:13:56 +00:00
|
|
|
dynamicval<qfloorinfo> dq(qfi, qfi);
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, i, c)
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_WALL, (*Vdp), dcol)) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waFan:
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-10 00:43:07 +00:00
|
|
|
if(DIM == 3)
|
|
|
|
for(int a=0; a<10; a++)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V * zpush(cgi.FLOOR + (cgi.WALL - cgi.FLOOR) * a/10.) * spin(a *degree) * spintick(PURE ? -1000 : -500, 1/12.), cgi.shFan, darkena(wcol, 0, 0xFF));
|
2019-05-10 00:43:07 +00:00
|
|
|
else
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V * spintick(PURE ? -1000 : -500, 1/12.), cgi.shFan, darkena(wcol, 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waArrowTrap:
|
|
|
|
if(c->wparam >= 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mscale(V, cgi.FLOOR), cgi.shDisk, darkena(trapcol[c->wparam&3], 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
if(isCentralTrap(c)) arrowtraps.push_back(c);
|
|
|
|
break;
|
2017-07-16 21:00:55 +00:00
|
|
|
|
2018-12-16 23:04:59 +00:00
|
|
|
case waFireTrap:
|
2019-05-10 00:45:33 +00:00
|
|
|
|
|
|
|
if(DIM == 3) {
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_shapevec(c, V * zpush(-cgi.human_height/40), cgi.shMFloor.levels[0], darkena(0xC00000, 0, 0xFF));
|
|
|
|
draw_shapevec(c, V * zpush(-cgi.human_height/20), cgi.shMFloor2.levels[0], darkena(0x600000, 0, 0xFF));
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2019-05-10 00:45:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, V, cgi.shMFloor, darkena(0xC00000, 0, 0xFF));
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, darkena(0x600000, 0, 0xFF));
|
2019-05-10 00:45:33 +00:00
|
|
|
}
|
2018-12-16 23:04:59 +00:00
|
|
|
if(c->wparam >= 1)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(mscale(V, cgi.FLOOR), cgi.shDisk, darkena(trapcol[c->wparam&3], 0, 0xFF));
|
2018-12-16 23:04:59 +00:00
|
|
|
break;
|
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waGiantRug:
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shBigCarpet1, darkena(DIM == 3 ? 0 : 0xC09F00, 0, 0xFF));
|
|
|
|
queuepoly(V, cgi.shBigCarpet2, darkena(DIM == 3 ? 0xC09F00 : 0x600000, 0, 0xFF));
|
|
|
|
queuepoly(V, cgi.shBigCarpet3, darkena(DIM == 3 ? 0x600000 : 0xC09F00, 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waBarrier:
|
|
|
|
if(c->land == laOceanWall && wmescher && wmspatial) {
|
2019-05-09 23:31:34 +00:00
|
|
|
if(GDIM == 3 && qfi.fshape) {
|
2019-05-12 18:10:01 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->cone[1], darkena(wcol, 0, 0xFF), PPR::WALL);
|
2019-05-13 11:39:43 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
2019-05-09 23:31:34 +00:00
|
|
|
break;
|
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
const int layers = 2 << detaillevel;
|
2019-05-26 16:04:02 +00:00
|
|
|
dynamicval<const hpcshape*> ds(qfi.shape, &cgi.shCircleFloor);
|
2018-08-04 20:25:46 +00:00
|
|
|
dynamicval<transmatrix> dss(qfi.spin, Id);
|
2018-02-05 00:17:11 +00:00
|
|
|
for(int z=1; z<layers; z++) {
|
2019-05-29 14:27:24 +00:00
|
|
|
double zg = zgrad0(-vid.lake_top, geom3::actual_wall_height(), z, layers);
|
2018-05-07 18:13:56 +00:00
|
|
|
draw_qfi(c, xyzscale(V, zg*(layers-z)/layers, zg),
|
2018-08-28 12:27:23 +00:00
|
|
|
darkena(gradient(0, wcol, -layers, z, layers), 0, 0xFF), PPR::WALL3+z-layers+2);
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else goto wa_default;
|
|
|
|
break;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
case waMineOpen: {
|
|
|
|
int mines = countMinesAround(c);
|
2019-04-08 12:56:46 +00:00
|
|
|
if(mines >= 10)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shBigMineMark[ct6], darkena(minecolors[(mines/10) % 10], 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
if(mines)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shMineMark[ct6], darkena(minecolors[mines%10], 0, 0xFF));
|
2018-02-05 00:17:11 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-02-28 16:06:53 +00:00
|
|
|
|
|
|
|
case waEditStatue:
|
|
|
|
if(!mapeditor::drawUserShape(V * ddspin(c, c->mondir), mapeditor::sgWall, c->wparam, darkena(wcol, fd, 0xFF), c))
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shTriangle, darkena(wcol, fd, 0xFF));
|
2019-02-28 16:06:53 +00:00
|
|
|
break;
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
default: {
|
|
|
|
wa_default:
|
|
|
|
if(sl && wmspatial) {
|
|
|
|
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3 && qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[sl], darkena(wcol, fd, 0xFF), PPR::REDWALL-4+4*sl);
|
|
|
|
else
|
|
|
|
draw_qfi(c, (*Vdp), darkena(wcol, fd, 0xFF), PPR::REDWALL-4+4*sl);
|
2018-05-07 18:13:56 +00:00
|
|
|
floorShadow(c, V, SHADOW_SL * sl);
|
2018-02-05 00:17:11 +00:00
|
|
|
for(int s=0; s<sl; s++)
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
int sl2 = snakelevel(c2);
|
|
|
|
if(s >= sl2)
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_SLEV+s, V, getSnakelevColor(c, s, sl, fd, wcol))) break;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
else if(highwall(c))
|
|
|
|
draw_wall(c, V, wcol, zcol, ct6, fd);
|
|
|
|
|
|
|
|
else if(xch == '%') {
|
|
|
|
if(doHighlight())
|
|
|
|
poly_outline = (c->land == laMirror) ? OUTLINE_TREASURE : OUTLINE_ORB;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
if(wmspatial) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = winf[c->wall].color;
|
2018-02-05 00:17:11 +00:00
|
|
|
int dcol = darkena(col, 0, 0xC0);
|
2019-05-26 16:04:02 +00:00
|
|
|
transmatrix Vdepth = mscale((*Vdp), cgi.WALL);
|
2019-05-09 23:02:10 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_shapevec(c, V, cgi.shMFloor.levels[SIDE_WALL], dcol, PPR::WALL);
|
2019-05-09 23:02:10 +00:00
|
|
|
else
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_floorshape(c, Vdepth, cgi.shMFloor, dcol, PPR::WALL); // GLASS
|
2018-05-07 18:13:56 +00:00
|
|
|
dynamicval<qfloorinfo> dq(qfi, qfi);
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, i, c)
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_WALL, (*Vdp), dcol)) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-10-06 22:34:10 +00:00
|
|
|
else {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shMirror, darkena(wcol, 0, 0xC0));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2018-12-16 23:04:59 +00:00
|
|
|
else if(c->wall == waExplosiveBarrel) {
|
2019-05-10 00:45:33 +00:00
|
|
|
if(DIM == 3 && qfi.fshape) {
|
2019-05-12 18:10:01 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->cone[1], 0xD00000FF, PPR::REDWALL);
|
2019-05-13 11:39:43 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
2019-05-10 00:45:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<=layers; z++) {
|
|
|
|
double zg = zgrad0(0, geom3::actual_wall_height(), z, layers);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(xyzscale(V, zg, zg), cgi.shBarrel, darkena((z&1) ? 0xFF0000 : 0xC00000, 0, 0xFF), PPR(PPR::REDWALLm+z));
|
2019-05-10 00:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-16 23:04:59 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
else if(isFire(c) || isThumper(c) || c->wall == waBonfireOff) {
|
2018-09-10 15:49:51 +00:00
|
|
|
auto V2 = V;
|
|
|
|
if(hasTimeout(c)) V2 = V2 * spintick(c->land == laPower ? 5000 : 500);
|
2019-05-13 11:39:43 +00:00
|
|
|
if(GDIM == 3 && qfi.fshape) {
|
2019-05-12 18:10:01 +00:00
|
|
|
draw_shapevec(c, V2, qfi.fshape->cone[1], darkena(wcol, 0, 0xF0), PPR::WALL);
|
2019-05-13 11:39:43 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
|
|
|
}
|
2019-05-26 16:04:02 +00:00
|
|
|
else queuepoly(V2, cgi.shStar, darkena(wcol, 0, 0xF0));
|
2018-02-05 00:17:11 +00:00
|
|
|
if(isFire(c) && rand() % 300 < ticks - lastt)
|
|
|
|
drawParticle(c, wcol, 75);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(xch != '.' && xch != '+' && xch != '>' && xch != ':'&& xch != '-' && xch != ';' && xch != ',' && xch != '&')
|
|
|
|
error = true;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#else
|
|
|
|
error = true;
|
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-09-30 09:46:41 +00:00
|
|
|
|
2019-05-12 18:10:49 +00:00
|
|
|
if(wmascii || (WDIM == 2 && GDIM == 3)) {
|
2019-06-17 09:00:01 +00:00
|
|
|
if(!it && !c->monst) {
|
2019-05-20 11:41:37 +00:00
|
|
|
if(c->wall == waNone || isWatery(c)) asciicol = fcol;
|
|
|
|
}
|
2019-05-28 23:22:52 +00:00
|
|
|
if(c->wall == waBoat && !it) asciicol = 0xC06000;
|
2019-05-12 18:10:49 +00:00
|
|
|
|
2017-10-09 11:00:08 +00:00
|
|
|
if(c->wall == waArrowTrap)
|
|
|
|
asciicol = trapcol[c->wparam & 3];
|
2018-12-16 23:04:59 +00:00
|
|
|
if(c->wall == waFireTrap)
|
|
|
|
asciicol = trapcol[c->wparam & 3];
|
2017-10-09 11:00:08 +00:00
|
|
|
if(c->wall == waTerraWarrior)
|
|
|
|
asciicol = terracol[c->landparam & 7];
|
2018-02-05 00:17:11 +00:00
|
|
|
|
2019-05-20 11:41:37 +00:00
|
|
|
if(c->wall == waMineOpen && !it) {
|
2018-02-05 00:17:11 +00:00
|
|
|
int mines = countMinesAround(c);
|
|
|
|
if(ch == '.') {
|
|
|
|
if(mines == 0) ch = ' ';
|
2019-04-08 12:56:46 +00:00
|
|
|
else ch = '0' + mines, asciicol = minecolors[mines%10];
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
2019-04-08 12:56:46 +00:00
|
|
|
else if(ch == '@') asciicol = minecolors[mines%10];
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
2019-05-12 18:10:49 +00:00
|
|
|
if(wmascii && !(it || c->monst || c->cpdist == 0)) error = true;
|
2017-10-09 11:00:08 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
int sha = shallow(c);
|
2017-04-08 15:18:29 +00:00
|
|
|
|
2019-05-08 16:33:08 +00:00
|
|
|
if(wmspatial && sha && WDIM == 2) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!chasmg) {
|
2017-10-09 09:46:49 +00:00
|
|
|
|
|
|
|
#define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V * cellrelmatrix(c,i)) : 1), 1), fd, 0xFF)
|
2017-11-03 18:20:54 +00:00
|
|
|
// #define D(v) darkena(col, fd, 0xFF)
|
2017-10-09 09:46:49 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(sha & 1) {
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_LAKE, V, D(.8))) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
if(sha & 2) {
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_LTOB, V, D(.7))) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
if(sha & 4) {
|
|
|
|
bool dbot = true;
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) {
|
|
|
|
if(dbot) dbot = false,
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_qfi(c, mscale(V, cgi.BOTTOM), 0x080808FF, PPR::LAKEBOTTOM);
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_BTOI, V, D(.6))) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-10-09 09:46:49 +00:00
|
|
|
#undef D
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// wall between lake and chasm -- no Escher here
|
|
|
|
if(chasmg == 1) forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) {
|
2018-08-31 17:09:45 +00:00
|
|
|
dynamicval<qfloorinfo> qfib(qfi, qfi);
|
2019-05-26 16:04:02 +00:00
|
|
|
set_floor(cgi.shFullFloor);
|
2018-05-07 18:13:56 +00:00
|
|
|
placeSidewall(c, i, SIDE_LAKE, V, 0x202030FF);
|
|
|
|
placeSidewall(c, i, SIDE_LTOB, V, 0x181820FF);
|
|
|
|
placeSidewall(c, i, SIDE_BTOI, V, 0x101010FF);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-04-08 15:18:29 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(chasmg) {
|
2018-06-22 12:47:24 +00:00
|
|
|
int q = isize(ptds);
|
2017-11-13 10:57:05 +00:00
|
|
|
int maxtime = euclid || sphere ? 20000 : 1500;
|
2017-07-10 18:47:38 +00:00
|
|
|
if(fallanims.count(c)) {
|
|
|
|
fallanim& fa = fallanims[c];
|
|
|
|
bool erase = true;
|
|
|
|
if(fa.t_floor) {
|
|
|
|
int t = (ticks - fa.t_floor);
|
2017-11-13 10:57:05 +00:00
|
|
|
if(t <= maxtime) {
|
2017-07-10 18:47:38 +00:00
|
|
|
erase = false;
|
2019-05-08 18:40:41 +00:00
|
|
|
if(DIM == 3)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[0], darkena(fcol, fd, 0xFF), PPR::WALL);
|
|
|
|
else if(fa.walltype == waNone) {
|
2018-08-28 12:27:23 +00:00
|
|
|
draw_qfi(c, V, darkena(fcol, fd, 0xFF), PPR::FLOOR);
|
2019-05-08 18:40:41 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t wcol2, fcol2;
|
2017-07-10 18:47:38 +00:00
|
|
|
eWall w = c->wall; int p = c->wparam;
|
|
|
|
c->wall = fa.walltype; c->wparam = fa.m;
|
|
|
|
setcolors(c, wcol2, fcol2);
|
|
|
|
int starcol = c->wall == waVinePlant ? 0x60C000 : wcol2;
|
|
|
|
c->wall = w; c->wparam = p;
|
2019-05-26 16:04:02 +00:00
|
|
|
draw_qfi(c, mscale(V, cgi.WALL), darkena(starcol, fd, 0xFF), PPR::WALL3);
|
|
|
|
queuepolyat(mscale(V, cgi.WALL), cgi.shWall[ct6], darkena(wcol2, 0, 0xFF), PPR::WALL3A);
|
2017-07-10 18:47:38 +00:00
|
|
|
forCellIdEx(c2, i, c)
|
2018-05-07 18:13:56 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, 1, 0xFF))) break;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
pushdown(c, q, V, t*t / 1000000. + t / 1000., true, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(fa.t_mon) {
|
2017-08-06 12:50:16 +00:00
|
|
|
dynamicval<int> d(multi::cpid, fa.pid);
|
2017-07-10 18:47:38 +00:00
|
|
|
int t = (ticks - fa.t_mon);
|
2017-11-13 10:57:05 +00:00
|
|
|
if(t <= maxtime) {
|
2017-07-10 18:47:38 +00:00
|
|
|
erase = false;
|
|
|
|
c->stuntime = 0;
|
|
|
|
transmatrix V2 = V;
|
|
|
|
double footphase = t / 200.0;
|
|
|
|
applyAnimation(c, V2, footphase, LAYER_SMALL);
|
2019-06-24 10:57:00 +00:00
|
|
|
drawMonsterType(fa.m, c, V2, minf[fa.m].color, footphase, NOCOLOR);
|
2017-07-10 18:47:38 +00:00
|
|
|
pushdown(c, q, V2, t*t / 1000000. + t / 1000., true, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(erase) fallanims.erase(c);
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
if(it) {
|
2018-12-21 13:41:23 +00:00
|
|
|
if((c->land == laWhirlwind || c->item == itBabyTortoise || c->land == laWestWall) && c->wall != waBoat) {
|
2018-02-05 00:17:11 +00:00
|
|
|
double footphase = 0;
|
|
|
|
Vboat = &(Vboat0 = *Vboat);
|
|
|
|
applyAnimation(c, Vboat0, footphase, LAYER_BOAT);
|
2018-03-24 14:20:53 +00:00
|
|
|
}
|
2018-02-05 00:17:11 +00:00
|
|
|
|
|
|
|
if(cellHalfvine(c)) {
|
|
|
|
int i =-1;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int t=0;t<6; t++) if(c->move(t) && c->move(t)->wall == c->wall)
|
2018-02-05 00:17:11 +00:00
|
|
|
i = t;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-02-05 00:17:11 +00:00
|
|
|
Vboat = &(Vboat0 = *Vboat * ddspin(c, i) * xpush(-.13));
|
|
|
|
}
|
|
|
|
|
2019-05-12 18:10:49 +00:00
|
|
|
if(drawItemType(it, c, *Vboat, icol, ticks, hidden)) error = true, onradar = false;
|
2018-02-05 00:17:11 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(true) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
int q = ptds.size();
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2019-06-24 10:57:00 +00:00
|
|
|
bool m = drawMonster(V, ctype, c, moncol, mirrored, asciicol);
|
2019-05-12 18:10:49 +00:00
|
|
|
if(m) error = true;
|
|
|
|
if(m || c->monst) onradar = false;
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-05-09 23:03:53 +00:00
|
|
|
if(Vboat != &V && Vboat != &Vboat0 && q != isize(ptds)) {
|
2019-05-11 06:19:02 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
pushdown(c, q, V, cgi.SLEV[sl] - cgi.FLOOR, false, false);
|
2019-05-09 23:03:53 +00:00
|
|
|
else pushdown(c, q, V, -geom3::factor_to_lev(zlevel(tC0((*Vboat)))),
|
2017-07-10 18:47:38 +00:00
|
|
|
!isMultitile(c->monst), false);
|
2019-05-09 23:03:53 +00:00
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!shmup::on && sword::at(c)) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(V, cgi.shDisk, 0xC0404040, PPR::SWORDMARK);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2018-08-04 16:17:42 +00:00
|
|
|
|
|
|
|
#if CAP_TEXTURE
|
|
|
|
if(!texture::using_aura())
|
|
|
|
#endif
|
|
|
|
addaura(tC0(V), zcol, fd);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
int ad = airdist(c);
|
|
|
|
if(ad == 1 || ad == 2) {
|
2017-05-28 22:16:17 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int i=0; i<c->type; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
cell *c2 = c->move(i);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(airdist(c2) < airdist(c)) {
|
2019-02-26 13:08:51 +00:00
|
|
|
ld airdir = calcAirdir(c2); // printf("airdir = %d\n", airdir);
|
2018-08-19 13:52:39 +00:00
|
|
|
transmatrix V0 = ddspin(c, i, M_PI);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-26 13:08:51 +00:00
|
|
|
double ph = ptick(PURE?150:75) + airdir;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int aircol = 0x8080FF00 | int(32 + 32 * -cos(ph));
|
|
|
|
|
|
|
|
double ph0 = ph/2;
|
|
|
|
ph0 -= floor(ph0/M_PI)*M_PI;
|
2017-05-28 22:16:17 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
poly_outline = OUTLINE_TRANS;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly((*Vdp)*V0*xpush(cgi.hexf*-cos(ph0)), cgi.shDisk, aircol);
|
2017-07-10 18:47:38 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2017-05-28 22:16:17 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-10-17 19:26:21 +00:00
|
|
|
if(c->land == laBlizzard) {
|
2017-10-30 22:58:18 +00:00
|
|
|
if(vid.backeffects) {
|
|
|
|
if(c->cpdist <= getDistLimit())
|
2018-06-10 23:12:18 +00:00
|
|
|
set_blizzard_frame(c, frameid);
|
2017-10-30 22:58:18 +00:00
|
|
|
}
|
2017-10-17 19:26:21 +00:00
|
|
|
else {
|
|
|
|
forCellIdEx(c2, i, c) if(againstWind(c, c2))
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V * ddspin(c, i) * xpush(cellgfxdist(c, i)/2), cgi.shWindArrow, 0x8080FF80);
|
2017-10-17 19:26:21 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2018-12-23 02:14:48 +00:00
|
|
|
|
|
|
|
if(items[itOrbGravity] && c->cpdist <= 5)
|
|
|
|
draw_gravity_particles(c, V);
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
if(c->land == laWhirlwind) {
|
|
|
|
whirlwind::calcdirs(c);
|
|
|
|
|
|
|
|
for(int i=0; i<whirlwind::qdirs; i++) {
|
2018-08-19 13:52:39 +00:00
|
|
|
ld hdir0 = displayspin(c, whirlwind::dfrom[i]) + M_PI;
|
|
|
|
ld hdir1 = displayspin(c, whirlwind::dto[i]);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-09-10 15:49:51 +00:00
|
|
|
double ph1 = fractick(PURE ? 150 : 75);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
int aircol = 0xC0C0FF40;
|
|
|
|
|
2018-08-19 13:52:39 +00:00
|
|
|
if(hdir1 < hdir0-M_PI) hdir1 += 2 * M_PI;
|
|
|
|
if(hdir1 >= hdir0+M_PI) hdir1 -= 2 * M_PI;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-08-31 17:15:02 +00:00
|
|
|
ld hdir = (hdir1*ph1+hdir0*(1-ph1));
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-08-19 13:52:39 +00:00
|
|
|
transmatrix V0 = spin(hdir);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2018-08-31 17:15:02 +00:00
|
|
|
double ldist =
|
|
|
|
cellgfxdist(c, whirlwind::dfrom[i]) * (1-ph1)/2 +
|
|
|
|
cellgfxdist(c, whirlwind::dto[i]) * ph1/2;
|
2019-05-26 16:04:02 +00:00
|
|
|
// PURE ? cgi.crossf : c->type == 6 ? .2840 : 0.3399;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
poly_outline = OUTLINE_TRANS;
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly((*Vdp)*V0*xpush(ldist*(2*ph1-1)), cgi.shDisk, aircol);
|
2017-07-10 18:47:38 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
2017-05-28 22:16:17 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2017-07-10 18:47:38 +00:00
|
|
|
if(error) {
|
2019-02-22 20:13:33 +00:00
|
|
|
queuechr(V, 1, ch, darkenedby(asciicol, darken), 2);
|
2017-05-28 22:16:17 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-06-17 08:59:36 +00:00
|
|
|
if(vid.grid || (c->land == laAsteroids && !(WDIM == 2 && GDIM == 3))) if(!inmirrorcount) draw_grid_at(c, V);
|
2019-05-12 18:10:49 +00:00
|
|
|
|
2019-05-30 08:43:17 +00:00
|
|
|
if(onradar && WDIM == 2 && GDIM == 3) addradar(V, ch, darkenedby(asciicol, darken), 0);
|
|
|
|
|
|
|
|
if(WDIM == 2 && GDIM == 3) radar_grid(c, V);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!euclid) {
|
|
|
|
bool usethis = false;
|
|
|
|
double spd = 1;
|
2018-12-21 13:41:23 +00:00
|
|
|
int side = 0;
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-17 17:28:20 +00:00
|
|
|
if(0);
|
|
|
|
|
|
|
|
#if CAP_BT
|
|
|
|
else if(binarytiling && conformal::do_rotate >= 2) {
|
2018-08-09 17:28:53 +00:00
|
|
|
if(!straightDownSeek || c->master->distance < straightDownSeek->master->distance) {
|
|
|
|
usethis = true;
|
|
|
|
spd = 1;
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-09 17:28:53 +00:00
|
|
|
|
2018-08-30 17:14:04 +00:00
|
|
|
else if(isGravityLand(cwt.at->land) && cwt.at->land != laMountain) {
|
2018-12-21 13:41:23 +00:00
|
|
|
if(cwt.at->land == laDungeon) side = 2;
|
|
|
|
if(cwt.at->land == laWestWall) side = 1;
|
2018-03-25 13:07:11 +00:00
|
|
|
if(conformal::do_rotate >= 1)
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!straightDownSeek || edgeDepth(c) < edgeDepth(straightDownSeek)) {
|
|
|
|
usethis = true;
|
2018-08-17 22:46:45 +00:00
|
|
|
spd = cwt.at->landparam / 10.;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2018-03-25 13:07:11 +00:00
|
|
|
|
2018-08-17 22:46:45 +00:00
|
|
|
else if(c->master->alt && cwt.at->master->alt &&
|
2018-08-30 17:14:04 +00:00
|
|
|
((cwt.at->land == laMountain && conformal::do_rotate >= 1)||
|
2018-03-25 13:07:11 +00:00
|
|
|
(conformal::do_rotate >= 2 &&
|
2018-08-17 22:46:45 +00:00
|
|
|
(cwt.at->land == laTemple || cwt.at->land == laWhirlpool ||
|
|
|
|
(cheater && (cwt.at->land == laClearing || cwt.at->land == laCaribbean ||
|
|
|
|
cwt.at->land == laCamelot || cwt.at->land == laPalace)))
|
2017-07-10 18:47:38 +00:00
|
|
|
))
|
2018-08-17 22:46:45 +00:00
|
|
|
&& c->land == cwt.at->land && c->master->alt->alt == cwt.at->master->alt->alt) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!straightDownSeek || !straightDownSeek->master->alt || celldistAlt(c) < celldistAlt(straightDownSeek)) {
|
|
|
|
usethis = true;
|
|
|
|
spd = .5;
|
2018-12-21 13:41:23 +00:00
|
|
|
if(cwt.at->land == laMountain) side = 2;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-08-17 22:46:45 +00:00
|
|
|
else if(conformal::do_rotate >= 2 && cwt.at->land == laOcean && cwt.at->landparam < 25) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!straightDownSeek || coastval(c, laOcean) < coastval(straightDownSeek, laOcean)) {
|
|
|
|
usethis = true;
|
2018-08-17 22:46:45 +00:00
|
|
|
spd = cwt.at->landparam / 10;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(usethis) {
|
|
|
|
straightDownSeek = c;
|
2019-05-13 13:09:24 +00:00
|
|
|
straightDownPoint = tC0(V);
|
|
|
|
straightDownSpeed = spd;
|
|
|
|
if(side == 2) for(int i=0; i<3; i++) straightDownPoint[i] = -straightDownPoint[i];
|
|
|
|
if(side == 1) straightDownPoint = spin(-M_PI/2) * straightDownPoint;
|
2017-05-28 22:16:17 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
if(!inHighQual) {
|
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_EDIT
|
2017-07-12 17:50:39 +00:00
|
|
|
if((cmode & sm::MAP) && lmouseover && darken == 0 &&
|
2019-02-26 13:56:07 +00:00
|
|
|
(DIM == 3 || !mouseout()) &&
|
2017-12-09 07:06:41 +00:00
|
|
|
(patterns::whichPattern ? patterns::getpatterninfo0(c).id == patterns::getpatterninfo0(lmouseover).id : c == lmouseover)) {
|
2019-02-26 13:56:07 +00:00
|
|
|
queuecircleat(c, .78, 0x00FFFFFF);
|
2017-05-28 22:16:17 +00:00
|
|
|
}
|
2017-07-22 23:33:27 +00:00
|
|
|
|
2017-10-28 08:04:28 +00:00
|
|
|
mapeditor::drawGhosts(c, V, ctype);
|
2017-07-10 18:47:38 +00:00
|
|
|
#endif
|
2017-05-28 22:16:17 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-10-07 09:06:52 +00:00
|
|
|
if(vid.grid && c->bardir != NODIR && c->bardir != NOBARRIERS && c->land != laHauntedWall &&
|
2017-07-10 18:47:38 +00:00
|
|
|
c->barleft != NOWALLSEP_USED) {
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = darkena(0x505050, 0, 0xFF);
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(tC0(V), V*tC0(cgi.heptmove[c->bardir]), col, 2 + vid.linequality);
|
|
|
|
queueline(tC0(V), V*tC0(cgi.hexmove[c->bardir]), col, 2 + vid.linequality);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_MODEL
|
2017-07-10 18:47:38 +00:00
|
|
|
netgen::buildVertexInfo(c, V);
|
|
|
|
#endif
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
struct flashdata {
|
|
|
|
int t;
|
|
|
|
int size;
|
|
|
|
cell *where;
|
|
|
|
double angle;
|
2019-02-26 19:18:57 +00:00
|
|
|
double angle2;
|
2017-07-10 18:47:38 +00:00
|
|
|
int spd; // 0 for flashes, >0 for particles
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t color;
|
|
|
|
flashdata(int _t, int _s, cell *_w, color_t col, int sped) {
|
2017-07-10 18:47:38 +00:00
|
|
|
t=_t; size=_s; where=_w; color = col;
|
|
|
|
angle = rand() % 1000; spd = sped;
|
2019-05-08 18:41:18 +00:00
|
|
|
if(DIM == 3) angle2 = acos((rand() % 1000 - 499.5) / 500);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
};
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
vector<flashdata> flashes;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawFlash(cell *c) {
|
2017-07-10 18:47:38 +00:00
|
|
|
flashes.push_back(flashdata(ticks, 1000, c, iinf[itOrbFlash].color, 0));
|
|
|
|
}
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawBigFlash(cell *c) {
|
2017-07-10 18:47:38 +00:00
|
|
|
flashes.push_back(flashdata(ticks, 2000, c, 0xC0FF00, 0));
|
|
|
|
}
|
2019-02-26 19:19:19 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawParticleSpeed(cell *c, color_t col, int speed) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(vid.particles && !confusingGeometry())
|
2019-02-26 19:19:19 +00:00
|
|
|
flashes.push_back(flashdata(ticks, rand() % 16, c, col, speed));
|
|
|
|
}
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawParticle(cell *c, color_t col, int maxspeed IS(100)) {
|
2019-02-26 19:19:19 +00:00
|
|
|
drawParticleSpeed(c, col, 1 + rand() % maxspeed);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawParticles(cell *c, color_t col, int qty, int maxspeed IS(100)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(vid.particles)
|
|
|
|
while(qty--) drawParticle(c,col, maxspeed);
|
|
|
|
}
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawFireParticles(cell *c, int qty, int maxspeed IS(100)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(vid.particles)
|
|
|
|
for(int i=0; i<qty; i++)
|
|
|
|
drawParticle(c, firegradient(i / (qty-1.)), maxspeed);
|
|
|
|
}
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void fallingFloorAnimation(cell *c, eWall w IS(waNone), eMonster m IS(moNone)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!wmspatial) return;
|
|
|
|
fallanim& fa = fallanims[c];
|
|
|
|
fa.t_floor = ticks;
|
|
|
|
fa.walltype = w; fa.m = m;
|
|
|
|
// drawParticles(c, darkenedby(linf[c->land].color, 1), 4, 50);
|
|
|
|
}
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void fallingMonsterAnimation(cell *c, eMonster m, int id IS(multi::cpid)) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!mmspatial) return;
|
|
|
|
fallanim& fa = fallanims[c];
|
|
|
|
fa.t_mon = ticks;
|
|
|
|
fa.m = m;
|
2017-08-06 12:50:16 +00:00
|
|
|
fa.pid = id;
|
2017-07-10 18:47:38 +00:00
|
|
|
// drawParticles(c, darkenedby(linf[c->land].color, 1), 4, 50);
|
|
|
|
}
|
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void queuecircleat(cell *c, double rad, color_t col) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!c) return;
|
|
|
|
if(!gmatrix.count(c)) return;
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) {
|
2019-02-26 10:57:50 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, col);
|
2019-07-25 10:19:52 +00:00
|
|
|
int ofs = wall_offset(c);
|
2019-02-26 21:20:51 +00:00
|
|
|
for(int i=0; i<c->type; i++) {
|
2019-07-25 10:19:52 +00:00
|
|
|
queuepolyat(gmatrix[c], cgi.shWireframe3D[ofs + i], 0, PPR::SUPERLINE);
|
2019-02-26 21:20:51 +00:00
|
|
|
}
|
2019-02-26 10:57:50 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-05-09 15:03:28 +00:00
|
|
|
if(spatial_graphics || GDIM == 3) {
|
|
|
|
vector<transmatrix> corners(c->type+1);
|
|
|
|
for(int i=0; i<c->type; i++) corners[i] = gmatrix[c] * rgpushxto0(get_corner_position(c, i, 3 / rad));
|
|
|
|
corners[c->type] = corners[0];
|
|
|
|
for(int i=0; i<c->type; i++) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queueline(mscale(corners[i], cgi.FLOOR) * C0, mscale(corners[i+1], cgi.FLOOR) * C0, col, 2, PPR::SUPERLINE);
|
|
|
|
queueline(mscale(corners[i], cgi.WALL) * C0, mscale(corners[i+1], cgi.WALL) * C0, col, 2, PPR::SUPERLINE);
|
|
|
|
queueline(mscale(corners[i], cgi.FLOOR) * C0, mscale(corners[i], cgi.WALL) * C0, col, 2, PPR::SUPERLINE);
|
2019-05-09 15:03:28 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-11-17 18:24:02 +00:00
|
|
|
if(vid.stereo_mode || sphere) {
|
2018-09-04 17:53:42 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, col);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepolyat(gmatrix[c] * spintick(100), cgi.shGem[1], 0, PPR::LINE);
|
2018-07-23 12:04:32 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
queuecircle(gmatrix[c], rad, col);
|
|
|
|
if(!wmspatial) return;
|
|
|
|
if(highwall(c))
|
2019-05-26 16:04:02 +00:00
|
|
|
queuecircle(mscale(gmatrix[c], cgi.WALL), rad, col);
|
2017-07-10 18:47:38 +00:00
|
|
|
int sl;
|
|
|
|
if((sl = snakelevel(c))) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuecircle(mscale(gmatrix[c], cgi.SLEV[sl]), rad, col);
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(chasmgraph(c))
|
2019-05-26 16:04:02 +00:00
|
|
|
queuecircle(mscale(gmatrix[c], cgi.LAKE), rad, col);
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
#define G(x) x && gmatrix.count(x)
|
|
|
|
#define IG(x) if(G(x))
|
|
|
|
#define Gm(x) gmatrix[x]
|
|
|
|
#define Gm0(x) tC0(gmatrix[x])
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if ISMOBILE==1
|
2017-07-10 18:47:38 +00:00
|
|
|
#define MOBON (clicked)
|
|
|
|
#else
|
|
|
|
#define MOBON true
|
2016-01-02 10:09:13 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX cell *forwardcell() {
|
2019-02-26 11:28:54 +00:00
|
|
|
movedir md = vectodir(move_destination_vec(6));
|
|
|
|
cellwalker xc = cwt + md.d + wstep;
|
|
|
|
return xc.at;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void drawMarkers() {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-10-15 22:43:23 +00:00
|
|
|
if(!(cmode & sm::NORMAL)) return;
|
2018-01-02 10:15:42 +00:00
|
|
|
|
2018-09-06 20:34:35 +00:00
|
|
|
callhooks(hooks_markers);
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2018-08-18 15:38:07 +00:00
|
|
|
viewmat();
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2018-08-18 15:38:07 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2018-01-02 10:15:42 +00:00
|
|
|
for(cell *c1: crush_now)
|
|
|
|
queuecircleat(c1, .8, darkena(minf[moCrusher].color, 0, 0xFF));
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!inHighQual) {
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
bool ok = !ISPANDORA || mousepressed;
|
2019-02-17 17:41:40 +00:00
|
|
|
|
|
|
|
ignore(ok);
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2017-07-10 18:47:38 +00:00
|
|
|
if(G(dragon::target) && haveMount()) {
|
|
|
|
queuechr(Gm0(dragon::target), 2*vid.fsize, 'X',
|
2018-09-10 15:49:51 +00:00
|
|
|
gradient(0, iinf[itOrbDomination].color, -1, sintick(dragon::whichturn == turncount ? 75 : 150), 1));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
/* for(int i=0; i<12; i++) if(c->type == 5 && c->master == &dodecahedron[i])
|
|
|
|
queuechr(xc, yc, sc, 4*vid.fsize, 'A'+i, iinf[itOrbDomination].color); */
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
if(1) {
|
|
|
|
using namespace yendor;
|
|
|
|
if(yii < isize(yi) && !yi[yii].found) {
|
|
|
|
cell *keycell = NULL;
|
|
|
|
int i;
|
|
|
|
for(i=0; i<YDIST; i++)
|
|
|
|
if(yi[yii].path[i]->cpdist <= get_sightrange_ambush()) {
|
|
|
|
keycell = yi[yii].path[i];
|
|
|
|
}
|
|
|
|
if(keycell) {
|
|
|
|
for(; i<YDIST; i++) {
|
|
|
|
cell *c = yi[yii].path[i];
|
|
|
|
if(inscreenrange(c))
|
|
|
|
keycell = c;
|
|
|
|
}
|
|
|
|
hyperpoint H = tC0(ggmatrix(keycell));
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2018-11-17 18:24:02 +00:00
|
|
|
queuechr(H, 2*vid.fsize, 'X', 0x10101 * int(128 + 100 * sintick(150)));
|
2019-08-02 20:09:45 +00:00
|
|
|
int cd = celldistance(yi[yii].key(), cwt.at);
|
|
|
|
if(cd == DISTANCE_UNKNOWN) for(int i2 = 0; i2<YDIST; i2++) {
|
|
|
|
int cd2 = celldistance(cwt.at, yi[yii].path[i2]);
|
|
|
|
if(cd2 != DISTANCE_UNKNOWN) {
|
|
|
|
cd = cd2 + (YDIST-1-i2);
|
|
|
|
println(hlog, "i2 = ", i2, " cd = ", celldistance(cwt.at, keycell));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queuestr(H, vid.fsize, its(cd), 0x10101 * int(128 - 100 * sintick(150)));
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2018-11-17 18:24:02 +00:00
|
|
|
addauraspecial(H, iinf[itOrbYendor].color, 0);
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2017-05-27 19:40:40 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2018-11-17 18:24:02 +00:00
|
|
|
|
2018-11-17 18:30:50 +00:00
|
|
|
#if CAP_RACING
|
2018-11-24 14:35:02 +00:00
|
|
|
racing::markers();
|
2018-11-17 18:30:50 +00:00
|
|
|
#endif
|
2019-02-17 17:41:40 +00:00
|
|
|
|
|
|
|
#if CAP_QUEUE
|
2019-05-08 16:33:08 +00:00
|
|
|
if(lmouseover && vid.drawmousecircle && ok && DEFAULTCONTROL && MOBON && WDIM == 2) {
|
2017-07-10 18:47:38 +00:00
|
|
|
queuecircleat(lmouseover, .8, darkena(lmouseover->cpdist > 1 ? 0x00FFFF : 0xFF0000, 0, 0xFF));
|
|
|
|
}
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2019-05-08 16:33:08 +00:00
|
|
|
if(global_pushto && vid.drawmousecircle && ok && DEFAULTCONTROL && MOBON && WDIM == 2) {
|
2017-07-10 18:47:38 +00:00
|
|
|
queuecircleat(global_pushto, .6, darkena(0xFFD500, 0, 0xFF));
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_SDLJOY && CAP_QUEUE
|
2019-05-08 16:33:08 +00:00
|
|
|
if(joydir.d >= 0 && WDIM == 2)
|
2018-09-10 15:49:51 +00:00
|
|
|
queuecircleat(cwt.at->modmove(joydir.d+cwt.spin), .78 - .02 * sintick(199),
|
2017-07-10 18:47:38 +00:00
|
|
|
darkena(0x00FF00, 0, 0xFF));
|
2017-07-22 23:33:27 +00:00
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
bool m = true;
|
2019-02-17 17:41:40 +00:00
|
|
|
ignore(m);
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_MODEL
|
|
|
|
m = netgen::mode == 0;
|
|
|
|
#endif
|
2019-02-17 17:41:40 +00:00
|
|
|
|
|
|
|
#if CAP_QUEUE
|
2019-05-08 16:33:08 +00:00
|
|
|
if(centerover.at && !playermoved && m && !anims::any_animation() && WDIM == 2)
|
2018-09-10 15:58:36 +00:00
|
|
|
queuecircleat(centerover.at, .70 - .06 * sintick(200),
|
|
|
|
darkena(int(175 + 25 * sintick(200)), 0, 0xFF));
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::players > 1 || multi::alwaysuse) for(int i=0; i<numplayers(); i++) {
|
|
|
|
multi::cpid = i;
|
|
|
|
if(multi::players == 1) multi::player[i] = cwt;
|
|
|
|
cell *ctgt = multi::multiPlayerTarget(i);
|
2018-09-10 15:49:51 +00:00
|
|
|
queuecircleat(ctgt, .40 - .06 * sintick(200, i / numplayers()), getcs().uicolor);
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// process mouse
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-02-26 10:57:50 +00:00
|
|
|
if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on && DIM == 2) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::players == 1) {
|
2018-08-17 22:46:45 +00:00
|
|
|
forCellIdAll(c2, d, cwt.at) IG(c2) drawMovementArrows(c2, confusingGeometry() ? Gm(cwt.at) * calc_relative_matrix(c2, cwt.at, d) : Gm(c2));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
else if(multi::players > 1) for(int p=0; p<multi::players; p++) {
|
|
|
|
if(multi::playerActive(p) && (vid.axes == 4 || !drawstaratvec(multi::mdx[p], multi::mdy[p])))
|
2018-08-17 22:46:45 +00:00
|
|
|
forCellIdAll(c2, d, multi::player[p].at) IG(c2) {
|
2017-07-10 18:47:38 +00:00
|
|
|
multi::cpid = p;
|
|
|
|
dynamicval<transmatrix> ttm(cwtV, multi::whereis[p]);
|
|
|
|
dynamicval<cellwalker> tcw(cwt, multi::player[p]);
|
2018-08-17 22:46:45 +00:00
|
|
|
drawMovementArrows(c2, confusingGeometry() ? Gm(cwt.at) * calc_relative_matrix(c2, cwt.at, d) : Gm(c2));
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-26 10:57:50 +00:00
|
|
|
|
2019-06-25 08:30:31 +00:00
|
|
|
if(GDIM == 3 && !inHighQual && !shmup::on && vid.axes3 && playermoved) {
|
2019-02-26 13:56:07 +00:00
|
|
|
cell *c = forwardcell();
|
2019-02-26 11:28:54 +00:00
|
|
|
IG(c) queuecircleat(c, .8, getcs().uicolor);
|
2019-02-26 10:57:50 +00:00
|
|
|
}
|
2019-03-10 17:38:30 +00:00
|
|
|
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2019-06-24 20:28:20 +00:00
|
|
|
|
|
|
|
if(WDIM == 3 && !shmup::on) {
|
|
|
|
if(items[itOrbSword])
|
|
|
|
queuechr(gmatrix[cwt.at] * sword::dir[multi::cpid].T * xpush0(cgi.sword_size), vid.fsize*2, '+', iinf[itOrbSword].color);
|
|
|
|
if(items[itOrbSword2])
|
|
|
|
queuechr(gmatrix[cwt.at] * sword::dir[multi::cpid].T * xpush0(-cgi.sword_size), vid.fsize*2, '+', iinf[itOrbSword2].color);
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
monsterToSummon = moNone;
|
|
|
|
orbToTarget = itNone;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-12 17:50:39 +00:00
|
|
|
if(mouseover && targetclick) {
|
2017-07-10 18:47:38 +00:00
|
|
|
shmup::cpid = 0;
|
|
|
|
orbToTarget = targetRangedOrb(mouseover, roCheck);
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2017-07-10 18:47:38 +00:00
|
|
|
if(orbToTarget == itOrbSummon) {
|
|
|
|
monsterToSummon = summonedAt(mouseover);
|
|
|
|
queuechr(mousex, mousey, 0, vid.fsize, minf[monsterToSummon].glyph, minf[monsterToSummon].color);
|
|
|
|
queuecircleat(mouseover, 0.6, darkena(minf[monsterToSummon].color, 0, 0xFF));
|
|
|
|
}
|
|
|
|
else if(orbToTarget) {
|
|
|
|
queuechr(mousex, mousey, 0, vid.fsize, '@', iinf[orbToTarget].color);
|
|
|
|
queuecircleat(mouseover, 0.6, darkena(iinf[orbToTarget].color, 0, 0xFF));
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
if(orbToTarget && rand() % 200 < ticks - lastt) {
|
|
|
|
if(orbToTarget == itOrbDragon)
|
|
|
|
drawFireParticles(mouseover, 2);
|
|
|
|
else if(orbToTarget == itOrbSummon) {
|
|
|
|
drawParticles(mouseover, iinf[orbToTarget].color, 1);
|
|
|
|
drawParticles(mouseover, minf[monsterToSummon].color, 1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
drawParticles(mouseover, iinf[orbToTarget].color, 2);
|
|
|
|
}
|
|
|
|
}
|
2019-01-03 02:20:20 +00:00
|
|
|
if(items[itOrbAir] && mouseover->cpdist > 1) {
|
|
|
|
cell *c1 = mouseover;
|
|
|
|
for(int it=0; it<10; it++) {
|
|
|
|
int di;
|
|
|
|
cell *c2 = blowoff_destination(c1, di);
|
|
|
|
if(!c2) break;
|
|
|
|
transmatrix T1 = ggmatrix(c1);
|
|
|
|
transmatrix T2 = ggmatrix(c2);
|
|
|
|
transmatrix T = T1 * rspintox(inverse(T1)*T2*C0) * xpush(hdist(T1*C0, T2*C0) * fractick(50, 0));
|
|
|
|
color_t aircol = (orbToTarget == itOrbAir ? 0x8080FF40 : 0x8080FF20);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(T, cgi.shDisk, aircol);
|
2019-01-03 02:20:20 +00:00
|
|
|
c1 = c2;
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
void drawFlashes() {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_QUEUE
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int k=0; k<isize(flashes); k++) {
|
2017-07-10 18:47:38 +00:00
|
|
|
flashdata& f = flashes[k];
|
2018-04-14 08:27:49 +00:00
|
|
|
transmatrix V;
|
|
|
|
|
2018-06-07 11:58:00 +00:00
|
|
|
if(f.spd) try { V = gmatrix.at(f.where); } catch(out_of_range&) {
|
2018-06-22 12:47:24 +00:00
|
|
|
f = flashes[isize(flashes)-1];
|
2018-01-20 16:52:59 +00:00
|
|
|
flashes.pop_back(); k--;
|
|
|
|
continue;
|
2018-04-14 08:27:49 +00:00
|
|
|
}
|
2018-08-17 14:47:06 +00:00
|
|
|
else V = ggmatrix(f.where);
|
2018-04-14 08:27:49 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int tim = ticks - f.t;
|
|
|
|
|
|
|
|
bool kill = tim > f.size;
|
|
|
|
|
|
|
|
if(f.spd) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-07-10 18:47:38 +00:00
|
|
|
kill = tim > 300;
|
2019-02-26 19:18:57 +00:00
|
|
|
int partcol = darkena(f.color, 0, DIM == 3 ? 255 : max(255 - tim*255/300, 0));
|
2017-07-10 18:47:38 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
2019-05-26 16:04:02 +00:00
|
|
|
ld t = f.spd * tim * cgi.scalefactor / 50000.;
|
2019-02-26 19:18:57 +00:00
|
|
|
transmatrix T =
|
2019-05-08 18:41:18 +00:00
|
|
|
DIM == 2 ? V * spin(f.angle) * xpush(t) :
|
2019-02-26 19:18:57 +00:00
|
|
|
V * cspin(0, 1, f.angle) * cspin(0, 2, f.angle2) * cpush(2, t);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(T, cgi.shParticle[f.size], partcol);
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(f.size == 1000) {
|
|
|
|
for(int u=0; u<=tim; u++) {
|
|
|
|
if((u-tim)%50) continue;
|
|
|
|
if(u < tim-150) continue;
|
|
|
|
ld rad = u * 3 / 1000.;
|
|
|
|
rad = rad * (5-rad) / 2;
|
2019-05-26 16:04:02 +00:00
|
|
|
rad *= cgi.hexf;
|
2017-07-10 18:47:38 +00:00
|
|
|
int flashcol = f.color;
|
|
|
|
if(u > 500) flashcol = gradient(flashcol, 0, 500, u, 1100);
|
|
|
|
flashcol = darkena(flashcol, 0, 0xFF);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 13:04:54 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queueball(V * zpush(cgi.GROIN1), rad, flashcol, itDiamond);
|
2019-06-01 14:59:04 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2019-05-26 16:04:02 +00:00
|
|
|
PRING(a) curvepoint(V*xspinpush0(a * M_PI / cgi.S42, rad));
|
2019-05-11 13:04:54 +00:00
|
|
|
queuecurve(flashcol, 0x8080808, PPR::LINE);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(f.size == 2000) {
|
|
|
|
for(int u=0; u<=tim; u++) {
|
|
|
|
if((u-tim)%50) continue;
|
|
|
|
if(u < tim-250) continue;
|
|
|
|
ld rad = u * 3 / 2000.;
|
|
|
|
rad = rad * (5-rad) * 1.25;
|
2019-05-26 16:04:02 +00:00
|
|
|
rad *= cgi.hexf;
|
2017-07-10 18:47:38 +00:00
|
|
|
int flashcol = f.color;
|
|
|
|
if(u > 1000) flashcol = gradient(flashcol, 0, 1000, u, 2200);
|
|
|
|
flashcol = darkena(flashcol, 0, 0xFF);
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 13:04:54 +00:00
|
|
|
if(DIM == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queueball(V * zpush(cgi.GROIN1), rad, flashcol, itRuby);
|
2019-06-01 14:59:04 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2019-05-26 16:04:02 +00:00
|
|
|
PRING(a) curvepoint(V*xspinpush0(a * M_PI / cgi.S42, rad));
|
2019-05-11 13:04:54 +00:00
|
|
|
queuecurve(flashcol, 0x8080808, PPR::LINE);
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(kill) {
|
2018-06-22 12:47:24 +00:00
|
|
|
f = flashes[isize(flashes)-1];
|
2017-07-10 18:47:38 +00:00
|
|
|
flashes.pop_back(); k--;
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool allowIncreasedSight() {
|
2018-04-18 18:53:52 +00:00
|
|
|
if(cheater || autocheat) return true;
|
2017-08-18 00:58:55 +00:00
|
|
|
if(peace::on) return true;
|
|
|
|
#if CAP_TOUR
|
|
|
|
if(tour::on) return true;
|
|
|
|
#endif
|
|
|
|
if(randomPatternsMode) return true;
|
2019-01-11 14:01:36 +00:00
|
|
|
if(racing::on) return true;
|
2018-09-21 17:50:18 +00:00
|
|
|
if(quotient || !hyperbolic || archimedean) return true;
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) return true;
|
2017-08-18 00:58:55 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool allowChangeRange() {
|
2018-04-11 13:49:49 +00:00
|
|
|
if(cheater || peace::on || randomPatternsMode) return true;
|
|
|
|
#if CAP_TOUR
|
|
|
|
if(tour::on) return true;
|
|
|
|
#endif
|
2019-01-11 14:01:36 +00:00
|
|
|
if(racing::on) return true;
|
2018-04-11 13:49:49 +00:00
|
|
|
if(sightrange_bonus >= 0) return true;
|
2018-09-21 17:50:18 +00:00
|
|
|
if(archimedean) return true;
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) return true;
|
2018-04-11 13:49:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX purehookset hooks_drawmap;
|
2017-12-01 23:23:15 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX transmatrix actual_view_transform;
|
2019-04-29 01:34:21 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX ld wall_radar(cell *c, transmatrix T, ld max) {
|
2019-05-11 21:52:18 +00:00
|
|
|
if(pmodel != mdPerspective || !vid.use_wall_radar) return max;
|
|
|
|
ld step = max / 20;
|
2019-04-29 01:34:21 +00:00
|
|
|
ld fixed_yshift = 0;
|
|
|
|
for(int i=0; i<20; i++) {
|
2019-08-03 09:36:38 +00:00
|
|
|
T = solmul_pt(T, cpush(2, -step));
|
2019-04-29 01:34:21 +00:00
|
|
|
virtualRebase(c, T, false);
|
|
|
|
color_t col;
|
2019-05-26 16:04:02 +00:00
|
|
|
if(isWall3(c, col) || (WDIM == 2 && GDIM == 3 && tC0(T)[2] > cgi.FLOOR)) {
|
2019-08-03 09:36:38 +00:00
|
|
|
T = solmul_pt(T, cpush(2, step));
|
2019-04-29 01:34:21 +00:00
|
|
|
step /= 2; i = 17;
|
|
|
|
if(step < 1e-3) break;
|
|
|
|
}
|
|
|
|
else fixed_yshift += step;
|
|
|
|
}
|
|
|
|
return fixed_yshift;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void make_actual_view() {
|
2017-12-16 08:03:50 +00:00
|
|
|
sphereflip = Id;
|
2019-02-21 17:46:53 +00:00
|
|
|
if(sphereflipped()) sphereflip[DIM][DIM] = -1;
|
2019-05-11 21:52:18 +00:00
|
|
|
actual_view_transform = sphereflip;
|
|
|
|
if(vid.yshift && WDIM == 2) actual_view_transform = ypush(vid.yshift) * actual_view_transform;
|
2019-05-10 01:16:40 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-11 21:52:18 +00:00
|
|
|
if(GDIM == 3) {
|
2019-05-29 14:27:24 +00:00
|
|
|
ld max = WDIM == 2 ? vid.camera : vid.yshift;
|
2019-05-11 21:52:18 +00:00
|
|
|
if(max)
|
2019-08-03 09:36:38 +00:00
|
|
|
actual_view_transform = solmul(zpush(wall_radar((masterless ? centerover.at : viewctr.at->c7), inverse(View), max)), actual_view_transform * View) * inverse(View);
|
2019-05-20 11:40:56 +00:00
|
|
|
camera_level = asin_auto(tC0(inverse(actual_view_transform * View))[2]);
|
2019-05-11 21:52:18 +00:00
|
|
|
}
|
2019-08-06 10:00:46 +00:00
|
|
|
if(nonisotropic) {
|
2019-08-03 09:36:38 +00:00
|
|
|
transmatrix T = actual_view_transform * View;
|
|
|
|
transmatrix T2 = eupush( tC0(inverse(T)) );
|
2019-08-06 10:00:46 +00:00
|
|
|
nisot::local_perspective = T * T2;
|
|
|
|
actual_view_transform = inverse(nisot::local_perspective) * actual_view_transform;
|
2019-08-03 09:36:38 +00:00
|
|
|
}
|
2019-05-10 01:16:40 +00:00
|
|
|
#endif
|
2019-04-29 01:34:21 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX transmatrix cview() {
|
2019-04-29 01:34:21 +00:00
|
|
|
make_actual_view();
|
2019-06-01 14:59:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-05-24 19:42:30 +00:00
|
|
|
if(GDIM == 3 && WDIM == 2) {
|
|
|
|
transmatrix T = actual_view_transform * View;
|
|
|
|
transmatrix U = inverse(T);
|
|
|
|
|
|
|
|
if(T[0][2])
|
|
|
|
T = spin(-atan2(T[0][2], T[1][2])) * T;
|
|
|
|
if(T[1][2] && T[2][2])
|
|
|
|
T = cspin(1, 2, -atan2(T[1][2], T[2][2])) * T;
|
|
|
|
|
|
|
|
ld z = -asin_auto(tC0(inverse(T)) [2]);
|
|
|
|
T = zpush(-z) * T;
|
|
|
|
|
|
|
|
radar_transform = T * U;
|
|
|
|
}
|
2019-06-01 14:59:04 +00:00
|
|
|
#endif
|
2019-05-24 19:42:30 +00:00
|
|
|
|
2019-04-29 01:34:21 +00:00
|
|
|
return actual_view_transform * View;
|
2017-12-16 08:03:50 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void precise_mouseover() {
|
2019-05-09 15:02:50 +00:00
|
|
|
if(WDIM == 3) {
|
2019-02-26 13:56:07 +00:00
|
|
|
mouseover2 = mouseover = viewctr.at->c7;
|
|
|
|
ld best = HUGE_VAL;
|
2019-08-07 22:21:18 +00:00
|
|
|
hyperpoint h =
|
|
|
|
nisot::local_perspective_used() ? inverse(nisot::local_perspective) * cpush(2, 1) * C0 : cpush(2, 1) * C0;
|
2019-02-26 13:56:07 +00:00
|
|
|
forCellEx(c1, mouseover2) {
|
|
|
|
ld dist = hdist(tC0(ggmatrix(c1)), h);
|
|
|
|
if(dist < best) mouseover = c1, best = dist;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2018-08-19 20:53:51 +00:00
|
|
|
if(!mouseover) return;
|
2019-05-09 15:02:50 +00:00
|
|
|
if(GDIM == 3) return;
|
2018-08-19 20:53:51 +00:00
|
|
|
cell *omouseover = mouseover;
|
|
|
|
for(int loop = 0; loop < 10; loop++) {
|
|
|
|
bool found = false;
|
|
|
|
if(!gmatrix.count(mouseover)) return;
|
|
|
|
hyperpoint r_mouseh = inverse(gmatrix[mouseover]) * mouseh;
|
|
|
|
for(int i=0; i<mouseover->type; i++) {
|
|
|
|
hyperpoint h1 = get_corner_position(mouseover, (i+mouseover->type-1) % mouseover->type);
|
|
|
|
hyperpoint h2 = get_corner_position(mouseover, i);
|
|
|
|
hyperpoint hx = r_mouseh - h1;
|
|
|
|
h2 = h2 - h1;
|
|
|
|
ld z = h2[1] * hx[0] - h2[0] * hx[1];
|
|
|
|
ld z0 = h2[1] * h1[0] - h2[0] * h1[1];
|
|
|
|
if(z * z0 > 0) {
|
|
|
|
mouseover2 = mouseover;
|
|
|
|
mouseover = mouseover->move(i);
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) return;
|
|
|
|
}
|
|
|
|
// probably some error... just return the original
|
|
|
|
mouseover = omouseover;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawthemap() {
|
2019-05-27 05:19:04 +00:00
|
|
|
check_cgi();
|
|
|
|
cgi.require_shapes();
|
|
|
|
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_GRAPH, ("draw the map"));
|
|
|
|
|
2019-03-13 13:04:06 +00:00
|
|
|
last_firelimit = firelimit;
|
|
|
|
firelimit = 0;
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2019-05-11 13:06:48 +00:00
|
|
|
if(DIM == 3) make_clipping_planes();
|
2019-02-28 15:24:46 +00:00
|
|
|
radarpoints.clear();
|
2019-05-30 08:43:17 +00:00
|
|
|
radarlines.clear();
|
2017-12-01 23:23:15 +00:00
|
|
|
callhooks(hooks_drawmap);
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
frameid++;
|
2018-11-01 17:59:25 +00:00
|
|
|
cells_drawn = 0;
|
2019-05-15 13:49:09 +00:00
|
|
|
cells_generated = 0;
|
2019-05-11 13:06:48 +00:00
|
|
|
noclipped = 0;
|
2019-05-11 17:42:30 +00:00
|
|
|
first_cell_to_draw = true;
|
2017-09-03 19:12:44 +00:00
|
|
|
|
2018-04-03 21:34:47 +00:00
|
|
|
if(sightrange_bonus > 0 && !allowIncreasedSight())
|
|
|
|
sightrange_bonus = 0;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
profile_frame();
|
|
|
|
profile_start(0);
|
|
|
|
swap(gmatrix0, gmatrix);
|
|
|
|
gmatrix.clear();
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
wmspatial = vid.wallmode == 4 || vid.wallmode == 5;
|
|
|
|
wmescher = vid.wallmode == 3 || vid.wallmode == 5;
|
|
|
|
wmplain = vid.wallmode == 2 || vid.wallmode == 4;
|
|
|
|
wmascii = vid.wallmode == 0;
|
|
|
|
wmblack = vid.wallmode == 1;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
mmitem = vid.monmode >= 1;
|
|
|
|
mmmon = vid.monmode >= 2;
|
|
|
|
mmhigh = vid.monmode == 3 || vid.monmode == 5;
|
|
|
|
mmspatial = vid.monmode == 4 || vid.monmode == 5;
|
2018-12-05 18:57:35 +00:00
|
|
|
|
|
|
|
spatial_graphics = wmspatial || mmspatial;
|
2019-03-20 01:10:53 +00:00
|
|
|
spatial_graphics = spatial_graphics && DIM == 2;
|
2019-02-17 17:45:42 +00:00
|
|
|
#if CAP_RUG
|
2018-12-05 18:57:35 +00:00
|
|
|
if(rug::rugged && !rug::spatial_rug) spatial_graphics = false;
|
2019-02-17 17:45:42 +00:00
|
|
|
#endif
|
2018-12-05 18:57:35 +00:00
|
|
|
if(non_spatial_model())
|
|
|
|
spatial_graphics = false;
|
2018-12-23 02:15:00 +00:00
|
|
|
if(pmodel == mdDisk && abs(vid.alpha) < 1e-6) spatial_graphics = false;
|
2018-12-05 18:57:35 +00:00
|
|
|
|
|
|
|
if(!spatial_graphics) wmspatial = mmspatial = false;
|
2019-03-20 20:15:42 +00:00
|
|
|
if(DIM == 3) wmspatial = mmspatial = true;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int m=0; m<motypes; m++) if(isPrincess(eMonster(m)))
|
|
|
|
minf[m].name = princessgender() ? "Princess" : "Prince";
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
iinf[itSavedPrincess].name = minf[moPrincess].name;
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int i=0; i<NUM_GS; i++) {
|
|
|
|
genderswitch_t& g = genderswitch[i];
|
|
|
|
if(g.gender != princessgender()) continue;
|
|
|
|
minf[g.m].help = g.desc;
|
|
|
|
minf[g.m].name = g.name;
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(mapeditor::autochoose) mapeditor::ew = mapeditor::ewsearch;
|
|
|
|
mapeditor::ewsearch.dist = 1e30;
|
|
|
|
modist = 1e20; mouseover = NULL;
|
|
|
|
modist2 = 1e20; mouseover2 = NULL;
|
2017-07-12 16:03:53 +00:00
|
|
|
|
2018-04-11 11:16:40 +00:00
|
|
|
compute_graphical_distance();
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
centdist = 1e20;
|
2018-08-18 15:35:39 +00:00
|
|
|
if(!masterless) centerover.at = NULL;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int i=0; i<multi::players; i++) {
|
|
|
|
multi::ccdist[i] = 1e20; multi::ccat[i] = NULL;
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-13 13:09:24 +00:00
|
|
|
straightDownSeek = NULL;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if ISMOBILE
|
2017-07-10 18:47:38 +00:00
|
|
|
mouseovers = XLAT("No info about this...");
|
|
|
|
#endif
|
2019-05-09 15:02:50 +00:00
|
|
|
if(mouseout() && !mousepan)
|
2017-07-10 18:47:38 +00:00
|
|
|
modist = -5;
|
|
|
|
playerfound = false;
|
|
|
|
// playerfoundL = false;
|
|
|
|
// playerfoundR = false;
|
2017-10-04 19:26:26 +00:00
|
|
|
|
|
|
|
arrowtraps.clear();
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
profile_start(1);
|
2019-03-08 21:38:44 +00:00
|
|
|
currentmap->draw();
|
2018-01-11 22:18:02 +00:00
|
|
|
drawWormSegments();
|
2017-09-30 09:46:41 +00:00
|
|
|
drawBlizzards();
|
2017-10-04 19:26:26 +00:00
|
|
|
drawArrowTraps();
|
2018-08-19 20:53:51 +00:00
|
|
|
|
|
|
|
precise_mouseover();
|
|
|
|
|
2017-07-16 21:00:55 +00:00
|
|
|
ivoryz = false;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
linepatterns::drawAll();
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
callhooks(hooks_frame);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
profile_stop(1);
|
|
|
|
profile_start(4);
|
|
|
|
drawMarkers();
|
|
|
|
profile_stop(4);
|
|
|
|
drawFlashes();
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::players > 1 && !shmup::on) {
|
|
|
|
if(shmup::centerplayer != -1)
|
|
|
|
cwtV = multi::whereis[shmup::centerplayer];
|
|
|
|
else {
|
|
|
|
hyperpoint h;
|
|
|
|
for(int i=0; i<3; i++) h[i] = 0;
|
|
|
|
for(int p=0; p<multi::players; p++) if(multi::playerActive(p)) {
|
|
|
|
hyperpoint h1 = tC0(multi::whereis[p]);
|
|
|
|
for(int i=0; i<3; i++) h[i] += h1[i];
|
|
|
|
}
|
|
|
|
h = mid(h, h);
|
|
|
|
cwtV = rgpushxto0(h);
|
|
|
|
}
|
2016-08-26 09:58:03 +00:00
|
|
|
}
|
2017-04-04 09:13:15 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(shmup::on) {
|
|
|
|
if(shmup::players == 1)
|
|
|
|
cwtV = shmup::pc[0]->pat;
|
|
|
|
else if(shmup::centerplayer != -1)
|
|
|
|
cwtV = shmup::pc[shmup::centerplayer]->pat;
|
2017-04-04 09:13:15 +00:00
|
|
|
else {
|
2017-07-10 18:47:38 +00:00
|
|
|
hyperpoint h;
|
|
|
|
for(int i=0; i<3; i++) h[i] = 0;
|
|
|
|
for(int p=0; p<multi::players; p++) {
|
|
|
|
hyperpoint h1 = tC0(shmup::pc[p]->pat);
|
|
|
|
for(int i=0; i<3; i++) h[i] += h1[i];
|
|
|
|
}
|
|
|
|
h = mid(h, h);
|
|
|
|
cwtV = rgpushxto0(h);
|
2017-04-04 09:13:15 +00:00
|
|
|
}
|
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_SDL
|
2017-07-10 18:47:38 +00:00
|
|
|
Uint8 *keystate = SDL_GetKeyState(NULL);
|
|
|
|
lmouseover = mouseover;
|
|
|
|
bool useRangedOrb = (!(vid.shifttarget & 1) && haveRangedOrb() && lmouseover && lmouseover->cpdist > 1) || (keystate[SDLK_RSHIFT] | keystate[SDLK_LSHIFT]);
|
2017-12-22 19:58:47 +00:00
|
|
|
if(!useRangedOrb && !(cmode & sm::MAP) && !(cmode & sm::DRAW) && DEFAULTCONTROL && !mouseout()) {
|
2018-12-23 02:14:48 +00:00
|
|
|
dynamicval<eGravity> gs(gravity_state, gravity_state);
|
2017-07-10 18:47:38 +00:00
|
|
|
void calcMousedest();
|
|
|
|
calcMousedest();
|
|
|
|
cellwalker cw = cwt; bool f = flipplayer;
|
|
|
|
items[itWarning]+=2;
|
|
|
|
|
|
|
|
bool recorduse[ittypes];
|
|
|
|
for(int i=0; i<ittypes; i++) recorduse[i] = orbused[i];
|
|
|
|
movepcto(mousedest.d, mousedest.subdir, true);
|
|
|
|
for(int i=0; i<ittypes; i++) orbused[i] = recorduse[i];
|
|
|
|
items[itWarning] -= 2;
|
2017-07-22 23:33:27 +00:00
|
|
|
if(cw.spin != cwt.spin) mirror::act(-mousedest.d, mirror::SPINSINGLE);
|
2017-07-10 18:47:38 +00:00
|
|
|
cwt = cw; flipplayer = f;
|
2018-08-17 22:46:45 +00:00
|
|
|
lmouseover = mousedest.d >= 0 ? cwt.at->modmove(cwt.spin + mousedest.d) : cwt.at;
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
profile_stop(0);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawmovestar(double dx, double dy) {
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_GRAPH, ("draw movestar"));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(viewdists) return;
|
2019-02-26 10:57:50 +00:00
|
|
|
if(DIM == 3) return;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!playerfound) return;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(shmup::on) return;
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_RUG
|
2017-07-10 18:47:38 +00:00
|
|
|
if(rug::rugged && multi::players == 1 && !multi::alwaysuse) return;
|
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
hyperpoint H = tC0(cwtV);
|
|
|
|
ld R = sqrt(H[0] * H[0] + H[1] * H[1]);
|
|
|
|
transmatrix Centered = Id;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2018-08-18 15:35:39 +00:00
|
|
|
if(masterless)
|
2019-02-21 17:46:53 +00:00
|
|
|
Centered = eupush(H);
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(R > 1e-9) Centered = rgpushxto0(H);
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2019-02-22 19:58:40 +00:00
|
|
|
Centered = Centered * rgpushxto0(hpxy(dx*5, dy*5));
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::cpid >= 0) multi::crosscenter[multi::cpid] = Centered;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int rax = vid.axes;
|
|
|
|
if(rax == 1) rax = drawstaratvec(dx, dy) ? 2 : 0;
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(rax == 0 || vid.axes == 4) return;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
int starcol = getcs().uicolor;
|
2019-02-17 17:41:40 +00:00
|
|
|
ignore(starcol);
|
|
|
|
|
|
|
|
if(0);
|
2017-12-01 23:23:15 +00:00
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-02-17 17:41:40 +00:00
|
|
|
else if(vid.axes == 3)
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(Centered, cgi.shMovestar, starcol);
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
else for(int d=0; d<8; d++) {
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = starcol;
|
2017-07-22 23:33:27 +00:00
|
|
|
#if ISPANDORA
|
2017-07-10 18:47:38 +00:00
|
|
|
if(leftclick && (d == 2 || d == 6 || d == 1 || d == 7)) col &= 0xFFFFFF3F;
|
|
|
|
if(rightclick && (d == 2 || d == 6 || d == 3 || d == 5)) col &= 0xFFFFFF3F;
|
|
|
|
if(!leftclick && !rightclick && (d&1)) col &= 0xFFFFFF3F;
|
2015-08-08 13:57:52 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
// EUCLIDEAN
|
2017-12-01 23:23:15 +00:00
|
|
|
|
2018-08-19 14:28:36 +00:00
|
|
|
queueline(tC0(Centered), Centered * xspinpush0(d * M_PI / 4, euclid ? 0.5 : d==0?.7:d==2?.5:.2), col, 3 + vid.linequality);
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// old style joystick control
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
bool dronemode;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-07-09 16:59:12 +00:00
|
|
|
purehookset hooks_calcparam;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void calcparam() {
|
2018-11-17 18:24:02 +00:00
|
|
|
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_GRAPH, ("calc param"));
|
2018-11-17 18:24:02 +00:00
|
|
|
auto cd = current_display;
|
|
|
|
|
2018-11-17 23:35:50 +00:00
|
|
|
cd->xtop = vid.xres * cd->xmin;
|
|
|
|
cd->ytop = vid.yres * cd->ymin;
|
|
|
|
|
|
|
|
cd->xsize = vid.xres * (cd->xmax - cd->xmin);
|
|
|
|
cd->ysize = vid.yres * (cd->ymax - cd->ymin);
|
|
|
|
|
|
|
|
cd->xcenter = cd->xtop + cd->xsize / 2;
|
|
|
|
cd->ycenter = cd->ytop + cd->ysize / 2;
|
2018-09-10 15:24:58 +00:00
|
|
|
|
|
|
|
if(vid.scale > -1e-2 && vid.scale < 1e-2) vid.scale = 1;
|
2017-05-27 19:40:40 +00:00
|
|
|
|
2018-11-17 23:35:50 +00:00
|
|
|
ld realradius = min(cd->xsize / 2, cd->ysize / 2);
|
2017-12-14 01:53:29 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
cd->scrsize = realradius - (inHighQual ? 0 : ISANDROID ? 2 : ISIOS ? 40 : 40);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-11-27 01:33:10 +00:00
|
|
|
current_display->sidescreen = false;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-07-28 09:07:21 +00:00
|
|
|
if(vid.xres < vid.yres - 2 * vid.fsize && !inHighQual && !in_perspective()) {
|
2018-11-17 18:24:02 +00:00
|
|
|
cd->ycenter = vid.yres - cd->scrsize - vid.fsize;
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
else {
|
2018-12-13 16:03:13 +00:00
|
|
|
if(vid.xres > vid.yres * 4/3+16 && (cmode & sm::SIDE))
|
2018-11-27 01:33:10 +00:00
|
|
|
current_display->sidescreen = true;
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_TOUR
|
2017-07-10 18:47:38 +00:00
|
|
|
if(tour::on && (tour::slides[tour::currentslide].flags & tour::SIDESCREEN))
|
2018-11-27 01:33:10 +00:00
|
|
|
current_display->sidescreen = true;
|
2017-03-23 10:53:57 +00:00
|
|
|
#endif
|
|
|
|
|
2018-11-27 01:33:10 +00:00
|
|
|
if(current_display->sidescreen) cd->xcenter = vid.yres/2;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2018-02-20 21:11:39 +00:00
|
|
|
|
2019-02-28 18:00:32 +00:00
|
|
|
cd->radius = vid.scale * cd->scrsize;
|
2019-07-28 09:07:21 +00:00
|
|
|
if(DIM == 3 && in_perspective()) cd->radius = cd->scrsize;
|
2018-11-17 18:24:02 +00:00
|
|
|
realradius = min(realradius, cd->radius);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
if(dronemode) { cd->ycenter -= cd->radius; cd->ycenter += vid.fsize/2; cd->ycenter += vid.fsize/2; cd->radius *= 2; }
|
2017-12-25 09:26:50 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
cd->xcenter += cd->scrsize * vid.xposition;
|
|
|
|
cd->ycenter += cd->scrsize * vid.yposition;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
cd->tanfov = tan(vid.fov * degree / 2);
|
2018-02-03 12:41:49 +00:00
|
|
|
|
|
|
|
if(pmodel)
|
2018-11-17 18:24:02 +00:00
|
|
|
cd->scrdist = vid.xres / 2 / cd->tanfov;
|
2018-02-03 12:41:49 +00:00
|
|
|
else
|
2018-11-17 18:24:02 +00:00
|
|
|
cd->scrdist = cd->radius;
|
2018-07-09 16:59:12 +00:00
|
|
|
|
|
|
|
callhooks(hooks_calcparam);
|
2019-04-23 13:03:17 +00:00
|
|
|
reset_projection();
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-01-25 16:22:04 +00:00
|
|
|
function<void()> wrap_drawfullmap = drawfullmap;
|
|
|
|
|
2018-02-26 12:17:06 +00:00
|
|
|
bool force_sphere_outline = false;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawfullmap() {
|
2018-11-08 15:28:17 +00:00
|
|
|
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_GRAPH, ("draw full map"));
|
2018-11-08 15:28:17 +00:00
|
|
|
|
2019-05-27 05:19:04 +00:00
|
|
|
check_cgi();
|
|
|
|
cgi.require_shapes();
|
|
|
|
|
2018-11-08 15:28:17 +00:00
|
|
|
ptds.clear();
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
if(conformal::on) {
|
|
|
|
char ch = 'A';
|
|
|
|
for(auto& v: conformal::v) {
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(ggmatrix(v->base) * v->at, cgi.shTriangle, 0x306090C0);
|
2018-11-08 15:28:17 +00:00
|
|
|
queuechr(ggmatrix(v->base) * v->at * C0, 10, ch++, 0xFF0000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_QUEUE
|
2018-11-08 15:28:17 +00:00
|
|
|
draw_boundary(0);
|
|
|
|
draw_boundary(1);
|
|
|
|
|
|
|
|
draw_model_elements();
|
2019-06-01 15:01:04 +00:00
|
|
|
#if MAXMDIM >= 4
|
|
|
|
prepare_sky();
|
|
|
|
#endif
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2018-11-08 15:28:17 +00:00
|
|
|
|
2017-12-09 02:48:30 +00:00
|
|
|
/* if(vid.wallmode < 2 && !euclid && !patterns::whichShape) {
|
2018-06-22 12:47:24 +00:00
|
|
|
int ls = isize(lines);
|
2017-07-10 18:47:38 +00:00
|
|
|
if(ISMOBILE) ls /= 10;
|
|
|
|
for(int t=0; t<ls; t++) queueline(View * lines[t].P1, View * lines[t].P2, lines[t].col >> (darken+1));
|
|
|
|
} */
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
clearaura();
|
2018-07-09 16:10:28 +00:00
|
|
|
if(!nomap) drawthemap();
|
2017-07-10 18:47:38 +00:00
|
|
|
if(!inHighQual) {
|
2017-07-12 17:50:39 +00:00
|
|
|
if((cmode & sm::NORMAL) && !rug::rugged) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(multi::players > 1) {
|
|
|
|
transmatrix bcwtV = cwtV;
|
|
|
|
for(int i=0; i<multi::players; i++) if(multi::playerActive(i))
|
|
|
|
cwtV = multi::whereis[i], multi::cpid = i, drawmovestar(multi::mdx[i], multi::mdy[i]);
|
|
|
|
cwtV = bcwtV;
|
|
|
|
}
|
|
|
|
else if(multi::alwaysuse)
|
|
|
|
drawmovestar(multi::mdx[0], multi::mdy[0]);
|
|
|
|
else
|
|
|
|
drawmovestar(0, 0);
|
|
|
|
}
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_EDIT
|
2017-07-12 17:50:39 +00:00
|
|
|
if(cmode & sm::DRAW) mapeditor::drawGrid();
|
2017-07-22 23:33:27 +00:00
|
|
|
#endif
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
profile_start(2);
|
2017-07-16 21:00:55 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
drawaura();
|
2019-02-17 17:41:40 +00:00
|
|
|
#if CAP_QUEUE
|
2017-07-10 18:47:38 +00:00
|
|
|
drawqueue();
|
2019-02-17 17:41:40 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
profile_stop(2);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-06-28 08:22:48 +00:00
|
|
|
#if ISMOBILE
|
|
|
|
extern bool wclick;
|
|
|
|
#endif
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void gamescreen(int _darken) {
|
2017-11-07 15:42:31 +00:00
|
|
|
|
2019-03-09 15:20:06 +00:00
|
|
|
if(subscreens::split([=] () {
|
2018-11-17 18:30:50 +00:00
|
|
|
calcparam();
|
|
|
|
compute_graphical_distance();
|
|
|
|
gamescreen(_darken);
|
2018-11-17 23:36:31 +00:00
|
|
|
})) {
|
2019-03-09 15:20:06 +00:00
|
|
|
if(racing::on) return;
|
|
|
|
// create the gmatrix
|
|
|
|
View = subscreens::player_displays[0].view_matrix;
|
|
|
|
viewctr = subscreens::player_displays[0].view_center;
|
|
|
|
just_gmatrix = true;
|
|
|
|
currentmap->draw();
|
|
|
|
just_gmatrix = false;
|
2018-11-17 23:36:31 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-05-28 23:09:38 +00:00
|
|
|
|
|
|
|
if(dual::split([=] () {
|
|
|
|
dual::in_subscreen([=] () { gamescreen(_darken); });
|
|
|
|
})) {
|
|
|
|
calcparam();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-11-27 01:33:10 +00:00
|
|
|
if((cmode & sm::MAYDARK) && !current_display->sidescreen) {
|
2017-12-03 10:48:02 +00:00
|
|
|
_darken += 2;
|
2017-11-07 15:42:31 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
darken = _darken;
|
|
|
|
|
|
|
|
if(conformal::includeHistory) conformal::restore();
|
2017-07-04 13:38:33 +00:00
|
|
|
|
2018-09-10 15:58:36 +00:00
|
|
|
anims::apply();
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_RUG
|
2017-07-10 18:47:38 +00:00
|
|
|
if(rug::rugged) {
|
|
|
|
rug::actDraw();
|
2017-07-22 23:33:27 +00:00
|
|
|
} else
|
2017-07-04 13:38:33 +00:00
|
|
|
#endif
|
2018-01-25 16:22:04 +00:00
|
|
|
wrap_drawfullmap();
|
2018-09-10 15:58:36 +00:00
|
|
|
anims::rollback();
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(conformal::includeHistory) conformal::restoreBack();
|
2017-04-08 15:18:29 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if ISMOBILE
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
buttonclicked = false;
|
|
|
|
|
2018-11-17 18:24:02 +00:00
|
|
|
if((cmode & sm::NORMAL) && vid.stereo_mode != sLR) {
|
2017-07-10 18:47:38 +00:00
|
|
|
if(andmode == 0 && shmup::on) {
|
|
|
|
using namespace shmupballs;
|
|
|
|
calc();
|
|
|
|
drawCircle(xmove, yb, rad, OUTLINE_FORE);
|
|
|
|
drawCircle(xmove, yb, rad/2, OUTLINE_FORE);
|
|
|
|
drawCircle(xfire, yb, rad, 0xFF0000FF);
|
|
|
|
drawCircle(xfire, yb, rad/2, 0xFF0000FF);
|
2017-04-14 18:12:23 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else {
|
2019-06-28 08:05:28 +00:00
|
|
|
if(!haveMobileCompass()) displayabutton(-1, +1, XLAT(andmode == 0 && useRangedOrb ? "FIRE" : andmode == 0 && WDIM == 3 && wclick ? "WAIT" : "MOVE"), andmode == 0 ? BTON : BTOFF);
|
2019-06-28 07:59:26 +00:00
|
|
|
displayabutton(+1, +1, rug::rugged ? "RUG" : XLAT(andmode == 1 ? "BACK" : DIM == 3 ? "CAM" : "DRAG"), andmode == 1 ? BTON : BTOFF);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
displayabutton(-1, -1, XLAT("INFO"), andmode == 12 ? BTON : BTOFF);
|
|
|
|
displayabutton(+1, -1, XLAT("MENU"), andmode == 3 ? BTON : BTOFF);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
|
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
darken = 0;
|
2017-12-25 09:26:50 +00:00
|
|
|
|
2018-01-05 16:30:03 +00:00
|
|
|
#if CAP_TEXTURE
|
2018-03-17 20:12:46 +00:00
|
|
|
if(texture::config.tstate == texture::tsAdjusting)
|
|
|
|
texture::config.drawRawTexture();
|
2018-01-05 16:30:03 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool nohelp;
|
2018-03-02 12:03:50 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void normalscreen() {
|
2017-07-10 18:47:38 +00:00
|
|
|
help = "@";
|
2017-07-12 16:03:53 +00:00
|
|
|
|
|
|
|
mouseovers = XLAT("Press F1 or right click for help");
|
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_TOUR
|
2017-07-12 16:03:53 +00:00
|
|
|
if(tour::on) mouseovers = tour::tourhelp;
|
|
|
|
#endif
|
|
|
|
|
2019-03-09 00:35:55 +00:00
|
|
|
if(DIM == 3 || !outofmap(mouseh)) getcstat = '-';
|
2017-07-12 17:50:39 +00:00
|
|
|
cmode = sm::NORMAL | sm::DOTOUR | sm::CENTER;
|
2018-09-23 11:48:59 +00:00
|
|
|
if(viewdists && show_distance_lists) cmode |= sm::SIDE | sm::MAYDARK;
|
2017-07-10 18:47:38 +00:00
|
|
|
gamescreen(hiliteclick && mmmon ? 1 : 0); drawStats();
|
2017-08-06 12:50:16 +00:00
|
|
|
if(nomenukey || ISMOBILE)
|
2017-07-10 18:47:38 +00:00
|
|
|
;
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_TOUR
|
2017-07-10 18:47:38 +00:00
|
|
|
else if(tour::on)
|
|
|
|
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(ESC) tour menu"), SDLK_ESCAPE, 16);
|
|
|
|
else
|
2015-08-08 13:57:52 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(v) menu"), 'v', 16);
|
|
|
|
keyhandler = handleKeyNormal;
|
2017-07-12 16:03:53 +00:00
|
|
|
|
2018-09-10 17:39:15 +00:00
|
|
|
if(!playerfound && !anims::any_on())
|
2018-11-17 18:24:02 +00:00
|
|
|
displayButton(current_display->xcenter, current_display->ycenter, XLAT(mousing ? "find the player" : "press SPACE to find the player"), ' ', 8);
|
2018-08-21 16:23:31 +00:00
|
|
|
|
2017-07-12 16:03:53 +00:00
|
|
|
describeMouseover();
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
vector< function<void()> > screens = { normalscreen };
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int cmode;
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void drawscreen() {
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_GRAPH, ("drawscreen"));
|
2016-08-26 09:58:03 +00:00
|
|
|
|
2019-05-12 23:57:40 +00:00
|
|
|
if(vid.xres == 0 || vid.yres == 0) return;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
calcparam();
|
2017-11-06 18:24:02 +00:00
|
|
|
// rug::setVidParam();
|
2017-07-22 23:33:27 +00:00
|
|
|
|
|
|
|
#if CAP_GL
|
2017-07-10 18:47:38 +00:00
|
|
|
if(vid.usingGL) setGLProjection();
|
|
|
|
#endif
|
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_SDL
|
2017-07-10 18:47:38 +00:00
|
|
|
// SDL_LockSurface(s);
|
|
|
|
// unsigned char *b = (unsigned char*) s->pixels;
|
|
|
|
// int n = vid.xres * vid.yres * 4;
|
|
|
|
// while(n) *b >>= 1, b++, n--;
|
|
|
|
// memset(s->pixels, 0, vid.xres * vid.yres * 4);
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_GL
|
|
|
|
if(!vid.usingGL)
|
|
|
|
#endif
|
|
|
|
SDL_FillRect(s, NULL, backcolor);
|
2017-03-23 10:53:57 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
// displaynum(vx,100, 0, 24, 0xc0c0c0, celldist(cwt.at), ":");
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
lgetcstat = getcstat;
|
|
|
|
getcstat = 0; inslider = false;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-12 16:03:53 +00:00
|
|
|
mouseovers = " ";
|
|
|
|
|
2017-07-12 17:50:39 +00:00
|
|
|
cmode = 0;
|
2019-01-06 01:40:45 +00:00
|
|
|
keyhandler = [] (int sym, int uni) {};
|
2018-11-18 02:18:11 +00:00
|
|
|
#if CAP_SDL
|
|
|
|
joyhandler = [] (SDL_Event& ev) { return false; };
|
|
|
|
#endif
|
2018-06-22 12:47:24 +00:00
|
|
|
if(!isize(screens)) pushScreen(normalscreen);
|
2017-07-10 18:47:38 +00:00
|
|
|
screens.back()();
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2017-07-22 23:33:27 +00:00
|
|
|
#if !ISMOBILE
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t col = linf[cwt.at->land].color;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(cwt.at->land == laRedRock) col = 0xC00000;
|
2018-03-02 12:03:50 +00:00
|
|
|
if(!nohelp)
|
|
|
|
displayfr(vid.xres/2, vid.fsize, 2, vid.fsize, mouseovers, col, 8);
|
2017-07-12 16:03:53 +00:00
|
|
|
#endif
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
drawmessages();
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-12 17:50:39 +00:00
|
|
|
bool normal = cmode & sm::NORMAL;
|
|
|
|
|
|
|
|
if((havewhat&HF_BUG) && darken == 0 && normal) for(int k=0; k<3; k++)
|
2017-07-10 18:47:38 +00:00
|
|
|
displayfr(vid.xres/2 + vid.fsize * 5 * (k-1), vid.fsize*2, 2, vid.fsize,
|
|
|
|
its(hive::bugcount[k]), minf[moBug0+k].color, 8);
|
|
|
|
|
|
|
|
bool minefieldNearby = false;
|
2019-04-08 12:56:46 +00:00
|
|
|
int mines[MAXPLAYER], tmines=0;
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int p=0; p<numplayers(); p++) {
|
|
|
|
mines[p] = 0;
|
|
|
|
cell *c = playerpos(p);
|
|
|
|
if(!c) continue;
|
2019-04-08 12:58:54 +00:00
|
|
|
for(cell *c2: adj_minefield_cells(c)) {
|
|
|
|
if(c2->land == laMinefield)
|
2017-07-10 18:47:38 +00:00
|
|
|
minefieldNearby = true;
|
2019-04-08 12:58:54 +00:00
|
|
|
if(c2->wall == waMineMine) {
|
2017-07-10 18:47:38 +00:00
|
|
|
bool ep = false;
|
|
|
|
if(!ep) mines[p]++, tmines++;
|
2016-01-02 10:09:13 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2016-01-02 10:09:13 +00:00
|
|
|
|
2018-12-23 02:14:48 +00:00
|
|
|
if((minefieldNearby || tmines) && !items[itOrbAether] && !last_gravity_state && darken == 0 && normal) {
|
2017-07-10 18:47:38 +00:00
|
|
|
string s;
|
2019-04-08 12:56:46 +00:00
|
|
|
if(tmines > 9) tmines = 9;
|
|
|
|
color_t col = minecolors[tmines%10];
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
if(tmines == 7) seenSevenMines = true;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
for(int p=0; p<numplayers(); p++) if(multi::playerActive(p))
|
|
|
|
displayfr(vid.xres * (p+.5) / numplayers(),
|
2018-11-17 18:24:02 +00:00
|
|
|
current_display->ycenter - current_display->radius * 3/4, 2,
|
2017-07-10 18:47:38 +00:00
|
|
|
vid.fsize,
|
2019-04-08 12:56:46 +00:00
|
|
|
mines[p] > 7 ? its(mines[p]) : XLAT(minetexts[mines[p]]), minecolors[mines[p]%10], 8);
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2018-08-17 22:46:45 +00:00
|
|
|
if(minefieldNearby && !shmup::on && cwt.at->land != laMinefield && cwt.peek()->land != laMinefield) {
|
2018-11-17 18:24:02 +00:00
|
|
|
displayfr(vid.xres/2, current_display->ycenter - current_display->radius * 3/4 - vid.fsize*3/2, 2,
|
2017-07-10 18:47:38 +00:00
|
|
|
vid.fsize,
|
|
|
|
XLAT("WARNING: you are entering a minefield!"),
|
|
|
|
col, 8);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
// SDL_UnlockSurface(s);
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2018-09-04 21:27:27 +00:00
|
|
|
glflush();
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBB(DF_GRAPH, ("swapbuffers"));
|
2017-07-22 23:33:27 +00:00
|
|
|
#if CAP_SDL
|
|
|
|
#if CAP_GL
|
2017-07-10 18:47:38 +00:00
|
|
|
if(vid.usingGL) SDL_GL_SwapBuffers(); else
|
2015-08-08 13:57:52 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
SDL_UpdateRect(s, 0, 0, vid.xres, vid.yres);
|
2015-08-08 13:57:52 +00:00
|
|
|
#endif
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
//printf("\ec");
|
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void restartGraph() {
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_INIT, ("restartGraph"));
|
2017-07-10 18:47:38 +00:00
|
|
|
|
|
|
|
View = Id;
|
2018-04-21 17:35:17 +00:00
|
|
|
if(!autocheat) linepatterns::clearAll();
|
2017-07-10 18:47:38 +00:00
|
|
|
if(currentmap) {
|
2018-08-18 15:35:39 +00:00
|
|
|
if(masterless) {
|
2017-12-28 15:46:10 +00:00
|
|
|
centerover = vec_to_cellwalker(0);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
else {
|
2018-08-17 22:46:45 +00:00
|
|
|
viewctr.at = currentmap->getOrigin();
|
2017-07-10 18:47:38 +00:00
|
|
|
viewctr.spin = 0;
|
|
|
|
viewctr.mirrored = false;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-07-10 18:47:38 +00:00
|
|
|
if(sphere) View = spin(-M_PI/2);
|
2015-08-08 13:57:52 +00:00
|
|
|
}
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2015-08-08 13:57:52 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void clearAnimations() {
|
2018-01-13 18:20:46 +00:00
|
|
|
for(int i=0; i<ANIMLAYERS; i++) animations[i].clear();
|
|
|
|
flashes.clear();
|
|
|
|
fallanims.clear();
|
|
|
|
}
|
|
|
|
|
2017-07-10 18:47:38 +00:00
|
|
|
auto graphcm = addHook(clearmemory, 0, [] () {
|
2019-05-12 23:57:40 +00:00
|
|
|
DEBBI(DF_MEMORY, ("clear graph memory"));
|
2018-08-17 22:46:45 +00:00
|
|
|
mouseover = centerover.at = lmouseover = NULL;
|
2017-03-23 10:53:57 +00:00
|
|
|
gmatrix.clear(); gmatrix0.clear();
|
2018-01-13 18:20:46 +00:00
|
|
|
clearAnimations();
|
2019-05-28 23:09:38 +00:00
|
|
|
})
|
|
|
|
+ addHook(hooks_gamedata, 0, [] (gamedata* gd) {
|
|
|
|
gd->store(mouseover);
|
|
|
|
gd->store(lmouseover);
|
|
|
|
gd->store(animations);
|
|
|
|
gd->store(flashes);
|
|
|
|
gd->store(fallanims);
|
2019-05-30 14:12:38 +00:00
|
|
|
gd->store(radar_transform);
|
|
|
|
gd->store(actual_view_transform);
|
2017-07-10 18:47:38 +00:00
|
|
|
});
|
2017-03-23 10:53:57 +00:00
|
|
|
|
|
|
|
//=== animation
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
#if HDR
|
|
|
|
struct animation {
|
|
|
|
int ltick;
|
|
|
|
double footphase;
|
|
|
|
transmatrix wherenow;
|
|
|
|
int attacking;
|
|
|
|
transmatrix attackat;
|
|
|
|
bool mirrored;
|
|
|
|
};
|
|
|
|
|
|
|
|
// we need separate animation layers for Orb of Domination and Tentacle+Ghost,
|
|
|
|
// and also to mark Boats
|
|
|
|
#define ANIMLAYERS 3
|
|
|
|
#define LAYER_BIG 0 // for worms and krakens
|
|
|
|
#define LAYER_SMALL 1 // for others
|
|
|
|
#define LAYER_BOAT 2 // mark that a boat has moved
|
|
|
|
#endif
|
|
|
|
|
|
|
|
EX array<map<cell*, animation>, ANIMLAYERS> animations;
|
2017-03-23 10:53:57 +00:00
|
|
|
|
2019-08-09 20:37:11 +00:00
|
|
|
EX int revhint(cell *c, int hint) {
|
2018-08-17 22:46:45 +00:00
|
|
|
if(hint >= 0 && hint < c->type) return c->c.spin(hint);
|
2018-06-17 15:51:26 +00:00
|
|
|
else return hint;
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool compute_relamatrix(cell *src, cell *tgt, int direction_hint, transmatrix& T) {
|
2018-06-17 15:51:26 +00:00
|
|
|
if(confusingGeometry()) {
|
2018-08-17 14:47:06 +00:00
|
|
|
T = calc_relative_matrix(src, tgt, revhint(src, direction_hint));
|
2018-06-17 15:51:26 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(gmatrix.count(src) && gmatrix.count(tgt))
|
|
|
|
T = inverse(gmatrix[tgt]) * gmatrix[src];
|
|
|
|
else
|
|
|
|
return false;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2018-06-17 15:51:26 +00:00
|
|
|
return true;
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
|
|
|
|
2018-06-17 15:51:26 +00:00
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void animateMovement(cell *src, cell *tgt, int layer, int direction_hint) {
|
2018-01-25 16:19:50 +00:00
|
|
|
if(vid.mspeed >= 5) return; // no animations!
|
2018-06-17 15:51:26 +00:00
|
|
|
transmatrix T;
|
|
|
|
if(!compute_relamatrix(src, tgt, direction_hint, T)) return;
|
|
|
|
animation& a = animations[layer][tgt];
|
|
|
|
if(animations[layer].count(src)) {
|
|
|
|
a = animations[layer][src];
|
|
|
|
a.wherenow = T * a.wherenow;
|
|
|
|
animations[layer].erase(src);
|
|
|
|
a.attacking = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
a.ltick = ticks;
|
|
|
|
a.wherenow = T;
|
|
|
|
a.footphase = 0;
|
2019-05-15 12:19:19 +00:00
|
|
|
a.mirrored = false;
|
|
|
|
}
|
|
|
|
if(direction_hint >= 0 && direction_hint < src->type) {
|
|
|
|
if(src->c.mirror(direction_hint))
|
|
|
|
a.mirrored = !a.mirrored;
|
2018-01-25 16:19:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void animateAttack(cell *src, cell *tgt, int layer, int direction_hint) {
|
2018-06-17 15:51:26 +00:00
|
|
|
if(vid.mspeed >= 5) return; // no animations!
|
|
|
|
transmatrix T;
|
|
|
|
if(!compute_relamatrix(src, tgt, direction_hint, T)) return;
|
|
|
|
bool newanim = !animations[layer].count(src);
|
|
|
|
animation& a = animations[layer][src];
|
|
|
|
a.attacking = 1;
|
|
|
|
a.attackat = rspintox(tC0(inverse(T))) * xpush(hdist0(T*C0) / 3);
|
|
|
|
if(newanim) a.wherenow = Id, a.ltick = ticks, a.footphase = 0;
|
|
|
|
}
|
|
|
|
|
2017-03-23 10:53:57 +00:00
|
|
|
vector<pair<cell*, animation> > animstack;
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void indAnimateMovement(cell *src, cell *tgt, int layer, int direction_hint) {
|
2017-03-23 10:53:57 +00:00
|
|
|
if(vid.mspeed >= 5) return; // no animations!
|
|
|
|
if(animations[layer].count(tgt)) {
|
|
|
|
animation res = animations[layer][tgt];
|
|
|
|
animations[layer].erase(tgt);
|
2018-06-17 15:51:26 +00:00
|
|
|
animateMovement(src, tgt, layer, direction_hint);
|
2017-03-23 10:53:57 +00:00
|
|
|
if(animations[layer].count(tgt))
|
|
|
|
animstack.push_back(make_pair(tgt, animations[layer][tgt]));
|
|
|
|
animations[layer][tgt] = res;
|
|
|
|
}
|
|
|
|
else {
|
2018-06-17 15:51:26 +00:00
|
|
|
animateMovement(src, tgt, layer, direction_hint);
|
2017-03-23 10:53:57 +00:00
|
|
|
if(animations[layer].count(tgt)) {
|
|
|
|
animstack.push_back(make_pair(tgt, animations[layer][tgt]));
|
|
|
|
animations[layer].erase(tgt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void commitAnimations(int layer) {
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(animstack); i++)
|
2017-03-23 10:53:57 +00:00
|
|
|
animations[layer][animstack[i].first] = animstack[i].second;
|
|
|
|
animstack.clear();
|
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX void animateReplacement(cell *a, cell *b, int layer, int direction_hinta, int direction_hintb) {
|
2017-03-23 10:53:57 +00:00
|
|
|
if(vid.mspeed >= 5) return; // no animations!
|
|
|
|
static cell c1;
|
2019-04-11 22:11:58 +00:00
|
|
|
gmatrix[&c1] = gmatrix[b]; c1.master = b->master;
|
2017-03-23 10:53:57 +00:00
|
|
|
if(animations[layer].count(b)) animations[layer][&c1] = animations[layer][b];
|
2018-06-17 15:51:26 +00:00
|
|
|
animateMovement(a, b, layer, direction_hinta);
|
|
|
|
animateMovement(&c1, a, layer, direction_hintb);
|
2017-03-23 10:53:57 +00:00
|
|
|
}
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void drawBug(const cellwalker& cw, color_t col) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2017-08-06 12:50:16 +00:00
|
|
|
initquickqueue();
|
2018-08-17 22:46:45 +00:00
|
|
|
transmatrix V = ggmatrix(cw.at);
|
2018-08-19 13:52:39 +00:00
|
|
|
if(cw.spin) V = V * ddspin(cw.at, cw.spin, M_PI);
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(V, cgi.shBugBody, col);
|
2017-08-06 12:50:16 +00:00
|
|
|
quickqueue();
|
2017-12-01 23:23:15 +00:00
|
|
|
#endif
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX cell *viewcenter() {
|
2018-08-18 15:35:39 +00:00
|
|
|
if(masterless) return centerover.at;
|
2018-08-17 22:46:45 +00:00
|
|
|
else return viewctr.at->c7;
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX bool inscreenrange(cell *c) {
|
2018-04-06 21:28:58 +00:00
|
|
|
if(sphere) return true;
|
2018-04-11 11:16:40 +00:00
|
|
|
if(euclid) return celldistance(viewcenter(), c) <= get_sightrange_ambush();
|
2019-08-06 10:00:46 +00:00
|
|
|
if(nonisotropic) return gmatrix.count(c);
|
2018-04-23 11:21:00 +00:00
|
|
|
return heptdistance(viewcenter(), c) <= 8;
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
|
|
|
|
2019-05-08 19:09:22 +00:00
|
|
|
#if MAXMDIM >= 4
|
|
|
|
auto hooksw = addHook(hooks_swapdim, 100, [] { clearAnimations(); gmatrix.clear(); gmatrix0.clear(); });
|
|
|
|
#endif
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
}
|