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 get_plainshape_id(cell *c) {
|
||||||
int siid, sidir;
|
int siid, sidir;
|
||||||
if(geosupport_threecolor() == 2) {
|
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;
|
siid = si.id>>2;
|
||||||
// if(siid == 2) si.dir++;
|
// if(siid == 2) si.dir++;
|
||||||
// if(siid != pattern_threecolor(c)) printf("threecolor mismatch\n");
|
// 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;
|
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) {
|
void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||||
|
|
||||||
#if CAP_TEXTURE
|
#if CAP_TEXTURE
|
||||||
@ -3793,7 +3797,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
|
|
||||||
poly_outline = OUTLINE_DEFAULT;
|
poly_outline = OUTLINE_DEFAULT;
|
||||||
if(!wmascii) {
|
if(!wmascii) {
|
||||||
int gc;
|
|
||||||
|
|
||||||
// floor
|
// floor
|
||||||
|
|
||||||
@ -3821,8 +3824,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_EDIT
|
#if CAP_EDIT
|
||||||
else if(mapeditor::haveUserShape(mapeditor::sgFloor, gc = si.id + patterns::subcode(c, si))) {
|
else if(mapeditor::haveUserShape(mapeditor::sgFloor, si.id)) {
|
||||||
qfi.usershape = gc;
|
qfi.usershape = si.id;
|
||||||
qfi.spin = applyPatterndir(c, si);
|
qfi.spin = applyPatterndir(c, si);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4232,8 +4235,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
si.dir += si.symmetries;
|
si.dir += si.symmetries;
|
||||||
}
|
}
|
||||||
|
|
||||||
string label = its(si.id);
|
string label = its(si.id & 255);
|
||||||
queuestr(V, .5, label, 0xFF000000 + forecolor);
|
int col = forecolor ^ colorhash(si.id >> 8);
|
||||||
|
queuestr(V, .5, label, 0xFF000000 + col);
|
||||||
}
|
}
|
||||||
#endif
|
#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(cwt.at->land == laDungeon) rev = true;
|
||||||
if(conformal::do_rotate >= 1)
|
if(conformal::do_rotate >= 1)
|
||||||
if(!straightDownSeek || edgeDepth(c) < edgeDepth(straightDownSeek)) {
|
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 &&
|
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 &&
|
(conformal::do_rotate >= 2 &&
|
||||||
(cwt.at->land == laTemple || cwt.at->land == laWhirlpool ||
|
(cwt.at->land == laTemple || cwt.at->land == laWhirlpool ||
|
||||||
(cheater && (cwt.at->land == laClearing || cwt.at->land == laCaribbean ||
|
(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_FOOTBALL = 256;
|
||||||
static const int SPF_FULLSYM = 512;
|
static const int SPF_FULLSYM = 512;
|
||||||
static const int SPF_DOCKS = 1024;
|
static const int SPF_DOCKS = 1024;
|
||||||
|
static const int SPF_NO_SUBCODES = 2048;
|
||||||
|
|
||||||
static const int SPF_SYM0123 = SPF_SYM01 | SPF_SYM02 | SPF_SYM03;
|
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->monst) return drawcell->monst;
|
||||||
if(drawcell->item) return drawcell->item;
|
if(drawcell->item) return drawcell->item;
|
||||||
auto si = patterns::getpatterninfo0(drawcell);
|
auto si = patterns::getpatterninfo0(drawcell);
|
||||||
return si.id + patterns::subcode(drawcell, si);
|
return si.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool editingShape(eShapegroup group, int id) {
|
bool editingShape(eShapegroup group, int id) {
|
||||||
|
36
pattern2.cpp
36
pattern2.cpp
@ -875,6 +875,18 @@ namespace patterns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
patterninfo getpatterninfo(cell *c, ePattern pat, int sub) {
|
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 symRotation = sub & SPF_ROT;
|
||||||
// bool sym0 = sub & (SPF_SYM01 | SPF_SYM02 | SPF_SYM03);
|
// 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::addBoolItem(XLAT("single type"), (whichPattern == PAT_SINGLETYPE), PAT_SINGLETYPE);
|
||||||
|
|
||||||
|
dialog::addBreak(50);
|
||||||
|
|
||||||
if(
|
if(
|
||||||
(whichPattern == PAT_EMERALD && (stdhyperbolic || a38)) ||
|
(whichPattern == PAT_EMERALD && (stdhyperbolic || a38)) ||
|
||||||
(whichPattern == PAT_PALACE && stdhyperbolic) ||
|
(whichPattern == PAT_PALACE && stdhyperbolic) ||
|
||||||
@ -1618,6 +1632,11 @@ namespace patterns {
|
|||||||
|
|
||||||
if(a38 && whichPattern == PAT_COLORING)
|
if(a38 && whichPattern == PAT_COLORING)
|
||||||
dialog::addBoolItem(XLAT("Docks pattern"), subpattern_flags & SPF_DOCKS, '@');
|
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 pattern codes (full)"), displaycodes, 'd');
|
||||||
|
|
||||||
@ -1678,6 +1697,11 @@ namespace patterns {
|
|||||||
REMAP_TEXTURE;
|
REMAP_TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(uni == '#') {
|
||||||
|
subpattern_flags ^= SPF_NO_SUBCODES;
|
||||||
|
REMAP_TEXTURE;
|
||||||
|
}
|
||||||
|
|
||||||
else if(uni == '6' || uni == '7' || uni == '8' || uni == '9') {
|
else if(uni == '6' || uni == '7' || uni == '8' || uni == '9') {
|
||||||
if(whichShape == uni) whichShape = 0;
|
if(whichShape == uni) whichShape = 0;
|
||||||
else whichShape = uni;
|
else whichShape = uni;
|
||||||
@ -1901,17 +1925,7 @@ namespace patterns {
|
|||||||
void pushChangeablePatterns() {
|
void pushChangeablePatterns() {
|
||||||
pushScreen(showChangeablePatterns);
|
pushScreen(showChangeablePatterns);
|
||||||
computeCgroup();
|
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) {
|
bool is_master(cell *c) {
|
||||||
|
@ -342,7 +342,7 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
auto& mi = texture_map.at(si.id + patterns::subcode(c, si));
|
auto& mi = texture_map.at(si.id);
|
||||||
|
|
||||||
set_floor(shFullFloor);
|
set_floor(shFullFloor);
|
||||||
qfi.tinf = &mi;
|
qfi.tinf = &mi;
|
||||||
@ -420,8 +420,6 @@ void texture_config::perform_mapping() {
|
|||||||
|
|
||||||
// int sgn = sphere ? -1 : 1;
|
// int sgn = sphere ? -1 : 1;
|
||||||
|
|
||||||
si.id += patterns::subcode(c, si);
|
|
||||||
|
|
||||||
if(!texture_map.count(si.id))
|
if(!texture_map.count(si.id))
|
||||||
replace = true;
|
replace = true;
|
||||||
else if(hdist0(p.second*sphereflip * C0) < hdist0(texture_map[si.id].M * sphereflip * C0))
|
else if(hdist0(p.second*sphereflip * C0) < hdist0(texture_map[si.id].M * sphereflip * C0))
|
||||||
@ -1452,10 +1450,8 @@ void texture_config::true_remap() {
|
|||||||
missing_cells_known.clear();
|
missing_cells_known.clear();
|
||||||
for(cell *c: dcal) {
|
for(cell *c: dcal) {
|
||||||
auto si = patterns::getpatterninfo0(c);
|
auto si = patterns::getpatterninfo0(c);
|
||||||
int oldid = si.id;
|
int oldid = patterns::getpatterninfo(c, patterns::whichPattern, patterns::subpattern_flags | patterns::SPF_NO_SUBCODES).id;
|
||||||
|
|
||||||
si.id += patterns::subcode(c, si);
|
|
||||||
|
|
||||||
if(texture_map.count(si.id)) continue;
|
if(texture_map.count(si.id)) continue;
|
||||||
|
|
||||||
int pshift = 0;
|
int pshift = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user