Skip to content

Conversation

@LiquidityC
Copy link
Member

@LiquidityC LiquidityC commented Oct 10, 2025

Also updates sound for vampiric blow and modified the timer for the
sword animation.

These seem a bit off though...

Summary by CodeRabbit

  • New Features

    • Added an additional in-game sound effect.
  • Improvements

    • Sword swing animation uses longer frame durations for smoother motion.
    • Skills gain new animation settings (positional offsets and "on-player" rendering).
    • Skill visuals and tooltips are now camera-aware for consistent on-screen presentation.
    • Some skill audio/visual hookups updated to use the new effect and animation flow.
@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

Adds a new SUCK sound effect to the mixer and updates the Fx enum. Makes several skill constructors camera-aware, exposes per-skill animation_properties (offset, on_player), updates skill creation to pass Camera, and changes player skill animation placement and sword frame timing.

Changes

Cohort / File(s) Summary
Audio: Mixer effect addition
src/mixer.c, src/mixer.h
Adds SUCK to the Fx enum, updates LAST_EFFECT, and loads Sounds/FX/suck.wav during effect initialization.
Skills API: Camera-aware constructors & properties
src/skill.c, src/skill.h
Changes create_vampiric_blow, create_backstab, and create_erupt to accept Camera *cam. Adds animation_properties (Position offset, bool on_player) to Skill_t, and wires camera into per-skill tooltip/animation setup.
Player animation behavior
src/player.c
In use_skill, conditionally position skill animation using on_player vs. sword animation, then apply animation_properties.offset. In build_sword_animation, increases sword frame durations from 20 to 50.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Player
  participant PlayerLogic as Player Logic
  participant Skill as Skill (animation_properties)
  participant Camera as Camera
  participant Mixer as Mixer

  rect rgba(230,245,255,0.6)
    note right of Skill: Creation (camera-aware)
    PlayerLogic->>Skill: create_* (Camera*)
    Skill-->>Camera: use renderer for tooltip/animation init
  end

  rect rgba(240,255,240,0.6)
    note right of PlayerLogic: Skill use flow
    Player->>PlayerLogic: use_skill(skill)
    PlayerLogic->>Skill: read animation_properties
    alt on_player == true
      PlayerLogic->>PlayerLogic: pos = player sprite position
    else on_player == false
      PlayerLogic->>PlayerLogic: pos = sword animation position/orientation
    end
    PlayerLogic->>PlayerLogic: pos += animation_properties.offset
    PlayerLogic->>Mixer: play effect (e.g., SUCK)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

Hop-hop I tweak and thrum,
SUCK joins the chorus, beat of drum. 🔊
Camera guides each skill’s display,
Offsets nudge the frames that play.
Sword slows its swing — a gentler hum. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly summarizes the primary change by stating that new backstab, erupt, and vampiric blow animations are being added, which aligns with the main purpose of the pull request and omits less critical details like sound and timing tweaks.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch more_animations

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0600108 and a50401f.

