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

reworked wmspatial: consistent naming of geometry variables, priorities, and side parameters. Fixed some bugs with shallow water

This commit is contained in:
Zeno Rogue
2025-03-16 23:34:55 +01:00
parent 5320da992d
commit a48dc9a856
15 changed files with 401 additions and 446 deletions

View File

@@ -345,14 +345,33 @@ EX bool highwall(cell *c) {
return winf[c->wall].glyph == '#' || c->wall == waClosedGate;
}
EX int chasmgraph(cell *c) {
if(c->wall == waChasm || c->wall == waInvisibleFloor) return 2;
if(isChasmy(c)) return 1;
if(isWateryOrBoat(c)) return 1;
if(c->wall == waShallow) return 1;
if(wmescher && c->wall == waBarrier && c->land == laOceanWall) return 1;
if(c->wall == waReptileBridge) return 1;
return 0;
EX spatial_info get_spatial_info(cell *c) {
#define F(x) Flag((int) SIDE::x)
if(cellUnstable(c))
return spatial_info{SIDE::INFDEEP, SIDE::INFDEEP, 0};
if(c->wall == waChasm || c->wall == waInvisibleFloor)
return spatial_info{SIDE::INFDEEP, SIDE::INFDEEP, 0};
if(c->wall == waBarrier && wmescher && c->land == laOceanWall)
return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(DEEP)};
if(c->wall == waReptile)
return spatial_info{SIDE::FLOOR, SIDE::FLOOR, F(FLOOR) | F(DEEP)};
if(c->wall == waShallow)
return spatial_info{SIDE::WATERLEVEL, SIDE::SHALLOW, F(SHALLOW) | F(DEEP)};
if(isWateryOrBoat(c) || isChasmy(c))
return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(DEEP)};
if(among(c->wall, waReptileBridge, waGargoyleFloor, waGargoyleBridge, waTempFloor, waTempBridge, waPetrifiedBridge, waFrozenLake))
return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(WATERLEVEL) | F(DEEP)};
int slev = snakelevel(c);
if(slev == 1)
return spatial_info{SIDE::RED1, SIDE::RED1, F(RED1) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)};
if(slev == 2)
return spatial_info{SIDE::RED2, SIDE::RED2, F(RED1) | F(RED2) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)};
if(slev == 3)
return spatial_info{SIDE::RED3, SIDE::RED3, F(RED1) | F(RED2) | F(RED3) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)};
if(highwall(c))
return spatial_info{SIDE::WALL, SIDE::WALL, F(WALL) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)};
return spatial_info{SIDE::FLOOR, SIDE::FLOOR, F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)};
#undef F
}
EX bool conegraph(cell *c) {