From 5df98358c3fa5543ce78e8a6e6ad2d3ac68c5223 Mon Sep 17 00:00:00 2001 From: Ralph Caraveo Date: Thu, 31 Oct 2024 19:58:43 -0700 Subject: [PATCH] Adding additional clarifying comments on linkedlist.zig, fixed a minor effect key bug and added some additional logs to be like the original --- zsrc/linkedlist.zig | 2 ++ zsrc/res.zig | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zsrc/linkedlist.zig b/zsrc/linkedlist.zig index 0974346..3143e89 100644 --- a/zsrc/linkedlist.zig +++ b/zsrc/linkedlist.zig @@ -33,10 +33,12 @@ const tps = @import("types.zig"); // Phase 1: Just start off by storing a pointer to a nullable opaque type. // Original C-style ADT linked list has been deprecated in favor of this! +// This is complete! pub const GenericLL = std.DoublyLinkedList(?*anyopaque); pub const GenericNode = GenericLL.Node; // Phase 2: Break these out into type-safe individual linked lists. (maybe) +// Not started. // Need one for: *Animation // Need one for: *Bullet // Need one for: *Sprite diff --git a/zsrc/res.zig b/zsrc/res.zig index 82b1cc7..b24b01a 100644 --- a/zsrc/res.zig +++ b/zsrc/res.zig @@ -694,7 +694,8 @@ pub fn initCommonEffects() void { effects[0].keys[2] = death; death.r = 0; death.a = 0; - effects[0].keys[0] = death; + effects[0].keys[3] = death; + std.log.debug("Effect #0: Death (30frames) loaded", .{}); tps.initEffect(&effects[1], 30, 3, c.SDL_BLENDMODE_ADD); var blink: c.SDL_Color = .{ .r = 0, .g = 0, .b = 0, .a = 255 }; @@ -707,12 +708,14 @@ pub fn initCommonEffects() void { blink.g = 0; blink.b = 0; effects[1].keys[2] = blink; + std.log.debug("Effect #1: Blink (white) (30frames) loaded", .{}); tps.initEffect(&effects[2], 30, 2, c.SDL_BLENDMODE_BLEND); var vanish: c.SDL_Color = .{ .r = 255, .g = 255, .b = 255, .a = 255 }; effects[2].keys[0] = vanish; vanish.a = 0; effects[2].keys[1] = vanish; + std.log.debug("Effect #2: Vanish (30frames) loaded", .{}); } fn initCommonSprite(sprite: *spr.Sprite, weapon: *wp.Weapon, res_id: c_int, hp: c_int) void {