📒 Files selected for processing (2)
  • src/player.c (2 hunks)
  • src/skill.c (11 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/player.c
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-10T20:25:20.892Z
Learnt from: LiquidityC
PR: Oliveshark/breakhack#141
File: src/skill.c:343-346
Timestamp: 2025-10-10T20:25:20.892Z
Learning: In the vampiric_blow_skill function in src/skill.c, the SUCK sound effect should play on every vampiric blow attempt, even on misses. This is an intentional design decision for audio feedback.

Applied to files:

  • src/skill.c
🧬 Code graph analysis (1)
src/skill.c (3)
src/mixer.c (1)
  • mixer_play_effect (191-202)
src/tooltip.c (1)
  • tooltip_create (122-129)
src/animation.c (3)
  • animation_create (25-37)
  • animation_load_texture (39-43)
  • animation_set_frames (88-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Analyze (c-cpp)
🔇 Additional comments (5)
src/skill.c (5)

311-312: LGTM!

Sensible default values for the new animation_properties fields. Skills can override these as needed (e.g., erupt sets custom values).


395-406: Verify the animation timing feels right.

The vampiric blow animation uses 120ms per frame (total ~720ms), which is significantly slower than similar skills like flurry (20ms per frame) or bash (20ms per frame). This could be intentional for a dramatic effect, but given your note that changes "seem a bit off," the timing might need adjustment.

Consider testing the animation in-game to confirm the speed feels appropriate. If it's too slow, reducing the frame duration to 60-80ms might feel more responsive.


740-758: Verify the animation timing feels right.

The backstab animation uses 100ms per frame (total ~900ms), making it one of the longer skill animations. Similar to vampiric blow, this might be intentionally dramatic, but could also contribute to the "off" feeling you mentioned.

Test the animation timing in-game. If it feels sluggish, consider reducing frame duration to 60-80ms for better responsiveness.


1084-1102: LGTM!

The erupt animation setup is well-configured:

  • Larger sprite dimension (96x96) is appropriate for an area-of-effect skill
  • Offset of (-32, -32) correctly centers the 96x96 animation on the 32x32 player tile
  • on_player = true ensures the animation follows the player position
  • Variable frame timing (80ms then 100ms for the last two frames) creates a nice "hold" effect at the end of the explosion

1115-1115: LGTM!

Correctly passes the camera parameter to the updated skill constructors for vampiric blow, erupt, and backstab.

Also applies to: 1130-1130, 1144-1144


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Also updates sound for vampiric blow and modified the timer for the
sword animation.

These seem a bit off though...
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/skill.c (1)

1070-1104: Erupt animation pivot likely miscentered

Rotation point for a 64x64 clip should be center (32,32). Using {64,64} sets pivot to bottom-right and can skew placement when rotation is applied. Offset looks right for 96x96 scaling.

 a->sprite->clip = (SDL_Rect) { 0, 0, 64, 64 };
- a->sprite->rotationPoint = (SDL_Point) { 64, 64 };
+ a->sprite->rotationPoint = (SDL_Point) { 32, 32 };
🧹 Nitpick comments (3)
src/skill.h (1)

71-73: Ensure Camera is forward‑declared to keep header self‑contained

skill_create now references Camera*. Add a forward declaration here to avoid include-order surprises.

 typedef struct Player Player;
+typedef struct Camera Camera;
 
 Skill*
 skill_create(enum SkillType, Camera *cam);
src/player.c (1)

493-505: Reset angle/flip when rendering on player to avoid stale orientation

If on_player, previous angle/flip may bleed over between uses. Reset explicitly.

-    if (skill->animation_properties.on_player) {
-      a->sprite->pos = player->sprite->pos;
+    if (skill->animation_properties.on_player) {
+      a->sprite->pos = player->sprite->pos;
+      a->sprite->angle = 0;
+      a->sprite->flip = SDL_FLIP_NONE;
src/skill.c (1)

724-759: Backstab animation: check alignment; consider explicit offset

Depending on sheet art, you may need a small offset to match the swapped position. Test in-game and set animation_properties.offset if misaligned.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67d8f3d and 0600108.

⛔ Files ignored due to path filters (4)
  • assets/Extras/AcidSplash.png is excluded by !**/*.png
  • assets/Extras/BackStab.png is excluded by !**/*.png
  • assets/Extras/VampiricBlow.png is excluded by !**/*.png
  • assets/Sounds/FX/suck.wav is excluded by !**/*.wav
📒 Files selected for processing (5)
  • src/mixer.c (1 hunks)
  • src/mixer.h (1 hunks)
  • src/player.c (2 hunks)
  • src/skill.c (11 hunks)
  • src/skill.h (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/skill.c (3)
src/mixer.c (1)
  • mixer_play_effect (191-202)
src/tooltip.c (1)
  • tooltip_create (122-129)
src/animation.c (3)
  • animation_create (25-37)
  • animation_load_texture (39-43)
  • animation_set_frames (88-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Mac (Clang)
🔇 Additional comments (8)
src/skill.h (1)

65-69: animation_properties addition: LGTM

Clear defaultable fields for positioning. No issues spotted.

src/player.c (1)

585-590: Sword swing slowed (20 → 50 ms): confirm intended pacing

This lengthens the swing by 2.5x and may feel sluggish. Confirm this is deliberate or consider 30–40 ms for responsiveness, or make it a constant.

src/skill.c (4)

311-313: Good defaults for animation_properties

Sane zero offset and target-anchored rendering by default.


382-411: Vampiric blow animation wiring: OK

Camera-aware ctor, frames, and non-loop setup look correct.

Visually verify alignment with sword swing in all four directions (no offset set). Adjust skill->animation_properties.offset if it appears a few pixels off.


1102-1104: Nice: on_player and offset set for erupt

This matches a centered AoE. Keep this pattern for future on-player effects.


1116-1146: Camera-aware skill_create calls: OK

Signatures and usage are consistent.

src/mixer.c (1)

112-114: SUCK effect: asset and usage verified

assets/Sounds/FX/suck.wav exists and mixer_play_effect(SUCK) is invoked in src/skill.c.

src/mixer.h (1)

74-82: No numeric coupling detected; safe to insert SUCK enum value

@LiquidityC LiquidityC enabled auto-merge (squash) October 10, 2025 20:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/skill.c (3)

382-411: Vampiric blow: camera-aware constructor and animation — please verify asset and timing

Construction flow and 6-frame animation wiring look correct. Two quick checks:

  • Verify Extras/VampiricBlow.png exists and loads.
  • 120 ms/frame may feel slow (total ~720 ms). If pacing feels off, try 60–90 ms.

724-759: Backstab animation added — consider tuning frame duration

Frames are set to 100 ms (total ~900 ms). If it feels sluggish, consider 60–80 ms to better match a snappy stab.


1070-1103: Erupt animation placement OK; add rotationPoint for consistency

Nice use of on_player=true with a centering offset and scaled dim. To keep transforms centered (future rotations/scales), set the sprite rotationPoint to the frame center.

Apply this diff:

 a->sprite->clip = (SDL_Rect) { 0, 0, 64, 64 };
+ a->sprite->rotationPoint = (SDL_Point) { 32, 32 };
 skill->animation_properties.offset = POS(-32, -32);
 skill->animation_properties.on_player = true;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0600108 and 74cf5e6.

📒 Files selected for processing (1)
  • src/skill.c (11 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-10T20:25:20.892Z
Learnt from: LiquidityC
PR: Oliveshark/breakhack#141
File: src/skill.c:343-346
Timestamp: 2025-10-10T20:25:20.892Z
Learning: In the vampiric_blow_skill function in src/skill.c, the SUCK sound effect should play on every vampiric blow attempt, even on misses. This is an intentional design decision for audio feedback.

Applied to files:

  • src/skill.c
🧬 Code graph analysis (1)
src/skill.c (3)
src/mixer.c (1)
  • mixer_play_effect (191-202)
src/tooltip.c (1)
  • tooltip_create (122-129)
src/animation.c (3)
  • animation_create (25-37)
  • animation_load_texture (39-43)
  • animation_set_frames (88-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Windows (MSVC)
🔇 Additional comments (3)
src/skill.c (3)

311-313: Default animation_properties initialization looks good

Zero-offset and on_player=false as defaults are sensible. Confirm upstream code in use_skill respects these defaults as “target-tile” placement when on_player=false.


343-346: Intentional SUCK audio on every attempt

Playing SUCK before hit check matches the stated design (audio even on miss). No change requested.

Based on learnings


1115-1115: skill_create call sites correctly updated with Camera
Verified all invocations pass cam.

@LiquidityC LiquidityC merged commit d530239 into dev Oct 10, 2025
9 checks passed
@LiquidityC LiquidityC deleted the more_animations branch October 10, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants