From 997467805a75602bac3849c93e782c4033fef0d6 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 2 Sep 2026 22:00:49 +0200 Subject: [PATCH] ru:: slippery/icy walls and platforms --- rogueviz/ru/classes.cpp | 3 ++- rogueviz/ru/entity.cpp | 13 +++++++++++-- rogueviz/ru/globals.cpp | 12 +++++++++--- rogueviz/ru/man.cpp | 9 +++++++-- rogueviz/ru/map.ru | 12 +++++++----- rogueviz/ru/randeff.cpp | 20 ++++++++++++++++++++ 6 files changed, 56 insertions(+), 13 deletions(-) diff --git a/rogueviz/ru/classes.cpp b/rogueviz/ru/classes.cpp index fb979097..a1b6fa75 100644 --- a/rogueviz/ru/classes.cpp +++ b/rogueviz/ru/classes.cpp @@ -315,7 +315,8 @@ struct entity { virtual double grav() { return 0.1; } - bool on_floor, fallthru, on_ice, wallhug, on_bounce, is_stable; + bool on_floor, fallthru, wallhug, on_bounce, is_stable; + int on_ice; bool destroyed; void kino(); diff --git a/rogueviz/ru/entity.cpp b/rogueviz/ru/entity.cpp index dbc1c77e..402ec524 100644 --- a/rogueviz/ru/entity.cpp +++ b/rogueviz/ru/entity.cpp @@ -149,17 +149,26 @@ void entity::apply_walls() { apply_grav(); apply_grav(); if(vel.y > 0) vel.y = 0; on_bounce = true; goto again; } on_floor = true; - if(walls[b].flags & W_FROZEN) on_ice = true; + if(walls[b].flags & W_FROZEN) on_ice = 2; + if(walls[b].flags & W_SLIPPERY) on_ice = max(on_ice, 1); vel.y /= 2; if(abs(vel.y) < 1e-6) vel.y = 0; if(burning()) { if(b == wWoodWall) current_room->replace_block_frev(x, y, wAir); + else if(b == wIcyWall) + current_room->replace_block_frev(x, y, wWetWall); + else if(b == wIcyPlatform) + current_room->replace_block_frev(x, y, wWetPlatform); else hit_wall(); } if(freezing()) { if(b == wWater) current_room->replace_block_frev(x, y, wFrozen); + else if(b == wWetPlatform) + current_room->replace_block_frev(x, y, wIcyPlatform); + else if(b == wWetWall) + current_room->replace_block_frev(x, y, wIcyWall); else if(b != wFrozen) hit_wall(); } if(pixel_to_block(get_pixel_bbox_at(where + vel)).maxy <= y) where.y += vel.y; @@ -352,7 +361,7 @@ void entity::kill_off_screen() { void entity::kino() { on_floor = false; - on_ice = false; + on_ice = 0; wallhug = false; on_bounce = false; is_stable = false; diff --git a/rogueviz/ru/globals.cpp b/rogueviz/ru/globals.cpp index d6a0fe59..0813a18c 100644 --- a/rogueviz/ru/globals.cpp +++ b/rogueviz/ru/globals.cpp @@ -67,6 +67,7 @@ enum eWall { wBottomSpike, wRogueWallHidden, wRogueWall, wRightSlope, wLeftSlope, wLeftSlopedRoof, wRightSlopedRoof, wWeakWall, wStrangeSign, wWalkSpikes, wHyperBouncy, wArenaDoor, wGlassWall, + wWetWall, wIcyWall, wWetPlatform, wIcyPlatform, wGUARD }; flagtype W_BLOCK = 1; @@ -82,6 +83,7 @@ flagtype W_DOWNWARD = 512; flagtype W_SLOPE = 1024; flagtype W_PAIN_DOWN = 2048; flagtype W_HYPERBOUNCY = 4096; +flagtype W_SLIPPERY = 8192; constexpr int qwall = int(wGUARD); @@ -103,8 +105,8 @@ ruwall walls[qwall] = { r_wall, {"bouncy wall", "#", 'B', 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."}, - {"frozen water", "#", 'F', 0xC0C0FFFF, W_BLOCK | W_FROZEN, "Water magically turned into a slippery wall."}, + {"water", "~", '~', 0x0000FFFF, W_TRANS | W_BLOCKBIRD, "Not used yet."}, + {"frozen water", "#", 'F', 0xC0C0FFFF, W_BLOCK | W_FROZEN, "Water magically turned into a very slippery wall."}, {"door", "+", '+', 0xC06000FF, W_BLOCK, "Attack the doors with your weapon to open them."}, {"smashed door", "'", '?', 0xC06000FF, W_TRANS, "This door has been already opened."}, {"locked door", "+", 'L', 0xA05000FF, W_BLOCK, "What is behind this door is not your business."}, @@ -138,7 +140,11 @@ ruwall walls[qwall] = { {"walkable spikes", "|", 'w', 0xC08080FF, W_TRANS | W_PAIN_DOWN, "You can walk through these spikes, but falling into them would hurt."}, {"hyper-bouncy wall", "#", 'H', 0xC04040FF, W_BLOCK | W_BOUNCY | W_HYPERBOUNCY, "Like walls, but things really bounce off them."}, {"arena door", "+", 'A', 0x50A000FF, W_BLOCK, "You need to defeat all monsters here to open this door."}, - {"glass wall", "#", 'G', 0xA0A0FFFF, W_BLOCK | W_STABLE | W_TRANS, "This wall is tough, but transparent."} + {"glass wall", "#", 'G', 0xA0A0FFFF, W_BLOCK | W_STABLE | W_TRANS, "This wall is tough, but transparent."}, + {"wet wall", "#", 'W', 0x404080FF, W_BLOCK | W_SLIPPERY, "This wall is wet. Be careful!"}, + {"icy wall", "#", 'I', 0xD0D0FFFF, W_BLOCK | W_FROZEN, "This wall is covered with ice. Be very careful!"}, + {"wet platform", "-", 'x', 0x404080FF, W_PLATFORM | W_TRANS | W_BLOCKBIRD | W_SLIPPERY, "This wall is wet. Be careful!"}, + {"icy platform", "-", 'j', 0xD0D0FFFF, W_PLATFORM | W_TRANS | W_BLOCKBIRD | W_SLIPPERY, "This wall is covered with ice. Be very careful!"}, }; int sel = 1; diff --git a/rogueviz/ru/man.cpp b/rogueviz/ru/man.cpp index 8f885833..54518696 100644 --- a/rogueviz/ru/man.cpp +++ b/rogueviz/ru/man.cpp @@ -141,8 +141,13 @@ void man::act() { if(next.hallucinating && !current.hallucinating) prepare_hallucination(); - if((on_floor || current.jump_control || wallhug) && !on_ice) { - vel.x = zero_vel.x + dat.dx * dat.d * dat.modv * 2.5; + if(on_floor || current.jump_control || wallhug) { + if(on_ice == 0) { + vel.x = zero_vel.x + dat.dx * dat.d * dat.modv * 2.5; + } + if(on_ice == 1) { + vel.x = lerp(vel.x, zero_vel.x + dat.dx * dat.d * dat.modv * 2.5, 10. / game_fps); + } } if(on_bounce) { diff --git a/rogueviz/ru/map.ru b/rogueviz/ru/map.ru index 7cc36d1c..839e166f 100644 --- a/rogueviz/ru/map.ru +++ b/rogueviz/ru/map.ru @@ -1737,6 +1737,8 @@ ROOM Swinging Rope Room - platform . air ^ spike +i icy wall +w wet wall MAP ##################################.......####################################### ################################...........##################################### @@ -1744,18 +1746,18 @@ MAP ####..............................................^.........................#### ####..............^.........................................................#### ####........................................................................#### -########...........................................................############# +####iiii...........................................................iiii######### ####........................................................................#### ..##........................................................................#### ..##........................................................................#### ..##........................................................................#### ..##........................................................................#### --##..................................................................^^....#### --b.................................................................############# +-b.................................................................iii########## ................................................................................ ................................................................................ ####............................................................................ -####................................................................############ +####................................................................iiii######## ####........................................................................#### ####........................................................................#### ####................^.......................................................#### @@ -1774,8 +1776,8 @@ MAP ####........................................................................#### ####........................................................................#### #b#b........................................................................#b#b -################################################################################ -#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b +##########################iiiiii##########wwwwwwww############################## +#b#b#b#b#b#b#b#b#b#b#b#b#bibibib#b#b#b#b#bwbwbwbwb#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b ################################################################################ #b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b#b ROPE 300 0 0.7 50 5 0 60 diff --git a/rogueviz/ru/randeff.cpp b/rogueviz/ru/randeff.cpp index a5896328..34f10b0a 100644 --- a/rogueviz/ru/randeff.cpp +++ b/rogueviz/ru/randeff.cpp @@ -206,6 +206,18 @@ randeff fire_weapon("Fiery Weapon", "Attacks with your [weapon] set things on fi current_room->replace_block_frev(x, y, wAir); addMessage("You burn the wall!"); } + if(b == wFrozen) { + current_room->replace_block_frev(x, y, wWater); + addMessage("You melt the ice!"); + } + if(b == wIcyPlatform) { + current_room->replace_block_frev(x, y, wWetPlatform); + addMessage("You melt the ice on the platform!"); + } + if(b == wIcyWall) { + current_room->replace_block_frev(x, y, wWetWall); + addMessage("You melt the ice on the wall!"); + } } }); }); @@ -226,6 +238,14 @@ randeff ice_weapon("Chill Weapon", "Attacks with your [weapon] freeze things.", current_room->replace_block_frev(x, y, wFrozen); addMessage("You freeze the water!"); } + if(b == wWetPlatform) { + current_room->replace_block_frev(x, y, wIcyPlatform); + addMessage("You freeze the platform!"); + } + if(b == wWetWall) { + current_room->replace_block_frev(x, y, wIcyWall); + addMessage("You freeze the wall!"); + } } }); });