wavelength 1.0.0
Loading...
Searching...
No Matches
TriggerMgr Class Reference

Registry of the triggers that fire actions on game and display events. More...

#include <triggermgr.h>

Public Types

enum  Clock { kClockGame = 0 , kClockReal = 1 , kNumClocks = 2 }
 The clocks an action runs on, the indices of mTime. More...
enum  { kNumPlayers = 4 , kNoPlayer = 4 , kNumTracks = 8 }
 Sizes of the per-player and per-track records. More...

Public Member Functions

 TriggerMgr ()
 Construct the registry with an empty event of each kind.
 ~TriggerMgr ()
 Release every trigger.
void Init ()
 Read the "trigger" section of the configuration.
void Terminate ()
 Release every registered trigger.
void SetPaths (const std::vector< bool > &paths)
 Record which paths of the arena are unlocked.
bool IsPathUnlocked (unsigned int nPath) const
 Report whether a path exists and is unlocked.
bool PathExists (unsigned int nPath) const
 Report whether a path exists.
void Schedule (TriggerAction *pAction, float flDelay)
 Schedule an action to run after a delay on the current clock.
void AddRunning (TriggerAction *pAction)
 Poll an action every frame until it reports itself done.
void Poll ()
 Run the actions whose time has come, and poll the running actions.
void Load (const char *pszFile, BinStream *pStream)
 Read triggers from a data file and register them.
void AddTriggers (DataArray *pTriggers)
 Register the triggers of an array, each with the event its node 0 names.
void BeatEvent (char chNote)
 Fire the triggers that wait on a note of the background music.
void MetagameEvent (float flStart, float flTime, float flValue)
 Advance the clocks and fire the triggers that wait on the time.
void ComponentSelectEvent (UIComponentSelectMsg *pMsg)
 Fire the triggers that wait on a component being chosen.
void ComponentSelectStartEvent (UIComponentSelectStartMsg *pMsg)
 Fire the triggers that wait on the choice of a component beginning.
void ComponentFocusEvent (UIComponentFocusChangeMsg *pMsg)
 Fire the triggers that wait on the focus moving between components.
void ComponentFocusEvent (const char *pszComponent, const char *pszPanel, const char *pszScreen)
 Fire the triggers that wait on the focus arriving at a component, with no previous component.
void ScreenChangeEvent (UIScreenChangeMsg *pMsg)
 Fire the triggers that wait on a move between screens.
void ButtonEvent (int nPlayer, int nButtons)
 Fire the triggers that wait on a button.
void BeginEvent (int nRuleSet)
 Fire the triggers that wait on the begin event.
void StageCompleteEvent (int nPlayer)
 Fire the triggers that wait on a player completing a stage.
void EndEvent (int nState, int nPlayer)
 Fire the triggers that wait on the end of the game.
void ScoreEvent (int nPlayer, int nScore)
 Fire the triggers that wait on a new score.
void HitEvent (int nPlayer, int nGemPos)
 Fire the triggers that wait on a player hitting a gem.
void MissEvent (int nPlayer, int nGemPos)
 Fire the triggers that wait on a player missing a gem.
void GemEvent (int nTrack, int nGemPos)
 Fire the triggers that wait on a gem of a captured track.
void NewBarEvent (int nBar)
 Fire the triggers that wait on the start of a bar.
void PhraseEndEvent (int nTrack)
 Fire the triggers that wait on the end of a phrase.
void PhraseCaptureEvent (int nPlayer, int nStreak)
 Fire the triggers that wait on a player capturing a phrase.
void PhraseMissEvent (int nPlayer)
 Fire the triggers that wait on a missed phrase.
void NewTrackEvent (int nPlayer, int nTrack, int nInstrument, int nMode)
 Fire the triggers that wait on a player moving to a new track.
void HealthEvent (int nPlayer, int nHealth)
 Fire the triggers that wait on a change of health.
void DyingEvent (int nPlayer, int nDying)
 Fire the triggers that wait on a player starting or stopping dying.
