resonance 1.0.1
Loading...
Searching...
No Matches
Powerup Class Referenceabstract

Base of the thirteen powerups a player can store and deploy. More...

#include <powerup.h>

Inheritance diagram for Powerup:

Public Member Functions

void * operator new (size_t nSize)
 Allocate a powerup from the tagged heap under the tag Powerup.
void operator delete (void *pBlock)
 Release a powerup to the tagged heap.
virtual ~Powerup ()
virtual int Deploy (int nTrack, int nBar, Player *pPlayer, int nUnused)=0
 Apply the powerup's effect.
virtual int Type ()=0
 Report which of the thirteen kinds this powerup is.

Static Public Member Functions

static Powerup * CreateForType (int nType)
 Produce one powerup of the requested kind on the heap.

Detailed Description

Base of the thirteen powerups a player can store and deploy.

Its RTTI descriptor is at 0x0086f690. It is a leaf with no base list. The object is four bytes of vtable pointer, and the class has no data member. The factory confirms the size by allocating four bytes for the subclasses that add nothing. Its table at 0x007e4690 has four entries with a zero terminator at index 4. Slots 2 and 3 both address the shared pure-virtual stub at 0x005381a8, and the class is therefore abstract.

The two method names are inferred from the bodies of the subclasses and of the two collections that use them. No method name survives anywhere in the image.

Eight subclasses implement the thirteen kinds (the PowerupType values). Seven kinds each have their own class (NeutralizePowerup, CripplePowerup, FreestylePowerup, AutocatchPowerup, BumpPowerup, GhostNotesPowerup, and MultiplierPowerup), and the factory's jump table at 0x007e3f70 sends the six effect kinds to one shared arm that builds an EffectPowerup recording its kind.

Constructor & Destructor Documentation

◆ ~Powerup()

virtual Powerup::~Powerup ( )
virtual
Ghidra address:
NTSC-U/C: 0x001ca4c8
Ghidra address:
PAL: 0x001d0380

Member Function Documentation

◆ operator new()

void * Powerup::operator new ( size_t nSize)
inline

Allocate a powerup from the tagged heap under the tag Powerup.

No out-of-line body exists. CreateForType() expands the call in every arm.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.

◆ operator delete()

void Powerup::operator delete ( void * pBlock)
inline

Release a powerup to the tagged heap.

No out-of-line body exists. Every deleting destructor expands the call.

Parameters
pBlockThe block.

◆ Deploy()

virtual int Powerup::Deploy ( int nTrack,
int nBar,
Player * pPlayer,
int nUnused )
pure virtual

Apply the powerup's effect.

Slot 2, and pure. Both collections call it and proceed only when it reports success, which is what recovers the return value as a result rather than as a state read. NeutralizePowerup implements it at 0x001c9c40 and CripplePowerup at 0x001c9830.

The arity comes from the two call sites (0x001cb538 and 0x001cb97c), which forward the collection's two arguments untouched in a1 and a2, load the owning player into a3, and clear t0. NeutralizePowerup stores a1 where PhraseNeutralizer compares the track and a2 where it reads the bar. No implementation reads the fourth argument.

Parameters
nTrackThe deploying player's track, from Player::GetTrack().
nBarThe current bar.
pPlayerThe deploying player.
nUnusedZero at both call sites.
Returns
Non-zero once the effect has been applied.

Implemented in AutocatchPowerup, BumpPowerup, CripplePowerup, EffectPowerup, FreestylePowerup, GhostNotesPowerup, MultiplierPowerup, and NeutralizePowerup.

◆ Type()

virtual int Powerup::Type ( )
pure virtual

Report which of the thirteen kinds this powerup is.

Slot 3, and pure. Every implementation is a two-instruction body that returns a constant, and the constant is the index the factory accepts, which PowerupCollection::Add() confirms by matching an incoming kind against it.

Returns
The kind.

Implemented in AutocatchPowerup, BumpPowerup, CripplePowerup, EffectPowerup, FreestylePowerup, GhostNotesPowerup, MultiplierPowerup, and NeutralizePowerup.

◆ CreateForType()

Powerup * Powerup::CreateForType ( int nType)
static

Produce one powerup of the requested kind on the heap.

The body is a jump table over thirteen kinds at 0x007e3f70. Each arm allocates against the Powerup tag and installs one subclass table. A kind outside 0 through 12 (the unsigned comparison rejects a negative kind too) returns a null pointer, and the two collections both store the result with no test.

Parameters
nTypeThe kind, a PowerupType.
Returns
The powerup, or a null pointer for a kind outside 0 through 12.
Ghidra address:
NTSC-U/C: 0x001c65f0
Ghidra address:
PAL: 0x001cc438

The documentation for this class was generated from the following file: