mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
nilrider:: define pixels and blocks in levels
This commit is contained in:
parent
e1684a57f1
commit
74f6937b64
@ -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;
|
||||
|
@ -4,6 +4,10 @@ DESC This is a copy of the 'Trying to be horizontal' level.
|
||||
# (x,y) coordinates of the top left corner of the map, and (x,y) coordinates of the bottom right corner of the map
|
||||
BOUNDS -7.5 7.5 7.5 -7.5
|
||||
|
||||
# the map, as composed from blocks
|
||||
# see levels.cpp for predefined color pixels and blocks
|
||||
# https://github.com/zenorogue/hyperrogue/blob/master/rogueviz/nilrider/levels.cpp
|
||||
|
||||
MAP ggggggggggggggg
|
||||
MAP ggggggfffgggggg
|
||||
MAP ggggggfffgggggg
|
||||
@ -12,7 +16,7 @@ MAP gg*-*-----*-*gg
|
||||
MAP gggg|ggggf|gggg
|
||||
MAP ggGg|g+ggg|grgG
|
||||
MAP gGgg|g|xgo|gggg
|
||||
MAP ggGg|g|ggg|grgg
|
||||
MAP ggGg|g|gFg|grgg
|
||||
MAP gggg|g|ggg|gggg
|
||||
MAP gg*-*-+---*-*gg
|
||||
MAP gggg|ggggg|gggg
|
||||
@ -20,6 +24,31 @@ MAP gggggggGGgggggg
|
||||
MAP ggggggggggggggg
|
||||
MAP ggggggggggggggg
|
||||
|
||||
# you can also define your own colors and blocks -- the 'F' block in the map above is defined like this:
|
||||
|
||||
PIXEL y FFFFFF00
|
||||
PIXEL g FF404040
|
||||
PIXEL b FF000000
|
||||
|
||||
BLOCK F
|
||||
bbbbbbbbbbbbbbbb
|
||||
bbbggggggggggbbb
|
||||
bbgyyyyyyyyyygbb
|
||||
bgyyyyyyyyyyyygb
|
||||
bgyyybyyyybyyygb
|
||||
bgyyybyyyybyyygb
|
||||
bgyyyyyyyyyyyygb
|
||||
bgyyyyyyyyyyyygb
|
||||
bgyyyyyyyyyyyygb
|
||||
bgyyyyyyyyyyyygb
|
||||
bgybyyyyyyyybygb
|
||||
bgyybyyyyyybyygb
|
||||
bgyyybbbbbbyyygb
|
||||
bbgyyyyyyyyyygbb
|
||||
bbbggggggggggbbb
|
||||
bbbbbbbbbbbbbbbb
|
||||
|
||||
|
||||
# (x,y) coordinates, in terms of the map -- top left corner is (0,0)
|
||||
START 6 6.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user