void BossJourneyEvent ()
 Fire the triggers that wait on the boss journey starting.
void LyricEvent (const char *pszLyric)
 Fire the triggers that wait on a lyric.
void PathUnlockedEvent (int nPath)
 Fire the triggers that wait on a path being unlocked.
int GetClock () const
void SetClock (int nClock)
 Set the clock of the action in progress.
float GetCurrentTime () const
float GetTime (int nClock) const
 Report the time of a clock.
int GetPlayer () const
char GetNote () const
int GetGemPos () const
const String & GetLyric () const
int GetBar () const
int GetButtons () const
int GetCapturer (int nTrack) const
 Report the player who captured a track.
const String & GetComponent () const
float GetDistance () const
int GetDying (int nPlayer) const
 Report whether a player is dying.
int GetGameState () const
int GetHealth (int nPlayer) const
 Report the health of a player.
int GetInstrument (int nPlayer) const
 Report the instrument of the track of a player.
int GetLeader () const
int GetMode (int nPlayer) const
 Report the music mode of the track of a player.
const String & GetOldComponent () const
const String & GetOldPanel () const
const String & GetOldScreen () const
const String & GetPanel () const
int GetPowerup () const
float GetRandom () const
int GetRuleSet () const
int GetScore (int nPlayer) const
 Report the score of a player.
const String & GetScreen () const
int GetStreak (int nPlayer) const
 Report the phrase streak of a player.
int GetTrack (int nPlayer) const
 Report the track of a player.

Detailed Description

Registry of the triggers that fire actions on game and display events.

The name is inferred from the "trigger" section of the configuration Init() reads and from the TriggerEvent, TriggerAction, and TriggerCondition classes the RTTI includes. The one instance is TheTriggerMgr, 0x198 bytes.

Each event routine records the values of the event for the conditions to test, fires the TriggerEvent of its kind, and prints a debug line when Init() enabled the kind. Actions run on one of two clocks, which MetagameEvent() advances. Poll() runs the scheduled actions whose time has come and polls the running ones.

Member Enumeration Documentation

◆ Clock

The clocks an action runs on, the indices of mTime.

Enumerator
kClockGame 

The clock of the game, the default.

kClockReal 

The real-time clock, chosen by realtime in a trigger file.

kNumClocks 

The number of clocks.

◆ anonymous enum

anonymous enum

Sizes of the per-player and per-track records.

Enumerator
kNumPlayers 

Players with a record of their own.

kNoPlayer 

The mCapturer value of a track no player has captured.

kNumTracks 

Tracks with a record of their own.

Constructor & Destructor Documentation

◆ TriggerMgr()

TriggerMgr::TriggerMgr ( )

Construct the registry with an empty event of each kind.

Ghidra address:
NTSC-U/C: 0x001fd6b8
Ghidra address:
PAL: 0x00206458

◆ ~TriggerMgr()

TriggerMgr::~TriggerMgr ( )

Release every trigger.

Ghidra address:
NTSC-U/C: 0x001fd9c8
Ghidra address:
PAL: 0x00206768

Member Function Documentation

◆ Init()

void TriggerMgr::Init ( )

Read the "trigger" section of the configuration.

Each kind of event the debug list names sets its bit of mDebug.

Ghidra address:
NTSC-U/C: 0x001fdb38
Ghidra address:
PAL: 0x002068d8

◆ Terminate()

void TriggerMgr::Terminate ( )

Release every registered trigger.

The running and scheduled actions are forgotten. Their handlers deleted them.

Ghidra address:
NTSC-U/C: 0x001fe6e0
Ghidra address:
PAL: 0x00207480

◆ SetPaths()

void TriggerMgr::SetPaths ( const std::vector< bool > & paths)

Record which paths of the arena are unlocked.

Parameters
pathsOne flag per path.
Ghidra address:
NTSC-U/C: 0x001fdbe8
Ghidra address:
PAL: 0x00206988

