|
resonance 1.0.1
|
In-game renderer that drives the tunnel, the overlay, and the arena for one game. More...
#include <renderer.h>


Classes | |
| struct | Cell |
| One cell of the bar grid, a plain record of the last BarStatusMsg state per track and bar. More... | |
Public Member Functions | |
| Renderer () | |
| Build the tunnel, overlay, and arena for the game about to start. | |
| virtual | ~Renderer () |
| Release the three sinks and clear g_pRenderer. | |
| virtual void | DispatchPriv (Message *pMsg) |
| Dispatch one message. | |
| virtual void | PollMessages () |
| Sample the song clock, then deliver every queued message. | |
| virtual void | Update () |
| Advance everything the renderer draws to the sampled song tick. | |
| virtual void | Draw () |
| Draw the frame. | |
| Cell * | GetCell (int nTrack, int nBar) |
| Look up the cell for one track and bar. | |
| Public Member Functions inherited from MsgSource | |
| virtual | ~MsgSource () |
| virtual void | AddSink (MsgSink *pSink) |
| Register a sink, ignoring a sink that is already registered. | |
| virtual void | RemoveSink (MsgSink *pSink) |
| Unregister the first occurrence of a sink. | |
| void | Send (Message *pMsg) const |
| Deliver a message to every registered sink, in registration order. | |
| void | ClearSinks () |
| Unregister every sink. | |
| Public Member Functions inherited from RendererBase | |
| RendererBase () | |
| Start the queue with the router as its one sink. | |
| virtual | ~RendererBase () |
| Release the queue and the router. | |
| virtual void | Dispatch (Message *pMsg) |
| Accept a message into the queue. | |
| virtual void | Start () |
| Start the renderer running. | |
| virtual void | Stop () |
| Stop the renderer running. | |
| virtual void | UpdateSimple () |
| Advance the renderer by one frame without the full update. | |
| virtual void | DrawSimple () |
| Draw the frame without the full draw. | |
| Public Member Functions inherited from MsgSink | |
| void * | operator new (size_t nSize) |
| Allocate a sink from the tagged heap under the tag "MsgSink". | |
| void | operator delete (void *pBlock) |
| Release a sink to the tagged heap. | |
| virtual | ~MsgSink () |
Static Public Member Functions | |
| static void | LoadCommon () |
| Start the three common loads unless they have already started. | |
| static void | UnloadCommon () |
| Release the level loads and then the three common loads. | |
| static void | LoadLevel (const GameParams ¶ms) |
| Start the level and arena loads for one game unless they are already the ones loaded. | |
| static void | UnloadLevel () |
| Delete the level and arena loaders and forget both names. | |
| static int | PollCommon (float *pflProgress) |
| Poll the common loads, three or, in the European release, four. | |
| static int | PollLevel (float *pflProgress) |
| Poll the arena and level loads. | |
| static int | IsLevelLoaded (const HxStr &arena, const HxStr &level) |
| Report whether one arena and level are loaded. | |
Public Attributes | |
| float | mSongTick |
| The song tick PollMessages() last sampled, in MIDI ticks. | |
| Public Attributes inherited from MsgSource | |
| int | mGraphBuilt |
| A word no member of this class reads. | |
In-game renderer that drives the tunnel, the overlay, and the arena for one game.
Its RTTI descriptor is at 0x008efc70. It has two public non-virtual bases, MsgSource at +0x00 and RendererBase at +0x14. Its type function is at 0x00431f18.
The base offsets follow from the base sizes in the same way as for MetRenderer. MsgSource is 0x14 bytes and RendererBase is 0x48, and the first member of this class is therefore at +0x5c. The object is 0xa8 bytes, the size the allocation at 0x0018cadc requests under the MsgSink tag. The allocating routine, at 0x0018caa8, is the constructor's one caller and stores the result at +0x28 of the world.
Two tables belong to the class. The MsgSource table at 0x0081a110 has four entries, the same length as MsgSource's table, and only the destructor differs. The RendererBase table at 0x0081a0b0 has eleven entries and adjusts this by -20. A diff against RendererBase's table at 0x007d2d20 reads overrides at slots 1, 3, 6, 7, and 8, and inheritance at slots 2, 4, 5, 9, and 10. Slots 3, 7, and 8 are pure in the base, and this class makes the renderer concrete.
The constructor records the object in g_pRenderer and the destructor clears it. The three objects the renderer builds (AppTunnel, Overlay, and TnlArena) are also its three message sinks. MsgSource::Send() delivers every message DispatchPriv() does not consume to all three.
The translation unit also defines seven static routines over five async loaders and two cached names, all file-scope globals. The front end starts the loads and the constructor waits for them.
The unreferenced forwarder at 0x00432440 in this unit, byte-identical to MsgJoiner::DispatchPriv() at 0x00195b70, has its unwind record at 0x006e32b8 as its only reference and is recorded here rather than declared.
| Renderer::Renderer | ( | ) |
Build the tunnel, overlay, and arena for the game about to start.
Pumps the timers and polls every async load until the three common loaders and then the level and arena loaders report done, the second wait against the arena and level names of configuration codes 0x27c and 0x278. Each wait ends with one more poll whose result is discarded. Resolves outer.env, whose fog colour becomes the device clear colour after the VRAM table is cleared, and the views outer.view, tnl.view, hud.view, and one tnl locald.view per local player, numbered from 1. Reads configuration codes 0x397 and 0x3a2 into the two debug-overlay switches, builds the three sinks, sizes the cell grid from the tunnel object, and records itself in g_pRenderer.
|
virtual |
Release the three sinks and clear g_pRenderer.
Slot 1 of both tables. The sinks are deleted in reverse order of construction.
|
virtual |
Dispatch one message.
RendererBase slot 3, pure in the base. A GameBeginMsg runs OnMsg(), a BarStatusMsg runs OnBarStatus(), and a PointAmountMsg runs OnPointAmount(). Every other message is sent on to the sinks.
| pMsg | The message to dispatch. |
Implements MsgSink.
|
virtual |
Sample the song clock, then deliver every queued message.
RendererBase slot 6. The tick is stored as a float in mSongTick before RendererBase::PollMessages() drains the queue.
Reimplemented from RendererBase.
|
virtual |
Advance everything the renderer draws to the sampled song tick.
RendererBase slot 7, pure in the base. The tick goes to the three sinks and the three views, and each view then recomposes its world transform.
Implements RendererBase.
|
virtual |
Draw the frame.
RendererBase slot 8, pure in the base. Draws outer.view, sets up an alternative GS draw context while g_nLsdMode is set, draws each local tunnel view after AppTunnel::PrepareLocalView() has placed it, draws hud.view and the overlay, and finally the two debug overlays under mDrawTimingGraph and mDrawRenderStats.
Implements RendererBase.
| Cell * Renderer::GetCell | ( | int | nTrack, |
| int | nBar ) |
Look up the cell for one track and bar.
The bar wraps modulo the slice count, with a negative remainder raised into range. The title is inferred.
| nTrack | The track. It selects the row. |
| nBar | The bar. It selects the column. |
|
static |
Start the three common loads unless they have already started.
Rewinds the zone rndCommon, starts tunnel/tunnel_new.rnd, tunnel/launch.rnd, and hud/hud.rnd, passing the zone's index as each loader's third argument, and enqueues all three. The European release also starts hud/game_fonts<suffix>.rnd, the suffix being GetFontLanguageSuffix(), and enqueues that load first.
|
static |
Release the level loads and then the three common loads.
Each common loader is unloaded and then deleted, hud/hud.rnd first, and its global is cleared. The European release unloads its font load after hud/hud.rnd.
|
static |
Start the level and arena loads for one game unless they are already the ones loaded.
A changed level name drops both loaders, and a changed arena name drops the arena loader. Each missing loader then rewinds its zone (rndTnlLevel or rndTnlArena) and starts levels/<level>/images/images.rnd or arenas/<arena>/<arena>.rnd, and the new name is recorded.
| params | The settings whose level and arena names are loaded. |
|
static |
Delete the level and arena loaders and forget both names.
|
static |
Poll the common loads, three or, in the European release, four.
| pflProgress | Receives the mean progress of the loads. Not written when the loads have not started. |
|
static |
Poll the arena and level loads.
| pflProgress | Receives the mean progress of the two loads. Not written when the arena load has not started. |
Report whether one arena and level are loaded.
The image has no caller.
| arena | The arena name to compare. |
| level | The level name to compare. |
| float Renderer::mSongTick |
The song tick PollMessages() last sampled, in MIDI ticks.
+0x60
Public because Overlay's handlers at 0x0041fdd8 and 0x0042b068 and AppTunnel::OnBarChanged() read it directly through the renderer they record, and the image has no accessor for it.