resonance 1.0.1
Loading...
Searching...
No Matches
PowerupCollection Class Reference

Store of one powerup of every configured kind, with a count for each. More...

#include <powerupcollection.h>

Inheritance diagram for PowerupCollection:
Collaboration diagram for PowerupCollection:

Classes

class  PowCount
 One configured kind, with the number of them stored. More...

Public Member Functions

 PowerupCollection (LocalPlayer *pOwner, int bUnlimited)
 Build one entry for every kind the configuration lists.
virtual ~PowerupCollection ()
 Delete every stored powerup.
virtual void Add (PowerupType type)
 Increase the count of the entry whose kind matches, up to nine.
virtual void SelectRelative (int nDelta)
 Move the selection by nDelta, wrapping, and stop at the first entry with a count above zero.
virtual void Select (int nIndex)
 Select one entry by index, without checking its count.
virtual void Deploy (int nTrack, int nBar)
 Deploy the selected powerup and spend one of them.
virtual int HasSelection () const
 Report whether an entry is selected.
virtual void SendState () const
 Send one PowerupCountMsg for every non-empty entry, then one ChoosePowerupMsg.
Public Member Functions inherited from PowerupCollectionI
 PowerupCollectionI ()
virtual ~PowerupCollectionI ()
Public Member Functions inherited from MsgSource
virtual ~MsgSource ()
virtual void AddSink (MsgSink *pSink)
 Register a sink, ignoring a sink that is already registered.
virtual void RemoveSink (MsgSink *pSink)
 Unregister the first occurrence of a sink.
void Send (Message *pMsg) const
 Deliver a message to every registered sink, in registration order.
void ClearSinks ()
 Unregister every sink.

Additional Inherited Members

Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.

Detailed Description

Store of one powerup of every configured kind, with a count for each.

Its RTTI descriptor is at 0x008ef460. It has PowerupCollectionI as its one base at offset 0. Its table is at 0x007e48a8 and has ten entries with a zero terminator at index 10, the same length as the base table. The class adds no virtual. It overrides the destructor and all six of the slots the base introduces.

The object is 0x2c bytes. The base occupies the first 0x14 including the inherited vptr at +0x10, and the four members below follow it.

LocalPlayer's constructor allocates one at 0x0011e0ec for one of its modes and stores the pointer at its own +0xa4, then hands the same pointer to the JamPowerupPlacer it allocates next. Its other modes allocate a SinglePowerupCollection instead.

The class manages every powerup it stores. The destructor deletes each one through the Powerup table and then releases the vector.

Every method name is inferred from the bodies. No method name survives anywhere in the image.

Constructor & Destructor Documentation

◆ PowerupCollection()

PowerupCollection::PowerupCollection ( LocalPlayer * pOwner,
int bUnlimited )

Build one entry for every kind the configuration lists.

The kinds come from configuration code 0x389 through QueryConfigVector(), and each one is turned into a powerup by Powerup::CreateForType(). Every entry starts with a count of zero, unless bUnlimited is set, in which case each entry starts with one and the selection starts at the first entry.

Parameters
pOwnerThe player whose collection this is.
bUnlimitedNon-zero to start every entry stocked and to stop Deploy() from spending.
Ghidra address:
NTSC-U/C: 0x001cad70
Ghidra address:
PAL: 0x001d0c28

◆ ~PowerupCollection()

virtual PowerupCollection::~PowerupCollection ( )
virtual

Delete every stored powerup.

Ghidra address:
NTSC-U/C: 0x001cb090
Ghidra address:
PAL: 0x001d0f48

Member Function Documentation

◆ Add()

virtual void PowerupCollection::Add ( PowerupType type)
virtual

Increase the count of the entry whose kind matches, up to nine.

An entry already storing nine is ignored, and a kind with no entry is ignored. A successful increase sends a PowerupCountMsg. With nothing selected, SelectRelative(1) follows.

Parameters
typeThe kind.
Ghidra address:
NTSC-U/C: 0x001cb230
Ghidra address:
PAL: 0x001d10e8

Reimplemented from PowerupCollectionI.

◆ SelectRelative()

virtual void PowerupCollection::SelectRelative ( int nDelta)
virtual

Move the selection by nDelta, wrapping, and stop at the first entry with a count above zero.

A delta of zero returns with no change and no message. The search tries every entry once and selects -1 when all of them are empty. Either outcome sends a ChoosePowerupMsg.

Parameters
nDeltaThe step to apply to the selected index.
Ghidra address:
NTSC-U/C: 0x001cb320
Ghidra address:
PAL: 0x001d11d8

Reimplemented from PowerupCollectionI.

◆ Select()

virtual void PowerupCollection::Select ( int nIndex)
virtual

Select one entry by index, without checking its count.

An index outside the vector is not tested for.

Parameters
nIndexThe entry, or -1 for none.
Ghidra address:
NTSC-U/C: 0x001cb450
Ghidra address:
PAL: 0x001d1308

Reimplemented from PowerupCollectionI.

◆ Deploy()

virtual void PowerupCollection::Deploy ( int nTrack,
int nBar )
virtual

Deploy the selected powerup and spend one of them.

The selected entry is read with no test against -1, so a caller selects first. A powerup that reports failure stops the whole body. With mUnlimited set the count is preserved and no message follows. Otherwise the count drops by one, a PowerupCountMsg follows, and an entry that reaches zero triggers SelectRelative(1).

Parameters
nTrackForwarded to Powerup::Deploy(). See PowerupCollectionI::Deploy().
nBarForwarded to Powerup::Deploy(). See PowerupCollectionI::Deploy().
Ghidra address:
NTSC-U/C: 0x001cb500
Ghidra address:
PAL: 0x001d13b8

Reimplemented from PowerupCollectionI.

◆ HasSelection()

virtual int PowerupCollection::HasSelection ( ) const
virtual

Report whether an entry is selected.

Returns
Non-zero unless the selected index is -1.
Ghidra address:
NTSC-U/C: 0x001cc9a0
Ghidra address:
PAL: 0x001d2858

Reimplemented from PowerupCollectionI.

◆ SendState()

virtual void PowerupCollection::SendState ( ) const
virtual

Send one PowerupCountMsg for every non-empty entry, then one ChoosePowerupMsg.

Ghidra address:
NTSC-U/C: 0x001cb620
Ghidra address:
PAL: 0x001d14d8

Reimplemented from PowerupCollectionI.


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