|
wavelength 1.0.0
|
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. | |
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.
| enum TriggerMgr::Clock |
| anonymous enum |
| TriggerMgr::TriggerMgr | ( | ) |
Construct the registry with an empty event of each kind.
| TriggerMgr::~TriggerMgr | ( | ) |
Release every trigger.
| void TriggerMgr::Init | ( | ) |
Read the "trigger" section of the configuration.
Each kind of event the debug list names sets its bit of mDebug.
| void TriggerMgr::Terminate | ( | ) |
Release every registered trigger.
The running and scheduled actions are forgotten. Their handlers deleted them.
| void TriggerMgr::SetPaths | ( | const std::vector< bool > & | paths | ) |
Record which paths of the arena are unlocked.
| paths | One flag per path. |
| bool TriggerMgr::IsPathUnlocked | ( | unsigned int | nPath | ) | const |
Report whether a path exists and is unlocked.
| nPath | The path. |
| bool TriggerMgr::PathExists | ( | unsigned int | nPath | ) | const |
Report whether a path exists.
| nPath | The path. |
| 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.
| pAction | The action. |
| flDelay | The delay. |
| 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.
| pAction | The action. |
| void TriggerMgr::Poll | ( | ) |
Run the actions whose time has come, and poll the running actions.
| void TriggerMgr::Load | ( | const char * | pszFile, |
| BinStream * | pStream ) |
Read triggers from a data file and register them.
| pszFile | The data file, which also identifies the triggers in error messages. |
| pStream | The stream to read instead of the file, or null. |
| void TriggerMgr::AddTriggers | ( | DataArray * | pTriggers | ) |
Register the triggers of an array, each with the event its node 0 names.
| pTriggers | The triggers. |
| void TriggerMgr::BeatEvent | ( | char | chNote | ) |
Fire the triggers that wait on a note of the background music.
| chNote | The note, a letter from A through G. |
| 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.
| flStart | The time of the game clock. |
| flTime | The time of the real-time clock. |
| flValue | The distance DistanceCondition tests. |
| 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.
| pMsg | The message that reported the choice. |
| void TriggerMgr::ComponentSelectStartEvent | ( | UIComponentSelectStartMsg * | pMsg | ) |
Fire the triggers that wait on the choice of a component beginning.
| pMsg | The message that reported the choice. |
| void TriggerMgr::ComponentFocusEvent | ( | UIComponentFocusChangeMsg * | pMsg | ) |
Fire the triggers that wait on the focus moving between components.
| pMsg | The message that reported the move. |
| 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.
| pszComponent | The component. |
| pszPanel | The panel of the component. |
| pszScreen | The screen of the panel. |
| void TriggerMgr::ScreenChangeEvent | ( | UIScreenChangeMsg * | pMsg | ) |
Fire the triggers that wait on a move between screens.
| pMsg | The message that reported the move. |
| void TriggerMgr::ButtonEvent | ( | int | nPlayer, |
| int | nButtons ) |
Fire the triggers that wait on a button.
| nPlayer | The controller. |
| nButtons | The buttons the controller holds. |
| 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.
| nRuleSet | The rule set RuleSetCondition tests. |
| void TriggerMgr::StageCompleteEvent | ( | int | nPlayer | ) |
Fire the triggers that wait on a player completing a stage.
| nPlayer | The player. |
| void TriggerMgr::EndEvent | ( | int | nState, |
| int | nPlayer ) |
Fire the triggers that wait on the end of the game.
| nState | The game state GameStateCondition tests. |
| nPlayer | The player. |
| void TriggerMgr::ScoreEvent | ( | int | nPlayer, |
| int | nScore ) |
Fire the triggers that wait on a new score.
| nPlayer | The player. |
| nScore | The score of the player. |
| void TriggerMgr::HitEvent | ( | int | nPlayer, |
| int | nGemPos ) |
Fire the triggers that wait on a player hitting a gem.
| nPlayer | The player. |
| nGemPos | The lane of the gem. |
| void TriggerMgr::MissEvent | ( | int | nPlayer, |
| int | nGemPos ) |
Fire the triggers that wait on a player missing a gem.
| nPlayer | The player. |
| nGemPos | The lane of the gem. |
| 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.
| nTrack | The track. |
| nGemPos | The lane of the gem. |
| void TriggerMgr::NewBarEvent | ( | int | nBar | ) |
Fire the triggers that wait on the start of a bar.
| nBar | The bar. |
| void TriggerMgr::PhraseEndEvent | ( | int | nTrack | ) |
Fire the triggers that wait on the end of a phrase.
The track is no longer captured.
| nTrack | The track the phrase ended on. |
| 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.
| nPlayer | The player. |
| nStreak | The streak of the player. |
| void TriggerMgr::PhraseMissEvent | ( | int | nPlayer | ) |
Fire the triggers that wait on a missed phrase.
The streak of the player returns to 0.
| nPlayer | The player that missed the phrase. |
| void TriggerMgr::NewTrackEvent | ( | int | nPlayer, |
| int | nTrack, | ||
| int | nInstrument, | ||
| int | nMode ) |
Fire the triggers that wait on a player moving to a new track.
| nPlayer | The player. |
| nTrack | The track. |
| nInstrument | The instrument of the track. |
| nMode | The music mode of the track. |
| void TriggerMgr::HealthEvent | ( | int | nPlayer, |
| int | nHealth ) |
Fire the triggers that wait on a change of health.
| nPlayer | The player. |
| nHealth | The health of the player. |
| 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.
| nPlayer | The player. |
| nDying | Non-zero while the player is dying. |
| void TriggerMgr::BossJourneyEvent | ( | ) |
Fire the triggers that wait on the boss journey starting.
| void TriggerMgr::LyricEvent | ( | const char * | pszLyric | ) |
Fire the triggers that wait on a lyric.
The lyric is stored for ChangeLyricAction to show.
| pszLyric | The lyric text. |
| void TriggerMgr::PathUnlockedEvent | ( | int | nPath | ) |
Fire the triggers that wait on a path being unlocked.
| nPath | The path, printed only. |
|
inline |
|
inline |
Set the clock of the action in progress.
| nClock | One of Clock. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Report the player who captured a track.
| nTrack | The track. |
|
inline |
|
inline |
|
inline |
Report whether a player is dying.
| nPlayer | The player. |
|
inline |
|
inline |
Report the health of a player.
| nPlayer | The player. |
|
inline |
Report the instrument of the track of a player.
| nPlayer | The player. |
|
inline |
|
inline |
Report the music mode of the track of a player.
| nPlayer | The player. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Report the score of a player.
| nPlayer | The player. |
|
inline |
|
inline |
Report the phrase streak of a player.
| nPlayer | The player. |
|
inline |
Report the track of a player.
| nPlayer | The player. |