◆ IsPathUnlocked()

bool TriggerMgr::IsPathUnlocked ( unsigned int nPath) const

Report whether a path exists and is unlocked.

Parameters
nPathThe path.
Returns
Whether SetPaths() recorded the path as unlocked.
Ghidra address:
NTSC-U/C: 0x001fe068
Ghidra address:
PAL: 0x00206e08

◆ PathExists()

bool TriggerMgr::PathExists ( unsigned int nPath) const

Report whether a path exists.

Parameters
nPathThe path.
Returns
Whether SetPaths() recorded a flag for the path.
Ghidra address:
NTSC-U/C: 0x001fe180
Ghidra address:
PAL: 0x00206f20

◆ Schedule()

void TriggerMgr::Schedule ( TriggerAction * pAction,
float flDelay )

Schedule an action to run after a delay on the current clock.

The action follows the actions scheduled for the same time.

Parameters
pActionThe action.
flDelayThe delay.
Ghidra address:
NTSC-U/C: 0x001fe1d8
Ghidra address:
PAL: 0x00206f78

◆ AddRunning()

void TriggerMgr::AddRunning ( TriggerAction * pAction)

Poll an action every frame until it reports itself done.

An action already running moves to the end of the list.

Parameters
pActionThe action.
Ghidra address:
NTSC-U/C: 0x001fe340
Ghidra address:
PAL: 0x002070e0

◆ Poll()

void TriggerMgr::Poll ( )

Run the actions whose time has come, and poll the running actions.

Ghidra address:
NTSC-U/C: 0x001fe460
Ghidra address:
PAL: 0x00207200

◆ Load()

void TriggerMgr::Load ( const char * pszFile,
BinStream * pStream )

Read triggers from a data file and register them.

Parameters
pszFileThe data file, which also identifies the triggers in error messages.
pStreamThe stream to read instead of the file, or null.
Ghidra address:
NTSC-U/C: 0x001fe600
Ghidra address:
PAL: 0x002073a0

◆ AddTriggers()

void TriggerMgr::AddTriggers ( DataArray * pTriggers)

Register the triggers of an array, each with the event its node 0 names.

Parameters
pTriggersThe triggers.
Ghidra address:
NTSC-U/C: 0x001fe650
Ghidra address:
PAL: 0x002073f0

◆ BeatEvent()

void TriggerMgr::BeatEvent ( char chNote)

Fire the triggers that wait on a note of the background music.

Parameters
chNoteThe note, a letter from A through G.
Ghidra address:
NTSC-U/C: 0x001fe780
Ghidra address:
PAL: 0x00207520

◆ MetagameEvent()

void TriggerMgr::MetagameEvent ( float flStart,
float flTime,
float flValue )

Advance the clocks and fire the triggers that wait on the time.

A new random value is stored for RandomCondition. The metagame passes its clock twice and 0.

Parameters
flStartThe time of the game clock.
flTimeThe time of the real-time clock.
flValueThe distance DistanceCondition tests.
Ghidra address:
NTSC-U/C: 0x001feb88
Ghidra address:
PAL: 0x00207928

◆ ComponentSelectEvent()

void TriggerMgr::ComponentSelectEvent ( UIComponentSelectMsg * pMsg)

Fire the triggers that wait on a component being chosen.

The names of the component, its panel, and its screen are stored for the conditions to test.

Parameters
pMsgThe message that reported the choice.
Ghidra address:
NTSC-U/C: 0x001fe7d8
Ghidra address:
PAL: 0x00207578

◆ ComponentSelectStartEvent()

void TriggerMgr::ComponentSelectStartEvent ( UIComponentSelectStartMsg * pMsg)

Fire the triggers that wait on the choice of a component beginning.

Parameters
pMsgThe message that reported the choice.
Ghidra address:
NTSC-U/C: 0x001fe888
Ghidra address:
PAL: 0x00207628

◆ ComponentFocusEvent() [1/2]

