mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-08-27 16:02:19 +00:00
ru:: replace_block_frev
This commit is contained in:
parent
9b18175eba
commit
25f095d225
@ -136,6 +136,12 @@ struct room {
|
|||||||
place_block_full(x, y, b);
|
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 generate();
|
||||||
|
|
||||||
void reveal(int cx, int cy);
|
void reveal(int cx, int cy);
|
||||||
|
@ -111,11 +111,13 @@ void entity::apply_walls() {
|
|||||||
vel.y /= 2;
|
vel.y /= 2;
|
||||||
if(abs(vel.y) < 1e-6) vel.y = 0;
|
if(abs(vel.y) < 1e-6) vel.y = 0;
|
||||||
if(burning()) {
|
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();
|
else hit_wall();
|
||||||
}
|
}
|
||||||
if(freezing()) {
|
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();
|
else if(b != wFrozen) hit_wall();
|
||||||
}
|
}
|
||||||
if(pixel_to_block(get_pixel_bbox_at(where + vel)).maxy <= y) where.y += vel.y;
|
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(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(pixel_to_block(get_pixel_bbox_at(where + vel)).miny > y) where.y += vel.y;
|
||||||
if(burning()) {
|
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;
|
goto again;
|
||||||
}
|
}
|
||||||
@ -154,7 +156,7 @@ void entity::apply_walls() {
|
|||||||
if(walls[b].flags & W_BLOCK) {
|
if(walls[b].flags & W_BLOCK) {
|
||||||
if(freezing()) { hit_wall(); }
|
if(freezing()) { hit_wall(); }
|
||||||
if(burning()) {
|
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();
|
else hit_wall();
|
||||||
}
|
}
|
||||||
vel.x = (vel.x - max<ld>(vel.y, 0)/10) / 2;
|
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(walls[b].flags & W_BLOCK) {
|
||||||
if(freezing()) { hit_wall(); }
|
if(freezing()) { hit_wall(); }
|
||||||
if(burning()) {
|
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();
|
else hit_wall();
|
||||||
}
|
}
|
||||||
vel.x = (vel.x + max<ld>(vel.y, 0)/10) / 2;
|
vel.x = (vel.x + max<ld>(vel.y, 0)/10) / 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user