1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-26 15:32:19 +00:00

ru:: replace_block_frev

This commit is contained in:
Zeno Rogue 2025-05-24 17:13:21 +02:00
parent 9b18175eba
commit 25f095d225
2 changed files with 13 additions and 5 deletions

View File

@ -136,6 +136,12 @@ struct room {
place_block_full(x, y, b);
}
void replace_block_frev(int x, int y, eWall w) {
auto orig = at(x, y);
replace_block(x, y, w);
add_revert(fountain_revert, [this, x, y, orig] { replace_block(x, y, orig); });
}
void generate();
void reveal(int cx, int cy);

View File

@ -111,11 +111,13 @@ void entity::apply_walls() {
vel.y /= 2;
if(abs(vel.y) < 1e-6) vel.y = 0;
if(burning()) {
if(b == wWoodWall) current_room->replace_block(x, y, wAir);
if(b == wWoodWall)
current_room->replace_block_frev(x, y, wAir);
else hit_wall();
}
if(freezing()) {
if(b == wWater) current_room->replace_block(x, y, wFrozen);
if(b == wWater)
current_room->replace_block_frev(x, y, wFrozen);
else if(b != wFrozen) hit_wall();
}
if(pixel_to_block(get_pixel_bbox_at(where + vel)).maxy <= y) where.y += vel.y;
@ -134,7 +136,7 @@ void entity::apply_walls() {
if(abs(vel.y) < 1e-6) vel.y = 0;
if(pixel_to_block(get_pixel_bbox_at(where + vel)).miny > y) where.y += vel.y;
if(burning()) {
if(b == wWoodWall) current_room->replace_block(x, y, wAir);
if(b == wWoodWall) current_room->replace_block_frev(x, y, wAir);
}
goto again;
}
@ -154,7 +156,7 @@ void entity::apply_walls() {
if(walls[b].flags & W_BLOCK) {
if(freezing()) { hit_wall(); }
if(burning()) {
if(b == wWoodWall) current_room->replace_block(x, y, wAir);
if(b == wWoodWall) current_room->replace_block_frev(x, y, wAir);
else hit_wall();
}
vel.x = (vel.x - max<ld>(vel.y, 0)/10) / 2;
@ -169,7 +171,7 @@ void entity::apply_walls() {
if(walls[b].flags & W_BLOCK) {
if(freezing()) { hit_wall(); }
if(burning()) {
if(b == wWoodWall) current_room->replace_block(x, y, wAir);
if(b == wWoodWall) current_room->replace_block_frev(x, y, wAir);
else hit_wall();
}
vel.x = (vel.x + max<ld>(vel.y, 0)/10) / 2;