Skip to content

Bird morph and refined Jazz/Lori copter behavior (#2)#141

Open
marcostocco wants to merge 2 commits into
deathkiller:masterfrom
marcostocco:bird-morph-new
Open

Bird morph and refined Jazz/Lori copter behavior (#2)#141
marcostocco wants to merge 2 commits into
deathkiller:masterfrom
marcostocco:bird-morph-new

Conversation

@marcostocco
Copy link
Copy Markdown

@marcostocco marcostocco commented May 14, 2026

This PR add Bird and BirdYellow as playable characters with flying, new animations, sounds, and a BirdYellow charge attack; new HUD icons.

The cheat "jjmorph" now can change the character in this order: Jazz->Spaz->Lori->BirdYellow->Frog->Bird.

BirdYellow has "charge" as attack. It does not harm, it only increase speed ("charge_ver" animation). The Charge animation is possible only if BirdYellow is moving.

Bird can fly and shoot. It shoots 2 bullet at time. Bird can use all the weapons available to the other characters.

Both Bird can fly in every direction, they slowly fall if jump button or "up" button is pressed.

This PR also reworked second-jump handling for Jazz/Lori using a buffered trigger approach, with an adjusted timing so copter does not visually overlap too early with jump frames.

This PR also add some missing animation for frog.

Summary by CodeRabbit

  • New Features

    • Two new playable bird morphs with unique animations, flight mechanics, and sounds
    • New HUD icons for bird characters and updated HUD behavior for BirdYellow (ammo hidden)
    • Bird morphs added to the character transformation/cheat cycle
    • Bird-specific weapon behavior (additional angled shot when descending)
  • Bug Fixes

    • Improved morph save/load positioning to avoid spawning inside geometry

Review Change Stack

new sugar rush animation for frog,
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8d9bf02f-4b36-4750-be19-a50515882020

📥 Commits

Reviewing files that changed from the base of the PR and between f50e249 and fab30f5.

📒 Files selected for processing (3)
  • Content/Metadata/Interactive/PlayerBirdYellow.res
  • Sources/Jazz2/Actors/Player.cpp
  • Sources/Jazz2/PlayerType.h
✅ Files skipped from review due to trivial changes (1)
  • Content/Metadata/Interactive/PlayerBirdYellow.res
🚧 Files skipped from review as they are similar to previous changes (2)
  • Sources/Jazz2/PlayerType.h
  • Sources/Jazz2/Actors/Player.cpp

📝 Walkthrough

Walkthrough

Adds two bird player morphs (Bird, BirdYellow) with flight/charging movement, new animations and sounds, HUD icons, checkpoint/morph integration, and related player state, physics, animation, and audio handling across game systems.

Changes

Bird Morph Gameplay System

Layer / File(s) Summary
Player type enum & helpers
Sources/Jazz2/PlayerType.h
Adds Bird and BirdYellow enum values and inline helpers: GetNextBaseMorphType(), IsBirdMorphType(), GetNextCheatMorphType() to extend morph sequencing and identify bird morphs.
Metadata & HUD assets
Content/Metadata/Interactive/PlayerBird.res, Content/Metadata/Interactive/PlayerBirdYellow.res, Content/Metadata/Interactive/PlayerFrog.res, Content/Metadata/UI/HUD.res
New bird animation & sound metadata files added; Frog metadata extended (SugarRush, EndOfLevel/Warp sounds); HUD animations CharacterBird and CharacterBirdYellow added.
Player state, helpers, and audio handles
Sources/Jazz2/Actors/Player.h, Sources/Jazz2/Actors/Player.cpp
Declares/initializes _pendingCopterFramesLeft, _birdFlySound, _birdPreviousAnimState, _birdIdleBaseY; adds OnAnimationFinished() override and helpers HasGroundBelowForBird() and UpdateSwimmingRotationAndAnimation(); ensures bird fly SFX lifecycle and audio cleanup.
Activation, metadata loading & morph transitions
Sources/Jazz2/Actors/Player.cpp, Sources/Jazz2/Actors/PlayerCorpse.cpp, Sources/Jazz2/Actors/Solid/PowerUpMorphMonitor.cpp
Activation now requests PlayerBird/PlayerBirdYellow metadata; corpse loading and morph monitor preload bird assets; MorphTo preserves world checkpoint Y across morphs, applies bird-specific physics resets, clears suspend/gravity/forces, and refactors morph smoke emission.
Movement, jump, copter & water behavior
Sources/Jazz2/Actors/Player.cpp
Introduces bird-specific movement branch in OnHandleMovement with flight/charging (BirdYellow gating), smooth velocity lerping, rotation/animation updates, and exclusions from ground-walk/pipe/tube logic; refactors jump/copter logic with _pendingCopterFramesLeft to defer/activate copter behavior; rewrites water handling to segregate frog vs non-frog/bird swimmers.
Animation selection & firing behavior
Sources/Jazz2/Actors/Player.cpp
Extends UpdateAnimation to handle bird composites/idle-bored indices, gates certain composites by input/ground checks, and updates firing logic: BirdYellow fire input is direction-gated and Bird firing may spawn an extra angled shot when descending.
Checkpoint, save/load, suspend & integration
Sources/Jazz2/Actors/Player.cpp, Sources/Jazz2/LevelHandler.cpp, Sources/Jazz2/UI/HUD.cpp
Adds GetCheckpointYOffsetForPlayerType() and per-type checkpoint adjustments; InitializeFromStream nudges birds to avoid tile overlap; CheckSuspendState and suspend assignment exclude birds; LevelHandler cheat morph cycle extended; HUD maps new character icons and excludes BirdYellow from weapon-ammo rendering.
sequenceDiagram
  participant Player as Player
  participant Movement as MovementSystem
  participant Animation as AnimationSystem
  participant Audio as AudioSystem
  participant Checkpoint as Checkpoint/Save

  Player->>Movement: Update (bird morph)
  activate Movement
  Movement->>Movement: Check ground below for bird
  Movement->>Movement: Normalize input / compute flight velocity
  alt BirdYellow charging
    Movement->>Movement: Apply charge gating & lerp to charge target
  else normal flight
    Movement->>Movement: Lerp to directional target
  end
  Movement->>Player: Return updated position/rotation
  deactivate Movement

  Player->>Animation: UpdateAnimation (select composites/idle)
  activate Animation
  alt descending + firing
    Animation->>Animation: Select shoot composite / spawn angled shot
  else in-flight idle/walk
    Animation->>Animation: Select flight idle/walk
  end
  Animation->>Player: Animation finished
  deactivate Animation

  Player->>Audio: OnAnimationFinished
  alt ground absent and appropriate state
    Audio->>Audio: Start bird fly SFX
  else stopped/grounded
    Audio->>Audio: Stop/clear bird fly SFX
  end

  Player->>Checkpoint: Save/Load
  activate Checkpoint
  alt saving
    Checkpoint->>Checkpoint: Apply morph-specific Y offset
  else loading
    Checkpoint->>Player: Nudge bird upward until clear
  end
  deactivate Checkpoint
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I flapped my paws and found some wings,
New birdy morphs and shiny things,
Yellow charges, twin-shot flare,
HUD icons cheering in the air,
Jazz2 sings — the rabbit springs! 🎵

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Bird morph and refined Jazz/Lori copter behavior (#2)' accurately reflects the main changes: it introduces bird morph gameplay (two new playable bird characters with animations, sounds, and mechanics) and refines Jazz/Lori copter behavior through improved second-jump handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

Copy link
Copy Markdown

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Content/Metadata/Interactive/PlayerBirdYellow.res`:
- Around line 51-54: The trailing comma after the "States" array in the "Shoot"
object causes JSON parse errors; remove the comma following the closing bracket
of the "States" property so the object becomes valid JSON (locate the "Shoot"
object and its "States" property in PlayerBirdYellow.res and delete the trailing
comma after the ]).

In `@Sources/Jazz2/Actors/Player.cpp`:
- Around line 2972-2975: The bird fly sound (_birdFlySound) is stopped only in
OnPerishInner() causing the sound loop to outlive the actor if the Player is
destroyed via other paths; ensure the destructor (~Player()) also stops and
clears _birdFlySound (call stop() and set to nullptr) and mirror this teardown
in any other non-death cleanup paths to prevent the loop from persisting beyond
the Player object's lifetime.

In `@Sources/Jazz2/PlayerType.h`:
- Around line 38-47: GetNextCheatMorphType currently implements the wrong cycle
order; update its switch mapping so the cheat morph sequence matches the PR
contract: Jazz -> Spaz -> Lori -> BirdYellow -> Frog -> Bird -> Jazz.
Concretely, keep PlayerType::Jazz -> Spaz and Spaz -> Lori, change
PlayerType::Lori to return PlayerType::BirdYellow, change PlayerType::BirdYellow
to return PlayerType::Frog, change PlayerType::Frog to return PlayerType::Bird,
and change PlayerType::Bird to return PlayerType::Jazz so the full cycle is
correct.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7cc5f267-9bf8-4543-9a31-4d912ec2c29b

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1a5c6 and f50e249.

📒 Files selected for processing (11)
  • Content/Metadata/Interactive/PlayerBird.res
  • Content/Metadata/Interactive/PlayerBirdYellow.res
  • Content/Metadata/Interactive/PlayerFrog.res
  • Content/Metadata/UI/HUD.res
  • Sources/Jazz2/Actors/Player.cpp
  • Sources/Jazz2/Actors/Player.h
  • Sources/Jazz2/Actors/PlayerCorpse.cpp
  • Sources/Jazz2/Actors/Solid/PowerUpMorphMonitor.cpp
  • Sources/Jazz2/LevelHandler.cpp
  • Sources/Jazz2/PlayerType.h
  • Sources/Jazz2/UI/HUD.cpp

Comment thread Content/Metadata/Interactive/PlayerBirdYellow.res
Comment thread Sources/Jazz2/Actors/Player.cpp
Comment thread Sources/Jazz2/PlayerType.h
@deathkiller
Copy link
Copy Markdown
Owner

Your changes in Player::UpdateAnimation seems to be quite complicated, is it necessary like this? For example if I remove line 2132-2133, it seems to work the same.

Yellow bird attack is still wrong - in the original, you need to have certain speed to trigger it, and the attack will boost the speed. Also in your implementation, when I'm flying and rapidly pressing attack, it's somehow glitching.

And bird speed seems to be slower than in the original.

Also it seems to me that there is wrong sound effect when shooting with red bird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants