1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

Added Canvas Floor and Canvas Darkness options

This commit is contained in:
Charlotte Peppers 2022-03-06 20:01:59 -07:00
parent 6117d626d8
commit ab08a69cc6
No known key found for this signature in database
GPG Key ID: 999661E1478F22CF
5 changed files with 98 additions and 2 deletions

View File

@ -1057,8 +1057,58 @@ void celldrawer::draw_mirrorwall() {
} }
} }
EX int canvasfloor;
void celldrawer::set_land_floor(const shiftmatrix& Vf) { void celldrawer::set_land_floor(const shiftmatrix& Vf) {
switch(c->land) { switch(c->land) {
case laCanvas:
switch(canvasfloor) {
case caflM: set_floor(cgi.shMFloor); break;
case caflFull: set_floor(cgi.shFullFloor); break;
// case caflWarp is warped floor
case caflStar: set_floor(cgi.shStarFloor); break;
case caflCloud: set_floor(cgi.shCloudFloor); break;
case caflCross: set_floor(cgi.shCrossFloor); break;
case caflCharged: set_floor(cgi.shChargedFloor); break;
case caflSStar: set_floor(cgi.shSStarFloor); break;
case caflOver: set_floor(cgi.shOverFloor); break;
case caflTri: set_floor(cgi.shTriFloor); break;
case caflFeather: set_floor(cgi.shFeatherFloor); break;
case caflBarrow: set_floor(cgi.shBarrowFloor); break;
case caflNew: set_floor(cgi.shNewFloor); break;
case caflTroll: set_floor(cgi.shTrollFloor); break;
case caflButterfly: set_floor(cgi.shButterflyFloor); break;
case caflLava: set_floor(cgi.shLavaFloor); break;
case caflPalace: set_floor(cgi.shPalaceFloor); break;
case caflDemon: set_floor(cgi.shDemonFloor); break;
case caflCave: set_floor(cgi.shCaveFloor); break;
case caflDesert: set_floor(cgi.shDesertFloor); break;
case caflPower: set_floor(cgi.shPowerFloor); break;
case caflRose: set_floor(cgi.shRoseFloor); break;
case caflTurtle: set_floor(cgi.shTurtleFloor); break;
case caflDragon: set_floor(cgi.shDragonFloor); break;
case caflReptile: set_reptile_floor(V, fcol); break;
case caflHive:
if(c->wall != waFloorB && c->wall != waFloorA && c->wall != waMirror && c->wall != waCloud && !chasmgraph(c)) {
set_floor(cgi.shFloor);
if(GDIM == 2) {
draw_floorshape(c, V, cgi.shMFloor, darkena(fcol, fd + 1, 0xFF), PPR::FLOORa);
draw_floorshape(c, V, cgi.shMFloor2, darkena(fcol, fcol==uint(c->landparam) ? fd : fd + 1, 0xFF), PPR::FLOORb);
}
}
else
set_floor(cgi.shFloor);
break;
case caflSwitch:
set_floor(cgi.shSwitchFloor);
if(!chasmgraph(c) && ctof(c) && STDVAR && !arcm::in() && !bt::in() && GDIM == 2) for(int i=0; i<c->type; i++)
queuepoly(Vf * ddspin(c, i, M_PI/S7) * xpush(cgi.rhexf), cgi.shSwitchDisk, darkena(fcol, fd, 0xFF));
break;
case caflNone: default:
set_floor(cgi.shFloor); break;
}
break;
case laPrairie: case laPrairie:
case laAlchemist: case laAlchemist:
set_floor(cgi.shCloudFloor); set_floor(cgi.shCloudFloor);

View File

@ -626,6 +626,11 @@ EX walltype winf[walltypes] = {
// -- land types --- // -- land types ---
#if HDR #if HDR
enum eCanvasFloor { caflNone, caflM, caflFull, caflWarp, caflStar, caflCloud, caflCross, caflCharged,
caflSStar, caflOver, caflTri, caflFeather, caflBarrow, caflNew, caflTroll, caflButterfly, caflLava,
caflPalace, caflDemon, caflCave, caflDesert, caflPower, caflRose, caflTurtle, caflDragon, caflReptile,
caflHive, caflSwitch, caflEND };
static const flagtype LF_GENERATE_ALL = Flag(0); static const flagtype LF_GENERATE_ALL = Flag(0);
static const flagtype LF_ICY = Flag(1); static const flagtype LF_ICY = Flag(1);
static const flagtype LF_GRAVITY = Flag(2); static const flagtype LF_GRAVITY = Flag(2);
@ -661,6 +666,13 @@ enum eLand {
extern color_t floorcolors[landtypes]; extern color_t floorcolors[landtypes];
#endif #endif
EX const char *canvasFloorNames[caflEND] = {
"default", "smaller", "full", "warped", "star", "cloud", "cross", "charged",
"saloon", "overgrown", "triangle", "feather", "barrow", "elemental", "troll", "butterfly", "lava",
"palace", "demon", "cave", "desert", "power", "rose", "turtle", "dragon", "reptile",
"hive", "jelly"
};
EX const landtype linf[landtypes] = { EX const landtype linf[landtypes] = {
#define LAND(a,b,c,d,e,f,g) {a,b,d,e,g}, #define LAND(a,b,c,d,e,f,g) {a,b,d,e,g},
#include "content.cpp" #include "content.cpp"

View File

@ -3674,15 +3674,18 @@ bool allemptynear(cell *c) {
} }
EX bool bright; EX bool bright;
EX int canvasdark;
// how much to darken // how much to darken
EX int getfd(cell *c) { EX int getfd(cell *c) {
if(bright) return 0; if(bright) return 0;
if(among(c->land, laAlchemist, laHell, laVariant, laEclectic) && WDIM == 2 && GDIM == 3) return 0; if(among(c->land, laAlchemist, laHell, laVariant, laEclectic) && WDIM == 2 && GDIM == 3) return 0;
switch(c->land) { switch(c->land) {
case laCanvas:
return min(2,max(0,canvasdark));
case laRedRock: case laRedRock:
case laReptile: case laReptile:
case laCanvas:
return 0; return 0;
case laSnakeNest: case laSnakeNest:

View File

@ -697,6 +697,8 @@ EX namespace mapstream {
f.write(canvas_default_wall); f.write(canvas_default_wall);
f.write(mapeditor::drawplayer); f.write(mapeditor::drawplayer);
if(patterns::whichCanvas == 'f') f.write(patterns::color_formula); if(patterns::whichCanvas == 'f') f.write(patterns::color_formula);
f.write(canvasfloor);
f.write(canvasdark);
{ {
int i = ittypes; f.write(i); int i = ittypes; f.write(i);
@ -880,6 +882,8 @@ EX namespace mapstream {
f.read(canvas_default_wall); f.read(canvas_default_wall);
f.read(mapeditor::drawplayer); f.read(mapeditor::drawplayer);
if(patterns::whichCanvas == 'f') f.read(patterns::color_formula); if(patterns::whichCanvas == 'f') f.read(patterns::color_formula);
f.read(canvasfloor);
f.read(canvasdark);
int i; int i;
f.read(i); if(i > ittypes || i < 0) throw hstream_exception(); f.read(i); if(i > ittypes || i < 0) throw hstream_exception();
@ -3055,6 +3059,20 @@ EX namespace mapeditor {
} }
#endif #endif
string canvasFloorName(int id) {
if(id>=0 && id<caflEND)
return XLAT(canvasFloorNames[id]);
return its(id);
}
string allCanvasFloorNames() {
string ret;
for(int i=0; i<caflEND; i++) {
ret += its(i) + ":" + canvasFloorName(i) + " ";
}
return ret;
}
EX void map_settings() { EX void map_settings() {
cmode = sm::SIDE | sm::MAYDARK; cmode = sm::SIDE | sm::MAYDARK;
gamescreen(1); gamescreen(1);
@ -3086,6 +3104,19 @@ EX namespace mapeditor {
dialog::addItem(XLAT("edit cell values"), 'G'); dialog::addItem(XLAT("edit cell values"), 'G');
dialog::add_action(push_debug_screen); dialog::add_action(push_debug_screen);
dialog::addSelItem(XLAT("canvas floor shape"), canvasFloorName(canvasfloor), 'S');
dialog::add_action([] {
dialog::editNumber(canvasfloor, 0, caflEND - 1, 1, 0, XLAT("canvas floor shape"),allCanvasFloorNames());
});
dialog::addSelItem(XLAT("canvas darkness"), its(canvasdark), 'd');
dialog::add_action([] {
dialog::editNumber(canvasdark, 0, 2, 1, 0, XLAT("canvas darkness"),
"0: no darkening (bright mode, canvas, reptiles, etc)\n"
"1: light darkening (r'lyeh, palace, dragon chasms, etc)\n"
"2: normal darkening (default, most lands)");
});
dialog::addBack(); dialog::addBack();
dialog::display(); dialog::display();

View File

@ -117,7 +117,7 @@ EX eGravity get_move_gravity(cell *c, cell *c2) {
} }
EX bool isWarped(cell *c) { EX bool isWarped(cell *c) {
return isWarpedType(c->land) || (!inmirrororwall(c->land) && (items[itOrb37] && c->cpdist <= 4)); return isWarpedType(c->land) || (c->land == laCanvas && canvasfloor == 3) || (!inmirrororwall(c->land) && (items[itOrb37] && c->cpdist <= 4));
} }
EX bool nonAdjacent(cell *c, cell *c2) { EX bool nonAdjacent(cell *c, cell *c2) {