Merge branch 'master' into keybind

This commit is contained in:
CJ van den Berg 2024-12-03 19:56:07 +01:00
commit 9c476c4d10
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 12 additions and 12 deletions

View file

@ -30,8 +30,8 @@
.hash = "122019f077d09686b1ec47928ca2b4bf264422f3a27afc5b49dafb0129a4ceca0d01", .hash = "122019f077d09686b1ec47928ca2b4bf264422f3a27afc5b49dafb0129a4ceca0d01",
}, },
.vaxis = .{ .vaxis = .{
.url = "https://github.com/neurocyte/libvaxis/archive/352fa9c89d6339325b9f851b9a27e62ec79ba33c.tar.gz", .url = "https://github.com/neurocyte/libvaxis/archive/ffe35b4342bd2913efd46c35c0ccd15544ac87e6.tar.gz",
.hash = "1220e604b723781b4a306db5801eee419a689b4d470232a1bacc525f45f00d455b1a", .hash = "12202ee9842d28927674e552f1ea41e2c41e59f6b4b5d290de9b6fd626fd332ac627",
}, },
.zeit = .{ .zeit = .{
.url = "https://github.com/rockorager/zeit/archive/9cca8ec620a54c3b07cd249f25e5bcb3153d03d7.tar.gz", .url = "https://github.com/rockorager/zeit/archive/9cca8ec620a54c3b07cd249f25e5bcb3153d03d7.tar.gz",

View file

@ -233,12 +233,12 @@ const Fire = struct {
//scope cache - spread fire //scope cache - spread fire
spread_px: u8 = 0, spread_px: u8 = 0,
spread_rnd_idx: u8 = 0, spread_rnd_idx: u8 = 0,
spread_dst: u16 = 0, spread_dst: usize = 0,
FIRE_H: u16, FIRE_H: u16,
FIRE_W: u16, FIRE_W: u16,
FIRE_SZ: u16, FIRE_SZ: usize,
FIRE_LAST_ROW: u16, FIRE_LAST_ROW: usize,
screen_buf: []u8, screen_buf: []u8,
@ -259,12 +259,12 @@ const Fire = struct {
}), }),
.FIRE_H = FIRE_H, .FIRE_H = FIRE_H,
.FIRE_W = FIRE_W, .FIRE_W = FIRE_W,
.FIRE_SZ = FIRE_H * FIRE_W, .FIRE_SZ = @as(usize, @intCast(FIRE_H)) * FIRE_W,
.FIRE_LAST_ROW = (FIRE_H - 1) * FIRE_W, .FIRE_LAST_ROW = @as(usize, @intCast(FIRE_H - 1)) * FIRE_W,
.screen_buf = try allocator.alloc(u8, FIRE_H * FIRE_W), .screen_buf = try allocator.alloc(u8, @as(usize, @intCast(FIRE_H)) * FIRE_W),
}; };
var buf_idx: u16 = 0; var buf_idx: usize = 0;
while (buf_idx < self.FIRE_SZ) : (buf_idx += 1) { while (buf_idx < self.FIRE_SZ) : (buf_idx += 1) {
self.screen_buf[buf_idx] = fire_black; self.screen_buf[buf_idx] = fire_black;
} }
@ -294,7 +294,7 @@ const Fire = struct {
while (doFire_x < self.FIRE_W) : (doFire_x += 1) { while (doFire_x < self.FIRE_W) : (doFire_x += 1) {
var doFire_y: u16 = 0; var doFire_y: u16 = 0;
while (doFire_y < self.FIRE_H) : (doFire_y += 1) { while (doFire_y < self.FIRE_H) : (doFire_y += 1) {
const doFire_idx: u16 = doFire_y * self.FIRE_W + doFire_x; const doFire_idx = @as(usize, @intCast(doFire_y)) * self.FIRE_W + doFire_x;
//spread fire //spread fire
self.spread_px = self.screen_buf[doFire_idx]; self.spread_px = self.screen_buf[doFire_idx];
@ -333,8 +333,8 @@ const Fire = struct {
//each character rendered is actually to rows of 'pixels' //each character rendered is actually to rows of 'pixels'
// - "hi" (current px row => fg char) // - "hi" (current px row => fg char)
// - "low" (next row => bg color) // - "low" (next row => bg color)
const px_hi = self.screen_buf[frame_y * self.FIRE_W + frame_x]; const px_hi = self.screen_buf[@as(usize, @intCast(frame_y)) * self.FIRE_W + frame_x];
const px_lo = self.screen_buf[(frame_y + 1) * self.FIRE_W + frame_x]; const px_lo = self.screen_buf[@as(usize, @intCast(frame_y + 1)) * self.FIRE_W + frame_x];
self.plane.set_fg_palindex(fire_palette[px_hi]) catch {}; self.plane.set_fg_palindex(fire_palette[px_hi]) catch {};
self.plane.set_bg_palindex(fire_palette[px_lo]) catch {}; self.plane.set_bg_palindex(fire_palette[px_lo]) catch {};