Skip to content

Commit

Permalink
Adding additional clarifying comments on linkedlist.zig, fixed a mino…
Browse files Browse the repository at this point in the history
…r effect key bug and added some additional logs to be like the original
  • Loading branch information
deckarep committed Nov 1, 2024
1 parent e646018 commit 5df9835
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions zsrc/linkedlist.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion zsrc/res.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -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 {
Expand Down

0 comments on commit 5df9835

Please sign in to comment.