mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
options -pal and -palrgba now accept the pattern name
This commit is contained in:
parent
c1de923454
commit
0294c0acb1
@ -480,14 +480,13 @@ void viewdist_configure_dialog() {
|
|||||||
dialog::editNumber(first_distance, 0, 3000, 0, 1, "display distances from", "");
|
dialog::editNumber(first_distance, 0, 3000, 0, 1, "display distances from", "");
|
||||||
});
|
});
|
||||||
|
|
||||||
auto& cp = linepatterns::patterns;
|
for(auto& lp: linepatterns::patterns) {
|
||||||
using namespace linepatterns;
|
using namespace linepatterns;
|
||||||
for(int numpat=0; cp[numpat].lpname; numpat++) {
|
int id = 0;
|
||||||
auto &pn = cp[numpat];
|
if(among(lp.id, patTriTree, patTriRings, patTriOther)) {
|
||||||
if(among(pn.id, patTriTree, patTriRings, patTriOther)) {
|
dialog::addColorItem(XLAT(lp.lpname), lp.color, '1'+(id++));
|
||||||
dialog::addColorItem(XLAT(pn.lpname), pn.color, '1'+numpat);
|
dialog::add_action([&lp] () {
|
||||||
dialog::add_action([&pn] () {
|
dialog::openColorDialog(lp.color, NULL);
|
||||||
dialog::openColorDialog(pn.color, NULL);
|
|
||||||
dialog::dialogflags |= sm::MAYDARK | sm::SIDE | sm::EXPANSION;
|
dialog::dialogflags |= sm::MAYDARK | sm::SIDE | sm::EXPANSION;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
hyper.h
2
hyper.h
@ -2199,7 +2199,7 @@ namespace linepatterns {
|
|||||||
color_t color;
|
color_t color;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern linepattern patterns[];
|
extern vector<linepattern> patterns;
|
||||||
};
|
};
|
||||||
|
|
||||||
transmatrix ddspin(cell *c, int d, ld bonus = 0);
|
transmatrix ddspin(cell *c, int d, ld bonus = 0);
|
||||||
|
58
pattern2.cpp
58
pattern2.cpp
@ -1952,7 +1952,7 @@ namespace linepatterns {
|
|||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
linepattern patterns[] = {
|
vector<linepattern> patterns = {
|
||||||
|
|
||||||
{patDual, "dual grid", 0xFFFFFF00},
|
{patDual, "dual grid", 0xFFFFFF00},
|
||||||
|
|
||||||
@ -1978,26 +1978,25 @@ namespace linepatterns {
|
|||||||
{patTriTree, "triangle grid: tree edges", 0xFFFFFF00},
|
{patTriTree, "triangle grid: tree edges", 0xFFFFFF00},
|
||||||
{patTriOther, "triangle grid: other edges", 0xFFFFFF00},
|
{patTriOther, "triangle grid: other edges", 0xFFFFFF00},
|
||||||
|
|
||||||
{0, NULL, 0}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void clearAll() {
|
void clearAll() {
|
||||||
for(int k=0; patterns[k].lpname; k++) patterns[k].color &= ~255;
|
for(auto& lp: patterns) lp.color &= ~255;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool any() {
|
bool any() {
|
||||||
for(int k=0; patterns[k].lpname; k++) if(patterns[k].color & 255) return true;
|
for(auto& lp: patterns) if(lp.color & 255) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setColor(ePattern id, color_t col) {
|
void setColor(ePattern id, color_t col) {
|
||||||
for(int k=0; patterns[k].lpname; k++)
|
for(auto& lp: patterns)
|
||||||
if(patterns[k].id == id) patterns[k].color = col;
|
if(lp.id == id) lp.color = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchAlpha(ePattern id, color_t col) {
|
void switchAlpha(ePattern id, color_t col) {
|
||||||
for(int k=0; patterns[k].lpname; k++)
|
for(auto& lp: patterns)
|
||||||
if(patterns[k].id == id) patterns[k].color ^= col;
|
if(lp.id == id) lp.color ^= col;
|
||||||
}
|
}
|
||||||
|
|
||||||
void queuelinef(const hyperpoint& h1, const hyperpoint& h2, color_t col, int par) {
|
void queuelinef(const hyperpoint& h1, const hyperpoint& h2, color_t col, int par) {
|
||||||
@ -2228,12 +2227,10 @@ namespace linepatterns {
|
|||||||
cell *c = it->first;
|
cell *c = it->first;
|
||||||
transmatrix& V = it->second;
|
transmatrix& V = it->second;
|
||||||
|
|
||||||
for(int k=0; patterns[k].lpname; k++) {
|
for(auto& lp: patterns) {
|
||||||
color_t col = patterns[k].color;
|
color_t col = lp.color;
|
||||||
if(!(col & 255)) continue;
|
if(!(col & 255)) continue;
|
||||||
int id = patterns[k].id;
|
drawPattern(lp.id, col, c, V);
|
||||||
|
|
||||||
drawPattern(id, col, c, V);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2246,8 +2243,16 @@ namespace linepatterns {
|
|||||||
|
|
||||||
dialog::init(XLAT("line patterns"));
|
dialog::init(XLAT("line patterns"));
|
||||||
|
|
||||||
for(numpat=0; patterns[numpat].lpname; numpat++)
|
int id = 0;
|
||||||
dialog::addColorItem(among(patterns[numpat].id, patVine, patPower) && GOLDBERG ? XLAT("Goldberg") + (patterns[numpat].id == patVine ? " " : ""): XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat);
|
for(auto& lp: patterns) {
|
||||||
|
string name = XLAT(lp.lpname);
|
||||||
|
if(GOLDBERG && among(lp.id, patVine, patPower)) name = XLAT("Goldberg");
|
||||||
|
dialog::addColorItem(name, lp.color, 'a'+(id++));
|
||||||
|
dialog::add_action([&lp] () {
|
||||||
|
dialog::openColorDialog(lp.color, NULL);
|
||||||
|
dialog::dialogflags |= sm::MAYDARK | sm::SIDE;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
@ -2256,15 +2261,6 @@ namespace linepatterns {
|
|||||||
dialog::addInfo("change the alpha parameter to show the lines");
|
dialog::addInfo("change the alpha parameter to show the lines");
|
||||||
|
|
||||||
dialog::display();
|
dialog::display();
|
||||||
|
|
||||||
keyhandler = [] (int sym, int uni) {
|
|
||||||
dialog::handleNavigation(sym, uni);
|
|
||||||
if(uni >= 'a' && uni < 'a' + numpat) {
|
|
||||||
dialog::openColorDialog(patterns[uni - 'a'].color, NULL);
|
|
||||||
dialog::dialogflags |= sm::MAYDARK | sm::SIDE;
|
|
||||||
}
|
|
||||||
else if(doexiton(sym,uni)) popScreen();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -2300,13 +2296,19 @@ int read_pattern_args() {
|
|||||||
|
|
||||||
else if(argis("-pal")) {
|
else if(argis("-pal")) {
|
||||||
PHASEFROM(2); cheat();
|
PHASEFROM(2); cheat();
|
||||||
shift(); int id = argi();
|
shift(); string ss = args();
|
||||||
shift(); linepatterns::patterns[id].color |= argi();
|
shift();
|
||||||
|
for(auto& lp: linepatterns::patterns)
|
||||||
|
if(appears(lp.lpname, ss))
|
||||||
|
lp.color |= argi();
|
||||||
}
|
}
|
||||||
else if(argis("-palrgba")) {
|
else if(argis("-palrgba")) {
|
||||||
PHASEFROM(2); cheat();
|
PHASEFROM(2); cheat();
|
||||||
shift(); int id = argi();
|
shift(); string ss = args();
|
||||||
shift(); linepatterns::patterns[id].color = arghex();
|
shift();
|
||||||
|
for(auto& lp: linepatterns::patterns)
|
||||||
|
if(appears(lp.lpname, ss))
|
||||||
|
lp.color = arghex();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(argis("-noplayer")) mapeditor::drawplayer = !mapeditor::drawplayer;
|
else if(argis("-noplayer")) mapeditor::drawplayer = !mapeditor::drawplayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user