wavelength 1.0.0
Loading...
Searching...
No Matches
tnlcatcher.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/rampanimator.h"
4#include "gfx/gfxtunnel.h"
5#include "gfx/tnlgeom.h"
6#include "math/color.h"
7#include "rnd/rndanimatable.h"
8#include "rnd/rnddrawable.h"
9#include "rnd/rndmatanim.h"
10#include "rnd/rndview.h"
11#include "script/dataarray.h"
12
13// The activator includes this header, so the class is declared here instead.
14class TnlActivator;
15
24public:
26 static constexpr int kNumTargets = 3;
27
36 TnlCatcher(const char *pszColor, GfxTunnel *pTunnel);
37
45
53 void SetAlpha(float flAlpha);
54
62 void SetMultiplied(int bMultiplied);
63
71 void AttachTo(RndView *pParent);
72
80 void Hit(int nTarget);
81
89 void SetEnabled(int bEnabled);
90
98 void SetShown(int bShown);
99
107
116 void StopBump(TnlGeom *pGeom, int nPlayer);
117
127 void StartBump(const TnlActivator *pAttacker, TnlGeom *pGeom, int nPlayer);
128
136 void SetRaised(bool bRaised);
137
151 void Update(TnlGeom *pGeom, int nPlayer, bool bBumped, float flDelta, float flBumpTime);
152
164 static void
165 LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption);
166
173 static float sTargetSize;
174
181 static float sTargetOffset;
182
189 static int sTargetsOnTop;
190
197 static float sBumpShowTime;
198
205 static float sBumpEndTime;
206
207private:
208 Color mColor;
209 RndView *mView;
210 int mShown;
211 int mEnabled;
212 RndView *mTargets[kNumTargets];
213 RndAnimatable *mTargetHits[kNumTargets];
214 RndDrawable *mBumpFlareMesh;
215 RndMatAnim *mBumpFlare;
216 float mHitTimes[kNumTargets];
217 RndAnimatable *mAmbient;
218 RampAnimator mAnim;
219 int mMultiplied;
220 int mBumping;
221
223 static constexpr float kNoHit = -1e9f;
224};
Reference-counted array of script data nodes.
Definition dataarray.h:20
Tunnel of tracks the players fly down, with the gems, the cameras of the players, and the effects dra...
Definition gfxtunnel.h:58
Value that moves toward a target along an interpolator, and poses an animation on the value.
Definition rampanimator.h:14
Mix-in for an object driven by a frame.
Definition rndanimatable.h:16
Mix-in for an object that draws itself and then a list of other drawables.
Definition rnddrawable.h:16
Animation of a material's colours, alpha, and texture stages by keys.
Definition rndmatanim.h:19
View that shows the children of another view, its children owner, under its own transform and frame.
Definition rndview.h:27
The activator of a player, the frame at the bottom of the track that carries the catcher.
Definition tnlactivator.h:16
void SetAlpha(float flAlpha)
Set the opacity of the catcher.
static void LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption)
Load the size, the offset, and the depth test of the targets.
void SetRaised(bool bRaised)
Move the animation of the catcher towards its raised or its lowered pose.
~TnlCatcher()
Destroy the catcher.
void Hit(int nTarget)
Start the hit animation of a target, if the catcher is shown.
TnlCatcher(const char *pszColor, GfxTunnel *pTunnel)
Find the views and animations of the catcher of a colour and place its targets.
void StartBump(const TnlActivator *pAttacker, TnlGeom *pGeom, int nPlayer)
Show the bump flare in the colour of the attacker and hold the camera of the player.
static float sTargetOffset
The height of a target above the track, target_offset.
Definition tnlcatcher.h:181
static float sTargetSize
The scale of a target, target_size.
Definition tnlcatcher.h:173
void ResetTargets()
Stop the hit animations of every target.
static float sBumpEndTime
The time after the start of a bump at which the flare ends, the last frame of its alpha.
Definition tnlcatcher.h:205
void SetEnabled(int bEnabled)
Set whether the catcher may be shown.
static int sTargetsOnTop
Whether the targets draw without a depth test, targets_always_on_top.
Definition tnlcatcher.h:189
static constexpr int kNumTargets
The targets of the catcher, one for each gem button.
Definition tnlcatcher.h:26
void AttachTo(RndView *pParent)
Hang the catcher and the bump flare from a view.
void SetShown(int bShown)
Set whether the catcher is shown.
void Update(TnlGeom *pGeom, int nPlayer, bool bBumped, float flDelta, float flBumpTime)
Advance the hit animations, the animation of the catcher, and the bump flare.
void SetMultiplied(int bMultiplied)
Record whether the multiplier of the player is raised.
void StopBump(TnlGeom *pGeom, int nPlayer)
Hide the bump flare and let the camera of the player follow the player again.
static float sBumpShowTime
The time after the start of a bump at which the catcher shows again.
Definition tnlcatcher.h:197
The geometry of the tracks of the tunnel, which places a cell of a track in the world.
Definition tnlgeom.h:32
Linear colour with four float components.
Definition color.h:12