1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-08 09:42:59 +00:00

nilrider:: define pixels and blocks in levels

This commit is contained in:
Zeno Rogue
2024-08-20 11:05:18 +02:00
parent e1684a57f1
commit 74f6937b64
2 changed files with 43 additions and 1 deletions

View File

@@ -599,6 +599,19 @@ void load_level(const string& fname) {
else if(cmd == "BOUNDS") { if(sscanf(param.c_str(), "%lf%lf%lf%lf", &csub->minx, &csub->miny, &csub->maxx, &csub->maxy) != 4) throw hr_exception("incorrect BOUNDS line"); }
else if(cmd == "START") { if(sscanf(param.c_str(), "%lf%lf", &csub->startx, &csub->starty) != 2) throw hr_exception("incorrect START line"); }
else if(cmd == "MAP") csub->map_tiles.push_back(param);
else if(cmd == "PIXEL") {
char label; color_t col;
if(sscanf(param.c_str(), "%c%x", &label, &col) != 2) throw hr_exception("incorrect PIXEL line");
bcols[label] = col;
}
else if(cmd == "BLOCK") {
if(param.size() != 1) throw hr_exception("incorrect BLOCK line");
auto& submap = submaps[param[0]];
for(int y=0; y<pixel_per_block; y++) {
submap[y] = scanline_noblank(f);
if(isize(submap[y]) != pixel_per_block) throw hr_exception("incorrect length of a BLOCK line");
}
}
else if(cmd == "FUNCTION") {
if(param == "zero") csub->surface = rot_plane;
else if(param == "heisenberg") csub->surface = f_heisenberg0;