void TriggerMgr::ComponentFocusEvent ( UIComponentFocusChangeMsg * pMsg)

Fire the triggers that wait on the focus moving between components.

Parameters
pMsgThe message that reported the move.
Ghidra address:
NTSC-U/C: 0x001fe938
Ghidra address:
PAL: 0x002076d8

◆ ComponentFocusEvent() [2/2]

void TriggerMgr::ComponentFocusEvent ( const char * pszComponent,
const char * pszPanel,
const char * pszScreen )

Fire the triggers that wait on the focus arriving at a component, with no previous component.

Parameters
pszComponentThe component.
pszPanelThe panel of the component.
pszScreenThe screen of the panel.
Ghidra address:
NTSC-U/C: 0x001fea18
Ghidra address:
PAL: 0x002077b8

◆ ScreenChangeEvent()

void TriggerMgr::ScreenChangeEvent ( UIScreenChangeMsg * pMsg)

Fire the triggers that wait on a move between screens.

Parameters
pMsgThe message that reported the move.
Ghidra address:
NTSC-U/C: 0x001feae0
Ghidra address:
PAL: 0x00207880

◆ ButtonEvent()

void TriggerMgr::ButtonEvent ( int nPlayer,
int nButtons )

Fire the triggers that wait on a button.

Parameters
nPlayerThe controller.
nButtonsThe buttons the controller holds.
Ghidra address:
NTSC-U/C: 0x001febc8
Ghidra address:
PAL: 0x00207968

◆ BeginEvent()

void TriggerMgr::BeginEvent ( int nRuleSet)

Fire the triggers that wait on the begin event.

The metagame calls it once the triggers of the arena have loaded, and GfxManager once the tracks are built. mGameState becomes 4, the state of a beginning game.

Parameters
nRuleSetThe rule set RuleSetCondition tests.
Ghidra address:
NTSC-U/C: 0x001fec38
Ghidra address:
PAL: 0x002079d8

◆ StageCompleteEvent()

void TriggerMgr::StageCompleteEvent ( int nPlayer)

Fire the triggers that wait on a player completing a stage.

Parameters
nPlayerThe player.
Ghidra address:
NTSC-U/C: 0x001fec90
Ghidra address:
PAL: 0x00207a30

◆ EndEvent()

void TriggerMgr::EndEvent ( int nState,
int nPlayer )

Fire the triggers that wait on the end of the game.

Parameters
nStateThe game state GameStateCondition tests.
nPlayerThe player.
Ghidra address:
NTSC-U/C: 0x001fece8
Ghidra address:
PAL: 0x00207a88

◆ ScoreEvent()

void TriggerMgr::ScoreEvent ( int nPlayer,
int nScore )

Fire the triggers that wait on a new score.

Parameters
nPlayerThe player.
nScoreThe score of the player.
Ghidra address:
NTSC-U/C: 0x001fed58
Ghidra address:
PAL: 0x00207af8

◆ HitEvent()

void TriggerMgr::HitEvent ( int nPlayer,
int nGemPos )

Fire the triggers that wait on a player hitting a gem.

Parameters
nPlayerThe player.
nGemPosThe lane of the gem.
Ghidra address:
NTSC-U/C: 0x001fedd0
Ghidra address:
PAL: 0x00207b70

◆ MissEvent()

void TriggerMgr::MissEvent ( int nPlayer,
int nGemPos )

Fire the triggers that wait on a player missing a gem.

Parameters
nPlayerThe player.
nGemPosThe lane of the gem.
Ghidra address:
NTSC-U/C: 0x001fee40
Ghidra address:
PAL: 0x00207be0

◆ GemEvent()

void TriggerMgr::GemEvent ( int nTrack,
int nGemPos )

Fire the triggers that wait on a gem of a captured track.

Nothing fires unless the player who captured the track still plays it.

Parameters
nTrackThe track.
nGemPosThe lane of the gem.
Ghidra address:
NTSC-U/C: 0x001feeb8
Ghidra address:
PAL: 0x00207c58

