mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
subcodes can be (de)selected in the pattern selection
This commit is contained in:
parent
30a7248bf7
commit
a7f1e560c5
@ -551,7 +551,7 @@ namespace gp {
|
||||
int get_plainshape_id(cell *c) {
|
||||
int siid, sidir;
|
||||
if(geosupport_threecolor() == 2) {
|
||||
auto si = patterns::getpatterninfo(c, patterns::PAT_COLORING, 0);
|
||||
auto si = patterns::getpatterninfo(c, patterns::PAT_COLORING, patterns::SPF_NO_SUBCODES);
|
||||
siid = si.id>>2;
|
||||
// if(siid == 2) si.dir++;
|
||||
// if(siid != pattern_threecolor(c)) printf("threecolor mismatch\n");
|
||||
|
18
graph.cpp
18
graph.cpp
@ -3478,6 +3478,10 @@ void draw_wall(cell *c, const transmatrix& V, int wcol, int& zcol, int ct6, int
|
||||
|
||||
bool just_gmatrix;
|
||||
|
||||
int colorhash(int i) {
|
||||
return (i * 0x471211 + i*i*0x124159 + i*i*i*0x982165) & 0xFFFFFF;
|
||||
}
|
||||
|
||||
void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
|
||||
#if CAP_TEXTURE
|
||||
@ -3793,7 +3797,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
|
||||
poly_outline = OUTLINE_DEFAULT;
|
||||
if(!wmascii) {
|
||||
int gc;
|
||||
|
||||
// floor
|
||||
|
||||
@ -3821,8 +3824,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
|
||||
#if CAP_EDIT
|
||||
else if(mapeditor::haveUserShape(mapeditor::sgFloor, gc = si.id + patterns::subcode(c, si))) {
|
||||
qfi.usershape = gc;
|
||||
else if(mapeditor::haveUserShape(mapeditor::sgFloor, si.id)) {
|
||||
qfi.usershape = si.id;
|
||||
qfi.spin = applyPatterndir(c, si);
|
||||
}
|
||||
|
||||
@ -4232,8 +4235,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
si.dir += si.symmetries;
|
||||
}
|
||||
|
||||
string label = its(si.id);
|
||||
queuestr(V, .5, label, 0xFF000000 + forecolor);
|
||||
string label = its(si.id & 255);
|
||||
int col = forecolor ^ colorhash(si.id >> 8);
|
||||
queuestr(V, .5, label, 0xFF000000 + col);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4806,7 +4810,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
}
|
||||
|
||||
else if(isGravityLand(cwt.at->land)) {
|
||||
else if(isGravityLand(cwt.at->land) && cwt.at->land != laMountain) {
|
||||
if(cwt.at->land == laDungeon) rev = true;
|
||||
if(conformal::do_rotate >= 1)
|
||||
if(!straightDownSeek || edgeDepth(c) < edgeDepth(straightDownSeek)) {
|
||||
@ -4816,7 +4820,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
|
||||
else if(c->master->alt && cwt.at->master->alt &&
|
||||
(cwt.at->land == laMountain ||
|
||||
((cwt.at->land == laMountain && conformal::do_rotate >= 1)||
|
||||
(conformal::do_rotate >= 2 &&
|
||||
(cwt.at->land == laTemple || cwt.at->land == laWhirlpool ||
|
||||
(cheater && (cwt.at->land == laClearing || cwt.at->land == laCaribbean ||
|
||||
|
1
hyper.h
1
hyper.h
@ -1074,6 +1074,7 @@ namespace patterns {
|
||||
static const int SPF_FOOTBALL = 256;
|
||||
static const int SPF_FULLSYM = 512;
|
||||
static const int SPF_DOCKS = 1024;
|
||||
static const int SPF_NO_SUBCODES = 2048;
|
||||
|
||||
static const int SPF_SYM0123 = SPF_SYM01 | SPF_SYM02 | SPF_SYM03;
|
||||
|
||||
|
@ -541,7 +541,7 @@ namespace mapeditor {
|
||||
if(drawcell->monst) return drawcell->monst;
|
||||
if(drawcell->item) return drawcell->item;
|
||||
auto si = patterns::getpatterninfo0(drawcell);
|
||||
return si.id + patterns::subcode(drawcell, si);
|
||||
return si.id;
|
||||
}
|
||||
|
||||
bool editingShape(eShapegroup group, int id) {
|
||||
|
34
pattern2.cpp
34
pattern2.cpp
@ -875,6 +875,18 @@ namespace patterns {
|
||||
}
|
||||
|
||||
patterninfo getpatterninfo(cell *c, ePattern pat, int sub) {
|
||||
if(!(sub & SPF_NO_SUBCODES)) {
|
||||
auto si = getpatterninfo(c, pat, sub | SPF_NO_SUBCODES);
|
||||
if(IRREGULAR)
|
||||
si.id += irr::cellindex[c] << 8;
|
||||
else if(archimedean)
|
||||
si.id += (arcm::id_of(c->master) << 8) + (arcm::parent_index_of(c->master) << 16);
|
||||
else if(GOLDBERG) {
|
||||
if(c == c->master->c7) si.id += (fixdir(si.dir, c) << 8);
|
||||
else si.id += (get_code(gp::get_local_info(c)) << 16) | (fixdir(si.dir, c) << 8);
|
||||
}
|
||||
return si;
|
||||
}
|
||||
bool symRotation = sub & SPF_ROT;
|
||||
// bool sym0 = sub & (SPF_SYM01 | SPF_SYM02 | SPF_SYM03);
|
||||
|
||||
@ -1555,6 +1567,8 @@ namespace patterns {
|
||||
|
||||
dialog::addBoolItem(XLAT("single type"), (whichPattern == PAT_SINGLETYPE), PAT_SINGLETYPE);
|
||||
|
||||
dialog::addBreak(50);
|
||||
|
||||
if(
|
||||
(whichPattern == PAT_EMERALD && (stdhyperbolic || a38)) ||
|
||||
(whichPattern == PAT_PALACE && stdhyperbolic) ||
|
||||
@ -1619,6 +1633,11 @@ namespace patterns {
|
||||
if(a38 && whichPattern == PAT_COLORING)
|
||||
dialog::addBoolItem(XLAT("Docks pattern"), subpattern_flags & SPF_DOCKS, '@');
|
||||
|
||||
if(whichPattern && (IRREGULAR || GOLDBERG || archimedean))
|
||||
dialog::addBoolItem(XLAT("remove complete classification"), subpattern_flags & SPF_NO_SUBCODES, '#');
|
||||
|
||||
dialog::addBreak(50);
|
||||
|
||||
dialog::addBoolItem(XLAT("display pattern codes (full)"), displaycodes, 'd');
|
||||
|
||||
dialog::addBoolItem(XLAT("display only hexagons"), (whichShape == '6'), '6');
|
||||
@ -1678,6 +1697,11 @@ namespace patterns {
|
||||
REMAP_TEXTURE;
|
||||
}
|
||||
|
||||
else if(uni == '#') {
|
||||
subpattern_flags ^= SPF_NO_SUBCODES;
|
||||
REMAP_TEXTURE;
|
||||
}
|
||||
|
||||
else if(uni == '6' || uni == '7' || uni == '8' || uni == '9') {
|
||||
if(whichShape == uni) whichShape = 0;
|
||||
else whichShape = uni;
|
||||
@ -1902,16 +1926,6 @@ namespace patterns {
|
||||
pushScreen(showChangeablePatterns);
|
||||
computeCgroup();
|
||||
}
|
||||
|
||||
int subcode(cell *c, const patterninfo& si) {
|
||||
if(IRREGULAR)
|
||||
return irr::cellindex[c] << 8;
|
||||
else if(archimedean)
|
||||
return (arcm::id_of(c->master) << 8) + (arcm::parent_index_of(c->master) << 16);
|
||||
else if(!GOLDBERG) return 0;
|
||||
else if(c == c->master->c7) return (fixdir(si.dir, c) << 8);
|
||||
else return (get_code(gp::get_local_info(c)) << 16) | (fixdir(si.dir, c) << 8);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_master(cell *c) {
|
||||
|
@ -342,7 +342,7 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
auto& mi = texture_map.at(si.id + patterns::subcode(c, si));
|
||||
auto& mi = texture_map.at(si.id);
|
||||
|
||||
set_floor(shFullFloor);
|
||||
qfi.tinf = &mi;
|
||||
@ -420,8 +420,6 @@ void texture_config::perform_mapping() {
|
||||
|
||||
// int sgn = sphere ? -1 : 1;
|
||||
|
||||
si.id += patterns::subcode(c, si);
|
||||
|
||||
if(!texture_map.count(si.id))
|
||||
replace = true;
|
||||
else if(hdist0(p.second*sphereflip * C0) < hdist0(texture_map[si.id].M * sphereflip * C0))
|
||||
@ -1452,9 +1450,7 @@ void texture_config::true_remap() {
|
||||
missing_cells_known.clear();
|
||||
for(cell *c: dcal) {
|
||||
auto si = patterns::getpatterninfo0(c);
|
||||
int oldid = si.id;
|
||||
|
||||
si.id += patterns::subcode(c, si);
|
||||
int oldid = patterns::getpatterninfo(c, patterns::whichPattern, patterns::subpattern_flags | patterns::SPF_NO_SUBCODES).id;
|
||||
|
||||
if(texture_map.count(si.id)) continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user