Skip to content

Commit

Permalink
fix: UI: artifacts after death animation
Browse files Browse the repository at this point in the history
  • Loading branch information
kiedtl committed Sep 7, 2023
1 parent e13fee5 commit 460627a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/state.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const GeneratorCtx = @import("generators.zig").GeneratorCtx;
pub const GameState = union(enum) { Game, Win, Lose, Quit, Viewer };
pub const Layout = union(enum) { Unknown, Room: usize };

pub const HEIGHT = 110;
pub const WIDTH = 50;
pub const HEIGHT = 80;
pub const WIDTH = 40;
pub const LEVELS = 14; //21;
pub const PLAYER_STARTING_LEVEL = 13; //19; // TODO: define in data file

Expand Down
2 changes: 1 addition & 1 deletion src/surfaces.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ pub const Shrine = Machine{
return false;
}

state.player.max_MP += if (state.player.hasStatus(.Absorbing)) 5 else 2;
state.player.max_MP += if (state.player.hasStatus(.Absorbing)) @as(usize, 5) else 2;
const total = rng.range(usize, state.player.max_MP / 2, state.player.max_MP * 15 / 10);
const pot = @intCast(usize, state.player.stat(.Potential));
const amount = player.calculateDrainableMana(total);
Expand Down
8 changes: 5 additions & 3 deletions src/ui.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4759,7 +4759,7 @@ pub fn animationDeath(ctx: *GeneratorCtx(void), self: *Console) void {

var i: usize = 0;
var z: isize = @intCast(isize, pdc.distance(Coord.new(self.width, self.height / 2)));
const m = math.max(self.width - pdc.x, self.height - pdc.y) * 3;
const m = math.max(self.width - pdc.x, self.height - pdc.y) * 15 / 10;
while (i < m) : (i += 1) {
var farthest_ray: usize = 0;
for (rays.slice()) |*ray, angle| {
Expand Down Expand Up @@ -4795,9 +4795,10 @@ pub fn animationDeath(ctx: *GeneratorCtx(void), self: *Console) void {

const cell = self.getCell(x, y);

if (Coord.new(x, y).distance(pdc) < 3) {
if (Coord.new(x, y).distance(pdc) < 2) {
ray.dead = true;
self.setCell(x, y, .{ .trans = true });
self.setCell(x, y, .{ .trans = true, .fl = .{ .wide = cell.fl.wide } });
if (cell.fl.wide) self.setCell(x, y, .{ .fl = .{ .skip = true } });
} else if (!cell.fl.skip) {
ray.c.trans = false;
if ((ray.c.bg == colors.BG or rng.percent(33)) and cell.bg != colors.BG) {
Expand Down Expand Up @@ -4855,6 +4856,7 @@ pub fn animationDeath(ctx: *GeneratorCtx(void), self: *Console) void {
ctx.yield({});
}

self.clearTo(.{ .trans = true });
ctx.finish();
}

Expand Down

0 comments on commit 460627a

Please sign in to comment.