SSBM Decomp
Loading...
Searching...
No Matches
itflipper.c File Reference
#include "itflipper.h"
#include <math.h>
#include <melee/ft/ftlib.h>
#include <melee/it/inlines.h>
#include <melee/it/it_26B1.h>
#include <melee/it/it_2725.h>
#include <melee/it/it_3F14.h>
#include <melee/it/item.h>
#include <melee/it/itgroundcoll.h>
#include <melee/it/ithitbox.h>
#include <melee/lb/lb_00B0.h>
#include <melee/lb/lbcollision.h>
#include <melee/lb/lbvector.h>

Functions

HSD_GObjitFlipper_Spawn (HSD_JObj *jobj)
 Spawns a flipper pinned to a stage joint jobj (Break-the-Targets obstacles): stores it in xDEC_stageAnchor, sets xDE8_isStageFixed, and settles it.
void itFlipper_Spawned (Item_GObj *gobj)
 Logic-20 spawn callback: zero-initializes the itemVars and enters the falling state.
void itFlipper_UpdateSpin (Item_GObj *gobj)
 Advances the paddle spin one frame: decays xDE4_spinVel toward 0, adds it into xDE0_spinAngle, and applies that as an X rotation.
void itFlipper_AddSpinImpulse (Item_GObj *gobj, Vec3 *pos, f32 vel)
 Adds a spin impulse directed by the contact point pos, clamped to +/- x24_maxSpinVel.
static f32 itFlipper_SpinSpeedFromFighter (Item_GObj *gobj, HSD_GObj *fighter, Vec3 *pos, Vec3 *vel)
static void itFlipper_SpinFromFighter_inline (Item_GObj *gobj, Vec3 *vel, Vec3 *pos, f32 speed)
void itFlipper_SpinFromFighter (Item_GObj *gobj)
 Derives the spin impulse from the striking fighter's speed and applies it via itFlipper_AddSpinImpulse(), reading the fighter from xCF4_fighterGObjUnk (the dealt-damage side).
static void itFlipper_Repel_inline (Item_GObj *gobj, s32 kind, Vec3 *pos, Vec3 *vec)
void itFlipper_Repel (Item_GObj *gobj, s32 kind, Vec3 *pos)
 Pushes the flipper away from pos with a fixed 0.2 impulse, only when kind is It_Kind_Flipper (0x14).
void itFlipper_EnterResting (Item_GObj *gobj)
 Resets the flipper's velocity and enters the resting state (motion state 0).
bool itFlipper_Resting_Anim (Item_GObj *gobj)
 Animate callback for the resting state (motion state 0).
void itFlipper_Resting_Phys (Item_GObj *gobj)
 Physics callback for the resting state (motion state 0).
bool itFlipper_Resting_Coll (Item_GObj *gobj)
 Collision callback for the resting state (motion state 0): falls again if the ground vanishes.
void itFlipper_EnterFalling (Item_GObj *gobj)
 Enters the falling state (motion state 1).
bool itFlipper_Falling_Anim (Item_GObj *gobj)
 Animate callback for the falling state (motion state 1).
void itFlipper_Falling_Phys (Item_GObj *gobj)
 Physics callback for the falling state (motion state 1): applies gravity toward terminal speed.
bool itFlipper_Falling_Coll (Item_GObj *gobj)
 Collision callback for the falling state (motion state 1): rests on landing.
void itFlipper_PickedUp (Item_GObj *gobj)
 Logic-20 pickup callback: enters the held state (motion state 2).
bool itFlipper_Held_Anim (Item_GObj *gobj)
 Animate callback for the held state (motion state 2).
void itFlipper_Held_Phys (Item_GObj *gobj)
 Physics callback for the held state (motion state 2).
void itFlipper_Dropped (Item_GObj *gobj)
 Logic-20 drop callback: forwards to itFlipper_Thrown() – a drop is handled as a throw.