◆ NewBarEvent()

void TriggerMgr::NewBarEvent ( int nBar)

Fire the triggers that wait on the start of a bar.

Parameters
nBarThe bar.
Ghidra address:
NTSC-U/C: 0x001fef50
Ghidra address:
PAL: 0x00207cf0

◆ PhraseEndEvent()

void TriggerMgr::PhraseEndEvent ( int nTrack)

Fire the triggers that wait on the end of a phrase.

The track is no longer captured.

Parameters
nTrackThe track the phrase ended on.
Ghidra address:
NTSC-U/C: 0x001fefa8
Ghidra address:
PAL: 0x00207d48

◆ PhraseCaptureEvent()

void TriggerMgr::PhraseCaptureEvent ( int nPlayer,
int nStreak )

Fire the triggers that wait on a player capturing a phrase.

The track of the player becomes captured by the player.

Parameters
nPlayerThe player.
nStreakThe streak of the player.
Ghidra address:
NTSC-U/C: 0x001ff010
Ghidra address:
PAL: 0x00207db0

◆ PhraseMissEvent()

void TriggerMgr::PhraseMissEvent ( int nPlayer)

Fire the triggers that wait on a missed phrase.

The streak of the player returns to 0.

Parameters
nPlayerThe player that missed the phrase.
Ghidra address:
NTSC-U/C: 0x001ff0a8
Ghidra address:
PAL: 0x00207e48

◆ NewTrackEvent()

void TriggerMgr::NewTrackEvent ( int nPlayer,
int nTrack,
int nInstrument,
int nMode )

Fire the triggers that wait on a player moving to a new track.

Parameters
nPlayerThe player.
nTrackThe track.
nInstrumentThe instrument of the track.
nModeThe music mode of the track.
Ghidra address:
NTSC-U/C: 0x001ff110
Ghidra address:
PAL: 0x00207eb0

◆ HealthEvent()

void TriggerMgr::HealthEvent ( int nPlayer,
int nHealth )

Fire the triggers that wait on a change of health.

Parameters
nPlayerThe player.
nHealthThe health of the player.
Ghidra address:
NTSC-U/C: 0x001ff1b8
Ghidra address:
PAL: 0x00207f58

◆ DyingEvent()

void TriggerMgr::DyingEvent ( int nPlayer,
int nDying )

Fire the triggers that wait on a player starting or stopping dying.

Nothing fires when the state is unchanged.

Parameters
nPlayerThe player.
nDyingNon-zero while the player is dying.
Ghidra address:
NTSC-U/C: 0x001ff230
Ghidra address:
PAL: 0x00207fd0

◆ BossJourneyEvent()

void TriggerMgr::BossJourneyEvent ( )

Fire the triggers that wait on the boss journey starting.

Ghidra address:
NTSC-U/C: 0x001ff2b8
Ghidra address:
PAL: 0x00208058

◆ LyricEvent()

void TriggerMgr::LyricEvent ( const char * pszLyric)

Fire the triggers that wait on a lyric.

The lyric is stored for ChangeLyricAction to show.

Parameters
pszLyricThe lyric text.
Ghidra address:
NTSC-U/C: 0x001ff308
Ghidra address:
PAL: 0x002080a8

◆ PathUnlockedEvent()

void TriggerMgr::PathUnlockedEvent ( int nPath)

Fire the triggers that wait on a path being unlocked.

Parameters
nPathThe path, printed only.
Ghidra address:
NTSC-U/C: 0x001ff368
Ghidra address:
PAL: 0x00208108

◆ GetClock()

int TriggerMgr::GetClock ( ) const
inline
Returns
The clock of the action in progress.

◆ SetClock()

void TriggerMgr::SetClock ( int nClock)
inline

Set the clock of the action in progress.

Parameters
nClockOne of Clock.

◆ GetCurrentTime()

float TriggerMgr::GetCurrentTime ( ) const
inline
Returns
The time of the clock of the action in progress.

◆ GetTime()

