diff --git a/rogueviz/ru/globals.cpp b/rogueviz/ru/globals.cpp index 97fb6dd8..b718686d 100644 --- a/rogueviz/ru/globals.cpp +++ b/rogueviz/ru/globals.cpp @@ -58,7 +58,11 @@ struct ruwall { enum eWall { wAir, wWall, wBouncy, wSpike, wWater, wFrozen, wDoor, wSmashedDoor, 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, wWeakWall, wStrangeSign, wWalkSpikes, wGUARD }; @@ -74,12 +78,26 @@ flagtype W_STABLE = 256; flagtype W_DOWNWARD = 512; flagtype W_SLOPE = 1024; flagtype W_PAIN_DOWN = 2048; +flagtype W_HYPERBOUNCY = 4096; constexpr int qwall = int(wGUARD); +ruwall r_wall = {"wall", "#", 0xFFFFFFFF, W_BLOCK | W_STABLE, "These kinds of tough walls can never be destroyed."}; + +vector> hidden_unhidden = { + {wSecretPassageHHidden, wSecretPassageH}, + {wSecretPassageVHidden, wSecretPassageV}, + {wSecretPassageUHidden, wSecretPassageU}, + {wRogueWallHidden, wRogueWall} + }; + +vector> base_changed = { + {wDoor, wSmashedDoor} + }; + ruwall walls[qwall] = { {"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."}, {"spike", "^", 0xC08080FF, W_TRANS | W_PAIN | W_BLOCKBIRD, "Dangerous!"}, {"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."}, {"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."}, - {"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."}, {"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."}, {"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."}, {"right slope", "/", 0xFFFFFFFF, W_STABLE | W_SLOPE, "Slope here."}, {"left slope", "\\", 0xFFFFFFFF, W_STABLE | W_SLOPE, "Slope here."}, diff --git a/rogueviz/ru/load-world.cpp b/rogueviz/ru/load-world.cpp index b6d0f4ee..4d5288d7 100644 --- a/rogueviz/ru/load-world.cpp +++ b/rogueviz/ru/load-world.cpp @@ -51,7 +51,10 @@ void save_map(string fname) { for(int y=0; y> 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]; if(c == 0 && !code_used.count(walls[i].glyph[0])) c = walls[i].glyph[0]; if(c == 0) c = next_code++; @@ -66,7 +69,10 @@ void save_map(string fname) { for(int x=0; x> 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])); } println(f); @@ -140,8 +146,8 @@ void load_room(fhstream& f, cell *c) { string t = s.substr(2); if(s.size() < 3 || s[1] != ' ') err("load codes", s); for(int i=0; i> 3; - if(r == current_room && cc == wSecretPassage && r->at(x, y-1) == wWall) { - r->replace_block(x, y, wAir); - r->replace_block(x, y-1, wSecretPassage); + if(r == current_room && cc == wSecretPassageVHidden && r->fov[y+1][x] && r->fov[y-1][x]) { + r->replace_block(x, y, wSecretPassageV); + } + + 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)