resonance 1.0.1
Loading...
Searching...
No Matches
tnlarena.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "app/msgsink.h"
6#include "rnd/mesh.h"
7
9class Message;
10class Player;
11class PointAmountMsg;
12class Renderer;
13class ScreenAnim;
14class WinMsg;
15
16namespace Rnd {
17class Mat;
18} // namespace Rnd
19
39class TnlArena : public MsgSink {
40public:
46 class ScreenMesh {
47 public:
59 mMesh->SetMat(mMat);
60 }
61
71 void SetMaterial(Rnd::Mat *pMat) const;
72
75 };
76
83 public:
92
95 };
96
107 TnlArena(Renderer *pRenderer);
108
119 virtual ~TnlArena();
120
133 virtual void DispatchPriv(Message *pMsg);
134
145 void SetFrame(float flFrame);
146
147private:
156 void OnPointAmount(PointAmountMsg *pMsg);
157
167 void OnJuiceAmount(JuiceAmountMsg *pMsg);
168
177 void OnWin(WinMsg *pMsg);
178
188 void LockLevel();
189
190 std::vector<PlayerMaterial *> mPlayerMaterials;
191 std::vector<ScreenMesh> mScreenMeshes;
192
193public:
194 // The animation the screens show. Public because the test-arena script command drives it
195 // directly.
197
198private:
199 // Globals::GetGameMode() at construction.
200 int mGameMode;
201
202public:
203 // Starts at -1, and DispatchPriv() acts on a JuiceAmountMsg only while the value is still
204 // -1. It is public because the test-arena script command sets it directly.
206
207private:
208 // The level last passed to ScreenAnim::SetLevel(). Starts at 1, or at the play mode when that
209 // is 2.
210 int mLevel;
211};
212
219extern TnlArena *g_pTnlArena;
Event the game passes between a MsgSource and a MsgSink.
Definition juiceamountmsg.h:20
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
One participant in a session, local or remote.
Definition player.h:39
Event the game passes between a MsgSource and a MsgSink.
Definition pointamountmsg.h:24
In-game renderer that drives the tunnel, the overlay, and the arena for one game.
Definition renderer.h:56
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Indexed triangle mesh with one material.
Definition mesh.h:46
Animation of the arena screens that TnlArena drives.
Definition screenanim.h:14
Player * mPlayer
Definition tnlarena.h:93
Rnd::Mat * mMat
Definition tnlarena.h:94
PlayerMaterial(Player *pPlayer)
Record the player and resolve its material.
One mesh that shows an arena screen, with the material it had when the arena was built.
Definition tnlarena.h:46
void SetMaterial(Rnd::Mat *pMat) const
Put a material on the mesh.
Rnd::Mesh * mMesh
Definition tnlarena.h:73
Rnd::Mat * mMat
Definition tnlarena.h:74
~ScreenMesh()
Put the recorded material back on the mesh.
Definition tnlarena.h:58
Game-side controller of the arena screens around the tunnel.
Definition tnlarena.h:39
virtual void DispatchPriv(Message *pMsg)
Act on one message the renderer sends on.
int mJuiceLock
Definition tnlarena.h:205
virtual ~TnlArena()
Stop the screen animation and restore every screen mesh's original material.
void SetFrame(float flFrame)
Advance the screen animation to one song position.
TnlArena(Renderer *pRenderer)
Build the arena screens for the game about to start.
ScreenAnim * mScreenAnim
Definition tnlarena.h:196
Event the game passes between a MsgSource and a MsgSink.
Definition winmsg.h:30
The rendering engine.
Definition animhelper.h:3
TnlArena * g_pTnlArena
The arena that exists, or null.