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

Powerup placer that walks a bar cursor forward with the song and deploys at the bar it rests on. More...

#include <gamepowerupplacer.h>

Inheritance diagram for GamePowerupPlacer:
Collaboration diagram for GamePowerupPlacer:

Public Member Functions

 GamePowerupPlacer (LocalPlayer *pOwner, Application *pApplication, PowerupCollectionI *pCollection)
 Post a task against the song clock and start with the cursor off the map.
virtual ~GamePowerupPlacer ()
virtual void MoveCursor (int nStep)
 Move the cursor by the negation of the argument and announce where it rests.
virtual void AnnounceCursor ()
 Announce where the cursor rests, for a listener that has just registered.
virtual void DeployPowerup ()
 Deploy the selected powerup at the bar the cursor rests on, then take the cursor off the map.
virtual void Activate ()
 Schedule the task on the clock, on the PowerupPlacer side.
virtual void Deactivate ()
 Withdraw the task from the clock, on the PowerupPlacer side.
virtual int Tick (int nElapsedTicks)
 Advance the cursor to the current bar and announce it.
Public Member Functions inherited from PowerupPlacer
 PowerupPlacer ()
virtual ~PowerupPlacer ()
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.
Public Member Functions inherited from TickTask
 TickTask (Sch::TickClock *pClock, int nPeriod, int bAligned)
virtual ~TickTask ()
 Withdraw the queued command.
virtual void Print (std::ostream &stream)
 Write the task to a diagnostic stream.
void Start (int nEpochOffset)
 Post the task on its clock.
void Run ()
 Run Tick() for the run now due and post the next one.
void Stop ()
 Withdraw the queued command and forget its handle.
Public Member Functions inherited from Attachment
 Attachment ()
virtual ~Attachment ()
int Release ()
 Give back one reference and destroy the object once the last one is gone.
virtual void Destroy ()
 Destroy the object.

Additional Inherited Members

Static Public Member Functions inherited from Attachment
static void ReleaseIfSet (Attachment *pAttachment)
 Give back one reference to an object that may be null.
Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.
Public Attributes inherited from Attachment
int mRefs

Detailed Description

Powerup placer that walks a bar cursor forward with the song and deploys at the bar it rests on.

Its RTTI descriptor is at 0x008f0130. It is built over two bases, PowerupPlacer at offset 0 and TickTask at offset 20. It is the one class in this family with two bases, and it therefore has two tables. The primary table at 0x007e4c50 has nine entries, the same length as PowerupPlacer's, so the class adds no virtual on that side. The secondary table at 0x007e4c20 has five entries with a slot 0 delta of -20 and serves the TickTask subobject.

The object is 0x44 bytes. PowerupPlacer and its MsgSource base occupy +0x00 through +0x13 with the primary vptr at +0x10. The TickTask subobject occupies +0x14 through +0x33 with its reference count at +0x14 and its own vptr at +0x18. The four members below follow it.

Nothing in the image constructs one. The constructor at 0x001ccb70 has no reference of any kind, from code or from data, so the class is unreachable in the shipped game. Its two PowerupPlacer siblings, JamPowerupPlacer and SimplifiedGamePowerupPlacer, are both constructed and share the deployment shape below.

Slots 6 and 8 take the cursor off the map with a DisplayPointerMsg that sets only the player value (-1, which Print() reports as remove) and the player, leaving the bar unset.

Constructor & Destructor Documentation

◆ GamePowerupPlacer()

GamePowerupPlacer::GamePowerupPlacer ( LocalPlayer * pOwner,
Application * pApplication,
PowerupCollectionI * pCollection )

Post a task against the song clock and start with the cursor off the map.

The TickTask subobject runs against the application's song clock with a period of 480 ticks and is not aligned.

Parameters
pOwnerThe player whose placer this is.
pApplicationThe application the song clock is reached through.
pCollectionThe store the deployment draws from.
Ghidra address:
NTSC-U/C: 0x001ccb70
Ghidra address:
PAL: 0x001d2a28

◆ ~GamePowerupPlacer()

virtual GamePowerupPlacer::~GamePowerupPlacer ( )
virtual
Ghidra address:
NTSC-U/C: 0x001cd9b0
Ghidra address:
PAL: 0x001d3868

Member Function Documentation

◆ MoveCursor()

virtual void GamePowerupPlacer::MoveCursor ( int nStep)
virtual

Move the cursor by the negation of the argument and announce where it rests.

A zero argument does nothing. Otherwise the routine negates the argument, reads the current bar from the song clock, and reads Player::GetTrack() for the message. A cursor of -1 accepts a step of 1 only, and then only when PowerupCollectionI::HasSelection() reports a selection, and the cursor jumps to the current bar. A cursor already on the map moves by the step. A cursor that falls behind the current bar leaves the map with a remove message, one more than four bars ahead of it steps back one bar without a message, and any other position is announced with a DisplayPointerMsg.

Parameters
nStepThe step, which the body negates.
Ghidra address:
NTSC-U/C: 0x001cccb0
Ghidra address:
PAL: 0x001d2b68

Reimplemented from PowerupPlacer.

◆ AnnounceCursor()

virtual void GamePowerupPlacer::AnnounceCursor ( )
virtual

Announce where the cursor rests, for a listener that has just registered.

A cursor of -1 sends nothing.

Ghidra address:
NTSC-U/C: 0x001cce90
Ghidra address:
PAL: 0x001d2d48

Reimplemented from PowerupPlacer.

◆ DeployPowerup()

virtual void GamePowerupPlacer::DeployPowerup ( )
virtual

Deploy the selected powerup at the bar the cursor rests on, then take the cursor off the map.

A cursor of -1 returns. The cursor must also lie before the bar PlayMap::GetEndBar() of Globals::GetPlayMap() reports. The deployment dispatches PowerupCollectionI::Deploy() with Player::GetTrack() and the cursor bar, then sends a remove DisplayPointerMsg and sets the cursor to -1.

Ghidra address:
NTSC-U/C: 0x001ccf30
Ghidra address:
PAL: 0x001d2de8

Reimplemented from PowerupPlacer.

◆ Activate()

virtual void GamePowerupPlacer::Activate ( )
virtual

Schedule the task on the clock, on the PowerupPlacer side.

The routine starts the TickTask subobject with the epoch offset kTickInfinity.

Ghidra address:
NTSC-U/C: 0x001cde18
Ghidra address:
PAL: 0x001d3cd0

Reimplemented from PowerupPlacer.

◆ Deactivate()

virtual void GamePowerupPlacer::Deactivate ( )
virtual

Withdraw the task from the clock, on the PowerupPlacer side.

The routine stops the TickTask subobject, which cancels the queued command and resets the handle to -2.

Ghidra address:
NTSC-U/C: 0x001cde40
Ghidra address:
PAL: 0x001d3cf8

Reimplemented from PowerupPlacer.

◆ Tick()

virtual int GamePowerupPlacer::Tick ( int nElapsedTicks)
virtual

Advance the cursor to the current bar and announce it.

Slot 4 of the TickTask table. The elapsed count arrives already saturated against Sch::Tick's bounds, and this body adds 480 and saturates again before dividing by 1920, so the bar it computes is half a beat ahead of the run now due. A cursor of -1 or a cursor already at or past the computed bar produces no message. The return value is 1 on every path, so the task runs again every 480 ticks for as long as it is scheduled.

Parameters
nElapsedTicksTicks between the task's epoch and the run now due.
Returns
1 on every path.
Ghidra address:
NTSC-U/C: 0x001cd028
Ghidra address:
PAL: 0x001d2ee0

Implements TickTask.


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