2019-10-25 10:44:41 +00:00
|
|
|
#include "hyper.h"
|
|
|
|
namespace hr {
|
|
|
|
|
|
|
|
#if HDR
|
|
|
|
int coastvalEdge(cell *c);
|
|
|
|
|
|
|
|
struct celldrawer {
|
2019-11-25 19:05:52 +00:00
|
|
|
cell *c;
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
color_t fcol;
|
|
|
|
color_t wcol;
|
|
|
|
color_t asciicol;
|
|
|
|
color_t aura_color;
|
|
|
|
int fd;
|
|
|
|
int chasmg;
|
|
|
|
int ct6;
|
|
|
|
bool error;
|
|
|
|
bool onradar;
|
|
|
|
char asciichar;
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix Vboat;
|
|
|
|
shiftmatrix Vd;
|
2019-10-25 10:44:41 +00:00
|
|
|
int sl;
|
2020-01-30 16:45:05 +00:00
|
|
|
color_t asciiborder;
|
|
|
|
color_t asciicol1;
|
|
|
|
char asciichar1;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
void addaura();
|
|
|
|
void setcolors();
|
|
|
|
void tune_colors();
|
|
|
|
int getSnakelevColor(int i, int last);
|
|
|
|
void draw_wall();
|
|
|
|
void draw_boat();
|
|
|
|
void draw_grid();
|
2023-03-16 13:40:26 +00:00
|
|
|
void draw_grid_edge(int t, color_t col, int prec);
|
2019-10-25 10:44:41 +00:00
|
|
|
void draw_ceiling();
|
|
|
|
void draw_halfvine();
|
|
|
|
void draw_mirrorwall();
|
|
|
|
bool set_randompattern_floor();
|
|
|
|
void draw_features();
|
|
|
|
void draw_features_and_walls_3d();
|
|
|
|
void check_rotations();
|
|
|
|
void drawcell_in_radar();
|
|
|
|
void bookkeeping();
|
|
|
|
void draw_cellstat();
|
|
|
|
void draw_wall_full();
|
2021-08-08 16:28:24 +00:00
|
|
|
void draw_wallshadow();
|
2019-10-25 10:44:41 +00:00
|
|
|
void draw_item_full();
|
|
|
|
void draw_monster_full();
|
|
|
|
void add_map_effects();
|
|
|
|
void draw();
|
|
|
|
bool cell_clipped();
|
|
|
|
void draw_fallanims();
|
|
|
|
bool draw_shmup_monster();
|
|
|
|
void draw_gravity_particles();
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
void set_land_floor(const shiftmatrix& Vf);
|
2019-10-25 10:44:41 +00:00
|
|
|
void set_towerfloor(const cellfunction& cf = coastvalEdge);
|
|
|
|
void set_zebrafloor();
|
|
|
|
void set_maywarp_floor();
|
2020-07-27 16:49:04 +00:00
|
|
|
void set_reptile_floor(const shiftmatrix& V, color_t col, bool nodetails = false);
|
2019-10-25 10:44:41 +00:00
|
|
|
void set_emeraldfloor();
|
|
|
|
void shmup_gravity_floor();
|
|
|
|
|
|
|
|
void draw_reptile(color_t col);
|
|
|
|
|
|
|
|
void radar_grid();
|
|
|
|
|
|
|
|
void do_viewdist();
|
2023-10-28 06:33:18 +00:00
|
|
|
|
|
|
|
void draw_bowpath();
|
2019-10-25 10:44:41 +00:00
|
|
|
};
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
inline void drawcell(cell *c, const shiftmatrix& V) {
|
2019-10-25 10:44:41 +00:00
|
|
|
celldrawer dd;
|
2019-11-25 19:05:52 +00:00
|
|
|
dd.c = c;
|
2019-10-25 10:44:41 +00:00
|
|
|
dd.V = V;
|
|
|
|
dd.draw();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2023-08-23 17:44:37 +00:00
|
|
|
static constexpr int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030};
|
|
|
|
static constexpr int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080};
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
void celldrawer::addaura() {
|
|
|
|
hr::addaura(tC0(V), darkened(aura_color), fd);
|
|
|
|
}
|
2020-03-02 12:17:17 +00:00
|
|
|
|
|
|
|
/* Eclectic City's version of Red Rock is of slightly different color, */
|
|
|
|
/* to make it different from hot cells */
|
|
|
|
void eclectic_red(color_t& col) {
|
|
|
|
part(col, 0) = part(col, 2) * 3 / 4;
|
|
|
|
}
|
2022-11-12 21:38:45 +00:00
|
|
|
|
|
|
|
constexpr ld spinspeed = .75 / M_PI;
|
|
|
|
|
2024-05-07 20:18:54 +00:00
|
|
|
EX color_t apply_mine_knowledge(color_t wcol, cell* c) {
|
|
|
|
if(mine::marked_safe(c))
|
|
|
|
return gradient(wcol, 0x40FF40, 0, 0.2, 1);
|
|
|
|
if(mine::marked_mine(c))
|
|
|
|
return gradient(wcol, 0xFF4040, -1, vid.ispeed ? sintick(100) : 1, 1);
|
|
|
|
return wcol;
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::setcolors() {
|
|
|
|
|
|
|
|
wcol = fcol = winf[c->wall].color;
|
|
|
|
|
|
|
|
if(c->wall == waMineMine)
|
|
|
|
wcol = fcol = winf[waMineUnknown].color;
|
|
|
|
|
|
|
|
// water colors
|
|
|
|
if(isWateryOrBoat(c) || c->wall == waReptileBridge) {
|
|
|
|
if(c->land == laOcean)
|
|
|
|
fcol =
|
|
|
|
#if CAP_FIELD
|
2021-04-11 20:15:40 +00:00
|
|
|
(c->landparam > 25 && !ls::any_chaos()) ? (
|
2019-10-25 10:44:41 +00:00
|
|
|
0x90 + 8 * sintick(1000, windmap::windcodes[windmap::getId(c)] / 256.)
|
|
|
|
) :
|
|
|
|
#endif
|
2022-11-12 21:38:45 +00:00
|
|
|
0x1010C0 + int(32 * sintick(500, (ls::any_chaos() ? c->CHAOSPARAM : c->landparam)*spinspeed));
|
2019-10-25 10:44:41 +00:00
|
|
|
else if(c->land == laOceanWall)
|
|
|
|
fcol = 0x2020FF;
|
|
|
|
else if(c->land == laVariant)
|
|
|
|
fcol = 0x002090 + 15 * sintick(300, 0);
|
|
|
|
else if(c->land == laKraken) {
|
|
|
|
fcol = 0x0000A0;
|
|
|
|
int mafcol = (kraken_pseudohept(c) ? 64 : 8);
|
|
|
|
/* bool nearshore = false;
|
|
|
|
for(int i=0; i<c->type; i++)
|
|
|
|
if(c->move(i)->wall != waSea && c->move(i)->wall != waBoat)
|
|
|
|
nearshore = true;
|
|
|
|
if(nearshore) mafcol += 30; */
|
2022-11-12 21:38:45 +00:00
|
|
|
fcol = fcol + mafcol * (4+sintick(500, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*spinspeed))/5;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else if(c->land == laDocks) {
|
|
|
|
fcol = 0x0000A0;
|
|
|
|
}
|
|
|
|
else if(c->land == laAlchemist)
|
|
|
|
fcol = 0x900090;
|
|
|
|
else if(c->land == laWhirlpool)
|
2022-11-12 21:38:45 +00:00
|
|
|
fcol = 0x0000C0 + int(32 * sintick(200, ((eubinary||c->master->alt) ? celldistAlt(c) : 0)*spinspeed));
|
2019-10-25 10:44:41 +00:00
|
|
|
else if(c->land == laLivefjord)
|
|
|
|
fcol = 0x000080;
|
|
|
|
else if(isWarpedType(c->land))
|
|
|
|
fcol = 0x0000C0 + int((warptype(c)?30:-30) * sintick(600));
|
|
|
|
else
|
|
|
|
fcol = wcol;
|
|
|
|
}
|
2020-02-27 19:47:59 +00:00
|
|
|
|
|
|
|
else if(c->wall == waShallow)
|
|
|
|
fcol = 0x40C0C0;
|
2019-10-25 10:44:41 +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:
|
|
|
|
case laDragon: case laStorms: case laTerracotta: case laMercuryRiver:
|
2020-04-12 18:32:37 +00:00
|
|
|
case laDesert: case laKraken: case laDocks:
|
2019-10-25 10:44:41 +00:00
|
|
|
case laMotion: case laGraveyard: case laWineyard: case laLivefjord:
|
|
|
|
case laRlyeh: case laHell: case laCrossroads: case laJungle:
|
2021-05-23 13:57:39 +00:00
|
|
|
case laAlchemist: case laFrog: case laCursed: case laDice:
|
2019-10-25 10:44:41 +00:00
|
|
|
fcol = floorcolors[c->land]; break;
|
|
|
|
|
2020-04-12 18:32:37 +00:00
|
|
|
case laCA:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
if(geosupport_chessboard()) {
|
|
|
|
if(chessvalue(c)) fcol += 0x202020;
|
|
|
|
}
|
|
|
|
else if(geosupport_threecolor()) {
|
|
|
|
fcol += 0x202020 * pattern_threecolor(c);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-02-26 00:15:30 +00:00
|
|
|
case laWet:
|
2020-02-27 19:47:59 +00:00
|
|
|
fcol = 0x40FF40; break;
|
2020-02-26 00:15:30 +00:00
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_COMPLEX2
|
|
|
|
case laVariant: {
|
|
|
|
int b = getBits(c);
|
|
|
|
fcol = 0x404040;
|
|
|
|
for(int a=0; a<21; a++)
|
|
|
|
if((b >> a) & 1)
|
2019-12-08 18:17:28 +00:00
|
|
|
fcol += variant::features[a].color_change;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(c->wall == waAncientGrave)
|
|
|
|
wcol = 0x080808;
|
|
|
|
else if(c->wall == waFreshGrave)
|
|
|
|
wcol = 0x202020;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case laRuins:
|
|
|
|
fcol = pseudohept(c) ? 0xC0E0C0 : 0x40A040;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laDual:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
if(c->landparam == 2) fcol = 0x40FF00;
|
|
|
|
if(c->landparam == 3) fcol = 0xC0FF00;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#if CAP_COMPLEX2
|
|
|
|
case laBrownian: {
|
2021-08-03 02:11:58 +00:00
|
|
|
if (c->wall == waNone)
|
|
|
|
fcol = wcol = brownian::get_color(c->landparam);
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_FIELD
|
|
|
|
case laVolcano: {
|
|
|
|
int id = lavatide(c, -1)/4;
|
|
|
|
if(c->wall == waMagma)
|
|
|
|
fcol = wcol = magma_color(id);
|
|
|
|
else if(c->wall == waNone) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case laMinefield:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
if(c->wall == waMineMine && ((cmode & sm::MAP) || !canmove))
|
|
|
|
fcol = wcol = 0xFF4040;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laCaribbean:
|
|
|
|
if(c->wall != waCIsland && c->wall != waCIsland2)
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laReptile:
|
|
|
|
fcol = reptilecolor(c);
|
|
|
|
break;
|
|
|
|
|
|
|
|
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:
|
|
|
|
if(c->land == laMirrorWall) fcol = floorcolors[laMirror];
|
|
|
|
else fcol = floorcolors[c->land];
|
|
|
|
break;
|
|
|
|
case laDryForest:
|
|
|
|
fcol = gradient(0x008000, 0x800000, 0, c->landparam, 10);
|
|
|
|
break;
|
|
|
|
case laMountain:
|
|
|
|
if(eubinary || sphere || c->master->alt)
|
2020-05-29 00:42:54 +00:00
|
|
|
fcol = 0x181008 * flip_dark(celldistAlt(c), 2, 4);
|
2019-10-25 10:44:41 +00:00
|
|
|
else fcol = 0;
|
|
|
|
if(c->wall == waPlatform) wcol = 0xF0F0A0;
|
|
|
|
break;
|
|
|
|
case laCanvas:
|
|
|
|
fcol = c->landparam;
|
|
|
|
if(c->wall == waWaxWall) wcol = c->landparam;
|
|
|
|
break;
|
|
|
|
case laPalace:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
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:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
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);
|
2023-09-18 13:41:53 +00:00
|
|
|
if(among(int(c->bardir), NOBARRIERS, NOBARRIERS2) && c->barleft)
|
2019-10-25 10:44:41 +00:00
|
|
|
fcol = minf[moBug0+c->barright].color;
|
|
|
|
break;
|
|
|
|
case laSwitch:
|
|
|
|
fcol = minf[passive_switch].color;
|
|
|
|
break;
|
|
|
|
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:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
if(c->wall == waSmallTree) wcol = 0x008060;
|
|
|
|
else if(c->wall == waBigTree) wcol = 0x0080C0;
|
|
|
|
break;
|
|
|
|
case laTemple: {
|
2020-03-27 18:53:59 +00:00
|
|
|
int d = (eubinary||c->master->alt) ? celldistAlt(c) : 99;
|
2021-04-11 20:15:40 +00:00
|
|
|
if(ls::any_chaos())
|
2019-10-25 10:44:41 +00:00
|
|
|
fcol = 0x405090;
|
2019-12-14 11:35:03 +00:00
|
|
|
else if(d % temple_layer_size() == 0)
|
2019-10-25 10:44:41 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
case laWhirlwind:
|
|
|
|
if(c->land == laWhirlwind) {
|
|
|
|
color_t whirlcolors[4] = {0x404040, 0x404080, 0x2050A0, 0x5050C0};
|
|
|
|
fcol = whirlcolors[whirlwind::fzebra3(c)];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laHunting:
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
if(pseudohept(c)) fcol = fcol * 3/4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laIvoryTower:
|
2020-05-29 00:42:54 +00:00
|
|
|
fcol = 0x10101 * flip_dark(c->landparam, 32, 64) - 0x000010;
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laWestWall:
|
2020-05-29 00:42:54 +00:00
|
|
|
fcol = 0x10101 * flip_dark(c->landparam, 0, 32) + floorcolors[c->land];
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
case laEndorian: {
|
|
|
|
int clev = pd_from->land == laEndorian ? edgeDepth(pd_from) : 0;
|
|
|
|
// xcol = (c->landparam&1) ? 0xD00000 : 0x00D000;
|
2020-05-29 00:42:54 +00:00
|
|
|
fcol = 0x10101 * flip_dark(c->landparam, 32, 64) - 0x000010;
|
2019-10-25 10:44:41 +00:00
|
|
|
int ed = edgeDepth(c);
|
|
|
|
int sr = get_sightrange_ambush();
|
|
|
|
|
|
|
|
if(clev == UNKNOWN || ed == UNKNOWN)
|
|
|
|
fcol = 0x0000D0;
|
|
|
|
else {
|
|
|
|
while(ed > clev + sr) ed -= 2;
|
|
|
|
while(ed < clev - sr) ed += 2;
|
|
|
|
fcol = gradient(fcol, 0x0000D0, clev-sr, ed, clev+sr);
|
|
|
|
}
|
|
|
|
if(c->wall == waTrunk) fcol = winf[waTrunk].color;
|
|
|
|
|
|
|
|
if(c->wall == waCanopy || c->wall == waSolidBranch || c->wall == waWeakBranch) {
|
|
|
|
fcol = winf[waCanopy].color;
|
2020-05-29 00:42:54 +00:00
|
|
|
int f = flip_dark(c->landparam, 0, 2);
|
|
|
|
if(f) fcol = gradient(0, fcol, 8, f, 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if CAP_FIELD
|
|
|
|
case laPrairie:
|
|
|
|
if(prairie::isriver(c)) {
|
2023-10-05 11:53:24 +00:00
|
|
|
fcol = flip_dark(prairie::get_val(c), 0x402000, 0x503000);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
fcol = 0x004000 + 0x001000 * c->LHU.fi.walldist;
|
|
|
|
fcol += 0x10000 * (255 - 511 / (1 + max((int) c->LHU.fi.flowerdist, 1)));
|
2023-10-05 11:53:24 +00:00
|
|
|
if(ls::hv_structure()) fcol = prairie::nearriver(c) ? 0x40FF00 : 0x40D000;
|
2019-10-25 10:44:41 +00:00
|
|
|
// fcol += 0x1 * (511 / (1 + max((int) c->LHU.fi.walldist2, 1)));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case laCamelot: {
|
2020-03-27 18:53:59 +00:00
|
|
|
int d = ((eubinary||c->master->alt) ? celldistAltRelative(c) : 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_TOUR
|
|
|
|
if(!tour::on) camelotcheat = false;
|
|
|
|
if(camelotcheat)
|
2020-05-29 00:42:54 +00:00
|
|
|
fcol = 0x10101 * flip_dark(d, 0x60, 0xC0);
|
2019-10-25 10:44:41 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if(d < 0) {
|
|
|
|
fcol = floorcolors[c->land];
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-02-26 00:34:30 +00:00
|
|
|
case laIce: case laCocytus: case laBlizzard: case laEclectic:
|
2019-10-25 10:44:41 +00:00
|
|
|
if(useHeatColoring(c)) {
|
|
|
|
float h = HEAT(c);
|
|
|
|
eLand l = c->land;
|
|
|
|
|
|
|
|
color_t colorN04 = l == laCocytus ? 0x4080FF : 0x4040FF;
|
|
|
|
color_t colorN10 = 0x0000FF;
|
|
|
|
color_t color0 = floorcolors[c->land];
|
|
|
|
color_t color02 = 0xFFFFFF;
|
|
|
|
color_t color06 = 0xFF0000;
|
|
|
|
color_t color08 = 0xFFFF00;
|
|
|
|
|
|
|
|
if(h < -1)
|
|
|
|
wcol = colorN10;
|
|
|
|
else if(h < -0.4)
|
|
|
|
wcol = gradient(colorN04, colorN10 , -0.4, h, -1);
|
|
|
|
else if(h < 0)
|
|
|
|
wcol = gradient(color0, colorN04, 0, h, -0.4);
|
|
|
|
else if(h < 0.2)
|
|
|
|
wcol = gradient(color0, color02, 0, h, 0.2);
|
|
|
|
// else if(h < 0.4)
|
|
|
|
// wcol = gradient(0xFFFFFF, 0xFFFF00, 0.2, h, 0.4);
|
|
|
|
else if(h < 0.6)
|
|
|
|
wcol = gradient(color02, color06, 0.2, h, 0.6);
|
|
|
|
else if(h < 0.8)
|
|
|
|
wcol = gradient(color06, color08, 0.6, h, 0.8);
|
|
|
|
else
|
|
|
|
wcol = color08;
|
|
|
|
if(c->wall == waFrozenLake)
|
|
|
|
fcol = wcol;
|
|
|
|
else
|
|
|
|
fcol = (wcol & 0xFEFEFE) >> 1;
|
|
|
|
if(c->wall == waLake)
|
|
|
|
fcol = wcol = (wcol & 0xFCFCFC) >> 2;
|
|
|
|
}
|
2020-03-02 12:17:17 +00:00
|
|
|
if(realred(c))
|
|
|
|
eclectic_red(wcol);
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laOcean:
|
2021-04-11 20:15:40 +00:00
|
|
|
if(ls::any_chaos())
|
2019-10-25 10:44:41 +00:00
|
|
|
fcol = gradient(0xD0A090, 0xD0D020, 0, c->CHAOSPARAM, 30);
|
|
|
|
else
|
|
|
|
fcol = gradient(0xD0D090, 0xD0D020, -1, sin((double) c->landparam), 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laSnakeNest: {
|
|
|
|
int fv = pattern_threecolor(c);
|
|
|
|
fcol = nestcolors[fv&7];
|
|
|
|
if(realred(c->wall))
|
|
|
|
wcol = fcol * (4 + snakelevel(c)) / 4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
if(isElemental(c->land)) fcol = linf[c->land].color;
|
|
|
|
if(isWarpedType(c->land)) {
|
|
|
|
fcol = warptype(c) ? 0x80C080 : 0xA06020;
|
|
|
|
if(c->wall == waSmallTree) wcol = 0x608000;
|
|
|
|
}
|
|
|
|
if(isHaunted(c->land)) {
|
|
|
|
int itcolor = 0;
|
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i) && c->move(i)->item)
|
|
|
|
itcolor = 1;
|
|
|
|
if(c->item) itcolor |= 2;
|
|
|
|
fcol = floorcolors[laHaunted] + 0x202020 * itcolor;
|
|
|
|
|
|
|
|
forCellEx(c2, c) if(c2->monst == moFriendlyGhost)
|
|
|
|
fcol = gradient(fcol, fghostcolor(c2), 0, .25, 1);
|
|
|
|
|
|
|
|
if(c->monst == moFriendlyGhost)
|
|
|
|
fcol = gradient(fcol, fghostcolor(c), 0, .5, 1);
|
|
|
|
|
|
|
|
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; */
|
|
|
|
|
|
|
|
switch(c->wall) {
|
|
|
|
case waSulphur: case waSulphurC: case waPlatform: case waMercury: case waDock:
|
|
|
|
case waAncientGrave: case waFreshGrave: case waThumperOn: case waThumperOff: case waBonfireOff:
|
|
|
|
case waRoundTable: case waExplosiveBarrel:
|
|
|
|
// floors become fcol
|
|
|
|
fcol = wcol;
|
|
|
|
break;
|
|
|
|
|
2021-03-30 09:29:18 +00:00
|
|
|
case waCrateCrate: case waCrateTarget: case waCrateOnTarget:
|
|
|
|
fcol = c->landparam;
|
|
|
|
break;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
case waDeadTroll2: case waPetrifiedBridge: case waPetrified: {
|
2019-11-27 21:42:44 +00:00
|
|
|
eMonster m = eMonster((unsigned char)c->wparam);
|
2019-10-25 10:44:41 +00:00
|
|
|
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
|
2022-04-26 12:42:07 +00:00
|
|
|
wcol = winf[conditional_flip_slime(det(V.T) < 0, c->wall)].color;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(c->item && !(history::includeHistory && history::infindhistory.count(c)))
|
|
|
|
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;
|
|
|
|
|
|
|
|
case waMineUnknown: case waMineMine:
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_COMPLEX2
|
2024-05-07 20:18:54 +00:00
|
|
|
if(!mine_markers) fcol = wcol = apply_mine_knowledge(wcol, c);
|
2021-03-12 14:31:00 +00:00
|
|
|
goto fallthrough;
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
|
2021-03-12 14:31:00 +00:00
|
|
|
case waMineOpen: fallthrough:
|
2020-02-13 10:01:20 +00:00
|
|
|
if(wmblack || wmascii) {
|
|
|
|
wcol &= 0xFEFEFE;
|
|
|
|
wcol >>= 1;
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
fcol = wcol;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waCavewall:
|
|
|
|
if(c->land != laEmerald) fcol = winf[waCavefloor].color;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waEditStatue:
|
|
|
|
if(c->land == laCanvas) wcol = c->landparam;
|
|
|
|
else wcol = (0x125628 * c->wparam) & 0xFFFFFF;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if(false && isAlch2(c, true)) {
|
|
|
|
int id = lavatide(c, -1);
|
|
|
|
if(id < 96)
|
|
|
|
wcol = gradient(0x800000, 0xFF0000, 0, id, 96);
|
|
|
|
else
|
|
|
|
wcol = gradient(0x00FF00, 0xFFFF00, 96, id, 255);
|
|
|
|
fcol = wcol;
|
|
|
|
} */
|
|
|
|
|
|
|
|
if(WDIM == 2) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(items[itRevolver] && !shmup::on) {
|
|
|
|
bool inrange = c->mpdist <= GUNRANGE;
|
|
|
|
if(inrange) {
|
|
|
|
inrange = false;
|
2021-03-06 10:46:13 +00:00
|
|
|
for(cell *pc: player_positions())
|
|
|
|
for(cell *c1: gun_targets(pc)) if(c1 == c)
|
|
|
|
inrange = true;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
if(!inrange)
|
|
|
|
fcol = gradient(fcol, 0, 0, 25, 100),
|
|
|
|
wcol = gradient(wcol, 0, 0, 25, 100);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(highwall(c) && !wmspatial)
|
|
|
|
fcol = wcol;
|
|
|
|
|
|
|
|
if(wmascii && (c->wall == waNone || isWatery(c))) wcol = fcol;
|
|
|
|
|
|
|
|
if(!wmspatial && snakelevel(c) && !realred(c->wall)) fcol = wcol;
|
|
|
|
|
|
|
|
if(c->wall == waGlass && !wmspatial) fcol = wcol;
|
2020-01-18 16:11:57 +00:00
|
|
|
|
2020-03-27 18:38:15 +00:00
|
|
|
if(neon_mode == eNeon::illustration) {
|
2020-01-18 16:11:57 +00:00
|
|
|
fcol = highwall(c) ? w_monochromatize(fcol, 0) : w_monochromatize(fcol, 1);
|
|
|
|
wcol = w_monochromatize(wcol, 0);
|
|
|
|
if(c->land == laWarpCoast && !pseudohept(c) && c->wall == waNone) fcol = 0x707070;
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-01-18 16:11:57 +00:00
|
|
|
EX color_t w_monochromatize(color_t x, int d) {
|
|
|
|
int c = part(x,2) + part(x,1) + part(x, 0) + 1;
|
|
|
|
c /= 3;
|
2020-01-19 10:54:35 +00:00
|
|
|
if(d != 0) c = (c + 2 * 255) / 3;
|
2020-01-18 16:11:57 +00:00
|
|
|
return c * 0x10101;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::tune_colors() {
|
|
|
|
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);
|
|
|
|
|
|
|
|
aura_color = fcol;
|
|
|
|
|
2020-03-22 08:46:13 +00:00
|
|
|
if(peace::on && peace::hint && (c->land != laTortoise || !tortoise::shading_on())) {
|
2019-10-25 10:44:41 +00:00
|
|
|
int d =
|
|
|
|
(c->land == laCamelot || (c->land == laCaribbean && celldistAlt(c) <= 0) || (c->land == laPalace && celldistAlt(c))) ? celldistAlt(c):
|
|
|
|
celldist(c);
|
|
|
|
|
|
|
|
int dc =
|
2022-11-12 21:38:45 +00:00
|
|
|
0x10101 * (127 + int(127 * sintick(200, d*spinspeed)));
|
2019-10-25 10:44:41 +00:00
|
|
|
wcol = gradient(wcol, dc, 0, .3, 1);
|
|
|
|
fcol = gradient(fcol, dc, 0, .3, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int celldrawer::getSnakelevColor(int i, int last) {
|
|
|
|
color_t col;
|
|
|
|
if(c->wall == waTower)
|
|
|
|
col = 0xD0D0D0-i*0x101010;
|
|
|
|
else if(c->land == laSnakeNest)
|
|
|
|
return darkena(nestcolors[pattern_threecolor(c)] * (5 + i) / 4, 0, 0xFF);
|
|
|
|
#if CAP_COMPLEX2
|
|
|
|
else if(c->land == laBrownian)
|
|
|
|
col = brownian::get_color(c->landparam % brownian::level + (i+1) * brownian::level);
|
|
|
|
#endif
|
|
|
|
else if(i == last-1)
|
|
|
|
col = wcol;
|
2020-03-02 12:17:17 +00:00
|
|
|
else {
|
2019-10-25 10:44:41 +00:00
|
|
|
col = winf[waRed1+i].color;
|
2020-03-02 12:17:17 +00:00
|
|
|
if(c->land == laEclectic)
|
|
|
|
eclectic_red(col);
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
return darkena(col, fd, 0xFF);
|
|
|
|
}
|
|
|
|
|
2021-08-08 16:28:24 +00:00
|
|
|
void celldrawer::draw_wallshadow() {
|
2023-02-05 09:09:36 +00:00
|
|
|
if(!noshadow && qfi.fshape) {
|
2021-08-08 16:28:24 +00:00
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
2022-12-15 09:14:06 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, GDIM == 3 ? PPR::TRANSPARENT_SHADOW : PPR::WALLSHADOW);
|
2021-08-08 16:28:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::draw_wall() {
|
|
|
|
|
2020-06-03 13:11:20 +00:00
|
|
|
if(no_wall_rendering) return;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(GDIM == 3 && WDIM == 2) {
|
|
|
|
if(!qfi.fshape) qfi.fshape = &cgi.shFullFloor;
|
|
|
|
if(conegraph(c)) {
|
|
|
|
draw_shapevec(c, V, qfi.fshape->cone[0], darkena(wcol, 0, 0xFF), PPR::WALL);
|
2021-08-08 16:28:24 +00:00
|
|
|
draw_wallshadow();
|
2019-10-25 10:44:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(c->wall == waClosedGate) {
|
|
|
|
int hdir = 0;
|
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i)->wall == waClosedGate)
|
|
|
|
hdir = i;
|
2022-11-12 21:38:45 +00:00
|
|
|
queuepolyat(V * ddspin180(c, hdir), cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
color_t wcol0 = wcol;
|
|
|
|
color_t wcol2 = gradient(0, wcol0, 0, .8, 1);
|
2023-05-01 14:06:10 +00:00
|
|
|
color_t wcol1 = wcol2;
|
|
|
|
if(geometry == gEuclidSquare) wcol1 = gradient(0, wcol0, 0, .9, 1);
|
2019-10-25 10:44:41 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol, 0, 0xFF), PPR::WALL);
|
|
|
|
forCellIdEx(c2, i, c)
|
2020-06-03 09:43:35 +00:00
|
|
|
if(!highwall(c2) || conegraph(c2) || c2->wall == waClosedGate || fake::split())
|
2023-05-01 14:06:10 +00:00
|
|
|
placeSidewall(c, i, SIDE_WALL, V, darkena((i&1)?wcol1:wcol2, fd, 255));
|
2019-10-25 10:44:41 +00:00
|
|
|
|
2021-08-08 16:28:24 +00:00
|
|
|
draw_wallshadow();
|
2019-10-25 10:44:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aura_color = wcol;
|
|
|
|
color_t wcol0 = wcol;
|
|
|
|
int starcol = wcol;
|
|
|
|
if(c->wall == waWarpGate) starcol = 0;
|
|
|
|
if(c->wall == waVinePlant) starcol = 0x60C000;
|
|
|
|
|
|
|
|
color_t wcol2 = gradient(0, wcol0, 0, .8, 1);
|
|
|
|
|
|
|
|
if(c->wall == waClosedGate) {
|
|
|
|
int hdir = 0;
|
2020-02-26 21:29:58 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i) && c->move(i)->wall == waClosedGate)
|
2019-10-25 10:44:41 +00:00
|
|
|
hdir = i;
|
2022-12-06 00:04:26 +00:00
|
|
|
shiftmatrix V2 = orthogonal_move_fol(V, wmspatial?cgi.WALL:1) * ddspin180(c, hdir); // to test
|
2019-10-25 10:44:41 +00:00
|
|
|
queuepolyat(V2, cgi.shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR::WALL3A:PPR::WALL);
|
|
|
|
starcol = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
hpcshape& shThisWall = isGrave(c->wall) ? cgi.shCross : cgi.shWall[ct6];
|
2019-11-14 15:58:36 +00:00
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V1 = V;
|
2019-11-14 15:58:36 +00:00
|
|
|
if(&shThisWall == &cgi.shCross) {
|
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123);
|
|
|
|
V1 = V * applyPatterndir(c, si);
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(conegraph(c)) {
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++) {
|
|
|
|
double zg = zgrad0(0, geom3::actual_wall_height(), z, layers);
|
|
|
|
draw_qfi(c, xyzscale(V, zg*(layers-z)/layers, zg),
|
|
|
|
darkena(gradient(0, wcol, -layers, z, layers), 0, 0xFF), PPR::WALL3+z-layers+2);
|
|
|
|
}
|
|
|
|
floorShadow(c, V, SHADOW_WALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(true) {
|
|
|
|
if(!wmspatial) {
|
2019-11-14 15:58:36 +00:00
|
|
|
if(starcol) queuepoly(V1, shThisWall, darkena(starcol, 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-12-06 00:04:26 +00:00
|
|
|
shiftmatrix Vdepth = orthogonal_move_fol(V1, cgi.WALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
int alpha = 0xFF;
|
|
|
|
if(c->wall == waIcewall)
|
|
|
|
alpha = 0xC0;
|
|
|
|
|
|
|
|
if(starcol && !(wmescher && c->wall == waPlatform))
|
|
|
|
queuepolyat(Vdepth, shThisWall, darkena(starcol, 0, 0xFF), PPR::WALL3A);
|
|
|
|
|
|
|
|
draw_qfi(c, Vdepth, darkena(wcol0, fd, alpha), PPR::WALL3);
|
|
|
|
floorShadow(c, V, SHADOW_WALL);
|
|
|
|
|
|
|
|
if(c->wall == waCamelot) {
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
if(placeSidewall(c, i, SIDE_SLEV, V, darkena(wcol2, fd, alpha))) break;
|
|
|
|
}
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
if(placeSidewall(c, i, SIDE_SLEV+1, V, darkena(wcol2, fd, alpha))) break;
|
|
|
|
}
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
if(placeSidewall(c, i, SIDE_SLEV+2, V, darkena(wcol2, fd, alpha))) break;
|
|
|
|
}
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
if(placeSidewall(c, i, SIDE_WTS3, V, darkena(wcol2, fd, alpha))) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
forCellIdEx(c2, i, c)
|
2020-03-27 18:38:15 +00:00
|
|
|
if(!highwall(c2) || conegraph(c2) || neon_mode == eNeon::illustration) {
|
2019-10-25 10:44:41 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, fd, alpha))) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_boat() {
|
|
|
|
double footphase;
|
|
|
|
if(WDIM == 3 && c == cwt.at && hide_player()) return;
|
|
|
|
bool magical = items[itOrbWater] && (isPlayerOn(c) || (isFriendly(c) && items[itOrbEmpathy]));
|
|
|
|
int outcol = magical ? watercolor(0) : 0xC06000FF;
|
|
|
|
int incol = magical ? 0x0060C0FF : 0x804000FF;
|
|
|
|
bool nospin = false;
|
|
|
|
|
|
|
|
if(WDIM == 3) {
|
|
|
|
Vboat = V;
|
|
|
|
nospin = c->wall == waBoat && applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
|
|
|
if(!nospin) Vboat = face_the_player(V);
|
2022-11-12 21:38:45 +00:00
|
|
|
else Vboat = Vboat * cspin180(0, 2);
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(orthogonal_move(Vboat, cgi.scalefactor/2), cgi.shBoatOuter, outcol, PPR::BOATLEV2);
|
|
|
|
queuepolyat(orthogonal_move(Vboat, cgi.scalefactor/2-0.01), cgi.shBoatInner, incol, PPR::BOATLEV2);
|
2019-10-25 10:44:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(wmspatial && c->wall == waBoat) {
|
|
|
|
nospin = c->wall == waBoat && applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
2022-11-12 21:38:45 +00:00
|
|
|
if(!nospin && c->mondir != NODIR) Vboat = Vboat * ddspin180(c, c->mondir);
|
2019-10-25 10:44:41 +00:00
|
|
|
queuepolyat(Vboat, cgi.shBoatOuter, outcol, PPR::BOATLEV);
|
2019-10-27 00:29:49 +00:00
|
|
|
Vboat = V;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
if(c->wall == waBoat) {
|
|
|
|
nospin = applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
|
|
|
}
|
2020-06-03 09:44:19 +00:00
|
|
|
if(!nospin && c->mondir != NODIR)
|
2022-11-12 21:38:45 +00:00
|
|
|
Vboat = Vboat * ddspin180(c, c->mondir);
|
2019-10-25 10:44:41 +00:00
|
|
|
else {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix Vx;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(applyAnimation(c, Vx, footphase, LAYER_SMALL))
|
|
|
|
animations[LAYER_SMALL][c].footphase = 0;
|
|
|
|
}
|
|
|
|
if(wmspatial && GDIM == 2)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(orthogonal_move_fol(Vboat, (cgi.LAKE+1)/2), cgi.shBoatOuter, outcol, PPR::BOATLEV2);
|
2020-08-01 11:57:39 +00:00
|
|
|
if(GDIM == 3) {
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepoly(orthogonal_move(Vboat, -0.004), cgi.shBoatOuter, outcol);
|
|
|
|
queuepoly(orthogonal_move(Vboat, -0.008), cgi.shBoatInner, incol);
|
2020-08-01 11:57:39 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
queuepoly(Vboat, cgi.shBoatOuter, outcol);
|
|
|
|
queuepoly(Vboat, cgi.shBoatInner, incol);
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 02:23:49 +00:00
|
|
|
EX int grid_prec() {
|
2019-12-27 11:41:54 +00:00
|
|
|
int prec = sphere ? 3 : 1;
|
|
|
|
prec += vid.linequality;
|
2020-12-30 02:23:49 +00:00
|
|
|
return prec;
|
|
|
|
}
|
|
|
|
|
2023-03-16 13:40:26 +00:00
|
|
|
// should we draw t-th edge of c, or the opposite edge?
|
|
|
|
EX bool pick_for_grid(cell *c, int t) {
|
|
|
|
cell *c1 = c->move(t);
|
|
|
|
if(!c1) return false;
|
|
|
|
// removed: if(WDIM == 3 && bt::in() && !sn::in()) return !among(t, 5, 6, 8);
|
|
|
|
return c < c1 || isWarped(c->move(t)) || fake::split();
|
|
|
|
}
|
|
|
|
|
2020-12-30 02:23:49 +00:00
|
|
|
void celldrawer::draw_grid() {
|
|
|
|
|
|
|
|
int prec = grid_prec();
|
2019-12-27 11:41:54 +00:00
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(inmirrorcount) return;
|
|
|
|
|
|
|
|
if(vid.grid || (c->land == laAsteroids && !(WDIM == 2 && GDIM == 3))) ; else return;
|
|
|
|
|
|
|
|
dynamicval<ld> lw(vid.linewidth, vid.linewidth);
|
|
|
|
|
|
|
|
vid.linewidth *= vid.multiplier_grid;
|
|
|
|
vid.linewidth *= cgi.scalefactor;
|
|
|
|
|
2023-03-16 13:40:26 +00:00
|
|
|
int maxt = c->type;
|
|
|
|
if(arb::apeirogon_hide_grid_edges && arb::is_apeirogonal(c)) maxt -= 2;
|
|
|
|
|
|
|
|
if(isWarped(c) && has_nice_dual()) {
|
|
|
|
if(pseudohept(c)) for(int t=0; t<c->type; t++) if(isWarped(c->move(t)))
|
|
|
|
gridline(V, get_warp_corner(c, t%c->type), get_warp_corner(c, (t+1)%c->type), gridcolor(c, c->move(t)), prec);
|
|
|
|
return;
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
|
2023-03-16 13:40:26 +00:00
|
|
|
for(int t=0; t<maxt; t++)
|
|
|
|
if(pick_for_grid(c, t))
|
|
|
|
draw_grid_edge(t, gridcolor(c, c->move(t)), prec);
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_grid_edge(int t, color_t col, int prec) {
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
#if MAXMDIM == 4
|
2023-03-16 13:40:26 +00:00
|
|
|
if(WDIM == 3) {
|
2021-07-09 08:09:31 +00:00
|
|
|
int ofs = currentmap->wall_offset(c);
|
2023-03-16 13:40:26 +00:00
|
|
|
|
|
|
|
// if(bt::in() && !sn::in() && !among(t, 5, 6, 8)) continue;
|
|
|
|
// if(!bt::in() && c->move(t) < c) continue;
|
|
|
|
|
|
|
|
dynamicval<color_t> g(poly_outline, col);
|
|
|
|
bool use_fat = fat_edges && (reg3::in() || euc::in(3));
|
|
|
|
if(!use_fat) {
|
|
|
|
queuepoly(V, cgi.shWireframe3D[ofs + t], 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto& ss = currentmap->get_cellshape(c);
|
|
|
|
auto& fa = ss.faces[t];
|
|
|
|
int face = isize(fa);
|
|
|
|
for(int j=0; j<face; j++) {
|
|
|
|
int jj = j == face-1 ? 0 : j+1;
|
|
|
|
int jjj = jj == face-1 ? 0 : jj+1;
|
|
|
|
hyperpoint a = fa[j];
|
|
|
|
hyperpoint b = fa[jj];
|
|
|
|
if(cgflags & qIDEAL) {
|
|
|
|
ld mm = cgi.ultra_mirror_part;
|
|
|
|
if((cgflags & qULTRA) && !reg3::ultra_mirror_in())
|
|
|
|
mm = lerp(1-cgi.ultra_material_part, cgi.ultra_material_part, .99);
|
|
|
|
tie(a, b) = make_pair(normalize(lerp(a, b, mm)), normalize(lerp(b, a, mm)));
|
2020-04-29 13:09:22 +00:00
|
|
|
}
|
|
|
|
else {
|
2023-03-16 13:40:26 +00:00
|
|
|
a = normalize(a);
|
|
|
|
b = normalize(b);
|
|
|
|
}
|
|
|
|
gridline(V, a, b, col, prec);
|
|
|
|
|
|
|
|
if(reg3::ultra_mirror_in()) {
|
|
|
|
hyperpoint a = fa[j];
|
|
|
|
hyperpoint b = fa[jj];
|
|
|
|
hyperpoint d = fa[jjj];
|
|
|
|
auto& mm = cgi.ultra_mirror_part;
|
|
|
|
tie(a, d) = make_pair(normalize(lerp(a, b, mm)), normalize(lerp(d, b, mm)));
|
|
|
|
gridline(V, a, d, stdgridcolor, prec);
|
2020-04-29 13:09:22 +00:00
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
2023-03-16 13:40:26 +00:00
|
|
|
return;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if CAP_BT
|
2023-03-16 13:40:26 +00:00
|
|
|
if(bt::in() && WDIM == 2) {
|
|
|
|
auto h0 = bt::get_corner_horo_coordinates(c, t);
|
|
|
|
auto h1 = bt::get_corner_horo_coordinates(c, t+1);
|
|
|
|
int steps = 12 * abs(h0[1] - h1[1]);
|
|
|
|
if(!steps) {
|
|
|
|
gridline(V, bt::get_horopoint(h0), bt::get_horopoint(h1), col, prec);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(vid.linequality > 0) steps <<= vid.linequality;
|
|
|
|
if(vid.linequality < 0) steps >>= -vid.linequality;
|
|
|
|
auto step = (h1 - h0) / steps;
|
|
|
|
if(GDIM == 3) {
|
|
|
|
for(int i=0; i<=steps; i++) gridline(V, bt::get_horopoint(h0 + i * step), V, bt::get_horopoint(h0 + (i+1) * step), gridcolor(c, c->move(t)), prec-2);
|
2022-12-15 08:58:47 +00:00
|
|
|
}
|
|
|
|
else {
|
2023-03-16 13:40:26 +00:00
|
|
|
for(int i=0; i<=steps; i++) curvepoint(bt::get_horopoint(h0 + i * step));
|
|
|
|
queuecurve(V, col, 0, PPR::LINE);
|
2022-12-15 08:58:47 +00:00
|
|
|
}
|
|
|
|
}
|
2023-03-16 13:40:26 +00:00
|
|
|
return;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
2023-03-16 13:40:26 +00:00
|
|
|
gridline(V, get_corner_position(c, t%c->type), get_corner_position(c, (t+1)%c->type), col, prec);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_halfvine() {
|
|
|
|
|
|
|
|
int i =-1;
|
|
|
|
for(int t=0;t<6; t++) if(c->move(t) && c->move(t)->wall == c->wall)
|
|
|
|
i = t;
|
|
|
|
|
|
|
|
qfi.spin = ddspin(c, i, M_PI/S3);
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V2 = V * qfi.spin;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(wmspatial && wmescher && GDIM == 2) {
|
|
|
|
set_floor(cgi.shSemiFeatherFloor[0]);
|
|
|
|
int dk = 1;
|
|
|
|
int vcol = winf[waVinePlant].color;
|
2022-12-06 00:04:26 +00:00
|
|
|
draw_qfi(c, orthogonal_move_fol(V2, cgi.WALL), darkena(vcol, dk, 0xFF), PPR::WALL3A);
|
2019-10-25 10:44:41 +00:00
|
|
|
escherSidewall(c, SIDE_WALL, V2, darkena(gradient(0, vcol, 0, .8, 1), dk, 0xFF));
|
|
|
|
queuepoly(V2, cgi.shSemiFeatherFloor[1], darkena(fcol, dk, 0xFF));
|
|
|
|
set_floor(cgi.shFeatherFloor);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(wmspatial || GDIM == 3) {
|
2023-12-17 16:46:46 +00:00
|
|
|
floorshape& shar = *(GDIM == 3 ? (floorshape*)&cgi.shFullFloor : wmplain ? (floorshape*)&cgi.shFloor : (floorshape*)&cgi.shFeatherFloor);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
set_floor(shar);
|
|
|
|
|
|
|
|
int vcol = winf[waVinePlant].color;
|
|
|
|
int vcol2 = gradient(0, vcol, 0, .8, 1);
|
|
|
|
|
2022-12-06 00:04:26 +00:00
|
|
|
shiftmatrix Vdepth = orthogonal_move_fol(V2, cgi.WALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
queuepolyat(GDIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A);
|
2021-08-08 16:28:24 +00:00
|
|
|
if(!noshadow) {
|
|
|
|
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
2022-11-12 21:38:45 +00:00
|
|
|
queuepolyat(V2 * spin(120._deg), cgi.shSemiFloorShadow, SHADOW_WALL, GDIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW);
|
2021-08-08 16:28:24 +00:00
|
|
|
}
|
2020-01-29 17:18:51 +00:00
|
|
|
#if MAXMDIM >= 4
|
2020-01-18 15:03:32 +00:00
|
|
|
if(GDIM == 3 && qfi.fshape) {
|
2021-03-30 09:28:35 +00:00
|
|
|
auto& side = queuepolyat(V2, cgi.shSemiFloorSide[SIDE_WALL], darkena(vcol, fd, 0xFF), PPR::WALL3A-2+away(V2.T));
|
2020-01-18 15:03:32 +00:00
|
|
|
side.tinf = &floor_texture_vertices[shar.id];
|
|
|
|
ensure_vertex_number(*side.tinf, side.cnt);
|
|
|
|
}
|
2020-01-29 17:18:51 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) {
|
|
|
|
int dis = i-j;
|
|
|
|
dis %= 6;
|
|
|
|
if(dis<0) dis += 6;
|
|
|
|
if(dis != 1 && dis != 5) continue;
|
|
|
|
if(placeSidewall(c, j, SIDE_WALL, V, darkena(vcol2, fd, 0xFF))) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
hpcshape *shar = cgi.shSemiFeatherFloor;
|
|
|
|
|
|
|
|
if(wmblack) shar = cgi.shSemiBFloor;
|
|
|
|
if(wmplain) shar = cgi.shSemiFloor;
|
|
|
|
|
|
|
|
queuepoly(V2, shar[0], darkena(winf[waVinePlant].color, fd, 0xFF));
|
|
|
|
|
|
|
|
set_floor(qfi.spin, shar[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_mirrorwall() {
|
|
|
|
int d = mirror::mirrordir(c);
|
|
|
|
bool onleft = c->type == 7;
|
|
|
|
if(c->type == 7 && c->barleft == laMirror)
|
|
|
|
onleft = !onleft;
|
|
|
|
if(c->type == 6 && d != -1 && c->move(d)->barleft == laMirror)
|
|
|
|
onleft = !onleft;
|
|
|
|
if(PURE) onleft = !onleft;
|
|
|
|
|
|
|
|
if(d == -1) {
|
|
|
|
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)
|
|
|
|
break;
|
|
|
|
qfi.spin = ddspin(c, d, 0);
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V2 = V * qfi.spin;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(!wmblack) for(int d=0; d<c->type; d++) {
|
|
|
|
inmirrorcount+=d;
|
|
|
|
queuepolyat(V2 * spin(d*M_PI/S3), cgi.shHalfFloor[2], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
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);
|
|
|
|
#endif
|
|
|
|
inmirrorcount-=d;
|
|
|
|
}
|
|
|
|
if(GDIM == 3) {
|
|
|
|
for(int d=0; d<6; d++)
|
|
|
|
queue_transparent_wall(V2 * spin(d*M_PI/S3), cgi.shHalfMirror[2], 0xC0C0C080);
|
|
|
|
}
|
|
|
|
else if(wmspatial) {
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(orthogonal_move_fol(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), cgi.shHalfMirror[2], 0xC0C0C080, PPR::WALL3+z-layers);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
queuepolyat(V2, cgi.shHalfMirror[2], 0xC0C0C080, PPR::WALL3);
|
|
|
|
}
|
|
|
|
else {
|
2022-11-12 21:38:45 +00:00
|
|
|
qfi.spin = ddspin180(c, d);
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V2 = V * qfi.spin;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(!wmblack) {
|
|
|
|
inmirrorcount++;
|
|
|
|
queuepolyat(mirrorif(V2, !onleft), cgi.shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(GDIM == 3 && camera_level > cgi.WALL && pmodel == mdPerspective)
|
|
|
|
queuepolyat(mirrorif(V2, !onleft), cgi.shHalfFloor[ct6+3], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
|
|
|
#endif
|
|
|
|
inmirrorcount--;
|
|
|
|
queuepolyat(mirrorif(V2, onleft), cgi.shHalfFloor[ct6], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(GDIM == 3 && camera_level > cgi.WALL && pmodel == mdPerspective)
|
|
|
|
queuepolyat(mirrorif(V2, onleft), cgi.shHalfFloor[ct6+3], darkena(fcol, fd, 0xFF), PPR::FLOORa);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if(GDIM == 3)
|
|
|
|
queue_transparent_wall(V2, cgi.shHalfMirror[ct6], 0xC0C0C080);
|
|
|
|
else if(wmspatial) {
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<layers; z++)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(orthogonal_move_fol(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), cgi.shHalfMirror[ct6], 0xC0C0C080, PPR::WALL3+z-layers);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
queuepolyat(V2, cgi.shHalfMirror[ct6], 0xC0C0C080, PPR::WALL3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-07 03:01:59 +00:00
|
|
|
EX int canvasfloor;
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
void celldrawer::set_land_floor(const shiftmatrix& Vf) {
|
2019-10-25 10:44:41 +00:00
|
|
|
switch(c->land) {
|
2022-03-07 03:01:59 +00:00
|
|
|
case laCanvas:
|
|
|
|
switch(canvasfloor) {
|
|
|
|
case caflM: set_floor(cgi.shMFloor); break;
|
|
|
|
case caflFull: set_floor(cgi.shFullFloor); break;
|
|
|
|
// case caflWarp is warped floor
|
|
|
|
case caflStar: set_floor(cgi.shStarFloor); break;
|
|
|
|
case caflCloud: set_floor(cgi.shCloudFloor); break;
|
|
|
|
case caflCross: set_floor(cgi.shCrossFloor); break;
|
|
|
|
case caflCharged: set_floor(cgi.shChargedFloor); break;
|
|
|
|
case caflSStar: set_floor(cgi.shSStarFloor); break;
|
|
|
|
case caflOver: set_floor(cgi.shOverFloor); break;
|
|
|
|
case caflTri: set_floor(cgi.shTriFloor); break;
|
|
|
|
case caflFeather: set_floor(cgi.shFeatherFloor); break;
|
|
|
|
case caflBarrow: set_floor(cgi.shBarrowFloor); break;
|
|
|
|
case caflNew: set_floor(cgi.shNewFloor); break;
|
|
|
|
case caflTroll: set_floor(cgi.shTrollFloor); break;
|
|
|
|
case caflButterfly: set_floor(cgi.shButterflyFloor); break;
|
|
|
|
case caflLava: set_floor(cgi.shLavaFloor); break;
|
|
|
|
case caflPalace: set_floor(cgi.shPalaceFloor); break;
|
|
|
|
case caflDemon: set_floor(cgi.shDemonFloor); break;
|
|
|
|
case caflCave: set_floor(cgi.shCaveFloor); break;
|
|
|
|
case caflDesert: set_floor(cgi.shDesertFloor); break;
|
|
|
|
case caflPower: set_floor(cgi.shPowerFloor); break;
|
|
|
|
case caflRose: set_floor(cgi.shRoseFloor); break;
|
|
|
|
case caflTurtle: set_floor(cgi.shTurtleFloor); break;
|
|
|
|
case caflDragon: set_floor(cgi.shDragonFloor); break;
|
|
|
|
case caflReptile: set_reptile_floor(V, fcol); break;
|
|
|
|
case caflHive:
|
|
|
|
if(c->wall != waFloorB && c->wall != waFloorA && c->wall != waMirror && c->wall != waCloud && !chasmgraph(c)) {
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
if(GDIM == 2) {
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, darkena(fcol, fd + 1, 0xFF), PPR::FLOORa);
|
2022-04-07 18:46:59 +00:00
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, darkena(fcol, fcol==color_t(c->landparam) ? fd : fd + 1, 0xFF), PPR::FLOORb);
|
2022-03-07 03:01:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
break;
|
|
|
|
case caflSwitch:
|
|
|
|
set_floor(cgi.shSwitchFloor);
|
|
|
|
if(!chasmgraph(c) && ctof(c) && STDVAR && !arcm::in() && !bt::in() && GDIM == 2) for(int i=0; i<c->type; i++)
|
|
|
|
queuepoly(Vf * ddspin(c, i, M_PI/S7) * xpush(cgi.rhexf), cgi.shSwitchDisk, darkena(fcol, fd, 0xFF));
|
|
|
|
break;
|
2022-03-08 00:37:35 +00:00
|
|
|
case caflTower: set_towerfloor(celldist); break;
|
2022-03-07 03:01:59 +00:00
|
|
|
case caflNone: default:
|
|
|
|
set_floor(cgi.shFloor); break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
case laPrairie:
|
|
|
|
case laAlchemist:
|
|
|
|
set_floor(cgi.shCloudFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laJungle:
|
|
|
|
case laWineyard:
|
|
|
|
set_floor(cgi.shFeatherFloor);
|
|
|
|
break;
|
2020-02-26 00:34:30 +00:00
|
|
|
|
|
|
|
case laFrog:
|
|
|
|
if(c->wall == waDeepWater)
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
else
|
|
|
|
set_floor(cgi.shFeatherFloor);
|
|
|
|
break;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
case laZebra:
|
|
|
|
set_zebrafloor();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laMountain:
|
|
|
|
if(shmup::on || GDIM == 3)
|
|
|
|
shmup_gravity_floor();
|
|
|
|
else
|
|
|
|
set_towerfloor(euclid ? celldist : c->master->alt ? celldistAltPlus : celldist);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laEmerald:
|
|
|
|
set_emeraldfloor();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laRlyeh:
|
|
|
|
case laTemple:
|
|
|
|
set_floor(cgi.shTriFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laVolcano:
|
|
|
|
case laVariant:
|
2020-02-26 00:34:30 +00:00
|
|
|
case laEclectic:
|
2019-10-25 10:44:41 +00:00
|
|
|
set_floor(cgi.shLavaFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laRose:
|
|
|
|
set_floor(cgi.shRoseFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laTortoise:
|
|
|
|
set_floor(cgi.shTurtleFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laBurial: case laRuins:
|
|
|
|
set_floor(cgi.shBarrowFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laTrollheim:
|
|
|
|
set_floor(cgi.shTrollFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*case laMountain:
|
|
|
|
set_floor(FEATHERFLOOR);
|
|
|
|
break; */
|
|
|
|
|
|
|
|
case laGraveyard:
|
|
|
|
set_floor(cgi.shCrossFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laMotion:
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laWhirlwind:
|
|
|
|
case laEFire: case laEAir: case laEWater: case laEEarth: case laElementalWall:
|
|
|
|
set_floor(cgi.shNewFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laHell:
|
|
|
|
set_floor(cgi.shDemonFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laIce: case laBlizzard:
|
|
|
|
set_floor(cgi.shStarFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laSwitch:
|
|
|
|
set_floor(cgi.shSwitchFloor);
|
2019-12-14 11:05:01 +00:00
|
|
|
if(ctof(c) && STDVAR && !arcm::in() && !bt::in() && GDIM == 2) for(int i=0; i<c->type; i++)
|
2019-10-25 10:44:41 +00:00
|
|
|
queuepoly(Vf * ddspin(c, i, M_PI/S7) * xpush(cgi.rhexf), cgi.shSwitchDisk, darkena(minf[active_switch()].color, fd, 0xFF));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laStorms:
|
|
|
|
set_floor(cgi.shChargedFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laWildWest:
|
|
|
|
set_floor(cgi.shSStarFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laPower:
|
|
|
|
set_floor(cgi.shPowerFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laCaves:
|
|
|
|
case laLivefjord:
|
|
|
|
case laDeadCaves:
|
2021-05-30 12:18:56 +00:00
|
|
|
case laCursed:
|
2019-10-25 10:44:41 +00:00
|
|
|
set_floor(cgi.shCaveFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laDryForest:
|
|
|
|
set_floor(GDIM == 3 ? cgi.shFeatherFloor : cgi.shDesertFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laDesert:
|
|
|
|
case laRedRock: case laSnakeNest:
|
|
|
|
case laCocytus:
|
|
|
|
set_floor(cgi.shDesertFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laBull:
|
|
|
|
set_floor(cgi.shButterflyFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laCaribbean: case laOcean: case laOceanWall: case laWhirlpool:
|
|
|
|
set_floor(cgi.shCloudFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laKraken:
|
|
|
|
case laDocks:
|
|
|
|
set_floor(cgi.shFullFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laPalace: case laTerracotta:
|
|
|
|
set_floor(cgi.shPalaceFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laDragon:
|
|
|
|
set_floor(cgi.shDragonFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laOvergrown: case laClearing: case laHauntedWall: case laHaunted: case laHauntedBorder:
|
|
|
|
set_floor(cgi.shOverFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laMercuryRiver: {
|
|
|
|
if(euclid || !BITRUNCATED || GDIM == 3)
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
else {
|
|
|
|
int bridgedir = -1;
|
|
|
|
if(c->type == 6) {
|
|
|
|
for(int i=1; i<c->type; i+=2)
|
|
|
|
if(pseudohept(c->modmove(i-1)) && c->modmove(i-1)->land == laMercuryRiver)
|
|
|
|
if(pseudohept(c->modmove(i+1)) && c->modmove(i+1)->land == laMercuryRiver)
|
|
|
|
bridgedir = i;
|
|
|
|
}
|
|
|
|
if(bridgedir == -1)
|
|
|
|
set_floor(cgi.shPalaceFloor);
|
|
|
|
else {
|
|
|
|
transmatrix bspin = ddspin(c, bridgedir);
|
|
|
|
set_floor(bspin, cgi.shMercuryBridge[0]);
|
|
|
|
// only needed in one direction
|
|
|
|
if(c < c->move(bridgedir)) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix Vbspin = Vf * bspin;
|
|
|
|
queuepoly(Vbspin, cgi.shMercuryBridge[1], darkena(fcol, fd+1, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
if(wmspatial) {
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(orthogonal_move_fol(Vbspin, cgi.LAKE), cgi.shMercuryBridge[1], darkena(gradient(0, winf[waMercury].color, 0, 0.8,1), 0, 0x80), PPR::LAKELEV);
|
|
|
|
queuepolyat(orthogonal_move_fol(Vbspin, cgi.BOTTOM), cgi.shMercuryBridge[1], darkena(0x202020, 0, 0xFF), PPR::LAKEBOTTOM);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case laHive:
|
|
|
|
if(c->wall != waFloorB && c->wall != waFloorA && c->wall != waMirror && c->wall != waCloud) {
|
|
|
|
fd = 1;
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
if(c->wall != waMirror && c->wall != waCloud && GDIM == 2)
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, darkena(fcol, 2, 0xFF), PPR::FLOORa);
|
|
|
|
if(c->wall != waMirror && c->wall != waCloud && GDIM == 2)
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, darkena(fcol, fcol==wcol ? 1 : 2, 0xFF), PPR::FLOORb);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laEndorian:
|
|
|
|
if(shmup::on || GDIM == 3)
|
|
|
|
shmup_gravity_floor();
|
|
|
|
|
|
|
|
else if(c->wall == waTrunk)
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
|
|
|
|
else if(c->wall == waCanopy || c->wall == waSolidBranch || c->wall == waWeakBranch)
|
|
|
|
set_floor(cgi.shFeatherFloor);
|
|
|
|
|
|
|
|
else
|
|
|
|
set_towerfloor();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case laIvoryTower: case laDungeon: case laWestWall:
|
|
|
|
if(shmup::on || GDIM == 3)
|
|
|
|
shmup_gravity_floor();
|
|
|
|
else
|
2023-09-18 12:34:46 +00:00
|
|
|
set_towerfloor(ls::hv_structure() ? celldistAltPlus : coastvalEdge);
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laBrownian:
|
|
|
|
if(among(c->wall, waSea, waBoat))
|
|
|
|
set_floor(cgi.shCloudFloor);
|
|
|
|
else
|
|
|
|
set_floor(cgi.shTrollFloor);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool celldrawer::set_randompattern_floor() {
|
|
|
|
if(isWarpedType(c->land)) return false;
|
|
|
|
if(!randomPatternsMode) return false;
|
|
|
|
if(c->land == laBarrier) return false;
|
|
|
|
int j = (randompattern[c->land]/5) % 15;
|
|
|
|
int k = randompattern[c->land] % RPV_MODULO;
|
|
|
|
int k7 = randompattern[c->land] % 7;
|
|
|
|
|
|
|
|
if(k == RPV_ZEBRA && k7 < 2) set_zebrafloor();
|
|
|
|
else if(k == RPV_EMERALD && k7 == 0) set_emeraldfloor();
|
|
|
|
else if(k == RPV_CYCLE && k7 < 4) set_towerfloor(celldist);
|
|
|
|
|
|
|
|
else switch(j) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-05-17 07:34:58 +00:00
|
|
|
EX bool numerical_minefield;
|
2024-05-07 20:18:54 +00:00
|
|
|
EX int mine_zero_display = 1;
|
|
|
|
EX bool mine_hollow;
|
|
|
|
EX bool mine_markers;
|
|
|
|
|
|
|
|
EX void draw_mine_numbers(int mines, const shiftmatrix& V, int ct6) {
|
|
|
|
auto hollow = [&] (hpcshape& sh, color_t col) {
|
|
|
|
if(mine_hollow) {
|
|
|
|
dynamicval<color_t> dc(poly_outline, col);
|
|
|
|
queuepoly(V, sh, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
queuepoly(V, sh, col);
|
|
|
|
};
|
|
|
|
if(mines == 0 && mine_zero_display < (WDIM == 3 ? 2 : 1)) return;
|
|
|
|
if(numerical_minefield) {
|
|
|
|
string label = its(mines);
|
|
|
|
queuestr(V, (mines >= 10 ? .5 : 1) * mapfontscale / 100, label, darkened(minecolors[mines]), 8);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(mines >= isize(minecolors)) hollow(cgi.shBigMineMark[ct6], darkena(minecolors[mines/isize(minecolors)], 0, 0xFF));
|
|
|
|
hollow(cgi.shMineMark[ct6], darkena(minecolors[mines], 0, 0xFF));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EX void draw_mine_markers(cell *c, const shiftmatrix& V) {
|
|
|
|
if(mine_markers && !mine::marked_safe(c)) {
|
|
|
|
color_t col = 0xFF4040;
|
|
|
|
if(mine::marked_mine(c))
|
|
|
|
col = gradient(winf[waMineMine].color, col, -1, vid.ispeed ? sintick(100) : 1, 1);
|
|
|
|
dynamicval<color_t> dc(poly_outline, (col << 8) | 0xFF);
|
|
|
|
queuepoly(V, cgi.shJoint, 0);
|
|
|
|
}
|
|
|
|
}
|
2022-05-17 07:34:58 +00:00
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::draw_features() {
|
|
|
|
char xch = winf[c->wall].glyph;
|
|
|
|
#if CAP_SHAPES
|
|
|
|
switch(c->wall) {
|
|
|
|
|
|
|
|
case waBigBush:
|
|
|
|
if(detaillevel >= 2)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(at_smart_lof(V, zgrad0(0, cgi.slev, 1, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(detaillevel >= 1)
|
2022-12-13 18:04:43 +00:00
|
|
|
queuepolyat(at_smart_lof(V, cgi.SLEV[1]) * lpispin(), cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+1);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(detaillevel >= 2)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(at_smart_lof(V, zgrad0(0, cgi.slev, 3, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL+2);
|
|
|
|
queuepolyat(at_smart_lof(V, cgi.SLEV[2]), cgi.shSolidBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waSmallBush:
|
|
|
|
if(detaillevel >= 2)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(at_smart_lof(V, zgrad0(0, cgi.slev, 1, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(detaillevel >= 1)
|
2022-12-13 18:04:43 +00:00
|
|
|
queuepolyat(at_smart_lof(V, cgi.SLEV[1]) * lpispin(), cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+1);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(detaillevel >= 2)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(at_smart_lof(V, zgrad0(0, cgi.slev, 3, 2)), cgi.shHeptaMarker, darkena(wcol, 0, 0xFF), PPR::REDWALL+2);
|
|
|
|
queuepolyat(at_smart_lof(V, cgi.SLEV[2]), cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waSolidBranch:
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepoly(GDIM == 3 ? orthogonal_move_fol(V, cgi.BODY) : V, cgi.shSolidBranch, darkena(wcol, 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waWeakBranch:
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepoly(GDIM == 3 ? orthogonal_move_fol(V, cgi.BODY) : V, cgi.shWeakBranch, darkena(wcol, 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waLadder:
|
|
|
|
if(GDIM == 3) {
|
|
|
|
#if MAXMDIM >= 4
|
2023-02-04 00:58:13 +00:00
|
|
|
draw_shapevec(c, V * lzpush(-cgi.human_height/20), cgi.shMFloor.levels[0], 0x804000FF, PPR::FLOOR+1);
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if(euclid) {
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, 0x804000FF);
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, 0x000000FF);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
draw_floorshape(c, V, cgi.shFloor, 0x804000FF, PPR::FLOOR+1);
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, 0x000000FF, PPR::FLOOR+2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waReptileBridge: {
|
|
|
|
Vboat = V;
|
|
|
|
dynamicval<qfloorinfo> qfi2(qfi, qfi);
|
|
|
|
color_t col = reptilecolor(c);
|
|
|
|
chasmg = 0;
|
|
|
|
set_reptile_floor(V, col);
|
|
|
|
draw_qfi(c, V, col);
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
|
|
|
if(placeSidewall(c, i, SIDE_LAKE, V, darkena(gradient(0, col, 0, .8, 1), fd, 0xFF))) break;
|
|
|
|
chasmg = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waTerraWarrior:
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_COMPLEX2
|
2021-08-04 00:15:53 +00:00
|
|
|
drawTerraWarrior(V, terracotta::randterra ? (c->wparam & 7) : (5 - (c->wparam & 7)), 7, 0);
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waBoat: case waStrandedBoat:
|
|
|
|
draw_boat();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waBigStatue: {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V2 = V;
|
2019-10-25 10:44:41 +00:00
|
|
|
double footphase;
|
|
|
|
applyAnimation(c, V2, footphase, LAYER_BOAT);
|
|
|
|
|
|
|
|
queuepolyat(V2, cgi.shStatue,
|
|
|
|
darkena(winf[c->wall].color, 0, 0xFF),
|
|
|
|
PPR::BIGSTATUE
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waSulphurC: {
|
|
|
|
if(drawstar(c)) {
|
|
|
|
aura_color = wcol;
|
|
|
|
if(wmspatial)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepolyat(orthogonal_move_fol(V, cgi.HELLSPIKE), cgi.shGiantStar[ct6], darkena(wcol, 0, 0x40), PPR::HELLSPIKE);
|
2019-10-25 10:44:41 +00:00
|
|
|
else
|
|
|
|
queuepoly(V, cgi.shGiantStar[ct6], darkena(wcol, 0, 0xFF));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waTrapdoor:
|
|
|
|
if(c->land == laZebra) break;
|
|
|
|
/* fallthrough */
|
|
|
|
|
|
|
|
case waClosePlate: case waOpenPlate: {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix V2 = V;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(wmescher && geosupport_football() == 2 && pseudohept(c) && c->land == laPalace) V2 = V * spin(M_PI / c->type);
|
|
|
|
if(GDIM == 3) {
|
|
|
|
#if MAXMDIM >= 4
|
2023-02-04 00:58:13 +00:00
|
|
|
draw_shapevec(c, V2 * lzpush(-cgi.human_height/40), cgi.shMFloor.levels[0], darkena(winf[c->wall].color, 0, 0xFF));
|
|
|
|
draw_shapevec(c, V2 * lzpush(-cgi.human_height/35), cgi.shMFloor2.levels[0], (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-03-30 09:29:18 +00:00
|
|
|
case waCrateCrate: case waCrateTarget: case waCrateOnTarget: {
|
|
|
|
shiftmatrix V2 = V;
|
|
|
|
if(c->wall != waCrateCrate) {
|
|
|
|
draw_floorshape(c, V2, cgi.shMFloor, darkena(winf[waCrateTarget].color, 0, 0xFF));
|
|
|
|
draw_floorshape(c, V2, cgi.shMFloor2, c->wall == waCrateOnTarget ? darkena(0xFFFF00, 0, 0xFF) : (!wmblack) ? darkena(fcol, 1, 0xFF) : darkena(0,1,0xFF));
|
|
|
|
}
|
|
|
|
if(c->wall != waCrateTarget) {
|
|
|
|
if(wmspatial) {
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
for(int z=1; z<=layers; z++) {
|
|
|
|
double zg = zgrad0(0, geom3::actual_wall_height(), z, layers);
|
|
|
|
queuepolyat(xyzscale(V, zg, zg), cgi.shBarrel, darkena((z&1) ? 0xFF0000 : 0xC00000, 0, 0xFF), PPR(PPR::REDWALLm+z));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
queuepolyat(V, cgi.shBarrel, darkena(0xC00000, 0, 0xFF), PPR(PPR::REDWALLm));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
case waFrozenLake: case waLake: case waCamelotMoat:
|
|
|
|
case waSea: case waOpenGate: case waBubble: case waDock:
|
2020-02-26 00:15:30 +00:00
|
|
|
case waDeepWater: case waShallow:
|
2019-10-25 10:44:41 +00:00
|
|
|
case waSulphur: case waMercury:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waNone:
|
|
|
|
if(c->land == laBrownian) goto wa_default;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waRose: {
|
|
|
|
aura_color = wcol;
|
|
|
|
wcol <<= 1;
|
|
|
|
if(c->cpdist > 5)
|
|
|
|
wcol = 0xC0C0C0;
|
|
|
|
else if(rosephase == 7)
|
|
|
|
wcol = 0xFF0000;
|
|
|
|
else
|
|
|
|
wcol = gradient(wcol, 0xC00000, 0, rosephase, 6);
|
|
|
|
queuepoly(V, cgi.shThorns, 0xC080C0FF);
|
|
|
|
|
|
|
|
for(int u=0; u<4; u+=2)
|
2022-11-12 21:38:45 +00:00
|
|
|
queuepoly(V * spin(30._deg * u), cgi.shRose, darkena(wcol, 0, 0xC0));
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waRoundTable:
|
|
|
|
if(wmspatial) goto wa_default;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waMirrorWall:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waGlass:
|
|
|
|
if(wmspatial) {
|
|
|
|
color_t col = winf[waGlass].color;
|
|
|
|
int dcol = darkena(col, 0, 0x80);
|
2022-12-06 00:04:26 +00:00
|
|
|
shiftmatrix Vdepth = orthogonal_move_fol(Vd, cgi.WALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(GDIM == 3)
|
|
|
|
draw_shapevec(c, V, cgi.shMFloor.levels[SIDE_WALL], dcol, PPR::WALL);
|
|
|
|
else
|
|
|
|
draw_floorshape(c, Vdepth, cgi.shMFloor, dcol, PPR::WALL); // GLASS
|
|
|
|
dynamicval<qfloorinfo> dq(qfi, qfi);
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, i, c)
|
|
|
|
if(placeSidewall(c, i, SIDE_WALL, Vd, dcol)) break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waFan:
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(GDIM == 3)
|
|
|
|
for(int a=0; a<10; a++)
|
2023-02-04 00:58:13 +00:00
|
|
|
queuepoly(V * lzpush(cgi.FLOOR + (cgi.WALL - cgi.FLOOR) * a/10.) * spin(a *degree) * spintick(PURE ? -1000 : -500, 1/12.), cgi.shFan, darkena(wcol, 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
queuepoly(V * spintick(PURE ? -1000 : -500, 1/12.), cgi.shFan, darkena(wcol, 0, 0xFF));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waArrowTrap:
|
2023-03-28 10:46:10 +00:00
|
|
|
if(c->wparam >= 1 || hat::in())
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepoly(orthogonal_move_fol(V, cgi.FLOOR), cgi.shDisk, darkena(trapcol[c->wparam&3], 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
if(isCentralTrap(c)) arrowtraps.push_back(c);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waFireTrap:
|
|
|
|
|
|
|
|
if(GDIM == 3) {
|
|
|
|
#if MAXMDIM >= 4
|
2023-02-04 00:58:13 +00:00
|
|
|
draw_shapevec(c, V * lzpush(-cgi.human_height/40), cgi.shMFloor.levels[0], darkena(0xC00000, 0, 0xFF));
|
|
|
|
draw_shapevec(c, V * lzpush(-cgi.human_height/20), cgi.shMFloor2.levels[0], darkena(0x600000, 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, darkena(0xC00000, 0, 0xFF));
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor2, darkena(0x600000, 0, 0xFF));
|
|
|
|
}
|
|
|
|
if(c->wparam >= 1)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuepoly(orthogonal_move_fol(V, cgi.FLOOR), cgi.shDisk, darkena(trapcol[c->wparam&3], 0, 0xFF));
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case waGiantRug:
|
|
|
|
queuepoly(V, cgi.shBigCarpet1, darkena(GDIM == 3 ? 0 : 0xC09F00, 0, 0xFF));
|
|
|
|
queuepoly(V, cgi.shBigCarpet2, darkena(GDIM == 3 ? 0xC09F00 : 0x600000, 0, 0xFF));
|
|
|
|
queuepoly(V, cgi.shBigCarpet3, darkena(GDIM == 3 ? 0x600000 : 0xC09F00, 0, 0xFF));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waBarrier:
|
|
|
|
if(c->land == laOceanWall && wmescher && wmspatial) {
|
|
|
|
if(GDIM == 3 && qfi.fshape) {
|
|
|
|
draw_shapevec(c, V, qfi.fshape->cone[1], darkena(wcol, 0, 0xFF), PPR::WALL);
|
2021-08-08 16:28:24 +00:00
|
|
|
draw_wallshadow();
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
const int layers = 2 << detaillevel;
|
|
|
|
dynamicval<const hpcshape*> ds(qfi.shape, &cgi.shCircleFloor);
|
|
|
|
dynamicval<transmatrix> dss(qfi.spin, Id);
|
|
|
|
for(int z=1; z<layers; z++) {
|
|
|
|
double zg = zgrad0(-vid.lake_top, geom3::actual_wall_height(), z, layers);
|
|
|
|
draw_qfi(c, xyzscale(V, zg*(layers-z)/layers, zg),
|
|
|
|
darkena(gradient(0, wcol, -layers, z, layers), 0, 0xFF), PPR::WALL3+z-layers+2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else goto wa_default;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case waMineOpen: {
|
|
|
|
int mines = countMinesAround(c);
|
2024-05-07 20:18:54 +00:00
|
|
|
draw_mine_numbers(mines, V, ct6);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waMineUnknown: case waMineMine: {
|
|
|
|
draw_mine_markers(c, V);
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case waEditStatue:
|
|
|
|
if(!mapeditor::drawUserShape(V * ddspin(c, c->mondir), mapeditor::sgWall, c->wparam, darkena(wcol, fd, 0xFF), c))
|
|
|
|
queuepoly(V, cgi.shTriangle, darkena(wcol, fd, 0xFF));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: {
|
|
|
|
wa_default:
|
|
|
|
if(sl && wmspatial) {
|
|
|
|
|
|
|
|
if(GDIM == 3 && qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[sl], darkena(wcol, fd, 0xFF), PPR::REDWALL-4+4*sl);
|
|
|
|
else
|
|
|
|
draw_qfi(c, Vd, darkena(wcol, fd, 0xFF), PPR::REDWALL-4+4*sl);
|
|
|
|
floorShadow(c, V, SHADOW_SL * sl);
|
|
|
|
for(int s=0; s<sl; s++)
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
int sl_2 = snakelevel(c2);
|
|
|
|
if(s >= sl_2)
|
|
|
|
if(placeSidewall(c, i, SIDE_SLEV+s, V, getSnakelevColor(s, sl))) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(highwall(c)) draw_wall();
|
|
|
|
|
|
|
|
else if(xch == '%') {
|
|
|
|
if(doHighlight())
|
|
|
|
poly_outline = (c->land == laMirror) ? OUTLINE_TREASURE : OUTLINE_ORB;
|
|
|
|
|
|
|
|
if(wmspatial) {
|
|
|
|
color_t col = winf[c->wall].color;
|
|
|
|
int dcol = darkena(col, 0, 0xC0);
|
2022-12-06 00:04:26 +00:00
|
|
|
shiftmatrix Vdepth = orthogonal_move_fol(Vd, cgi.WALL);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(GDIM == 3)
|
|
|
|
draw_shapevec(c, V, cgi.shMFloor.levels[SIDE_WALL], dcol, PPR::WALL);
|
|
|
|
else
|
|
|
|
draw_floorshape(c, Vdepth, cgi.shMFloor, dcol, PPR::WALL); // GLASS
|
|
|
|
dynamicval<qfloorinfo> dq(qfi, qfi);
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, i, c)
|
|
|
|
if(placeSidewall(c, i, SIDE_WALL, Vd, dcol)) break;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
queuepoly(V, cgi.shMirror, darkena(wcol, 0, 0xC0));
|
|
|
|
}
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
2021-05-23 13:57:39 +00:00
|
|
|
|
2021-06-09 02:33:55 +00:00
|
|
|
#if CAP_COMPLEX2
|
2021-05-30 11:48:24 +00:00
|
|
|
else if(isDie(c->wall)) {
|
2021-05-27 11:00:20 +00:00
|
|
|
color_t col = darkena(winf[c->wall].color, 0, 0xFF);
|
|
|
|
|
|
|
|
ld footphase;
|
|
|
|
Vboat = V;
|
|
|
|
bool animated = applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
|
|
|
if(animated) {
|
|
|
|
transmatrix U = inverse_shift(V, Vboat);
|
|
|
|
U = rgpushxto0(tC0(U));
|
|
|
|
Vboat = V * U;
|
|
|
|
}
|
|
|
|
die_target = V;
|
|
|
|
dice::draw_die(c, Vboat, 1, col);
|
2021-05-23 13:57:39 +00:00
|
|
|
}
|
2021-06-09 02:33:55 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
else if(c->wall == waExplosiveBarrel) {
|
|
|
|
if(GDIM == 3 && qfi.fshape) {
|
|
|
|
draw_shapevec(c, V, qfi.fshape->cone[1], 0xD00000FF, PPR::REDWALL);
|
2021-08-08 16:28:24 +00:00
|
|
|
draw_wallshadow();
|
2019-10-25 10:44:41 +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);
|
|
|
|
queuepolyat(xyzscale(V, zg, zg), cgi.shBarrel, darkena((z&1) ? 0xFF0000 : 0xC00000, 0, 0xFF), PPR(PPR::REDWALLm+z));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(isFire(c) || isThumper(c) || c->wall == waBonfireOff) {
|
|
|
|
auto V2 = V;
|
|
|
|
if(c->wall == waThumperOn) {
|
|
|
|
ld ds = fractick(160);
|
|
|
|
for(int u=0; u<5; u++) {
|
|
|
|
ld rad = cgi.hexf * (.3 * (u + ds));
|
|
|
|
int tcol = darkena(gradient(forecolor, backcolor, 0, rad, 1.5 * cgi.hexf), 0, 0xFF);
|
|
|
|
PRING(a)
|
2022-11-12 21:38:45 +00:00
|
|
|
curvepoint(xspinpush0(a * cgi.S_step, rad));
|
2020-07-27 16:49:04 +00:00
|
|
|
queuecurve(V, tcol, 0, PPR::LINE);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(hasTimeout(c)) V2 = V2 * spintick(c->land == laPower ? 5000 : 500);
|
|
|
|
if(GDIM == 3 && qfi.fshape) {
|
|
|
|
draw_shapevec(c, V2, qfi.fshape->cone[1], darkena(wcol, 0, 0xF0), PPR::WALL);
|
2021-08-08 16:28:24 +00:00
|
|
|
draw_wallshadow();
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else queuepoly(V2, cgi.shStar, darkena(wcol, 0, 0xF0));
|
|
|
|
if(isFire(c) && rand() % 300 < ticks - lastt)
|
|
|
|
drawParticle(c, wcol, 75);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(xch != '.' && xch != '+' && xch != '>' && xch != ':'&& xch != '-' && xch != ';' && xch != ',' && xch != '&')
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_features_and_walls_3d() {
|
2020-01-29 17:18:51 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-10-25 10:44:41 +00:00
|
|
|
color_t dummy;
|
2021-07-09 08:09:31 +00:00
|
|
|
int ofs = currentmap->wall_offset(c);
|
2023-03-28 20:54:46 +00:00
|
|
|
|
|
|
|
if((cgflags & qFRACTAL) && c->wall == waChasm && c->land == laMemory) {
|
|
|
|
for(int a=0; a<c->type; a++) if(c->move(a) && c->move(a)->land != laMemory) {
|
|
|
|
if(anyshiftclick) {
|
|
|
|
auto& poly = queuepoly(V, cgi.shPlainWall3D[ofs+a], 0xFFFFFFFF - 0xF0F0F00 * get_darkval(c, a));
|
|
|
|
poly.tinf = &floor_texture_vertices[cgi.shFullFloor.id];
|
|
|
|
ensure_vertex_number(*poly.tinf, poly.cnt);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
auto& poly = queuepoly(V, cgi.shWireframe3D[ofs + a], 0);
|
|
|
|
poly.outline = 0xFFFFFFFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(anyshiftclick) return;
|
|
|
|
}
|
|
|
|
|
2024-05-07 20:18:54 +00:00
|
|
|
if(among(c->wall, waMineUnknown, waMineMine))
|
|
|
|
draw_mine_markers(c, face_the_player(V));
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(isWall3(c, wcol)) {
|
|
|
|
if(!no_wall_rendering) {
|
2022-11-13 13:05:30 +00:00
|
|
|
if(c->wall == waChasm && c->land == laMemory && !in_perspective()) {
|
|
|
|
for(int a=0; a<c->type; a++) if(c->move(a) && c->move(a)->land != laMemory) {
|
|
|
|
auto& poly = queuepoly(V, cgi.shWireframe3D[ofs + a], 0);
|
|
|
|
poly.outline = (wcol << 8) | 0x40;
|
|
|
|
}
|
|
|
|
goto after_walls;
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
color_t wcol2 = wcol;
|
|
|
|
#if CAP_TEXTURE
|
|
|
|
if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int d = (wcol & 0xF0F0F0) >> 4;
|
|
|
|
|
|
|
|
for(int a=0; a<c->type; a++) {
|
|
|
|
bool b = true;
|
2022-05-17 07:40:33 +00:00
|
|
|
if(c->move(a) && (in_perspective() || gmatrix0.count(c->move(a))))
|
2020-06-03 09:43:35 +00:00
|
|
|
b = (patterns::innerwalls && (tC0(V)[2] < tC0(V * currentmap->adj(c, a))[2])) || fake::split() || !isWall3(c->move(a), dummy);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(b) {
|
2020-04-16 19:00:28 +00:00
|
|
|
#if CAP_WRL
|
|
|
|
/* always render */
|
|
|
|
if(wrl::in && wrl::print) ; else
|
|
|
|
#endif
|
2023-03-23 00:32:24 +00:00
|
|
|
if(pmodel == mdPerspective && !sphere && !quotient && !aperiodic && !nonisotropic && !mhybrid && !experimental && !nih) {
|
2019-11-13 23:26:50 +00:00
|
|
|
if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(centerover)) continue;
|
|
|
|
else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(centerover)) continue;
|
2020-09-11 09:29:14 +00:00
|
|
|
// this optimization is not correct, need to fix
|
|
|
|
// else if(c->move(a)->master->distance > c->master->distance && c->master->distance > centerover->master->distance && !quotient) continue;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
2019-11-08 14:34:51 +00:00
|
|
|
else if(sol && in_perspective() && !nih && !asonov::in()) {
|
2019-10-25 10:44:41 +00:00
|
|
|
ld b = vid.binary_width * log(2) / 2;
|
|
|
|
const ld l = log(2) / 2;
|
|
|
|
switch(a) {
|
|
|
|
case 0: if(V[0][LDIM] >= b) continue; break;
|
|
|
|
case 1: if(V[1][LDIM] >= b) continue; break;
|
|
|
|
case 2: case 3: if (pmodel == mdPerspective && V[2][LDIM] >= l) continue; break;
|
|
|
|
case 4: if(V[0][LDIM] <= -b) continue; break;
|
|
|
|
case 5: if(V[1][LDIM] <= -b) continue; break;
|
|
|
|
case 6: case 7: if (pmodel == mdPerspective && V[2][LDIM] <= -l) continue; break;
|
|
|
|
}
|
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(mproduct) {
|
2019-12-06 12:04:17 +00:00
|
|
|
if(a < c->type-2 && !in_s2xe()) {
|
2020-07-27 16:49:04 +00:00
|
|
|
ld d = in_e2xe() ? sqhypot_d(2, unshift(tC0(V))) : V[2][2];
|
|
|
|
hyperpoint h = (unshift(V) * cgi.walltester[ofs + a]);
|
2019-12-06 11:13:09 +00:00
|
|
|
ld d1 = in_e2xe() ? sqhypot_d(2, h) : h[2];
|
|
|
|
if(d1 >= d - 1e-6) continue;
|
|
|
|
}
|
|
|
|
else if(a == c->type-1) {
|
2020-07-27 16:49:04 +00:00
|
|
|
if(zlevel(tC0(V.T)) >= -cgi.plevel/2) continue;
|
2019-12-06 11:13:09 +00:00
|
|
|
}
|
|
|
|
else if(a == c->type-2) {
|
2020-07-27 16:49:04 +00:00
|
|
|
if(zlevel(tC0(V.T)) <= +cgi.plevel/2) continue;
|
2019-12-06 11:13:09 +00:00
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
if(qfi.fshape && wmescher) {
|
|
|
|
auto& poly = queuepoly(V, cgi.shWall3D[ofs + a], darkena(wcol2 - d * get_darkval(c, a), 0, 0xFF));
|
|
|
|
#if CAP_TEXTURE
|
|
|
|
if(texture::config.tstate == texture::tsActive && isize(texture::config.tinf3.tvertices)) {
|
|
|
|
poly.tinf = &texture::config.tinf3;
|
|
|
|
poly.offset_texture = 0;
|
|
|
|
}
|
2020-04-06 09:24:57 +00:00
|
|
|
else
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
2020-04-06 09:24:57 +00:00
|
|
|
if(!floor_texture_vertices.empty() && neon_mode == eNeon::none) {
|
2019-10-25 10:44:41 +00:00
|
|
|
poly.tinf = &floor_texture_vertices[qfi.fshape->id];
|
2020-01-18 15:03:32 +00:00
|
|
|
ensure_vertex_number(*poly.tinf, poly.cnt);
|
2019-10-25 10:44:41 +00:00
|
|
|
poly.offset_texture = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
queuepoly(V, cgi.shPlainWall3D[ofs + a], darkena(wcol2 - d * get_darkval(c, a), 0, 0xFF));
|
|
|
|
}
|
|
|
|
}
|
2024-03-24 19:02:31 +00:00
|
|
|
if(WDIM == 3 && c->wall == waRose) {
|
|
|
|
color_t col = winf[waRose].color;
|
|
|
|
color_t col2 = (col << 8) | 0xFF;
|
|
|
|
if(rosephase == 7) col2 = 0xFFFFFFFF;
|
|
|
|
addradar(V, winf[waRose].glyph, col, col2);
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
} }
|
|
|
|
else {
|
|
|
|
if(!no_wall_rendering) for(int a=0; a<c->type; a++) if(c->move(a)) {
|
|
|
|
color_t t = transcolor(c, c->move(a), wcol);
|
|
|
|
if(t) {
|
|
|
|
t = t - get_darkval(c, a) * ((t & 0xF0F0F000) >> 4);
|
|
|
|
queue_transparent_wall(V, cgi.shPlainWall3D[ofs + a], t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(among(c->wall, waBoat, waStrandedBoat)) draw_boat();
|
|
|
|
else if(isFire(c)) {
|
|
|
|
static int r = 0;
|
|
|
|
r += ticks - lastt;
|
|
|
|
int each = 5 + last_firelimit;
|
|
|
|
while(r >= each) {
|
|
|
|
drawParticleSpeed(c, wcol, 75 + rand() % 75);
|
|
|
|
r -= each;
|
|
|
|
}
|
|
|
|
firelimit++;
|
|
|
|
}
|
|
|
|
else if(c->wall == waMineOpen) {
|
|
|
|
if(pmodel == mdGeodesic && hdist0(tC0(V)) < 1e-3) {
|
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(mproduct && hdist0(tC0(V)) < 1e-3) {
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
int mines = countMinesAround(c);
|
2024-05-07 20:18:54 +00:00
|
|
|
draw_mine_numbers(mines, face_the_player(V), 0);
|
2019-10-25 10:44:41 +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)) ;
|
|
|
|
|
|
|
|
else if(c->wall == waBigBush || c->wall == waSolidBranch)
|
|
|
|
queuepolyat(face_the_player(V), cgi.shSolidBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
|
|
|
|
|
|
|
else if(c->wall == waSmallBush || c->wall == waWeakBranch)
|
|
|
|
queuepolyat(face_the_player(V), cgi.shWeakBranch, darkena(wcol, 0, 0xFF), PPR::REDWALL+3);
|
|
|
|
|
|
|
|
else
|
|
|
|
queuepoly(face_the_player(V), chasmgraph(c) ? cgi.shSawRing : cgi.shRing, darkena(wcol, 0, 0xFF));
|
|
|
|
}
|
|
|
|
|
2022-11-13 13:05:30 +00:00
|
|
|
after_walls:
|
2019-10-25 10:44:41 +00:00
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd == 1)
|
|
|
|
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x804060, 0, 0xFF));
|
|
|
|
if(rd == 2)
|
|
|
|
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x402030, 0, 0xFF));
|
2020-01-29 17:18:51 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
2019-12-27 10:14:25 +00:00
|
|
|
#if HDR
|
|
|
|
struct downseek_t {
|
|
|
|
cell *best;
|
|
|
|
hyperpoint total;
|
|
|
|
hyperpoint point;
|
|
|
|
ld speed;
|
|
|
|
ld depth;
|
|
|
|
int qty;
|
|
|
|
void reset() {
|
|
|
|
qty = 0;
|
|
|
|
total = Hypc;
|
|
|
|
depth = 0;
|
|
|
|
best = nullptr;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
|
2019-12-27 10:14:25 +00:00
|
|
|
EX downseek_t downseek;
|
|
|
|
|
|
|
|
void celldrawer::check_rotations() {
|
|
|
|
|
|
|
|
auto& ds = downseek;
|
|
|
|
|
|
|
|
// we generally want function(ds.best) but this would fail if ds.best is not known yet,
|
|
|
|
// so we use function(old) which will return the same value as function(c) if ds.best is not known yet
|
|
|
|
cell *old = ds.best ? ds.best : c;
|
|
|
|
|
2020-01-02 18:03:57 +00:00
|
|
|
auto use_if_less = [this] (int a, int b, ld spd, int side) {
|
|
|
|
auto& ds = downseek;
|
2019-12-27 10:14:25 +00:00
|
|
|
if(a > b) return;
|
|
|
|
if(!ds.best || a < b) ds.reset();
|
|
|
|
if(a <= b) {
|
|
|
|
ds.best = c;
|
|
|
|
ds.speed = spd;
|
2022-12-08 18:38:06 +00:00
|
|
|
if(mproduct) {
|
2020-07-27 16:49:04 +00:00
|
|
|
auto pd = product_decompose(unshift(tC0(V)));
|
2019-12-27 10:14:25 +00:00
|
|
|
ds.total += pd.second;
|
|
|
|
ds.depth += pd.first;
|
|
|
|
}
|
|
|
|
else
|
2020-07-27 16:49:04 +00:00
|
|
|
ds.total += unshift(tC0(V));
|
2019-12-27 10:14:25 +00:00
|
|
|
ds.qty++;
|
2023-08-16 07:35:38 +00:00
|
|
|
ds.point = cgi.emb->normalize_flat(ds.total / ds.qty);
|
2022-12-08 18:38:06 +00:00
|
|
|
if(mproduct) ds.point = orthogonal_move(ds.point, ds.depth / ds.qty);
|
2019-12-27 10:14:25 +00:00
|
|
|
if(side == 2) for(int i=0; i<3; i++) ds.point[i] = -ds.point[i];
|
2022-11-12 21:38:45 +00:00
|
|
|
if(side == 1) ds.point = spin(-90._deg) * ds.point;
|
2019-12-27 10:14:25 +00:00
|
|
|
}
|
|
|
|
};
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(0);
|
|
|
|
|
|
|
|
#if CAP_BT
|
2019-12-14 11:05:01 +00:00
|
|
|
else if(bt::in() && models::do_rotate >= 2) {
|
2019-12-27 10:14:25 +00:00
|
|
|
use_if_less(c->master->distance, old->master->distance, 1, 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
else if(isGravityLand(cwt.at->land) && cwt.at->land != laMountain) {
|
2019-12-27 10:14:25 +00:00
|
|
|
int side = 0;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(cwt.at->land == laDungeon) side = 2;
|
|
|
|
if(cwt.at->land == laWestWall) side = 1;
|
2023-09-18 12:34:46 +00:00
|
|
|
if(cwt.at->land == laIvoryTower && ls::hv_structure()) side = 2;
|
2023-09-19 05:51:13 +00:00
|
|
|
if(cwt.at->land == laDungeon && ls::hv_structure()) side = 0;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(models::do_rotate >= 1)
|
2019-12-27 10:14:25 +00:00
|
|
|
use_if_less(edgeDepth(c), edgeDepth(old), cwt.at->landparam / 10., side);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(c->master->alt && cwt.at->master->alt &&
|
|
|
|
((cwt.at->land == laMountain && models::do_rotate >= 1)||
|
|
|
|
(models::do_rotate >= 2 &&
|
|
|
|
(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)))
|
|
|
|
))
|
|
|
|
&& c->land == cwt.at->land && c->master->alt->alt == cwt.at->master->alt->alt) {
|
2019-12-27 10:14:25 +00:00
|
|
|
use_if_less(celldistAlt(c), celldistAlt(old), .5, (cwt.at->land == laMountain) ? 2 : 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(models::do_rotate >= 2 && cwt.at->land == laOcean && cwt.at->landparam < 25) {
|
2019-12-27 10:14:25 +00:00
|
|
|
use_if_less(coastval(c, laOcean), coastval(old, laOcean), cwt.at->landparam / 10, 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-06 09:59:34 +00:00
|
|
|
EX int debug_tiles;
|
2022-04-28 06:23:33 +00:00
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::bookkeeping() {
|
|
|
|
bool orig = false;
|
|
|
|
if(!inmirrorcount) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix& gm = gmatrix[c];
|
2019-12-06 12:04:57 +00:00
|
|
|
orig = (gm[LDIM][LDIM] == 0) || hdist0(tC0(gm)) >= hdist0(tC0(V));
|
2019-10-25 10:44:41 +00:00
|
|
|
if(orig) gm = V;
|
2019-12-06 13:03:02 +00:00
|
|
|
current_display->all_drawn_copies[c].emplace_back(V);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
if(just_gmatrix) return;
|
|
|
|
|
|
|
|
set_detail_level(V);
|
|
|
|
|
|
|
|
// save the player's view center
|
|
|
|
if(isPlayerOn(c) && !shmup::on) {
|
|
|
|
playerfound = true;
|
|
|
|
|
|
|
|
if(multi::players > 1) {
|
2021-03-06 10:46:13 +00:00
|
|
|
for(int i: player_indices()) if(playerpos(i) == c) {
|
|
|
|
playerV = V * ddspin(c, multi::player[i].spin, 0);
|
|
|
|
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
|
|
|
if(orig)
|
|
|
|
multi::whereis[i] = playerV;
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
playerV = V * ddspin(c, cwt.spin, 0);
|
|
|
|
if(cwt.mirrored) playerV = playerV * Mirror;
|
2021-05-30 11:00:42 +00:00
|
|
|
transmatrix F = back_to_view(V);
|
|
|
|
if((!confusingGeometry() && !fake::split() && !inmirrorcount) || eqmatrix(F, current_display->which_copy, 1e-2))
|
|
|
|
current_display->which_copy = F;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(orig) cwtV = playerV;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ld dist = mousedist(V);
|
|
|
|
|
|
|
|
if(inmirrorcount) ;
|
|
|
|
else if(WDIM == 3) ;
|
|
|
|
else if(dist < modist) {
|
|
|
|
modist2 = modist; mouseover2 = mouseover;
|
|
|
|
modist = dist;
|
|
|
|
mouseover = c;
|
2023-12-22 00:14:41 +00:00
|
|
|
mouseoverV = V;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
else if(dist < modist2) {
|
|
|
|
modist2 = dist;
|
|
|
|
mouseover2 = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
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)) {
|
2020-07-27 16:49:04 +00:00
|
|
|
double dfc = hdist(tC0(V), tC0(multi::crosscenter[i]));
|
2019-10-25 10:44:41 +00:00
|
|
|
if(dfc < multi::ccdist[i] && celldistance(playerpos(i), c) <= orbrange) {
|
|
|
|
multi::ccdist[i] = dfc;
|
|
|
|
multi::ccat[i] = c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-30 16:37:37 +00:00
|
|
|
EX bool draw_plain_floors;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
/**
|
|
|
|
Display text statistics about the cell (distances in viewdists mode, pattern codes, etc.).
|
|
|
|
may also change the colors provided in
|
|
|
|
*/
|
|
|
|
|
|
|
|
void celldrawer::draw_cellstat() {
|
|
|
|
if(viewdists) do_viewdist();
|
|
|
|
|
|
|
|
for(int i=0; i<isize(buggycells); i++)
|
|
|
|
if(c == buggycells[i]) {
|
|
|
|
queuepoly(V, cgi.shPirateX, 0xC000C080);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0; i<isize(buggycells); i++) {
|
|
|
|
cell *c1 = buggycells[i];
|
|
|
|
cell *cf = cwt.at;
|
|
|
|
|
|
|
|
while(cf != c1) {
|
|
|
|
cf = pathTowards(cf, c1);
|
|
|
|
if(cf == c) {
|
|
|
|
queuepoly(V, cgi.shMineMark[1], 0xC000C0D0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(c->land == laMirrored || c->land == laMirrorWall2 || c->land == laMirrored2) {
|
|
|
|
string label = its(c->landparam);
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V, mapfontscale / 500, label, 0xFFFFFFFF, 1);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
2022-04-28 06:23:33 +00:00
|
|
|
|
2022-10-06 09:59:34 +00:00
|
|
|
if(debug_tiles && mod_allowed()) {
|
|
|
|
string label;
|
|
|
|
if(arb::in() && debug_tiles == 2) {
|
|
|
|
int id = shvid(c);
|
|
|
|
auto& sh = arb::current.shapes[id];
|
|
|
|
int oid = sh.orig_id;
|
|
|
|
label = its(oid);
|
2022-10-06 11:35:56 +00:00
|
|
|
if(c->master->emeraldval || sh.is_mirrored) label += 'R';
|
2022-10-06 09:59:34 +00:00
|
|
|
if(arb::current.was_split_for_football) label += "F" + its(sh.football_type);
|
|
|
|
}
|
2022-10-16 08:31:17 +00:00
|
|
|
#if CAP_ARCM
|
2022-10-06 09:59:34 +00:00
|
|
|
else if(arcm::in() && debug_tiles == 2) {
|
|
|
|
int id = arcm::id_of(c->master);
|
|
|
|
int tid = arcm::current.tilegroup[id];
|
|
|
|
int tid2 = arcm::current.tilegroup[id^1];
|
|
|
|
bool mirrored = (id&1) && (tid != tid2);
|
|
|
|
if(tid2 >= 0) tid = min(tid, tid2);
|
|
|
|
label = its(tid);
|
2022-10-06 11:35:56 +00:00
|
|
|
if(mirrored) label += "R";
|
2022-10-06 09:59:34 +00:00
|
|
|
}
|
2022-10-16 08:31:17 +00:00
|
|
|
#endif
|
2022-10-06 09:59:34 +00:00
|
|
|
else
|
|
|
|
label = its(shvid(c));
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V, mapfontscale / 200, label, 0xFFFFFFFF, 1);
|
2022-04-28 06:23:33 +00:00
|
|
|
for(int i=0; i<c->type; i++) {
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V * rgpushxto0(currentmap->get_corner(c, i, 4)), mapfontscale / 500, its(i), 0xFFFFFFFF, 1);
|
|
|
|
queuestr(V * rgpushxto0(mid(currentmap->get_corner(c, i, 4), currentmap->get_corner(c, i+1, 5))), mapfontscale / 500, its(i), 0xFFFFFFFF, 1);
|
2022-04-28 06:23:33 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-14 15:36:31 +00:00
|
|
|
|
2024-03-21 17:44:28 +00:00
|
|
|
if(debug_voronoi && ls::hv_structure() && mod_allowed()) {
|
2023-09-14 15:36:31 +00:00
|
|
|
auto p = get_voronoi_winner(c);
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V, mapfontscale / 500, its(p.second), index_pointer_int(p.first) * 0x7F3015, 1);
|
2023-09-14 15:36:31 +00:00
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(cmode & sm::TORUSCONFIG) {
|
2019-12-08 09:59:09 +00:00
|
|
|
auto p = euc::coord_display(V, c);
|
2019-11-27 00:01:20 +00:00
|
|
|
if(p.second != "")
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V, (p.first ? .2 : .6) * mapfontscale / 100, p.second, p.first ? 0xFFFFFFD0 : 0xFFFF0040, 1);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if CAP_EDIT
|
|
|
|
if(patterns::displaycodes) {
|
|
|
|
|
|
|
|
auto si = patterns::getpatterninfo0(c);
|
|
|
|
|
2020-01-18 15:03:32 +00:00
|
|
|
for(int i= gmod(si.dir, si.symmetries); i<c->type; i += si.symmetries) {
|
2019-10-25 10:44:41 +00:00
|
|
|
queuepoly(V * ddspin(c, i) * (si.reflect?Mirror:Id), cgi.shAsymmetric, darkena(0x000000, 0, 0xC0));
|
|
|
|
si.dir += si.symmetries;
|
|
|
|
}
|
|
|
|
|
|
|
|
string label = its(si.id & 255);
|
|
|
|
color_t col = forecolor ^ colorhash(si.id >> 8);
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V, mapfontscale / 200, label, 0xFF000000 + col);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
2020-07-07 19:25:27 +00:00
|
|
|
|
|
|
|
if(debug_cellnames && pointer_indices.count(c)) {
|
|
|
|
shstream ss; print(ss, c);
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestr(V, mapfontscale / 200, ss.s, 0xFFFFFFFF);
|
2020-07-07 19:25:27 +00:00
|
|
|
queuepoly(V * ddspin(c, 0), cgi.shAsymmetric, darkena(0x000000, 0, 0xC0));
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
2023-05-30 16:37:37 +00:00
|
|
|
EX int default_flooralpha = 255;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::draw_wall_full() {
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix Vf0;
|
2022-12-06 00:04:26 +00:00
|
|
|
const shiftmatrix& Vf = (chasmg && wmspatial) ? (Vf0=orthogonal_move_fol(V, cgi.BOTTOM)) : V;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
#if CAP_SHAPES
|
2023-05-30 16:37:37 +00:00
|
|
|
int flooralpha = default_flooralpha;
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_EDIT && CAP_TEXTURE
|
|
|
|
if((cmode & sm::DRAW) && mapeditor::drawcell && mapeditor::drawcellShapeGroup() == mapeditor::sgFloor && texture::config.tstate != texture::tsActive)
|
|
|
|
flooralpha = 0xC0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
#endif
|
|
|
|
if(!wmascii) {
|
|
|
|
|
|
|
|
#if CAP_EDIT
|
|
|
|
auto si = patterns::getpatterninfo0(c);
|
|
|
|
if(drawing_usershape_on(c, mapeditor::sgFloor))
|
|
|
|
mapeditor::drawtrans = V * applyPatterndir(c, si);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
// floor
|
2021-04-11 20:15:40 +00:00
|
|
|
if(GDIM == 2 && (c->land != laRose || ls::any_chaos())) {
|
2019-10-25 10:44:41 +00:00
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd == 1)
|
2022-12-06 00:04:26 +00:00
|
|
|
draw_floorshape(c, at_smart_lof(V, cgi.SLEV[2]), cgi.shRoseFloor, 0x80406040, PPR::LIZEYE);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(rd == 2)
|
2022-12-06 00:04:26 +00:00
|
|
|
draw_floorshape(c, at_smart_lof(V, cgi.SLEV[2]), cgi.shRoseFloor, 0x80406080, PPR::LIZEYE);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(c->wall == waChasm) {
|
|
|
|
aura_color = 0;
|
|
|
|
int rd = rosedist(c);
|
|
|
|
if(GDIM == 2) {
|
|
|
|
if(rd == 1)
|
|
|
|
draw_floorshape(c, V, cgi.shRoseFloor, 0x80406020);
|
|
|
|
if(rd == 2)
|
|
|
|
draw_floorshape(c, V, cgi.shRoseFloor, 0x80406040);
|
|
|
|
}
|
|
|
|
if(c->land == laZebra) fd++;
|
|
|
|
if(c->land == laHalloween && !wmblack) {
|
2022-12-06 00:04:26 +00:00
|
|
|
shiftmatrix Vdepth = wmspatial ? orthogonal_move_fol(V, cgi.BOTTOM) : V;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(GDIM == 3)
|
|
|
|
draw_shapevec(c, V, cgi.shFullFloor.levels[SIDE_LAKE], darkena(firecolor(0, 10), 0, 0xDF), PPR::TRANSPARENT_LAKE);
|
|
|
|
else
|
|
|
|
draw_floorshape(c, Vdepth, cgi.shFullFloor, darkena(firecolor(0, 10), 0, 0xDF), PPR::LAKEBOTTOM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if CAP_EDIT
|
|
|
|
else if(mapeditor::haveUserShape(mapeditor::sgFloor, si.id)) {
|
|
|
|
qfi.usershape = si.id;
|
|
|
|
qfi.spin = applyPatterndir(c, si);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
else if(patterns::whichShape == '7')
|
|
|
|
set_floor(cgi.shBigHepta);
|
|
|
|
|
|
|
|
else if(patterns::whichShape == '8')
|
|
|
|
set_floor(cgi.shTriheptaFloor);
|
|
|
|
|
|
|
|
else if(patterns::whichShape == '6')
|
|
|
|
set_floor(cgi.shBigTriangle);
|
|
|
|
|
|
|
|
else if(among(patterns::whichShape, '9', '^'))
|
|
|
|
set_floor(cgi.shFullFloor);
|
|
|
|
|
2023-02-18 17:43:30 +00:00
|
|
|
else if(patterns::whichShape == '5')
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
|
|
|
|
else if(patterns::whichShape == '4')
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
|
|
|
|
else if(patterns::whichShape == '3')
|
|
|
|
set_floor(cgi.shMFloor2);
|
|
|
|
|
|
|
|
else if(patterns::whichShape == '2')
|
|
|
|
set_floor(cgi.shMFloor3);
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_TEXTURE
|
|
|
|
else if(GDIM == 2 && texture::config.apply(c, Vf, darkena(fcol, fd, 0xFF))) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
else if(c->land == laMirrorWall)
|
|
|
|
draw_mirrorwall();
|
|
|
|
|
|
|
|
else if(c->land == laWineyard && cellHalfvine(c))
|
|
|
|
draw_halfvine();
|
|
|
|
|
|
|
|
else if(c->land == laReptile || c->wall == waReptile)
|
|
|
|
set_reptile_floor(Vf, fcol);
|
|
|
|
|
|
|
|
else if(wmblack == 1 && c->wall == waMineOpen && vid.grid)
|
|
|
|
;
|
|
|
|
|
|
|
|
else if(wmblack) {
|
|
|
|
set_floor(cgi.shBFloor[ct6]);
|
|
|
|
int rd = rosedist(c);
|
|
|
|
if(WDIM == 2 && rd == 1)
|
|
|
|
queuepoly(Vf, cgi.shHeptaMarker, darkena(fcol, 0, 0x80));
|
|
|
|
else if(WDIM == 2 && rd == 2)
|
|
|
|
queuepoly(Vf, cgi.shHeptaMarker, darkena(fcol, 0, 0x40));
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(isWarped(c) || is_nice_dual(c))
|
|
|
|
set_maywarp_floor();
|
|
|
|
|
|
|
|
else if(wmplain) {
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(set_randompattern_floor()) ;
|
|
|
|
|
|
|
|
else set_land_floor(Vf);
|
|
|
|
|
2023-12-17 16:46:46 +00:00
|
|
|
if(embedded_plane && qfi.fshape == &cgi.shFloor) set_floor(cgi.shFullFloor);
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
// actually draw the floor
|
|
|
|
|
|
|
|
if(chasmg == 2) ;
|
|
|
|
else if(chasmg && wmspatial && detaillevel == 0) {
|
|
|
|
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, Vd, darkena(fcol, fd, 0x80), PPR::LAKELEV);
|
|
|
|
}
|
|
|
|
else if(chasmg && wmspatial) {
|
|
|
|
|
|
|
|
color_t col = c->land == laCocytus ? 0x080808FF : 0x101010FF;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2020-02-26 00:15:30 +00:00
|
|
|
int sid = SIDE_LTOB;
|
|
|
|
if(c->wall == waShallow) sid = SIDE_ASHA;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
2020-02-26 00:15:30 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[sid], col, PPR::LAKEBOTTOM);
|
2019-10-25 10:44:41 +00:00
|
|
|
else
|
2022-12-06 00:04:26 +00:00
|
|
|
draw_qfi(c, orthogonal_move_fol(V, cgi.BOTTOM), col, PPR::LAKEBOTTOM);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
int fd0 = fd ? fd-1 : 0;
|
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd0, 0x80), PPR::TRANSPARENT_LAKE);
|
|
|
|
else
|
|
|
|
draw_qfi(c, Vd, darkena(fcol, fd0, 0x80), PPR::LAKELEV);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(patterns::whichShape == '^') poly_outline = darkena(fcol, fd, flooralpha);
|
2023-05-30 16:37:37 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && qfi.fshape && !draw_plain_floors)
|
2019-10-25 10:44:41 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[0], darkena(fcol, fd, 255), PPR::FLOOR);
|
2023-05-30 16:37:37 +00:00
|
|
|
else {
|
|
|
|
draw_qfi(c, V, darkena3(fcol, fd, flooralpha));
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
// draw the ceiling
|
|
|
|
if(WDIM == 2 && GDIM == 3) {
|
2020-07-03 13:17:59 +00:00
|
|
|
#if CAP_GL
|
2019-10-25 10:44:41 +00:00
|
|
|
draw_ceiling();
|
2020-07-03 13:17:59 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
int rd = rosedist(c);
|
|
|
|
if(rd) {
|
|
|
|
dynamicval<qfloorinfo> qfi2(qfi, qfi);
|
|
|
|
qfi.fshape = &cgi.shRoseFloor;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// walls
|
|
|
|
if(realred(c->wall) && !wmspatial) {
|
|
|
|
int s = snakelevel(c);
|
|
|
|
if(s >= 1) draw_floorshape(c, V, cgi.shRedRockFloor[0], getSnakelevColor(0, 7));
|
|
|
|
if(s >= 2) draw_floorshape(c, V, cgi.shRedRockFloor[1], getSnakelevColor(1, 7));
|
|
|
|
if(s >= 3) draw_floorshape(c, V, cgi.shRedRockFloor[2], getSnakelevColor(2, 7));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(c->wall == waTower && !wmspatial) {
|
|
|
|
fcol = 0xE8E8E8;
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(WDIM == 2 && pseudohept(c) && (
|
|
|
|
c->land == laRedRock ||
|
|
|
|
vid.darkhepta ||
|
|
|
|
(c->land == laClearing && !BITRUNCATED))) {
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(GDIM == 3 && WDIM == 2)
|
2023-02-04 00:58:13 +00:00
|
|
|
queuepoly(Vd*lzpush(cgi.FLOOR), cgi.shHeptaMarker, wmblack ? 0x80808080 : 0x00000080);
|
2019-10-25 10:44:41 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
queuepoly(Vd, cgi.shHeptaMarker, wmblack ? 0x80808080 : 0x00000080);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(history::includeHistory && history::inmovehistory.count(c))
|
|
|
|
queuepoly(Vd, cgi.shHeptaMarker, 0x000000C0);
|
|
|
|
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(WDIM == 3)
|
|
|
|
draw_features_and_walls_3d();
|
|
|
|
#else
|
|
|
|
if(0) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
else draw_features();
|
|
|
|
#else
|
|
|
|
error = true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if(wmascii || (WDIM == 2 && GDIM == 3)) {
|
|
|
|
if(c->wall == waNone || isWatery(c)) asciicol = fcol;
|
|
|
|
if(c->wall == waBoat) asciicol = 0xC06000;
|
|
|
|
|
|
|
|
if(c->wall == waArrowTrap)
|
|
|
|
asciicol = trapcol[c->wparam & 3];
|
|
|
|
if(c->wall == waFireTrap)
|
|
|
|
asciicol = trapcol[c->wparam & 3];
|
|
|
|
if(c->wall == waTerraWarrior)
|
2021-08-04 00:15:53 +00:00
|
|
|
asciicol = terracol[c->wparam & 7];
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(c->wall == waMineOpen) {
|
|
|
|
int mines = countMinesAround(c);
|
|
|
|
if(asciichar == '.') {
|
|
|
|
if(mines == 0) asciichar = ' ';
|
2022-10-06 11:47:00 +00:00
|
|
|
else asciichar = '0' + mines, asciicol = minecolors[mines];
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
2020-01-30 16:45:05 +00:00
|
|
|
else if(asciichar == '@') {
|
2022-10-06 11:47:00 +00:00
|
|
|
asciicol = minecolors[mines];
|
2020-01-30 16:45:05 +00:00
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
2020-01-30 16:45:05 +00:00
|
|
|
if(wmascii && !((c->item && !itemHiddenFromSight(c)) || c->monst || c->cpdist == 0)) error = true;
|
|
|
|
asciiborder = bordcolor;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
int sha = shallow(c);
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
#define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V.T * currentmap->adj(c,i)) : 1), 1), fd, 0xFF)
|
2020-02-26 00:15:30 +00:00
|
|
|
if(wmspatial && c->wall == waShallow && WDIM == 2) {
|
|
|
|
color_t col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2) && c2->wall != waShallow)
|
|
|
|
if(placeSidewall(c, i, SIDE_BSHA, V, D(.6))) break;
|
2022-05-09 08:30:50 +00:00
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) {
|
|
|
|
dynamicval<qfloorinfo> qfib(qfi, qfi);
|
|
|
|
set_floor(cgi.shFullFloor);
|
|
|
|
placeSidewall(c, i, SIDE_LAKE, V, 0x202030FF);
|
|
|
|
// placeSidewall(c, i, SIDE_LTOB, V, 0x181820FF);
|
|
|
|
placeSidewall(c, i, SIDE_BTOI, V, 0x101010FF);
|
|
|
|
}
|
2020-02-26 00:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(wmspatial && sha && WDIM == 2) {
|
2019-10-25 10:44:41 +00:00
|
|
|
color_t col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
|
|
|
|
if(!chasmg) {
|
|
|
|
|
|
|
|
// #define D(v) darkena(col, fd, 0xFF)
|
|
|
|
|
|
|
|
if(sha & 1) {
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2))
|
|
|
|
if(placeSidewall(c, i, SIDE_LAKE, V, D(.8))) break;
|
|
|
|
}
|
|
|
|
if(sha & 2) {
|
2020-02-26 00:15:30 +00:00
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
if(chasmgraph(c2)) {
|
|
|
|
if(placeSidewall(c, i, c2->wall == waShallow ? SIDE_ASHA : SIDE_LTOB, V, D(.7))) break;
|
|
|
|
}
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
if(sha & 4) {
|
|
|
|
bool dbot = true;
|
|
|
|
forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) {
|
2022-12-13 11:37:29 +00:00
|
|
|
if(dbot) {
|
|
|
|
dbot = false;
|
|
|
|
if(GDIM == 2)
|
|
|
|
draw_qfi(c, orthogonal_move_fol(V, cgi.BOTTOM), 0x080808FF, PPR::LAKEBOTTOM);
|
2023-02-05 09:09:36 +00:00
|
|
|
else if(qfi.fshape)
|
2022-12-13 11:37:29 +00:00
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_BTOI], 0x0F0808FF, PPR::LAKEBOTTOM);
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
if(placeSidewall(c, i, SIDE_BTOI, V, D(.6))) break;
|
|
|
|
}
|
|
|
|
#undef D
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// wall between lake and chasm -- no Escher here
|
|
|
|
if(chasmg == 1) forCellIdEx(c2, i, c) if(chasmgraph(c2) == 2) {
|
|
|
|
dynamicval<qfloorinfo> qfib(qfi, qfi);
|
|
|
|
set_floor(cgi.shFullFloor);
|
|
|
|
placeSidewall(c, i, SIDE_LAKE, V, 0x202030FF);
|
|
|
|
placeSidewall(c, i, SIDE_LTOB, V, 0x181820FF);
|
|
|
|
placeSidewall(c, i, SIDE_BTOI, V, 0x101010FF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_item_full() {
|
|
|
|
eItem it = c->item;
|
|
|
|
|
|
|
|
bool hidden = itemHidden(c);
|
|
|
|
bool hiddens = itemHiddenFromSight(c);
|
|
|
|
|
|
|
|
if(history::includeHistory && history::infindhistory.count(c)) {
|
|
|
|
hidden = true;
|
|
|
|
hiddens = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(hiddens && !(cmode & sm::MAP))
|
|
|
|
it = itNone;
|
|
|
|
|
|
|
|
color_t icol = 0;
|
|
|
|
|
2021-07-04 21:17:21 +00:00
|
|
|
if(ls::single() && specialland == laMotion && items[itOrbInvis] && c->wall == waChasm) {
|
2021-03-21 10:30:42 +00:00
|
|
|
if(c->mondir < c->type) {
|
|
|
|
vid.linewidth *= 3;
|
|
|
|
queueline(V*C0, V*currentmap->adj(c, c->mondir) * C0, 0xFFD500FF, 4);
|
|
|
|
vid.linewidth /= 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(it) {
|
|
|
|
asciichar = iinf[it].glyph, asciicol = icol = iinf[it].color;
|
2020-01-30 16:45:05 +00:00
|
|
|
if(doHighlight()) asciiborder = kind_outline(it) >> 8;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(it == itCompass && isPlayerOn(c)) {
|
2024-03-24 10:14:05 +00:00
|
|
|
shiftpoint dummy;
|
|
|
|
mark_compass(c, dummy);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(it) {
|
2024-03-19 18:25:08 +00:00
|
|
|
if(c->wall != waBoat) {
|
2019-10-25 10:44:41 +00:00
|
|
|
double footphase = 0;
|
|
|
|
applyAnimation(c, Vboat, footphase, LAYER_BOAT);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cellHalfvine(c)) {
|
|
|
|
int i =-1;
|
|
|
|
for(int t=0;t<6; t++) if(c->move(t) && c->move(t)->wall == c->wall)
|
|
|
|
i = t;
|
|
|
|
|
|
|
|
Vboat = Vboat * ddspin(c, i) * xpush(-.13);
|
|
|
|
}
|
|
|
|
|
2021-04-15 13:26:32 +00:00
|
|
|
if(drawItemType(it, c, Vboat, icol, ticks, hidden)) onradar = false;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_monster_full() {
|
|
|
|
color_t moncol = 0xFF00FF;
|
|
|
|
|
|
|
|
if(c->monst) {
|
|
|
|
asciichar = minf[c->monst].glyph, moncol = minf[c->monst].color;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
|
|
|
if(c->monst == moSlime) {
|
2022-04-26 12:42:07 +00:00
|
|
|
moncol = winf[conditional_flip_slime(det(V.T) < 0, c->wall)].color;
|
2019-10-25 10:44:41 +00:00
|
|
|
moncol |= (moncol>>1);
|
|
|
|
}
|
|
|
|
|
|
|
|
asciicol = moncol;
|
2020-01-30 16:45:05 +00:00
|
|
|
if(doHighlight() && !noHighlight(c->monst))
|
|
|
|
asciiborder = (isFriendly(c) ? OUTLINE_FRIEND : OUTLINE_ENEMY) >> 8;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(isDragon(c->monst) || isKraken(c->monst)) if(!c->hitpoints)
|
|
|
|
asciicol = 0x505050;
|
|
|
|
|
|
|
|
if(c->monst == moTortoise)
|
|
|
|
asciicol = tortoise::getMatchColor(tortoise::getb(c));
|
|
|
|
|
|
|
|
if(c->monst != moMutant) for(int k=0; k<c->stuntime; k++)
|
|
|
|
asciicol = ((asciicol & 0xFEFEFE) >> 1) + 0x101010;
|
|
|
|
}
|
|
|
|
|
2020-08-01 11:57:51 +00:00
|
|
|
if(c->cpdist == 0 && mapeditor::drawplayer && !shmup::on) {
|
2019-10-25 10:44:41 +00:00
|
|
|
asciichar = '@';
|
|
|
|
if(!mmitem) asciicol = moncol = cheater ? 0xFF3030 : 0xD0D0D0;
|
2020-01-30 16:45:05 +00:00
|
|
|
if(doHighlight())
|
|
|
|
asciiborder = OUTLINE_FRIEND >> 8;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
2019-10-26 12:34:22 +00:00
|
|
|
int q = isize(ptds);
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
2021-04-15 13:26:32 +00:00
|
|
|
bool dm = drawMonster(V, c->type, c, moncol, asciicol);
|
|
|
|
if(dm) onradar = false;
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_SHAPES
|
2024-03-19 18:36:28 +00:00
|
|
|
if(isize(ptds) != q && !(c == lmouseover_distant && isDie(c->monst))) {
|
2019-10-26 12:34:22 +00:00
|
|
|
if(WDIM == 2 && GDIM == 3 && abs(cgi.SLEV[sl] - cgi.FLOOR) > 1e-6)
|
2019-10-25 10:44:41 +00:00
|
|
|
pushdown(c, q, V, cgi.SLEV[sl] - cgi.FLOOR, false, false);
|
2020-07-27 16:49:04 +00:00
|
|
|
if(GDIM ==2 && abs(geom3::factor_to_lev(zlevel(tC0(Vboat.T)))) > 1e-6)
|
|
|
|
pushdown(c, q, V, -geom3::factor_to_lev(zlevel(tC0(Vboat.T))), !isMultitile(c->monst), false);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::add_map_effects() {
|
|
|
|
|
|
|
|
if(chasmg) draw_fallanims();
|
|
|
|
|
|
|
|
if(!shmup::on && sword::at(c)) {
|
|
|
|
queuepolyat(V, cgi.shDisk, 0xC0404040, PPR::SWORDMARK);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(c->land == laNone && (cmode & sm::MAP)) {
|
|
|
|
queuepoly(V, cgi.shTriangle, 0xFF0000FF);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Air Elemental */
|
|
|
|
if(1) {
|
|
|
|
int ad = airdist(c);
|
|
|
|
if(ad == 1 || ad == 2) {
|
|
|
|
for(int i=0; i<c->type; i++) {
|
|
|
|
cell *c2 = c->move(i);
|
|
|
|
if(airdist(c2) < airdist(c)) {
|
|
|
|
ld airdir = calcAirdir(c2); // printf("airdir = %d\n", airdir);
|
2022-11-12 21:38:45 +00:00
|
|
|
transmatrix V0 = ddspin180(c, i);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
double ph = ptick(PURE?150:75) + airdir;
|
|
|
|
|
|
|
|
int aircol = 0x8080FF00 | int(32 + 32 * -cos(ph));
|
|
|
|
|
|
|
|
double ph0 = ph/2;
|
|
|
|
ph0 -= floor(ph0/M_PI)*M_PI;
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_TRANS;
|
|
|
|
queuepoly(Vd*V0*xpush(cgi.hexf*-cos(ph0)), cgi.shDisk, aircol);
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-28 06:33:18 +00:00
|
|
|
draw_bowpath();
|
2023-10-26 10:26:24 +00:00
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(c->land == laBlizzard) {
|
|
|
|
if(vid.backeffects) {
|
|
|
|
if(c->cpdist <= getDistLimit())
|
|
|
|
set_blizzard_frame(c, frameid);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
forCellIdEx(c2, i, c) if(againstWind(c, c2))
|
|
|
|
queuepoly(V * ddspin(c, i) * xpush(cellgfxdist(c, i)/2), cgi.shWindArrow, 0x8080FF80);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(c->ligon) {
|
|
|
|
int tim = ticks - lightat;
|
|
|
|
if(tim > 1000) tim = 800;
|
|
|
|
if(elec::havecharge && tim > 400) tim = 400;
|
2019-12-26 18:04:32 +00:00
|
|
|
for(int t=0; t<c->type; t++) if(c->move(t)) {
|
|
|
|
if(c->move(t)->ligon) {
|
|
|
|
int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF);
|
2022-11-12 21:38:45 +00:00
|
|
|
queueline(V*chei(xspinpush((vid.flasheffects ? ticks : ptick(8)) * cgi.S_step, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
2019-12-26 18:04:32 +00:00
|
|
|
}
|
|
|
|
for(int u: {-1, 1}) {
|
|
|
|
cellwalker cw = cellwalker(c, t) + wstep + u;
|
2020-07-12 22:54:25 +00:00
|
|
|
if(u == -1 && valence() == 4) continue;
|
2019-12-26 18:04:32 +00:00
|
|
|
cell *c2 = cw.peek();
|
|
|
|
if(c2 && c2->ligon) {
|
|
|
|
int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF);
|
2022-11-12 21:38:45 +00:00
|
|
|
queueline(V*chei(xspinpush((vid.flasheffects ? ticks : ptick(8)) * cgi.S_step, cgi.hexf/2), rand() % 1000, 1000) * C0, V*chei(currentmap->adj(c, t)*currentmap->adj(cw.at, cw.spin), rand() % 1000, 1000) * C0, lcol, 2 + vid.linequality);
|
2019-12-26 18:04:32 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(c->land == laWhirlwind) {
|
|
|
|
whirlwind::calcdirs(c);
|
|
|
|
|
|
|
|
for(int i=0; i<whirlwind::qdirs; i++) {
|
2019-11-14 15:51:50 +00:00
|
|
|
ld hdir0 = currentmap->spin_angle(c, whirlwind::dfrom[i]) + M_PI;
|
|
|
|
ld hdir1 = currentmap->spin_angle(c, whirlwind::dto[i]);
|
|
|
|
/* todo what if no spin_angle */
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
double ph1 = fractick(PURE ? 150 : 75);
|
|
|
|
|
|
|
|
int aircol = 0xC0C0FF40;
|
|
|
|
|
2022-11-12 21:38:45 +00:00
|
|
|
cyclefix(hdir1, hdir0);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
ld hdir = (hdir1*ph1+hdir0*(1-ph1));
|
|
|
|
|
|
|
|
transmatrix V0 = spin(hdir);
|
|
|
|
|
|
|
|
double ldist =
|
|
|
|
cellgfxdist(c, whirlwind::dfrom[i]) * (1-ph1)/2 +
|
|
|
|
cellgfxdist(c, whirlwind::dto[i]) * ph1/2;
|
|
|
|
// PURE ? cgi.crossf : c->type == 6 ? .2840 : 0.3399;
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_TRANS;
|
|
|
|
queuepoly(Vd*V0*xpush(ldist*(2*ph1-1)), cgi.shDisk, aircol);
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(items[itOrbGravity] && c->cpdist <= 5)
|
|
|
|
draw_gravity_particles();
|
|
|
|
}
|
|
|
|
|
2023-10-28 06:33:18 +00:00
|
|
|
void celldrawer::draw_bowpath() {
|
|
|
|
auto v = at_or_null(bow::bowpath_map, c);
|
|
|
|
if(!v) return;
|
|
|
|
for(auto& m: *v) {
|
|
|
|
|
|
|
|
hyperpoint h0 = C0, t0 = Hypc, h1 = C0, t1 = Hypc;
|
2023-10-28 07:12:08 +00:00
|
|
|
bool birth = m.flags & bow::bpFIRST;
|
2023-10-28 06:33:18 +00:00
|
|
|
|
|
|
|
if(!birth) {
|
|
|
|
ld d = cellgfxdist(c, m.prev.spin) / 2;
|
|
|
|
h0 = ddspin(c, m.prev.spin) * xpush0(d);
|
|
|
|
t0 = ddspin(c, m.prev.spin) * xpush(d) * xtangent(-d*2);
|
|
|
|
}
|
|
|
|
else birth = true;
|
|
|
|
|
2023-10-28 07:12:08 +00:00
|
|
|
if(!(m.flags & bow::bpLAST)) {
|
2023-10-28 06:33:18 +00:00
|
|
|
ld d = cellgfxdist(c, m.next.spin) / 2;
|
|
|
|
h1 = ddspin(c, m.next.spin) * xpush0(d);
|
|
|
|
t1 = ddspin(c, m.next.spin) * xpush(d) * xtangent(-d*2);
|
|
|
|
}
|
|
|
|
|
|
|
|
ld t = frac(ptick(PURE?500:250));
|
|
|
|
|
|
|
|
color_t arrow_color = getcs().swordcolor;
|
2023-10-28 07:12:08 +00:00
|
|
|
|
|
|
|
if(m.flags & bow::bpCOPIED) {
|
|
|
|
arrow_color &= 0xFF;
|
|
|
|
arrow_color |= mirrorcolor(m.next.mirrored != cwt.mirrored ? 1 : 0) << 8;
|
|
|
|
}
|
|
|
|
|
2023-10-28 06:33:18 +00:00
|
|
|
color_t arrow_color_trans = arrow_color & 0xFFFFFF00;
|
|
|
|
if(bow::fire_mode) arrow_color = gradient(arrow_color_trans, arrow_color, 0, 0.25, 1);
|
|
|
|
|
2023-10-29 08:57:19 +00:00
|
|
|
auto V1 = shmup::at_missile_level(V);
|
|
|
|
|
2023-10-28 06:33:18 +00:00
|
|
|
if(birth) {
|
|
|
|
if(t > 0.8) {
|
|
|
|
hyperpoint h = h1 + t1 * (1-t);
|
|
|
|
hyperpoint tg = -t1;
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_TRANS;
|
2023-10-29 08:57:19 +00:00
|
|
|
queuepoly(V1 * rgpushxto0(h) * rspintox(gpushxto0(h) * tg), cgi.shTrapArrow, gradient(arrow_color_trans, arrow_color, 0.8, t, 1));
|
2023-10-28 06:33:18 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
hyperpoint h = h0 * (1-t) * (1-t) * (1 + 2 * t) + t0 * (1-t) * (1-t) * t + h1 * t * t * (3 - 2 * t) + t1 * t * t * (1-t);
|
|
|
|
h = normalize(h);
|
|
|
|
|
|
|
|
hyperpoint tg = (h1 - h0) * 6 * t * (1-t) + (3 * t*t - 4*t + 1) * t0 + (2*t-3*t*t) * t1;
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_TRANS;
|
2023-10-29 08:57:19 +00:00
|
|
|
queuepoly(V1 * rgpushxto0(h) * rspintox(gpushxto0(h) * tg), cgi.shTrapArrow, arrow_color);
|
2023-10-28 06:33:18 +00:00
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::draw_gravity_particles() {
|
2021-07-12 02:47:56 +00:00
|
|
|
unsigned int u = (unsigned int)(size_t)(c);
|
2019-10-25 10:44:41 +00:00
|
|
|
u = ((u * 137) + (u % 1000) * 51) % 1000;
|
2021-07-12 02:47:56 +00:00
|
|
|
int tt = ticks + u;
|
2019-10-25 10:44:41 +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;
|
|
|
|
|
|
|
|
auto levf = [] (ld l) {
|
|
|
|
return GDIM == 3 ? cheilevel(l) : 1 + (1-l) * 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
if(spatial_graphics || (WDIM == 2 && GDIM == 3)) {
|
|
|
|
|
|
|
|
switch(gravity_state) {
|
|
|
|
case gsNormal:
|
|
|
|
for(int i=0; i<6; i++) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T = V * spin(i*degree*60) * xpush(cgi.crossf/3);
|
2022-12-06 00:04:26 +00:00
|
|
|
queueline(at_smart_lof(T, levf(r0)) * C0, at_smart_lof(T, levf(r1)) * C0, grav_normal_color);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsAnti:
|
|
|
|
for(int i=0; i<6; i++) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T = V * spin(i*degree*60) * xpush(cgi.crossf/3);
|
2022-12-06 00:04:26 +00:00
|
|
|
queueline(at_smart_lof(T, levf(r0)) * C0, at_smart_lof(T, levf(r1)) * C0, antigrav_color);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsLevitation:
|
|
|
|
for(int i=0; i<6; i++) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T0 = V * spin(i*degree*60 + tt/60. * degree) * xpush(cgi.crossf/3);
|
|
|
|
shiftmatrix T1 = V * spin(i*degree*60 + (tt/60. + 30) * degree) * xpush(cgi.crossf/3);
|
2019-10-25 10:44:41 +00:00
|
|
|
ld lv = levf(GDIM == 3 ? (i+0.5)/6 : 0.5);
|
2022-12-06 00:04:26 +00:00
|
|
|
queueline(at_smart_lof(T0, lv) * C0, at_smart_lof(T1, lv) * C0, levitate_color);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
switch(gravity_state) {
|
|
|
|
case gsNormal:
|
|
|
|
for(int i=0; i<6; i++) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T0 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * (1-r0));
|
|
|
|
shiftmatrix T1 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * (1-r1));
|
2019-10-25 10:44:41 +00:00
|
|
|
queueline(T0 * C0, T1 * C0, grav_normal_color);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsAnti:
|
|
|
|
for(int i=0; i<6; i++) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T0 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * r0);
|
|
|
|
shiftmatrix T1 = V * spin(i*degree*60) * xpush(cgi.crossf/3 * r1);
|
2019-10-25 10:44:41 +00:00
|
|
|
queueline(T0 * C0, T1 * C0, antigrav_color);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsLevitation:
|
|
|
|
for(int i=0; i<6; i++) {
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T0 = V * spin(i*degree*60 + tt/60. * degree) * xpush(cgi.crossf/3);
|
|
|
|
shiftmatrix T1 = V * spin(i*degree*60 + (tt/60. + 30) * degree) * xpush(cgi.crossf/3);
|
2019-10-25 10:44:41 +00:00
|
|
|
queueline(T0 * C0, T1 * C0, levitate_color);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-16 17:48:25 +00:00
|
|
|
EX shiftmatrix ocwtV;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
void celldrawer::draw() {
|
2019-11-25 19:05:52 +00:00
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
cells_drawn++;
|
|
|
|
|
2024-04-22 22:07:35 +00:00
|
|
|
checkTide(c);
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_TEXTURE
|
|
|
|
if(texture::saving) {
|
|
|
|
texture::config.apply(c, V, 0xFFFFFFFF);
|
|
|
|
draw_qfi(c, V, 0xFFFFFFFF);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-02-01 10:45:52 +00:00
|
|
|
if((cmode & sm::DRAW) && mapeditor::intexture && !mouseout() && c)
|
2019-10-25 10:44:41 +00:00
|
|
|
mapeditor::draw_texture_ghosts(c, V);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bookkeeping();
|
|
|
|
if(just_gmatrix) return;
|
|
|
|
|
|
|
|
#if MAXMDIM >= 4
|
|
|
|
if(cell_clipped()) return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ivoryz = isGravityLand(c->land);
|
|
|
|
|
|
|
|
// if(behindsphere(V)) return;
|
|
|
|
|
|
|
|
if(callhandlers(false, hooks_drawcell, c, V)) return;
|
|
|
|
|
2024-01-07 08:33:29 +00:00
|
|
|
if(history::on || inHighQual || WDIM == 3 || shmup::on || sightrange_bonus > gamerange_bonus || !playermoved) checkTide(c);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
if(1) {
|
|
|
|
|
|
|
|
if(inmirror(c)) {
|
|
|
|
if(inmirrorcount >= 10) return;
|
2019-11-25 19:05:52 +00:00
|
|
|
cellwalker cw(c);
|
|
|
|
cellwalker cw2 = mirror::reflect(cw);
|
2019-10-25 10:44:41 +00:00
|
|
|
int cmc = (cw2.mirrored == cw.mirrored) ? 2 : 1;
|
2020-09-16 17:48:25 +00:00
|
|
|
if(inmirrorcount == 0) ocwtV = cwtV;
|
2019-10-25 10:44:41 +00:00
|
|
|
inmirrorcount += cmc;
|
|
|
|
draw_grid();
|
|
|
|
if(cw2.mirrored != cw.mirrored) V = V * Mirror;
|
2022-11-12 21:38:45 +00:00
|
|
|
if(cw2.spin) V = V * spin(TAU*cw2.spin/cw2.at->type);
|
2019-10-25 10:44:41 +00:00
|
|
|
cw2.spin = 0;
|
2020-07-27 16:49:04 +00:00
|
|
|
dynamicval<shiftmatrix> dc(cwtV, cwtV);
|
2020-09-16 17:48:25 +00:00
|
|
|
cwtV = V * inverse_shift(ggmatrix(cw2.at), cwtV);
|
2019-11-25 19:05:52 +00:00
|
|
|
drawcell(cw2.at, V);
|
2019-10-25 10:44:41 +00:00
|
|
|
inmirrorcount -= cmc;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!buggyGeneration && c->mpdist > 8 && !cheater && !autocheat) return; // not yet generated
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
ct6 = ctof(c);
|
|
|
|
#endif
|
|
|
|
fd = getfd(c);
|
2020-03-27 18:38:15 +00:00
|
|
|
if(neon_mode == eNeon::illustration) fd = 0;
|
2019-10-25 10:44:41 +00:00
|
|
|
error = false;
|
|
|
|
|
|
|
|
setcolors();
|
|
|
|
|
|
|
|
tune_colors();
|
|
|
|
|
|
|
|
draw_cellstat();
|
|
|
|
|
|
|
|
asciichar = winf[c->wall].glyph;
|
|
|
|
asciicol = wcol;
|
2020-01-30 16:45:05 +00:00
|
|
|
|
2023-02-05 10:24:19 +00:00
|
|
|
if(c->wall == waNone || isWatery(c)) asciicol = fcol;
|
|
|
|
|
2020-01-30 16:45:05 +00:00
|
|
|
asciichar1 = asciichar;
|
|
|
|
asciicol1 = asciicol;
|
|
|
|
|
|
|
|
if(c->wall == waBoat) {
|
|
|
|
asciicol1 = fcol;
|
|
|
|
asciichar1 = '=';
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
onradar = true;
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
chasmg = chasmgraph(c);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if(c->wall == waMagma) fd = 0;
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
|
|
|
|
sl = snakelevel(c);
|
|
|
|
|
|
|
|
Vd =
|
|
|
|
WDIM == 3 ? V:
|
|
|
|
!wmspatial ? V :
|
2022-12-06 00:04:26 +00:00
|
|
|
sl ? orthogonal_move_fol(V, GDIM == 3 ? cgi.SLEV[sl] - cgi.FLOOR : cgi.SLEV[sl]) :
|
|
|
|
(highwall(c) && GDIM == 2) ? orthogonal_move_fol(V, (1+cgi.WALL)/2) :
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_SHAPES
|
2022-12-06 00:04:26 +00:00
|
|
|
(chasmg==1) ? orthogonal_move_fol(V, GDIM == 3 ? cgi.LAKE - cgi.FLOOR : cgi.LAKE) :
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
|
|
|
V;
|
|
|
|
|
|
|
|
Vboat = Vd;
|
|
|
|
|
|
|
|
draw_shmup_monster();
|
|
|
|
|
|
|
|
poly_outline = OUTLINE_DEFAULT;
|
|
|
|
|
|
|
|
draw_wall_full();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
draw_item_full();
|
|
|
|
draw_monster_full();
|
2021-06-06 08:35:55 +00:00
|
|
|
|
|
|
|
if(animations[LAYER_THROW].count(c)) {
|
|
|
|
shiftmatrix Vthrow = V;
|
|
|
|
ld footphase;
|
|
|
|
applyAnimation(c, Vthrow, footphase, LAYER_THROW);
|
|
|
|
eItem it = animations[LAYER_THROW][c].thrown_item;
|
|
|
|
drawItemType(it, c, Vthrow, iinf[it].color, 0, false);
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
#if CAP_TEXTURE
|
|
|
|
if(!texture::using_aura())
|
|
|
|
#endif
|
|
|
|
addaura();
|
|
|
|
|
|
|
|
#if CAP_SHAPES
|
|
|
|
add_map_effects();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_QUEUE
|
2021-04-15 13:26:32 +00:00
|
|
|
if(error && onradar) {
|
2020-01-30 16:45:05 +00:00
|
|
|
int sl;
|
|
|
|
string s = s0+asciichar;
|
|
|
|
dynamicval<color_t> p(poly_outline, asciiborder << 8);
|
|
|
|
if(!wmascii3)
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(V, mapfontscale / 100, s, darkenedby(asciicol, darken), 2);
|
2020-01-30 16:45:05 +00:00
|
|
|
else if(highwall(c) && conegraph(c)) {
|
|
|
|
const int layers = 1 << detaillevel;
|
|
|
|
string s1 = s0+asciichar1;
|
|
|
|
poly_outline = bordcolor << 8;
|
|
|
|
for(int z=0; z<layers; z++)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, zgrad0(0, geom3::actual_wall_height(), z, layers)), 1. - z * .5 / layers, s1, darkenedby(gradient(bordcolor, asciicol1, -layers, z, layers), darken), 1);
|
2020-01-30 16:45:05 +00:00
|
|
|
poly_outline = asciiborder << 8;
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, cgi.WALL), (asciicol == asciicol1 && asciichar == asciichar1 ? .5 : 1) * mapfontscale / 100, s, darkenedby(asciicol, darken), 2);
|
2020-01-30 16:45:05 +00:00
|
|
|
}
|
|
|
|
else if(highwall(c)) {
|
|
|
|
const int layers = 1 << detaillevel;
|
|
|
|
string s1 = s0+asciichar1;
|
|
|
|
poly_outline = bordcolor << 8;
|
|
|
|
for(int z=0; z<layers; z++)
|
2022-12-06 00:04:26 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, zgrad0(0, geom3::actual_wall_height(), z, layers)), 1, s1, darkenedby(gradient(bordcolor, asciicol1, -layers, z, layers), darken), 1);
|
2020-01-30 16:45:05 +00:00
|
|
|
poly_outline = asciiborder << 8;
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, cgi.WALL), mapfontscale / 100, s, darkenedby(asciicol, darken), 2);
|
2020-01-30 16:45:05 +00:00
|
|
|
}
|
|
|
|
else if((sl = snakelevel(c))) {
|
|
|
|
string s1 = s0+asciichar1;
|
|
|
|
poly_outline = bordcolor << 8;
|
|
|
|
for(int z=0; z<sl*4; z++) if(z%4 == 0)
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, zgrad0(0, cgi.slev * sl, z, sl*4)), mapfontscale / 100, s1, darkenedby(gradient(bordcolor, asciicol1, -sl, z, sl*4), darken), 1);
|
2020-01-30 16:45:05 +00:00
|
|
|
poly_outline = asciiborder << 8;
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, cgi.SLEV[sl]), mapfontscale / 100, s, darkenedby(asciicol, darken), 2);
|
2020-01-30 16:45:05 +00:00
|
|
|
}
|
|
|
|
// else if(c->wall == waChasm) {
|
|
|
|
// const int layers = 1 << detaillevel;
|
2022-12-06 00:04:26 +00:00
|
|
|
// queuestr(orthogonal_move_fol(V, BOTTOM), zgrad0(0, -vid.lake_bottom, z, layers)), 1, s, darkenedby(gradient(asciicol, 0, 0, z, layers+1), darken), z==0?2:1);
|
2020-01-30 16:45:05 +00:00
|
|
|
// }
|
|
|
|
else if(chasmgraph(c)) {
|
|
|
|
string s1 = s0+asciichar1;
|
|
|
|
poly_outline = bordcolor << 8;
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(orthogonal_move_fol(V, cgi.BOTTOM), mapfontscale / 100, s1, darkenedby(gradient(bordcolor, asciicol1, 0, 0.3, 1), darken), 2);
|
2020-01-30 16:45:05 +00:00
|
|
|
poly_outline = asciiborder << 8;
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(V, mapfontscale / 100, s, darkenedby(asciicol, darken), 2);
|
2020-01-30 16:45:05 +00:00
|
|
|
}
|
|
|
|
else
|
2024-03-21 17:44:19 +00:00
|
|
|
queuestrn(V, mapfontscale / 100, s, darkenedby(asciicol, darken), 2);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
draw_grid();
|
|
|
|
|
|
|
|
if(onradar && WDIM == 2 && GDIM == 3) addradar(V, asciichar, darkenedby(asciicol, darken), 0);
|
|
|
|
|
|
|
|
if(WDIM == 2 && GDIM == 3) radar_grid();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
check_rotations();
|
|
|
|
|
|
|
|
#if CAP_EDIT
|
|
|
|
if(!inHighQual) mapeditor::drawGhosts(c, V, c->type);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CAP_MODEL
|
2020-07-27 16:49:04 +00:00
|
|
|
netgen::buildVertexInfo(c, unshift(V));
|
2019-10-25 10:44:41 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::set_towerfloor(const cellfunction& cf) {
|
2019-12-27 10:30:09 +00:00
|
|
|
if(weirdhyperbolic || sphere || (euc::in() && S7 == 4 && BITRUNCATED)) {
|
2019-10-25 10:44:41 +00:00
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int j = -1;
|
|
|
|
|
2019-11-27 00:01:20 +00:00
|
|
|
if(euclid) j = 10;
|
2019-10-25 10:44:41 +00:00
|
|
|
else if(cf(c) > 1) {
|
|
|
|
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;
|
|
|
|
if(PURE) {
|
|
|
|
if(i == 7) j = 7;
|
|
|
|
if(i == 11) j = 8;
|
|
|
|
if(i == 15) j = 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(j >= 0)
|
|
|
|
set_floor(applyDowndir(c, cf), cgi.shTower[j]);
|
|
|
|
else if(c->wall != waLadder)
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::set_zebrafloor() {
|
|
|
|
|
2023-03-28 21:08:54 +00:00
|
|
|
if(hat::in() || kite::in()) { set_floor(cgi.shFloor); return; }
|
|
|
|
|
2019-11-27 00:01:20 +00:00
|
|
|
if(euclid) { set_floor(cgi.shTower[10]); return; }
|
2019-10-25 10:44:41 +00:00
|
|
|
if(weirdhyperbolic) {
|
|
|
|
set_floor(cgi.shFloor); return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123);
|
|
|
|
|
|
|
|
int j;
|
|
|
|
if(PURE) j = 4;
|
|
|
|
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;
|
|
|
|
else j = 0;
|
|
|
|
|
|
|
|
set_floor(applyPatterndir(c, si), cgi.shZebra[j]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::set_maywarp_floor() {
|
|
|
|
bool warp = isWarped(c);
|
|
|
|
if(warp && use_warp_graphics()) {
|
|
|
|
if(!stdhyperbolic) {
|
|
|
|
set_floor(cgi.shTriheptaFloor);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_TYPES, 0);
|
|
|
|
if(si.id == 0 || si.id == 1)
|
|
|
|
set_floor(cgi.shTriheptaFloor);
|
|
|
|
else if(si.id >= 14)
|
|
|
|
set_floor(cgi.shFloor);
|
|
|
|
else
|
|
|
|
set_floor(applyPatterndir(c, si), cgi.shTriheptaSpecial[si.id]);
|
|
|
|
}
|
|
|
|
else if(is_nice_dual(c)) set_floor(cgi.shBigTriangle);
|
|
|
|
else set_floor(cgi.shFloor);
|
|
|
|
}
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
void celldrawer::set_reptile_floor(const shiftmatrix& V, color_t col, bool nodetails) {
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
auto si =
|
2019-12-14 10:26:03 +00:00
|
|
|
euc::in(2,6) ?
|
2019-10-25 10:44:41 +00:00
|
|
|
patterns::getpatterninfo(c, patterns::PAT_COLORING, patterns::SPF_CHANGEROT)
|
|
|
|
:
|
|
|
|
patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123);
|
|
|
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
if(!wmescher) j = 4;
|
|
|
|
else if(!BITRUNCATED) j = 0;
|
|
|
|
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;
|
|
|
|
else j = 4;
|
|
|
|
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6)) j = 0;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
2019-11-27 00:01:20 +00:00
|
|
|
transmatrix D = applyPatterndir(c, si);
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && GOLDBERG) D = ddspin(c, si.dir);
|
|
|
|
if(wmescher && (stdhyperbolic || euc::in(2,6)))
|
2019-10-25 10:44:41 +00:00
|
|
|
set_floor(D, cgi.shReptile[j][0]);
|
|
|
|
else set_maywarp_floor();
|
|
|
|
|
|
|
|
if(nodetails) return;
|
|
|
|
|
|
|
|
int dcol = 0;
|
|
|
|
|
|
|
|
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;
|
|
|
|
if(ecol) ecol = gradient(0, ecol, -1, sintick(30), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ecol == -1 || ecol == 0) dcol = darkena(col, 1, 0xFF);
|
|
|
|
else dcol = darkena(ecol, 0, 0x80);
|
|
|
|
|
|
|
|
dynamicval<color_t> p(poly_outline,
|
|
|
|
doHighlight() && ecol != -1 && ecol != 0 ? OUTLINE_ENEMY : OUTLINE_DEFAULT);
|
|
|
|
|
|
|
|
if(!chasmg) {
|
|
|
|
if(wmescher)
|
|
|
|
queuepoly(V*D, cgi.shReptile[j][1], dcol);
|
|
|
|
else
|
|
|
|
draw_floorshape(c, V, cgi.shMFloor, dcol);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ecol != -1) {
|
|
|
|
queuepoly(V*D, cgi.shReptile[j][2], (ecol << 8) + 0xFF);
|
|
|
|
queuepoly(V*D, cgi.shReptile[j][3], (ecol << 8) + 0xFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::set_emeraldfloor() {
|
2019-11-27 00:01:20 +00:00
|
|
|
if(!euclid && BITRUNCATED && GDIM == 2) {
|
2019-10-25 10:44:41 +00:00
|
|
|
auto si = patterns::getpatterninfo(c, patterns::PAT_EMERALD, patterns::SPF_SYM0123);
|
|
|
|
|
|
|
|
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) {
|
|
|
|
set_floor(applyPatterndir(c, si), cgi.shEmeraldFloor[j]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set_floor(cgi.shCaveFloor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::shmup_gravity_floor() {
|
|
|
|
if(GDIM == 2 && cellEdgeUnstable(c))
|
|
|
|
set_floor(cgi.shMFloor);
|
|
|
|
else
|
|
|
|
set_floor(cgi.shFullFloor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_reptile(color_t col) {
|
|
|
|
auto qfib = qfi;
|
|
|
|
set_reptile_floor(V, col, chasmg == 2);
|
|
|
|
draw_qfi(c, V, col);
|
|
|
|
qfi = qfib;
|
|
|
|
}
|
|
|
|
|
2019-10-26 15:02:30 +00:00
|
|
|
#undef c
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|