void itFlipper_Thrown (Item_GObj *gobj)
 Logic-20 throw callback: loads xDD4_flightTimer from x4_smashThrowDuration (smash) or x0_throwDuration (normal) and enters the in-flight state.
bool itFlipper_Inflight_Anim (Item_GObj *gobj)
 Animate callback for the in-flight state (motion state 3): decrements xDD4_flightTimer and settles the flipper at 0.
void itFlipper_Inflight_Phys (Item_GObj *gobj)
 Physics callback for the in-flight state (motion state 3): gravity plus end-of-flight velocity damping.
bool itFlipper_Inflight_Coll (Item_GObj *gobj)
 Collision callback for the in-flight state (motion state 3): bounces off walls/ceiling by xC_wallBounce and the floor by x10_floorBounce.
void itFlipper_Settle (Item_GObj *gobj)
 Settles a thrown flipper into a stationary hazard: stops it, sets xDD8_isSettled, loads xD44_lifeTimer from x8_lifetime, and enters the active state.
void itFlipper_EnterActive (Item_GObj *gobj)
 Enters the active (settled, hitbox-armed) state (motion state 5).
static void itFlipper_RefreshHitboxes (Item_GObj *gobj)
bool itFlipper_UpdateActive (Item_GObj *gobj)
 Per-frame update for the active flipper: advances the spin, damps leftover velocity, ticks xDDC_hitboxTimer, and expires the item by lifetime unless stage-fixed.
bool itFlipper_Active_Anim (Item_GObj *gobj)
 Animate callback for the active state (motion state 5): switches to spinning while xDE4_spinVel is nonzero.
bool itFlipper_Spinning_Anim (Item_GObj *gobj)
 Animate callback for the spinning state (motion state 6): returns to active once xDE4_spinVel reaches 0.
void itFlipper_Spinning_Phys (Item_GObj *gobj)
 Physics callback for the spinning state (motion state 6): re-pins a stage-fixed flipper to xDEC_stageAnchor each frame.
bool itFlipper_Spinning_Coll (Item_GObj *gobj)
 Collision callback for the spinning state (motion state 6).
bool itFlipper_DmgDealt (Item_GObj *gobj)
 Logic-20 "dealt damage" callback: bounces while airborne, or (once settled) arms xDDC_hitboxTimer and kicks spin from the fighter via xCF4_fighterGObjUnk.
bool itFlipper_Clanked (Item_GObj *gobj)
 Logic-20 clank callback: same handling as itFlipper_DmgDealt().
bool itFlipper_HitShield (Item_GObj *gobj)
 Logic-20 shield-hit callback: same handling as itFlipper_DmgDealt().
bool itFlipper_Reflected (Item_GObj *gobj)
 Logic-20 reflected callback.
bool itFlipper_ShieldBounced (Item_GObj *gobj)
 Logic-20 shield-bounce callback.
