resonance 1.0.1
Loading...
Searching...
No Matches
overlay.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "app/msgsink.h"
6#include "msg/barstatusmsg.h"
7#include "os/hxstr.h"
8
9class HudBadge;
10class HudPanel;
11class HudTrack;
12class Message;
13class Player;
14class Renderer;
15
32class Overlay : public MsgSink {
33public:
51 Overlay(Renderer *pRenderer);
52
62 virtual ~Overlay();
63
74 virtual void DispatchPriv(Message *pMsg);
75
89 void SetFrame(float flFrame);
90
100 void Draw();
101
114 void OnBarChanged(int nTrack, int nBar, BarStatusMsg::Effects effects);
115
127 void OnLeaderChanged(Player *pOldLeader, Player *pNewLeader);
128
129 // The parts that belong to the whole screen, deleted by the destructor. Public because
130 // the heads-up script commands drive them with no accessor in the image.
132
133private:
134 // DispatchPriv() runs one of the handlers below per message identity. Each handler written
135 // "inlined" is expanded in place there, and its out-of-line copy has no caller. Most handlers
136 // act on the track display of the message's player, which FindTrack() looks up, and show text
137 // through HudTextMessage::Show() at scale 1 for 1500 unless noted.
138
149 void OnTrackSelect(Message *pMsg);
150
159 void OnGameOver();
160
172 void OnWin(Message *pMsg);
173
183 void OnChoosePowerup(Message *pMsg);
184
194 void OnCaughtPowerbar(Message *pMsg);
195
205 void OnDeployedPowerup(Message *pMsg);
206
216 void OnPointAmount(Message *pMsg);
217
227 void OnJuiceAmount(Message *pMsg);
228
238 void OnPhraseCaptured(Message *pMsg);
239
248 void OnText(Message *pMsg);
249
259 void OnLoopToggle(Message *pMsg);
260
270 void OnAdvanceSectionToggle(Message *pMsg);
271
280 void OnShowEraseEffect(Message *pMsg);
281
292 void OnPlaybackToggle(Message *pMsg);
293
303 void OnToggleGhost(Message *pMsg);
304
314 void OnJamEffect();
315
326 void OnCatch(Message *pMsg);
327
337 void OnPhraseMuffed(Message *pMsg);
338
348 void OnBeginPhraseCatch(Message *pMsg);
349
359 void OnFadeGame(Message *pMsg);
360
369 void OnPlayersTrackNeutralized(Message *pMsg);
370
380 void OnMultiplierState(Message *pMsg);
381
390 void OnPowerupFailed(Message *pMsg);
391
398 HudBadge *FindBadge(Player *pPlayer);
399
400 // The track display whose mPlayer is pPlayer, or null. Every handler inlines the search, and
401 // no out-of-line copy is recovered.
402 HudTrack *FindTrack(Player *pPlayer);
403
412 static void SetLayoutName(int nLayout);
413
414 // One track display per world player that has a slot, deleted by the destructor.
415 std::vector<HudTrack *> mTracks;
416 // One badge per world player.
417 std::vector<HudBadge *> mBadges;
418 // One instrument name per track, which a TrackSelectMsg shows on the selecting player's label.
419 std::vector<HxStr> mInstrumentNames;
420 // One TrackData::mKind per track.
421 std::vector<int> mTrackKinds;
422 Renderer *mRenderer;
423 // Globals::GetGameMode() at construction.
424 int mGameMode;
425 // Globals::GetPlayMode() at construction.
426 int mPlayMode;
427 // Non-zero in a tutorial level, from configuration code 0x3a1.
428 int mTutorial;
429 // The state of the last PlaybackToggleMsg. The constructor starts it at 0.
430 int mPlaybackOn;
431 // The bar SetFrame() last saw. The constructor starts it at -123123.
432 int mCurrentBar;
433 // Milliseconds per MIDI tick at the tempo in force at construction. SetFrame() times the text
434 // animations with it.
435 float mMsPerTick;
436 // The last bar of the level, PlayMap::GetEndBar().
437 int mLastBar;
438 // The session difficulty, GameManagerImpl::GetDifficulty() at construction.
439 int mDifficulty;
440};
441
450extern Overlay *g_pOverlay;
451
std::bitset< kEffectCount > Effects
One bit per effect kind.
Definition barstatusmsg.h:45
One player's badge on the head-up display, a score readout over a FreQ icon.
Definition hudbadge.h:21
The parts of the head-up display that belong to the whole screen rather than to one player.
Definition hudpanel.h:28
One player's track display on the head-up display.
Definition hudtrack.h:30
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Receiver of engine messages.
Definition msgsink.h:37
Head-up display the in-game renderer draws over the tunnel.
Definition overlay.h:32
void OnBarChanged(int nTrack, int nBar, BarStatusMsg::Effects effects)
Update the track display for one bar whose state a BarStatusMsg changed.
void OnLeaderChanged(Player *pOldLeader, Player *pNewLeader)
Move the leader marker from one player to another.
HudPanel * mPanel
Definition overlay.h:131
virtual ~Overlay()
Release every display object and clear g_pOverlay.
void Draw()
Draw the display.
Overlay(Renderer *pRenderer)
Build the display for the game about to start.
virtual void DispatchPriv(Message *pMsg)
Act on one message the renderer sends on.
void SetFrame(float flFrame)
Advance the display to one song position.
One participant in a session, local or remote.
Definition player.h:39
In-game renderer that drives the tunnel, the overlay, and the arena for one game.
Definition renderer.h:56
Overlay * g_pOverlay
The display that exists, or null.
HxStr g_hudLayoutName
Prefix of every per-layout head-up display object name, HUD<n> for layout n.