|
resonance 1.0.1
|
Driver of the controllers' vibration motors during a song. More...
#include <forcefeedbackmgr.h>
Classes | |
| struct | Slot |
| One controller's motor state. More... | |
| struct | Effect |
| One vibration effect, read from the configuration by LoadConfig(). More... | |
Public Member Functions | |
| ForceFeedbackMgr () | |
| Load the configuration and register the object as the unit's instance. | |
| ~ForceFeedbackMgr () | |
| Clear mEffects and the unit's instance pointer. | |
| void | StartMetronome (const Sch::Tick &delay) |
| Schedule the metronome's start a delay from the current song position. | |
| void | SetPlayerCount (unsigned int nPlayers) |
| Size mSlots to the players and suspend everything for three players or more. | |
| void | PulseBeat () |
| Pulse the small motor of every idle controller for mPulseLength and schedule the next beat. | |
| void | SyncMetronome () |
| Schedule the first beat pulse ahead of the next beat by the motors' latency. | |
| void | PlayEffect (int nPlayerSlot, int nEffect) |
| Start one vibration effect on a player's controller. | |
| void | Suspend (unsigned char nMask) |
| Stop every motor and set flags in mFlags. | |
| void | SetPaused (int bPaused) |
| Stop every motor and set the paused flag, or clear the flag. | |
| void | SetJukeboxMode (int bJukebox) |
| Stop every motor and set the jukebox flag, or clear the flag. | |
| void | SetPlaybackMode (int bPlayback) |
| Stop every motor and set the playback flag, or clear the flag. | |
| void | SetEnabled (int bEnabled) |
| Clear the disabled flag, or stop every motor and set it. | |
| void | SetPowerup (unsigned int nPlayerSlot, int bPowerup) |
| Set a slot's powerup mark when the slot exists. | |
| void | StopAll (Sch::Tick when) |
| Stop every motor twice over and set the stopped flag. | |
| void | SetBigMotor (int nPlayerSlot, int nLevel) |
| void | SetSmallMotor (int nPlayerSlot, int nState) |
| void | SetBothMotors (int nPlayerSlot, int nSmallState, int nBigLevel) |
| void | ApplyMotors (int nPlayerSlot) |
| Pass a slot's motor state to the controller through InputPoller::SetVibration(). | |
| void | PlayUnusedEffect (Player *pPlayer) |
| Play effect 4, configuration 0x4b6, on a player's controller. | |
| void | PlayBumpEffect (Player *pPlayer) |
| Play the effect a bumper hit produces, effect 1, on the target's controller. | |
| void | PlayAutocatchEffect (Player *pPlayer) |
| Play the effect an autocatcher produces, effect 0, on a player's controller. | |
| void | PlayNeutralizedEffect (Player *pPlayer) |
| Play the effect a neutralized track produces, effect 3, on a player's controller. | |
| void | PlayCrippleEffect (Player *pPlayer) |
| Play the effect a crippler hit produces, effect 2, on a player's controller. | |
Driver of the controllers' vibration motors during a song.
The class is not polymorphic and emits no RTTI. The name is inferred from its translation unit. The six file-local scheduler commands beside it record ForceFeedbackMgr.cpp in their anonymous-namespace RTTI names (SteadyFBCmd, StartMetronomeFBCmd, SetPowerupFBCmd, SetSmallMotorCmd, SetLargeMotorCmd, and SetBothMotorsCmd). The object is 0x48 bytes. GrooveWorld builds one, keeps it at +0x34, and deletes it in GrooveWorld::Shutdown(). The constructor also stores the object in the unit's pointer at 0x0067a3f0, which every command's Execute() goes through.
Two kinds of vibration run through it. The metronome pulses the small motor of every player not inside a powerup effect once a beat, and an effect runs one of five configured motor patterns on one player's controller. Any bit set in mFlags suspends both.
The unit's static initialiser at 0x0016ff68 hands six factory functions to the command registrar at 0x00538208 with an identifier of zero, and each factory returns null. All six are the commands' NewCmd() members.
| ForceFeedbackMgr::ForceFeedbackMgr | ( | ) |
Load the configuration and register the object as the unit's instance.
| ForceFeedbackMgr::~ForceFeedbackMgr | ( | ) |
Clear mEffects and the unit's instance pointer.
| void ForceFeedbackMgr::StartMetronome | ( | const Sch::Tick & | delay | ) |
Schedule the metronome's start a delay from the current song position.
The stopped flag is cleared first. Nothing is scheduled unless the remaining flags are clear or the paused flag alone is set.
| delay | The delay, in MIDI ticks. |
| void ForceFeedbackMgr::SetPlayerCount | ( | unsigned int | nPlayers | ) |
Size mSlots to the players and suspend everything for three players or more.
| nPlayers | The player count. |
| void ForceFeedbackMgr::PulseBeat | ( | ) |
Pulse the small motor of every idle controller for mPulseLength and schedule the next beat.
The file-local SteadyFBCmd runs it.
| void ForceFeedbackMgr::SyncMetronome | ( | ) |
Schedule the first beat pulse ahead of the next beat by the motors' latency.
The file-local StartMetronomeFBCmd runs it. The lead is half the pulse length in milliseconds plus 90000000, converted to MIDI ticks through the song clock's tempo map. A beat closer than the lead moves the pulse one beat on.
| void ForceFeedbackMgr::PlayEffect | ( | int | nPlayerSlot, |
| int | nEffect ) |
Start one vibration effect on a player's controller.
Nothing happens while any flag is set or the slot is -1. The slot is marked as running an effect, each pulse turns both motors on at twice the period times the pulse index and off again, and a closing SetPowerupFBCmd clears the mark after one period.
| nPlayerSlot | The player's slot, as Player::GetInputSlot() reports it. |
| nEffect | The effect number, an index into mEffects. |
| void ForceFeedbackMgr::Suspend | ( | unsigned char | nMask | ) |
Stop every motor and set flags in mFlags.
The image has no caller.
| nMask | The flags to set. |
| void ForceFeedbackMgr::SetPaused | ( | int | bPaused | ) |
Stop every motor and set the paused flag, or clear the flag.
GameManagerImpl's pause and unpause handlers are the recovered callers.
| bPaused | Non-zero to pause. |
| void ForceFeedbackMgr::SetJukeboxMode | ( | int | bJukebox | ) |
Stop every motor and set the jukebox flag, or clear the flag.
GrooveWorld passes Globals::IsJukeboxMode().
| bJukebox | Non-zero in jukebox mode. |
| void ForceFeedbackMgr::SetPlaybackMode | ( | int | bPlayback | ) |
Stop every motor and set the playback flag, or clear the flag.
GrooveWorld passes GrooveWorld::mIsPlayback.
| bPlayback | Non-zero while a recording plays back. |
| void ForceFeedbackMgr::SetEnabled | ( | int | bEnabled | ) |
Clear the disabled flag, or stop every motor and set it.
| bEnabled | Non-zero to allow vibration. |
| void ForceFeedbackMgr::SetPowerup | ( | unsigned int | nPlayerSlot, |
| int | bPowerup ) |
Set a slot's powerup mark when the slot exists.
SetPowerupFBCmd runs it.
| nPlayerSlot | The slot. |
| bPowerup | The mark. |
| void ForceFeedbackMgr::StopAll | ( | Sch::Tick | when | ) |
Stop every motor twice over and set the stopped flag.
GrooveWorld::Exit() is the one caller, and it passes a song position of zero that the body does not read.
| when | The song position, which the body does not read. |
| void ForceFeedbackMgr::SetBigMotor | ( | int | nPlayerSlot, |
| int | nLevel ) |
| nPlayerSlot | The slot. |
| nLevel | The big motor's level. |
| void ForceFeedbackMgr::SetSmallMotor | ( | int | nPlayerSlot, |
| int | nState ) |
| nPlayerSlot | The slot. |
| nState | The small motor's state. |
| void ForceFeedbackMgr::SetBothMotors | ( | int | nPlayerSlot, |
| int | nSmallState, | ||
| int | nBigLevel ) |
| nPlayerSlot | The slot. |
| nSmallState | The small motor's state. |
| nBigLevel | The big motor's level. |
| void ForceFeedbackMgr::ApplyMotors | ( | int | nPlayerSlot | ) |
Pass a slot's motor state to the controller through InputPoller::SetVibration().
| nPlayerSlot | The slot. The controller's port is one more. |
| void ForceFeedbackMgr::PlayUnusedEffect | ( | Player * | pPlayer | ) |
Play effect 4, configuration 0x4b6, on a player's controller.
The image has no caller.
| pPlayer | The player. |
| void ForceFeedbackMgr::PlayBumpEffect | ( | Player * | pPlayer | ) |
Play the effect a bumper hit produces, effect 1, on the target's controller.
AppTunnel's powerup routine at 0x00448d58 calls it for a bumper.
| pPlayer | The player that was bumped. |
| void ForceFeedbackMgr::PlayAutocatchEffect | ( | Player * | pPlayer | ) |
Play the effect an autocatcher produces, effect 0, on a player's controller.
AppTunnel's powerup routine at 0x00448d58 calls it for an autocatcher.
| pPlayer | The player that used the autocatcher. |
| void ForceFeedbackMgr::PlayNeutralizedEffect | ( | Player * | pPlayer | ) |
Play the effect a neutralized track produces, effect 3, on a player's controller.
AppTunnel's handler of PlayersTrackNeutralizedMsg calls it.
| pPlayer | The player whose track was neutralized. |
| void ForceFeedbackMgr::PlayCrippleEffect | ( | Player * | pPlayer | ) |
Play the effect a crippler hit produces, effect 2, on a player's controller.
TnlCrippleFX's frame routine at 0x0043e500 is the recovered caller.
| pPlayer | The player that was hit. |