static void itFlipper_SpinFromFighterRecv (Item_GObj *gobj, Vec3 *vel, Vec3 *pos, f32 speed)
bool itFlipper_DmgReceived (Item_GObj *gobj)
 Logic-20 "received damage" callback: when settled, arms xDDC_hitboxTimer and kicks spin from the attacking fighter via xCEC_fighterGObj (mirrors itFlipper_DmgDealt()'s xCF4).
void itFlipper_EnteredAir (Item_GObj *gobj)
 Logic-20 entered-air callback: enters the airborne state (motion state 4).
bool itFlipper_Airborne_Anim (Item_GObj *gobj)
 Animate callback for the airborne state (motion state 4).
void itFlipper_Airborne_Phys (Item_GObj *gobj)
 Physics callback for the airborne state (motion state 4).
bool itFlipper_Airborne_Coll (Item_GObj *gobj)
 Collision callback for the airborne state (motion state 4): rests or falls on contact.
void itFlipper_EvtUnk (Item_GObj *gobj, Item_GObj *ref_gobj)
 Logic-20 event callback (purpose not yet identified).

Variables

ItemStateTable ItemStateTable_Flipper []

Function Documentation

◆ itFlipper_Spawn()

HSD_GObj * itFlipper_Spawn ( HSD_JObj * jobj)

Spawns a flipper pinned to a stage joint jobj (Break-the-Targets obstacles): stores it in xDEC_stageAnchor, sets xDE8_isStageFixed, and settles it.

[E6]

Alias
it_80290938.

◆ itFlipper_Spawned()

void itFlipper_Spawned ( Item_GObj * gobj)

Logic-20 spawn callback: zero-initializes the itemVars and enters the falling state.

Alias
itFlipper_Logic20_Spawned.

◆ itFlipper_UpdateSpin()

void itFlipper_UpdateSpin ( Item_GObj * gobj)

Advances the paddle spin one frame: decays xDE4_spinVel toward 0, adds it into xDE0_spinAngle, and applies that as an X rotation.

[E3]

Alias
it_80290A7C.

◆ itFlipper_AddSpinImpulse()

void itFlipper_AddSpinImpulse ( Item_GObj * gobj,
Vec3 * pos,
f32 vel )

Adds a spin impulse directed by the contact point pos, clamped to +/- x24_maxSpinVel.

[E3], [E4]

Alias
it_80290C38.

◆ itFlipper_SpinSpeedFromFighter()

f32 itFlipper_SpinSpeedFromFighter ( Item_GObj * gobj,
HSD_GObj * fighter,
Vec3 * pos,
Vec3 * vel )
inlinestatic

◆ itFlipper_SpinFromFighter_inline()

void itFlipper_SpinFromFighter_inline ( Item_GObj * gobj,
Vec3 * vel,
Vec3 * pos,
f32 speed )
inlinestatic

◆ itFlipper_SpinFromFighter()

void itFlipper_SpinFromFighter ( Item_GObj * gobj)

Derives the spin impulse from the striking fighter's speed and applies it via itFlipper_AddSpinImpulse(), reading the fighter from xCF4_fighterGObjUnk (the dealt-damage side).

[E4]

Alias
it_80290CE8.

◆ itFlipper_Repel_inline()

void itFlipper_Repel_inline ( Item_GObj * gobj,
s32 kind,
Vec3 * pos,
Vec3 * vec )
inlinestatic

◆ itFlipper_Repel()

void itFlipper_Repel ( Item_GObj * gobj,
s32 kind,
Vec3 * pos )

Pushes the flipper away from pos with a fixed 0.2 impulse, only when kind is It_Kind_Flipper (0x14).

[F2]

Alias
it_80290DD4.

◆ itFlipper_EnterResting()

void itFlipper_EnterResting ( Item_GObj * gobj)

Resets the flipper's velocity and enters the resting state (motion state 0).

[F1]

Alias
it_80290E78.

◆ itFlipper_Resting_Anim()

bool itFlipper_Resting_Anim ( Item_GObj * gobj)

Animate callback for the resting state (motion state 0).

Alias
itFlipper_UnkMotion0_Anim.

◆ itFlipper_Resting_Phys()

void itFlipper_Resting_Phys ( Item_GObj * gobj)

Physics callback for the resting state (motion state 0).

Alias
itFlipper_UnkMotion0_Phys.

◆ itFlipper_Resting_Coll()

bool itFlipper_Resting_Coll ( Item_GObj * gobj)

Collision callback for the resting state (motion state 0): falls again if the ground vanishes.

Alias
itFlipper_UnkMotion0_Coll.

◆ itFlipper_EnterFalling()

void itFlipper_EnterFalling ( Item_GObj * gobj)

Enters the falling state (motion state 1).

[F1]

Alias
it_80290F00.

◆ itFlipper_Falling_Anim()

bool itFlipper_Falling_Anim ( Item_GObj * gobj)

Animate callback for the falling state (motion state 1).

Alias
itFlipper_UnkMotion1_Anim.

◆ itFlipper_Falling_Phys()

void itFlipper_Falling_Phys ( Item_GObj * gobj)

Physics callback for the falling state (motion state 1): applies gravity toward terminal speed.

Alias
itFlipper_UnkMotion1_Phys.

◆ itFlipper_Falling_Coll()

bool itFlipper_Falling_Coll ( Item_GObj * gobj)

Collision callback for the falling state (motion state 1): rests on landing.

Alias
itFlipper_UnkMotion1_Coll.

◆ itFlipper_PickedUp()

void itFlipper_PickedUp ( Item_GObj * gobj)

Logic-20 pickup callback: enters the held state (motion state 2).

[F1]

Alias
itFlipper_Logic20_PickedUp.

◆ itFlipper_Held_Anim()

bool itFlipper_Held_Anim ( Item_GObj * gobj)

Animate callback for the held state (motion state 2).

Alias
itFlipper_UnkMotion2_Anim.

◆ itFlipper_Held_Phys()

void itFlipper_Held_Phys ( Item_GObj * gobj)

Physics callback for the held state (motion state 2).

Alias
itFlipper_UnkMotion2_Phys.

◆ itFlipper_Dropped()

void itFlipper_Dropped ( Item_GObj * gobj)

Logic-20 drop callback: forwards to itFlipper_Thrown() – a drop is handled as a throw.

Alias
itFlipper_Logic20_Dropped.

◆ itFlipper_Thrown()

void itFlipper_Thrown ( Item_GObj * gobj)

Logic-20 throw callback: loads xDD4_flightTimer from x4_smashThrowDuration (smash) or x0_throwDuration (normal) and enters the in-flight state.

[E1], [E2]

Alias
itFlipper_Logic20_Thrown.

◆ itFlipper_Inflight_Anim()

bool itFlipper_Inflight_Anim ( Item_GObj * gobj)

Animate callback for the in-flight state (motion state 3): decrements xDD4_flightTimer and settles the flipper at 0.

[E2]

Alias
itFlipper_UnkMotion3_Anim.

◆ itFlipper_Inflight_Phys()

void itFlipper_Inflight_Phys ( Item_GObj * gobj)

Physics callback for the in-flight state (motion state 3): gravity plus end-of-flight velocity damping.

Alias
itFlipper_UnkMotion3_Phys.

◆ itFlipper_Inflight_Coll()

bool itFlipper_Inflight_Coll ( Item_GObj * gobj)

Collision callback for the in-flight state (motion state 3): bounces off walls/ceiling by xC_wallBounce and the floor by x10_floorBounce.

[E5]

Alias
itFlipper_UnkMotion3_Coll.

◆ itFlipper_Settle()

void itFlipper_Settle ( Item_GObj * gobj)

Settles a thrown flipper into a stationary hazard: stops it, sets xDD8_isSettled, loads xD44_lifeTimer from x8_lifetime, and enters the active state.

[E2]

Alias
it_80291254.

◆ itFlipper_EnterActive()

void itFlipper_EnterActive ( Item_GObj * gobj)

Enters the active (settled, hitbox-armed) state (motion state 5).

[F1]

Alias
it_8029131C.

◆ itFlipper_RefreshHitboxes()

void itFlipper_RefreshHitboxes ( Item_GObj * gobj)
inlinestatic

◆ itFlipper_UpdateActive()

bool itFlipper_UpdateActive ( Item_GObj * gobj)

Per-frame update for the active flipper: advances the spin, damps leftover velocity, ticks xDDC_hitboxTimer, and expires the item by lifetime unless stage-fixed.

[E3], [E6]

Alias
it_80291344.

◆ itFlipper_Active_Anim()

bool itFlipper_Active_Anim ( Item_GObj * gobj)

Animate callback for the active state (motion state 5): switches to spinning while xDE4_spinVel is nonzero.

Alias
itFlipper_UnkMotion5_Anim.

◆ itFlipper_Spinning_Anim()

bool itFlipper_Spinning_Anim ( Item_GObj * gobj)

Animate callback for the spinning state (motion state 6): returns to active once xDE4_spinVel reaches 0.

Alias
itFlipper_UnkMotion6_Anim.

◆ itFlipper_Spinning_Phys()

void itFlipper_Spinning_Phys ( Item_GObj * gobj)

Physics callback for the spinning state (motion state 6): re-pins a stage-fixed flipper to xDEC_stageAnchor each frame.

[E6]

Alias
itFlipper_UnkMotion6_Phys.

◆ itFlipper_Spinning_Coll()

bool itFlipper_Spinning_Coll ( Item_GObj * gobj)

Collision callback for the spinning state (motion state 6).

Alias
itFlipper_UnkMotion6_Coll.

◆ itFlipper_DmgDealt()

bool itFlipper_DmgDealt ( Item_GObj * gobj)

Logic-20 "dealt damage" callback: bounces while airborne, or (once settled) arms xDDC_hitboxTimer and kicks spin from the fighter via xCF4_fighterGObjUnk.

[E1], [E3], [E4]

Alias
it_3F14_Logic20_DmgDealt.

◆ itFlipper_Clanked()

bool itFlipper_Clanked ( Item_GObj * gobj)

Logic-20 clank callback: same handling as itFlipper_DmgDealt().

Alias
it_3F14_Logic20_Clanked.

◆ itFlipper_HitShield()

bool itFlipper_HitShield ( Item_GObj * gobj)

Logic-20 shield-hit callback: same handling as itFlipper_DmgDealt().

Alias
it_3F14_Logic20_HitShield.

◆ itFlipper_Reflected()

bool itFlipper_Reflected ( Item_GObj * gobj)

Logic-20 reflected callback.

Alias
itFlipper_Logic20_Reflected.

◆ itFlipper_ShieldBounced()

bool itFlipper_ShieldBounced ( Item_GObj * gobj)

Logic-20 shield-bounce callback.

Alias
itFlipper_Logic20_ShieldBounced.

◆ itFlipper_SpinFromFighterRecv()

void itFlipper_SpinFromFighterRecv ( Item_GObj * gobj,
Vec3 * vel,
Vec3 * pos,
f32 speed )
inlinestatic

◆ itFlipper_DmgReceived()

bool itFlipper_DmgReceived ( Item_GObj * gobj)

Logic-20 "received damage" callback: when settled, arms xDDC_hitboxTimer and kicks spin from the attacking fighter via xCEC_fighterGObj (mirrors itFlipper_DmgDealt()'s xCF4).

[E1]

Alias
it_3F14_Logic20_DmgReceived.

◆ itFlipper_EnteredAir()

void itFlipper_EnteredAir ( Item_GObj * gobj)

Logic-20 entered-air callback: enters the airborne state (motion state 4).

Alias
itFlipper_Logic20_EnteredAir.

◆ itFlipper_Airborne_Anim()

bool itFlipper_Airborne_Anim ( Item_GObj * gobj)

Animate callback for the airborne state (motion state 4).

Alias
itFlipper_UnkMotion4_Anim.

◆ itFlipper_Airborne_Phys()

void itFlipper_Airborne_Phys ( Item_GObj * gobj)

Physics callback for the airborne state (motion state 4).

Alias
itFlipper_UnkMotion4_Phys.

◆ itFlipper_Airborne_Coll()

bool itFlipper_Airborne_Coll ( Item_GObj * gobj)

Collision callback for the airborne state (motion state 4): rests or falls on contact.

Alias
itFlipper_UnkMotion4_Coll.

◆ itFlipper_EvtUnk()

void itFlipper_EvtUnk ( Item_GObj * gobj,
Item_GObj * ref_gobj )

Logic-20 event callback (purpose not yet identified).

Alias
itFlipper_Logic20_EvtUnk.

Variable Documentation

◆ ItemStateTable_Flipper

ItemStateTable ItemStateTable_Flipper[]