resonance 1.0.1
Loading...
Searching...
No Matches
renderer.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "app/msgsource.h"
6#include "app/rendererbase.h"
7#include "msg/barstatusmsg.h"
8#include "msg/gamebeginmsg.h"
9
10class AppTunnel;
11class GameParams;
12class HxStr;
13class Message;
14class Overlay;
15class Player;
16class RndAsyncLoader;
17class TnlArena;
18
19namespace Rnd {
20class View;
21} // namespace Rnd
22
23namespace Sch {
24class TickClock;
25} // namespace Sch
26
56class Renderer : public MsgSource, public RendererBase {
57public:
72
89
98 virtual ~Renderer();
99
111 virtual void DispatchPriv(Message *pMsg);
112
122 virtual void PollMessages();
123
133 virtual void Update();
134
146 virtual void Draw();
147
160 Cell *GetCell(int nTrack, int nBar);
161
173 static void LoadCommon();
174
184 static void UnloadCommon();
185
198 static void LoadLevel(const GameParams &params);
199
206 static void UnloadLevel();
207
217 static int PollCommon(float *pflProgress);
218
228 static int PollLevel(float *pflProgress);
229
241 static int IsLevelLoaded(const HxStr &arena, const HxStr &level);
242
243private:
252 void OnMsg(const GameBeginMsg &msg);
253
262 void OnBarStatus(BarStatusMsg *pMsg);
263
274 void OnPointAmount(Message *pMsg);
275
276 // The world's song clock, read once by the constructor through Globals::GetSongClock().
277 Sch::TickClock *mSongClock; // +0x5c
278
279public:
288
289private:
290 // Draw the subsystem timing graph. Filled from configuration code 0x397.
291 int mDrawTimingGraph; // +0x64
292 // Draw the render-statistics overlay. Filled from configuration code 0x3a2.
293 int mDrawRenderStats; // +0x68
294 // The bar grid, mRowCount rows of mCellsPerRow cells.
295 std::vector<Cell> mCells; // +0x6c
296 // Cells per row, the `tunnel` object's slice count.
297 int mCellsPerRow; // +0x78
298 // Row count, the `tunnel` object's ring count.
299 int mRowCount; // +0x7c
300 // `outer.view`.
301 Rnd::View *mOuterView; // +0x80
302 // `tnl.view`.
303 Rnd::View *mTunnelView; // +0x84
304 // `hud.view`.
305 Rnd::View *mHudView; // +0x88
306 // One `tnl local%d.view` per local player.
307 std::vector<Rnd::View *> mLocalViews; // +0x8c
308 AppTunnel *mTunnel; // +0x98
309 Overlay *mOverlay; // +0x9c
310 TnlArena *mArena; // +0xa0
311 // The player OnPointAmount() last reported as the leader, or null.
312 Player *mLeader; // +0xa4
313};
314
324extern Renderer *g_pRenderer;
325
336extern int g_nLsdMode;
337
345
353
361
362#ifdef VIDEO_STANDARD_PAL
370extern RndAsyncLoader *g_pGameFontsLoader;
371#endif
372
380
388
395extern HxStr g_arenaName;
396
403extern HxStr g_levelName;
Game-side driver of the tunnel the in-game renderer draws.
Definition apptunnel.h:88
Event the game passes between a MsgSource and a MsgSink.
Definition barstatusmsg.h:34
std::bitset< kEffectCount > Effects
One bit per effect kind.
Definition barstatusmsg.h:45
Event the game passes between a MsgSource and a MsgSink.
Definition gamebeginmsg.h:21
Settings a game session is started with.
Definition gameparams.h:42
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
Sender of engine messages, which stores the list of sinks that receive them.
Definition msgsource.h:26
Head-up display the in-game renderer draws over the tunnel.
Definition overlay.h:32
One participant in a session, local or remote.
Definition player.h:39
RendererBase()
Start the queue with the router as its one sink.
In-game renderer that drives the tunnel, the overlay, and the arena for one game.
Definition renderer.h:56
static int PollCommon(float *pflProgress)
Poll the common loads, three or, in the European release, four.
float mSongTick
The song tick PollMessages() last sampled, in MIDI ticks.
Definition renderer.h:287
Renderer()
Build the tunnel, overlay, and arena for the game about to start.
static int PollLevel(float *pflProgress)
Poll the arena and level loads.
virtual void PollMessages()
Sample the song clock, then deliver every queued message.
static void LoadCommon()
Start the three common loads unless they have already started.
virtual void Draw()
Draw the frame.
virtual void DispatchPriv(Message *pMsg)
Dispatch one message.
virtual void Update()
Advance everything the renderer draws to the sampled song tick.
static int IsLevelLoaded(const HxStr &arena, const HxStr &level)
Report whether one arena and level are loaded.
virtual ~Renderer()
Release the three sinks and clear g_pRenderer.
static void LoadLevel(const GameParams &params)
Start the level and arena loads for one game unless they are already the ones loaded.
Cell * GetCell(int nTrack, int nBar)
Look up the cell for one track and bar.
static void UnloadLevel()
Delete the level and arena loaders and forget both names.
static void UnloadCommon()
Release the level loads and then the three common loads.
Request to load one renderer file in the background.
Definition asyncloader.h:29
Root of a loadable scene.
Definition view.h:47
Pausable view of scheduler time, together with the tempo that maps it to a song position.
Definition tickclock.h:40
Game-side controller of the arena screens around the tunnel.
Definition tnlarena.h:39
The rendering engine.
Definition animhelper.h:3
Scheduling of timed commands.
Definition activefilter.h:9
RndAsyncLoader * g_pTunnelLoader
Loader for tunnel/tunnel_new.rnd.
RndAsyncLoader * g_pLevelLoader
Loader for the level Renderer::LoadLevel() last started.
int g_nLsdMode
Switch that selects the alternative GS draw context in Renderer::Draw().
Renderer * g_pRenderer
The renderer that exists, or null.
RndAsyncLoader * g_pLaunchLoader
Loader for tunnel/launch.rnd.
HxStr g_levelName
Level name g_pLevelLoader was started for, empty when none.
HxStr g_arenaName
Arena name g_pArenaLoader was started for, empty when none.
RndAsyncLoader * g_pHudLoader
Loader for hud/hud.rnd.
RndAsyncLoader * g_pArenaLoader
Loader for the arena Renderer::LoadLevel() last started.
One cell of the bar grid, a plain record of the last BarStatusMsg state per track and bar.
Definition renderer.h:65
BarStatusMsg::Effects mEffects
Definition renderer.h:69
int mEnabled
Definition renderer.h:67
Player * mPlayer
Definition renderer.h:66
int mBar
Definition renderer.h:70
int mPowerup
Definition renderer.h:68