ru:: secret passage becomes simpler, but with more options

This commit is contained in:
Zeno Rogue
2026-04-14 21:09:11 +02:00
parent df7a23d113
commit 2964bd8472
4 changed files with 53 additions and 17 deletions
+27 -4
View File
@@ -58,7 +58,11 @@ struct ruwall {
enum eWall { enum eWall {
wAir, wWall, wBouncy, wSpike, wWater, wFrozen, wDoor, wSmashedDoor, wAir, wWall, wBouncy, wSpike, wWater, wFrozen, wDoor, wSmashedDoor,
wLockedDoor, wFountain, wBluePortal, wOrangePortal, wPlatform, wStaircase, wLockedDoor, wFountain, wBluePortal, wOrangePortal, wPlatform, wStaircase,
wColumn, wForge, wWoodWall, wShopDoor, wSecretPassage, wSign, wWallSign, wTimeDoor, wColumn, wForge, wWoodWall, wShopDoor,
wSecretPassageVHidden, wSecretPassageV,
wSecretPassageUHidden, wSecretPassageU,
wSecretPassageHHidden, wSecretPassageH,
wSign, wWallSign, wTimeDoor,
wBottomSpike, wRogueWallHidden, wRogueWall, wRightSlope, wLeftSlope, wLeftSlopedRoof, wRightSlopedRoof, wBottomSpike, wRogueWallHidden, wRogueWall, wRightSlope, wLeftSlope, wLeftSlopedRoof, wRightSlopedRoof,
wWeakWall, wStrangeSign, wWalkSpikes, wGUARD }; wWeakWall, wStrangeSign, wWalkSpikes, wGUARD };
@@ -74,12 +78,26 @@ flagtype W_STABLE = 256;
flagtype W_DOWNWARD = 512; flagtype W_DOWNWARD = 512;
flagtype W_SLOPE = 1024; flagtype W_SLOPE = 1024;
flagtype W_PAIN_DOWN = 2048; flagtype W_PAIN_DOWN = 2048;
flagtype W_HYPERBOUNCY = 4096;
constexpr int qwall = int(wGUARD); constexpr int qwall = int(wGUARD);
ruwall r_wall = {"wall", "#", 0xFFFFFFFF, W_BLOCK | W_STABLE, "These kinds of tough walls can never be destroyed."};
vector<pair<eWall, eWall>> hidden_unhidden = {
{wSecretPassageHHidden, wSecretPassageH},
{wSecretPassageVHidden, wSecretPassageV},
{wSecretPassageUHidden, wSecretPassageU},
{wRogueWallHidden, wRogueWall}
};
vector<pair<eWall, eWall>> base_changed = {
{wDoor, wSmashedDoor}
};
ruwall walls[qwall] = { ruwall walls[qwall] = {
{"air", ".", 0x40404080, W_TRANS, "Looks like an empty space, but actually necessary for survival."}, {"air", ".", 0x40404080, W_TRANS, "Looks like an empty space, but actually necessary for survival."},
{"wall", "#", 0xFFFFFFFF, W_BLOCK | W_STABLE, "These kinds of tough walls can never be destroyed."}, r_wall,
{"bouncy wall", "#", 0x80FF80FF, W_BLOCK | W_BOUNCY, "Like walls, but things bounce off them."}, {"bouncy wall", "#", 0x80FF80FF, W_BLOCK | W_BOUNCY, "Like walls, but things bounce off them."},
{"spike", "^", 0xC08080FF, W_TRANS | W_PAIN | W_BLOCKBIRD, "Dangerous!"}, {"spike", "^", 0xC08080FF, W_TRANS | W_PAIN | W_BLOCKBIRD, "Dangerous!"},
{"water", "~", 0x0000FFFF, W_BLOCK | W_TRANS | W_BLOCKBIRD, "Not used yet."}, {"water", "~", 0x0000FFFF, W_BLOCK | W_TRANS | W_BLOCKBIRD, "Not used yet."},
@@ -96,12 +114,17 @@ ruwall walls[qwall] = {
{"forge", "&", 0xB0202080, W_TRANS | W_PAIN, "Used by runesmiths."}, {"forge", "&", 0xB0202080, W_TRANS | W_PAIN, "Used by runesmiths."},
{"wooden wall", "#", 0xFF8000FF, W_BLOCK | W_STABLE, "These kinds of tough walls can be destroyed with fire."}, {"wooden wall", "#", 0xFF8000FF, W_BLOCK | W_STABLE, "These kinds of tough walls can be destroyed with fire."},
{"shop door", "#", 0xFFD500FF, W_TRANS, "A powerful door, to protect against shoplifters."}, {"shop door", "#", 0xFFD500FF, W_TRANS, "A powerful door, to protect against shoplifters."},
{"secret passage", "#", 0xFFFF40FF, W_PLATFORM | W_BLOCKBIRD, "You have discovered a secret passage from the other side."}, r_wall,
{"secret trapdoor", "#", 0xFFFF40FF, W_PLATFORM | W_BLOCKBIRD, "A secret passage that becomes obvious once you see it from above and below."},
r_wall,
{"secret tunnel", "#", 0xFFFF40FF, W_PLATFORM | W_BLOCKBIRD, "A secret passage that becomes obvious once you see it from below."},
r_wall,
{"secret door", "#", 0xFFFF40FF, W_BLOCKBIRD, "A secret passage that becomes obvious once you see it both from left and right."},
{"sign", "X", 0xFFFF40FF, W_TRANS, "You need to wait close to this sign to read it."}, {"sign", "X", 0xFFFF40FF, W_TRANS, "You need to wait close to this sign to read it."},
{"wall sign", "X", 0xFFFFC0FF, W_BLOCK, "You need to wait close to this sign to read it."}, {"wall sign", "X", 0xFFFFC0FF, W_BLOCK, "You need to wait close to this sign to read it."},
{"time door", "#", 0x8080FFFF, W_BLOCK | W_STABLE, "A powerful door, opened by a mechanism."}, {"time door", "#", 0x8080FFFF, W_BLOCK | W_STABLE, "A powerful door, opened by a mechanism."},
{"bottom spike", "v", 0xC08080FF, W_TRANS | W_PAIN | W_BLOCKBIRD | W_DOWNWARD, "A downward-pointing spike. You can fall from above through it safely, but otherwise, it is very dangerous."}, {"bottom spike", "v", 0xC08080FF, W_TRANS | W_PAIN | W_BLOCKBIRD | W_DOWNWARD, "A downward-pointing spike. You can fall from above through it safely, but otherwise, it is very dangerous."},
{"wall", "#", 0xFFFFFFFF, W_BLOCK | W_STABLE, "These kinds of tough walls can never be destroyed."}, r_wall,
{"fake wall", "#", 0x404080FF, W_PLATFORM | W_STABLE | W_BLOCKBIRD, "Your rogueish senses have discovered that this wall is fake."}, {"fake wall", "#", 0x404080FF, W_PLATFORM | W_STABLE | W_BLOCKBIRD, "Your rogueish senses have discovered that this wall is fake."},
{"right slope", "/", 0xFFFFFFFF, W_STABLE | W_SLOPE, "Slope here."}, {"right slope", "/", 0xFFFFFFFF, W_STABLE | W_SLOPE, "Slope here."},
{"left slope", "\\", 0xFFFFFFFF, W_STABLE | W_SLOPE, "Slope here."}, {"left slope", "\\", 0xFFFFFFFF, W_STABLE | W_SLOPE, "Slope here."},
+10 -4
View File
@@ -51,7 +51,10 @@ void save_map(string fname) {
for(int y=0; y<room_y; y++) for(int y=0; y<room_y; y++)
for(int x=0; x<room_x; x++) { for(int x=0; x<room_x; x++) {
auto i = r.block_at[y][x] >> 3; auto i = r.block_at[y][x] >> 3;
if(i == int(wRogueWallHidden)) i = int(wRogueWall); for(auto [hid, vis]: hidden_unhidden)
if(i == int(hid)) i = int(vis);
for(auto [bas, cha]: base_changed)
if(i == int(cha)) i = int(bas);
auto& c = code_for[i]; auto& c = code_for[i];
if(c == 0 && !code_used.count(walls[i].glyph[0])) c = walls[i].glyph[0]; if(c == 0 && !code_used.count(walls[i].glyph[0])) c = walls[i].glyph[0];
if(c == 0) c = next_code++; if(c == 0) c = next_code++;
@@ -66,7 +69,10 @@ void save_map(string fname) {
for(int x=0; x<room_x; x++) { for(int x=0; x<room_x; x++) {
auto v = r.block_at[y][x]; auto v = r.block_at[y][x];
auto vi = v >> 3; auto vi = v >> 3;
if(vi == int(wRogueWallHidden)) vi = int(wRogueWall); for(auto [hid, vis]: hidden_unhidden)
if(vi == int(hid)) vi = int(vis);
for(auto [bas, cha]: base_changed)
if(vi == int(cha)) vi = int(bas);
print(f, format("%c", (v & 7) == 7 ? 'b' : code_for[vi])); print(f, format("%c", (v & 7) == 7 ? 'b' : code_for[vi]));
} }
println(f); println(f);
@@ -140,8 +146,8 @@ void load_room(fhstream& f, cell *c) {
string t = s.substr(2); string t = s.substr(2);
if(s.size() < 3 || s[1] != ' ') err("load codes", s); if(s.size() < 3 || s[1] != ' ') err("load codes", s);
for(int i=0; i<qwall; i++) if(walls[i].name == t) { for(int i=0; i<qwall; i++) if(walls[i].name == t) {
if(i == int(wRogueWall)) i = int(wRogueWallHidden); for(auto [hid, vis]: hidden_unhidden)
if(i == int(wSmashedDoor)) i = int(wDoor); if(i == int(vis)) i = int(hid);
codes[s[0]] = i; codes[s[0]] = i;
break; break;
} }
+6 -6
View File
@@ -267,7 +267,7 @@ ROOM Climbing the Hill
# wall # wall
. air . air
\ left slope \ left slope
A secret passage A secret tunnel
- platform - platform
MAP MAP
################................................................................ ################................................................................
@@ -1272,7 +1272,7 @@ ROOM Mazes of Menace
A staircase A staircase
W wooden wall W wooden wall
S shop door S shop door
P secret passage P secret tunnel
MAP MAP
################################################################################ ################################################################################
################################################################################ ################################################################################
@@ -1285,8 +1285,8 @@ MAP
###..........#####...............#######.......###############...........####### ###..........#####...............#######.......###############...........#######
###..........+...+...............+.....+.......###############...........####### ###..........+...+...............+.....+.......###############...........#######
###..........+...+...............+.....+.......###################--############ ###..........+...+...............+.....+.......###################--############
###..........#####...............#################################AA############ ###..........#####...............########PP#######################AA############
###..........#####...............########PP............###########AA############ ###..........#####...............########..............###########AA############
###..........#####A.............A########..............###########AA############ ###..........#####A.............A########..............###########AA############
.##..........#####A.............A####################..#######....AA........#### .##..........#####A.............A####################..#######....AA........####
.##..........#####...............####################--#######....AA........#### .##..........#####...............####################--#######....AA........####
@@ -1757,7 +1757,7 @@ ROOM Leap of Faith
# wall # wall
- staircase - staircase
. air . air
S secret passage S secret tunnel
X wall sign X wall sign
P platform P platform
W wooden wall W wooden wall
@@ -1786,8 +1786,8 @@ MAP
####..........W...//##################.......................................... ####..........W...//##################..........................................
####....!!....W..//###################.......................................... ####....!!....W..//###################..........................................
........!b....W.//####################.......................................... ........!b....W.//####################..........................................
######################################..........................................
############SS########################.......................................... ############SS########################..........................................
############..########################..........................................
############--########################.......................................... ############--########################..........................................
############-b########################.......................................... ############-b########################..........................................
############--########################.......................................... ############--########################..........................................
+10 -3
View File
@@ -147,9 +147,16 @@ void render_room_walls(room *r) {
int cc = c >> 3; int cc = c >> 3;
if(r == current_room && cc == wSecretPassage && r->at(x, y-1) == wWall) { if(r == current_room && cc == wSecretPassageVHidden && r->fov[y+1][x] && r->fov[y-1][x]) {
r->replace_block(x, y, wAir); r->replace_block(x, y, wSecretPassageV);
r->replace_block(x, y-1, wSecretPassage); }
if(r == current_room && cc == wSecretPassageUHidden && r->fov[y+1][x]) {
r->replace_block(x, y, wSecretPassageU);
}
if(r == current_room && cc == wSecretPassageHHidden && r->fov[y][x-1] && r->fov[y][x+1]) {
r->replace_block(x, y, wSecretPassageH);
} }
if((c & 7) == 0) if((c & 7) == 0)