mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 12:19:18 +00:00
drawcell parameter is now cell, not cellwalker (need to check half-elliptic)
This commit is contained in:
parent
3f76943453
commit
622b683e33
@ -5,7 +5,7 @@ namespace hr {
|
|||||||
int coastvalEdge(cell *c);
|
int coastvalEdge(cell *c);
|
||||||
|
|
||||||
struct celldrawer {
|
struct celldrawer {
|
||||||
cellwalker cw;
|
cell *c;
|
||||||
transmatrix V;
|
transmatrix V;
|
||||||
|
|
||||||
color_t fcol;
|
color_t fcol;
|
||||||
@ -64,16 +64,14 @@ struct celldrawer {
|
|||||||
void do_viewdist();
|
void do_viewdist();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void drawcell(const cellwalker& cw, const transmatrix& V) {
|
inline void drawcell(cell *c, const transmatrix& V) {
|
||||||
celldrawer dd;
|
celldrawer dd;
|
||||||
dd.cw = cw;
|
dd.c = c;
|
||||||
dd.V = V;
|
dd.V = V;
|
||||||
dd.draw();
|
dd.draw();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define c (cw.at)
|
|
||||||
|
|
||||||
static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030};
|
static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030};
|
||||||
static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080};
|
static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080};
|
||||||
|
|
||||||
@ -1706,7 +1704,7 @@ void celldrawer::bookkeeping() {
|
|||||||
if(playerpos(i) == c) {
|
if(playerpos(i) == c) {
|
||||||
playerV = V * ddspin(c, multi::player[i].spin, 0);
|
playerV = V * ddspin(c, multi::player[i].spin, 0);
|
||||||
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
||||||
if(multi::player[i].mirrored == cw.mirrored)
|
if(orig)
|
||||||
multi::whereis[i] = playerV;
|
multi::whereis[i] = playerV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2184,7 +2182,7 @@ void celldrawer::draw_monster_full() {
|
|||||||
#if CAP_SHAPES
|
#if CAP_SHAPES
|
||||||
int q = isize(ptds);
|
int q = isize(ptds);
|
||||||
#endif
|
#endif
|
||||||
bool m = drawMonster(V, c->type, c, moncol, cw.mirrored, asciicol);
|
bool m = drawMonster(V, c->type, c, moncol, asciicol);
|
||||||
if(m) error = true;
|
if(m) error = true;
|
||||||
if(m || c->monst) onradar = false;
|
if(m || c->monst) onradar = false;
|
||||||
#if CAP_SHAPES
|
#if CAP_SHAPES
|
||||||
@ -2362,7 +2360,8 @@ void celldrawer::draw_gravity_particles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void celldrawer::draw() {
|
void celldrawer::draw() {
|
||||||
if(hybrid::pmap) { product::drawcell_stack(cw, V); return; }
|
|
||||||
|
if(hybrid::pmap) { product::drawcell_stack(c, V); return; }
|
||||||
|
|
||||||
cells_drawn++;
|
cells_drawn++;
|
||||||
|
|
||||||
@ -2396,16 +2395,15 @@ void celldrawer::draw() {
|
|||||||
|
|
||||||
if(inmirror(c)) {
|
if(inmirror(c)) {
|
||||||
if(inmirrorcount >= 10) return;
|
if(inmirrorcount >= 10) return;
|
||||||
cellwalker cw2 = cw;
|
cellwalker cw(c);
|
||||||
cw2.spin = 0;
|
cellwalker cw2 = mirror::reflect(cw);
|
||||||
cw2 = mirror::reflect(cw);
|
|
||||||
int cmc = (cw2.mirrored == cw.mirrored) ? 2 : 1;
|
int cmc = (cw2.mirrored == cw.mirrored) ? 2 : 1;
|
||||||
inmirrorcount += cmc;
|
inmirrorcount += cmc;
|
||||||
draw_grid();
|
draw_grid();
|
||||||
if(cw2.mirrored != cw.mirrored) V = V * Mirror;
|
if(cw2.mirrored != cw.mirrored) V = V * Mirror;
|
||||||
if(cw2.spin) V = V * spin(2*M_PI*cw2.spin/cw2.at->type);
|
if(cw2.spin) V = V * spin(2*M_PI*cw2.spin/cw2.at->type);
|
||||||
cw2.spin = 0;
|
cw2.spin = 0;
|
||||||
drawcell(cw2, V);
|
drawcell(cw2.at, V);
|
||||||
inmirrorcount -= cmc;
|
inmirrorcount -= cmc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -643,8 +643,6 @@ color_t distribute_color(int id) {
|
|||||||
void celldrawer::do_viewdist() {
|
void celldrawer::do_viewdist() {
|
||||||
if(behindsphere(V)) return;
|
if(behindsphere(V)) return;
|
||||||
|
|
||||||
cell *c = cw.at;
|
|
||||||
|
|
||||||
int cd = (use_color_codes || number_coding == ncDistance || number_coding == ncDebug) ? curr_dist(c) : 0;
|
int cd = (use_color_codes || number_coding == ncDistance || number_coding == ncDebug) ? curr_dist(c) : 0;
|
||||||
|
|
||||||
if(use_color_codes) {
|
if(use_color_codes) {
|
||||||
|
@ -2321,7 +2321,7 @@ void drawWormSegments() {
|
|||||||
|
|
||||||
EX bool dont_face_pc = false;
|
EX bool dont_face_pc = false;
|
||||||
|
|
||||||
EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool mirrored, color_t asciicol) {
|
EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, color_t asciicol) {
|
||||||
#if CAP_SHAPES
|
#if CAP_SHAPES
|
||||||
|
|
||||||
bool darkhistory = history::includeHistory && history::inkillhistory.count(c);
|
bool darkhistory = history::includeHistory && history::inkillhistory.count(c);
|
||||||
@ -2342,6 +2342,7 @@ EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, boo
|
|||||||
eMonster m = c->monst;
|
eMonster m = c->monst;
|
||||||
|
|
||||||
bool half_elliptic = elliptic && GDIM == 3 && WDIM == 2;
|
bool half_elliptic = elliptic && GDIM == 3 && WDIM == 2;
|
||||||
|
bool mirrored = det(Vparam) > 0;
|
||||||
|
|
||||||
if(!m) ;
|
if(!m) ;
|
||||||
|
|
||||||
@ -3805,7 +3806,6 @@ EX void fallingMonsterAnimation(cell *c, eMonster m, int id IS(multi::cpid)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void celldrawer::draw_fallanims() {
|
void celldrawer::draw_fallanims() {
|
||||||
cell*& c = cw.at;
|
|
||||||
poly_outline = OUTLINE_NONE;
|
poly_outline = OUTLINE_NONE;
|
||||||
if(fallanims.count(c)) {
|
if(fallanims.count(c)) {
|
||||||
int q = isize(ptds);
|
int q = isize(ptds);
|
||||||
@ -3825,7 +3825,7 @@ void celldrawer::draw_fallanims() {
|
|||||||
celldrawer ddalt;
|
celldrawer ddalt;
|
||||||
eWall w = c->wall; int p = c->wparam;
|
eWall w = c->wall; int p = c->wparam;
|
||||||
c->wall = fa.walltype; c->wparam = fa.m;
|
c->wall = fa.walltype; c->wparam = fa.m;
|
||||||
ddalt.cw.at = c;
|
ddalt.c = c;
|
||||||
ddalt.setcolors();
|
ddalt.setcolors();
|
||||||
int starcol = c->wall == waVinePlant ? 0x60C000 : ddalt.wcol;
|
int starcol = c->wall == waVinePlant ? 0x60C000 : ddalt.wcol;
|
||||||
c->wall = w; c->wparam = p;
|
c->wall = w; c->wparam = p;
|
||||||
|
84
hypgraph.cpp
84
hypgraph.cpp
@ -1138,6 +1138,46 @@ vector<tuple<heptspin, hstate, transmatrix, ld> > drawn_cells;
|
|||||||
|
|
||||||
bool in_multi = false;
|
bool in_multi = false;
|
||||||
|
|
||||||
|
bool drawcell_subs(cell *c, transmatrix V) {
|
||||||
|
|
||||||
|
#if CAP_GP
|
||||||
|
if(GOLDBERG) {
|
||||||
|
return gp::drawrec(c, V);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool draw = false;
|
||||||
|
|
||||||
|
#if CAP_IRR
|
||||||
|
if(IRREGULAR) {
|
||||||
|
auto& hi = irr::periodmap[c->master];
|
||||||
|
auto& vc = irr::cells_of_heptagon[hi.base.at];
|
||||||
|
for(int i=0; i<isize(vc); i++) {
|
||||||
|
cell *c = hi.subcells[i];
|
||||||
|
transmatrix V1 = V * irr::cells[vc[i]].pusher;
|
||||||
|
if(do_draw(c, V1))
|
||||||
|
draw = true,
|
||||||
|
drawcell(hi.subcells[i], V * irr::cells[vc[i]].pusher);
|
||||||
|
}
|
||||||
|
return draw;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(do_draw(c, V))
|
||||||
|
drawcell(c, V);
|
||||||
|
|
||||||
|
if(BITRUNCATED) forCellIdEx(c1, d, c) {
|
||||||
|
if(c->c.spin(d) == 0) {
|
||||||
|
transmatrix V2 = V * currentmap->adj(c, d);
|
||||||
|
if(do_draw(c1, V2))
|
||||||
|
draw = true,
|
||||||
|
drawcell(c1, V2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return draw;
|
||||||
|
}
|
||||||
|
|
||||||
void hrmap_standard::draw() {
|
void hrmap_standard::draw() {
|
||||||
if(sphere && pmodel == mdSpiral && !in_multi) {
|
if(sphere && pmodel == mdSpiral && !in_multi) {
|
||||||
in_multi = true;
|
in_multi = true;
|
||||||
@ -1181,49 +1221,7 @@ void hrmap_standard::draw() {
|
|||||||
transmatrix V10;
|
transmatrix V10;
|
||||||
const transmatrix& V1 = hs.mirrored ? (V10 = V * Mirror) : V;
|
const transmatrix& V1 = hs.mirrored ? (V10 = V * Mirror) : V;
|
||||||
|
|
||||||
bool draw = false;
|
bool draw = drawcell_subs(c, actualV(hs, V1));
|
||||||
|
|
||||||
if(0) ;
|
|
||||||
|
|
||||||
#if CAP_GP
|
|
||||||
else if(GOLDBERG) {
|
|
||||||
draw = gp::drawrec(c, actualV(hs, V1));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CAP_IRR
|
|
||||||
else if(IRREGULAR) {
|
|
||||||
auto& hi = irr::periodmap[hs.at];
|
|
||||||
transmatrix V0 = actualV(hs, V1);
|
|
||||||
auto& vc = irr::cells_of_heptagon[hi.base.at];
|
|
||||||
for(int i=0; i<isize(vc); i++) {
|
|
||||||
cell *c = hi.subcells[i];
|
|
||||||
transmatrix V1 = V0 * irr::cells[vc[i]].pusher;
|
|
||||||
if(do_draw(c, V1))
|
|
||||||
draw = true,
|
|
||||||
drawcell(hi.subcells[i], V0 * irr::cells[vc[i]].pusher);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
else {
|
|
||||||
if(do_draw(c, V1)) {
|
|
||||||
transmatrix V2 = actualV(hs, V1);
|
|
||||||
drawcell(cellwalker(c, 0, hs.mirrored), V2);
|
|
||||||
draw = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(BITRUNCATED) for(int d=0; d<S7; d++) {
|
|
||||||
int ds = hs.at->c.fix(hs.spin + d);
|
|
||||||
// createMov(c, ds);
|
|
||||||
if(c->move(ds) && c->c.spin(ds) == 0) {
|
|
||||||
transmatrix V2 = V1 * cgi.hexmove[d];
|
|
||||||
if(do_draw(c->move(ds), V2))
|
|
||||||
draw = true,
|
|
||||||
drawcell(cellwalker(c->move(ds), 0, hs.mirrored ^ c->c.mirror(ds)), V2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sphere) draw = true;
|
if(sphere) draw = true;
|
||||||
|
|
||||||
|
@ -1245,8 +1245,7 @@ EX namespace product {
|
|||||||
if(z == 1) cwall_mask ^= (1<<c->type);
|
if(z == 1) cwall_mask ^= (1<<c->type);
|
||||||
cell *c1 = hybrid::get_at(c, actual_view_level+z);
|
cell *c1 = hybrid::get_at(c, actual_view_level+z);
|
||||||
setdist(c1, 7, NULL);
|
setdist(c1, 7, NULL);
|
||||||
cw.at = c1;
|
drawcell(c1, V * mscale(Id, cgi.plevel * (z+actual_view_level - z0)));
|
||||||
drawcell(cw, V * mscale(Id, cgi.plevel * (z+actual_view_level - z0)));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,6 @@ EX void addradar(const hyperpoint h1, const hyperpoint h2, color_t col) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void celldrawer::drawcell_in_radar() {
|
void celldrawer::drawcell_in_radar() {
|
||||||
cell *c = cw.at;
|
|
||||||
#if CAP_SHMUP
|
#if CAP_SHMUP
|
||||||
if(shmup::on) {
|
if(shmup::on) {
|
||||||
pair<shmup::mit, shmup::mit> p =
|
pair<shmup::mit, shmup::mit> p =
|
||||||
@ -85,7 +84,6 @@ void celldrawer::drawcell_in_radar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void celldrawer::radar_grid() {
|
void celldrawer::radar_grid() {
|
||||||
cell *c = cw.at;
|
|
||||||
for(int t=0; t<c->type; t++)
|
for(int t=0; t<c->type; t++)
|
||||||
if(c->move(t) && c->move(t) < c)
|
if(c->move(t) && c->move(t) < c)
|
||||||
addradar(V*get_corner_position(c, t%c->type), V*get_corner_position(c, (t+1)%c->type), gridcolor(c, c->move(t)));
|
addradar(V*get_corner_position(c, t%c->type), V*get_corner_position(c, (t+1)%c->type), gridcolor(c, c->move(t)));
|
||||||
|
@ -906,7 +906,7 @@ EX void cast() {
|
|||||||
connections[u][1] = code[1];
|
connections[u][1] = code[1];
|
||||||
if(isWall3(c1)) {
|
if(isWall3(c1)) {
|
||||||
celldrawer dd;
|
celldrawer dd;
|
||||||
dd.cw.at = c1;
|
dd.c = c1;
|
||||||
dd.setcolors();
|
dd.setcolors();
|
||||||
transmatrix Vf;
|
transmatrix Vf;
|
||||||
dd.set_land_floor(Vf);
|
dd.set_land_floor(Vf);
|
||||||
|
@ -2875,7 +2875,6 @@ auto hooksw = addHook(hooks_swapdim, 100, [] {
|
|||||||
|
|
||||||
bool celldrawer::draw_shmup_monster() {
|
bool celldrawer::draw_shmup_monster() {
|
||||||
using namespace shmup;
|
using namespace shmup;
|
||||||
auto& c = cw.at;
|
|
||||||
#if CAP_SHAPES
|
#if CAP_SHAPES
|
||||||
|
|
||||||
pair<mit, mit> p =
|
pair<mit, mit> p =
|
||||||
|
2
sky.cpp
2
sky.cpp
@ -133,8 +133,6 @@ void celldrawer::draw_ceiling() {
|
|||||||
|
|
||||||
if(pmodel != mdPerspective || sphere) return;
|
if(pmodel != mdPerspective || sphere) return;
|
||||||
|
|
||||||
cell *c = cw.at;
|
|
||||||
|
|
||||||
switch(ceiling_category(c)) {
|
switch(ceiling_category(c)) {
|
||||||
/* ceilingless levels */
|
/* ceilingless levels */
|
||||||
case 1: {
|
case 1: {
|
||||||
|
Loading…
Reference in New Issue
Block a user