float TriggerMgr::GetTime ( int nClock) const
inline

Report the time of a clock.

Parameters
nClockOne of Clock.
Returns
The time.

◆ GetPlayer()

int TriggerMgr::GetPlayer ( ) const
inline
Returns
The player of the last event that specifies one.

◆ GetNote()

char TriggerMgr::GetNote ( ) const
inline
Returns
The note of the last beat event.

◆ GetGemPos()

int TriggerMgr::GetGemPos ( ) const
inline
Returns
The lane of the last hit, miss, or gem event.

◆ GetLyric()

const String & TriggerMgr::GetLyric ( ) const
inline
Returns
The lyric of the last lyric event.

◆ GetBar()

int TriggerMgr::GetBar ( ) const
inline
Returns
The bar of the last new bar event.

◆ GetButtons()

int TriggerMgr::GetButtons ( ) const
inline
Returns
The buttons of the last button event.

◆ GetCapturer()

int TriggerMgr::GetCapturer ( int nTrack) const
inline

Report the player who captured a track.

Parameters
nTrackThe track.
Returns
The player, or kNoPlayer.

◆ GetComponent()

const String & TriggerMgr::GetComponent ( ) const
inline
Returns
The component of the last component event.

◆ GetDistance()

float TriggerMgr::GetDistance ( ) const
inline
Returns
The distance of the last time event.

◆ GetDying()

int TriggerMgr::GetDying ( int nPlayer) const
inline

Report whether a player is dying.

Parameters
nPlayerThe player.
Returns
Non-zero for a dying player.

◆ GetGameState()

int TriggerMgr::GetGameState ( ) const
inline
Returns
The state of the game GameStateCondition tests.

◆ GetHealth()

int TriggerMgr::GetHealth ( int nPlayer) const
inline

Report the health of a player.

Parameters
nPlayerThe player.
Returns
The health.

◆ GetInstrument()

int TriggerMgr::GetInstrument ( int nPlayer) const
inline

Report the instrument of the track of a player.

Parameters
nPlayerThe player.
Returns
The instrument.

◆ GetLeader()

int TriggerMgr::GetLeader ( ) const
inline
Returns
The player in the lead.

◆ GetMode()

int TriggerMgr::GetMode ( int nPlayer) const
inline

Report the music mode of the track of a player.

Parameters
nPlayerThe player.
Returns
The music mode.

◆ GetOldComponent()

const String & TriggerMgr::GetOldComponent ( ) const
inline
Returns
The component that lost the focus.

◆ GetOldPanel()

const String & TriggerMgr::GetOldPanel ( ) const
inline
Returns
The previous panel.

◆ GetOldScreen()

const String & TriggerMgr::GetOldScreen ( ) const
inline
Returns
The screen exited by the last screen event.

◆ GetPanel()

const String & TriggerMgr::GetPanel ( ) const
inline
Returns
The panel of the last component event.

◆ GetPowerup()

int TriggerMgr::GetPowerup ( ) const
inline
Returns
The powerup.

◆ GetRandom()

float TriggerMgr::GetRandom ( ) const
inline
Returns
A random value from 0 to 1, new for each time event.

◆ GetRuleSet()

int TriggerMgr::GetRuleSet ( ) const
inline
Returns
The rule set of the last begin event.

◆ GetScore()

int TriggerMgr::GetScore ( int nPlayer) const
inline

Report the score of a player.

Parameters
nPlayerThe player.
Returns
The score.

◆ GetScreen()

const String & TriggerMgr::GetScreen ( ) const
inline
Returns
The screen of the last component or screen event.

◆ GetStreak()

int TriggerMgr::GetStreak ( int nPlayer) const
inline

Report the phrase streak of a player.

Parameters
nPlayerThe player.
Returns
The phrase streak.

◆ GetTrack()

int TriggerMgr::GetTrack ( int nPlayer) const
inline

Report the track of a player.

Parameters
nPlayerThe player.
Returns
The track.

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