wavelength 1.0.0
Loading...
Searching...
No Matches
tnlgem.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5#include "gfx/gfxtunnel.h"
6#include "gfx/meshgroup.h"
7#include "gfx/spritegroup.h"
8#include "gfx/tnltrackrange.h"
9#include "math/color.h"
10#include "math/transform.h"
11#include "rnd/rndparticlesys.h"
12
13class TnlGems;
14
22class TnlGem {
23public:
25 enum {
26 kTypeSprite = 0x40,
27 };
28
30 enum {
33 kFlagNoFlash = 0x10,
34 kFlagFlash = 0x20,
35 kFlagPassed = 0x40,
36 };
37
39 static constexpr float kNever = 1e9f;
40
42 static constexpr float kSlotWidth = 0.295f;
43
45 static constexpr float kSlotOffset = 0.205f;
46
61 void Update(TnlGems *pGems, GfxTunnel *pTunnel, const TnlTrackRange *pRange, float flTick);
62
70 void Release(GfxTunnel *pTunnel);
71
79 void Flash(GfxTunnel *pTunnel);
80
88 float Lateral() const {
89 return (static_cast<float>(mSlot) * kSlotWidth) + kSlotOffset;
90 }
91
98 static float sParticleHeight;
99
106 static float sSpriteHeight;
107
114 static float sFlareFlashSize;
115
122 static float sFlareFlashRate;
123
130 static float sMeshFlashSize;
131
138 static float sMeshFlashRate;
139
141 char GetType() const {
142 return mType;
143 }
144
146 void SetType(char nType) {
147 mType = nType;
148 }
149
151 unsigned char GetFlags() const {
152 return mFlags;
153 }
154
156 void SetFlags(unsigned char nFlags) {
157 mFlags = nFlags;
158 }
159
161 char GetTrack() const {
162 return mTrack;
163 }
164
166 void SetTrack(char nTrack) {
167 mTrack = nTrack;
168 }
169
171 float GetTick() const {
172 return mTick;
173 }
174
176 void SetTick(float flTick) {
177 mTick = flTick;
178 }
179
181 char GetSlot() const {
182 return mSlot;
183 }
184
186 void SetSlot(char nSlot) {
187 mSlot = nSlot;
188 }
189
191 float GetShowTick() const {
192 return mShowTick;
193 }
194
196 void SetShowTick(float flShowTick) {
197 mShowTick = flShowTick;
198 }
199
201 float GetRemoveTick() const {
202 return mRemoveTick;
203 }
204
206 void SetRemoveTick(float flRemoveTick) {
207 mRemoveTick = flRemoveTick;
208 }
209
212 return mMeshGroup;
213 }
214
217 return mParticle;
218 }
219
221 void SetParticle(Particle *pParticle) {
222 mParticle = pParticle;
223 }
224
226 const std::list<Transform>::iterator &GetTransform() const {
227 return mTransform;
228 }
229
231 void SetTransform(const std::list<Transform>::iterator &transform) {
232 mTransform = transform;
233 }
234
235private:
236 char mType;
237 unsigned char mFlags;
238 char mTrack;
239 float mTick;
240 char mSlot;
241 float mShowTick;
242 float mRemoveTick = kNever;
243 MeshGroup *mMeshGroup = nullptr;
244 SpriteGroup *mSpriteGroup = nullptr;
245 std::list<Transform>::iterator mTransform;
246 Particle *mParticle = nullptr;
247
256 static Color PlayerColor(char nColor);
257};
Tunnel of tracks the players fly down, with the gems, the cameras of the players, and the effects dra...
Definition gfxtunnel.h:58
The gems of one type and distance, drawn as the instances of a multimesh.
Definition meshgroup.h:19
The sprite gems of one type, drawn as the particles of a particle system.
Definition spritegroup.h:10
One gem on a track of the tunnel, 0x24 bytes.
Definition tnlgem.h:22
static float sSpriteHeight
The height of a sprite gem as a raise of PlaceCell(), one less sprite_gem_height.
Definition tnlgem.h:106
static float sParticleHeight
The height of the glow particle above a mesh gem, gem_particle_height.
Definition tnlgem.h:98
Particle * GetParticle() const
Definition tnlgem.h:216
void SetType(char nType)
Definition tnlgem.h:146
@ kFlagPassed
Definition tnlgem.h:35
@ kFlagColorMask
Definition tnlgem.h:31
@ kFlagFlash
Definition tnlgem.h:34
@ kFlagPlayerColor
Definition tnlgem.h:32
@ kFlagNoFlash
Definition tnlgem.h:33
char GetTrack() const
Definition tnlgem.h:161
static float sFlareFlashRate
One over gem_flare_flash_time, a multiple of the particle size of a sprite gem.
Definition tnlgem.h:122
unsigned char GetFlags() const
Definition tnlgem.h:151
float GetRemoveTick() const
Definition tnlgem.h:201
void SetRemoveTick(float flRemoveTick)
Definition tnlgem.h:206
const std::list< Transform >::iterator & GetTransform() const
Definition tnlgem.h:226
MeshGroup * GetMeshGroup() const
Definition tnlgem.h:211
static float sMeshFlashRate
The world length of a tick divided by gem_mesh_flash_time, the growth of a mesh flash.
Definition tnlgem.h:138
void SetSlot(char nSlot)
Definition tnlgem.h:186
float GetShowTick() const
Definition tnlgem.h:191
float GetTick() const
Definition tnlgem.h:171
void SetFlags(unsigned char nFlags)
Definition tnlgem.h:156
char GetType() const
Definition tnlgem.h:141
void SetTrack(char nTrack)
Definition tnlgem.h:166
void SetTransform(const std::list< Transform >::iterator &transform)
Definition tnlgem.h:231
void Release(GfxTunnel *pTunnel)
Return the mesh instance or the particle of the gem.
static constexpr float kNever
A tick that marks a gem as never removed.
Definition tnlgem.h:39
float Lateral() const
Report the position of the gem across its track.
Definition tnlgem.h:88
void SetParticle(Particle *pParticle)
Definition tnlgem.h:221
char GetSlot() const
Definition tnlgem.h:181
void SetShowTick(float flShowTick)
Definition tnlgem.h:196
static constexpr float kSlotWidth
A gem in slot n sits n times kSlotWidth plus kSlotOffset across its track.
Definition tnlgem.h:42
static float sMeshFlashSize
The size of the flash of a mesh gem, gem_mesh_flash_size.
Definition tnlgem.h:130
static constexpr float kSlotOffset
The position across the track of slot 0.
Definition tnlgem.h:45
void Flash(GfxTunnel *pTunnel)
Start a flash of the tunnel at the gem.
void SetTick(float flTick)
Definition tnlgem.h:176
@ kTypeSprite
Definition tnlgem.h:26
void Update(TnlGems *pGems, GfxTunnel *pTunnel, const TnlTrackRange *pRange, float flTick)
Place the gem on its track, giving it a mesh or sprite first, and pick the mesh group of its distance...
static float sFlareFlashSize
The size of the flash of a sprite gem as a multiple of its particle size.
Definition tnlgem.h:114
The gems of the tunnel, with the groups that draw them.
Definition tnlgems.h:25
A run of tracks over a span of ticks, which the tunnel reports when the region changes.
Definition tnltrackrange.h:8
Linear colour with four float components.
Definition color.h:12
One particle of a RndParticleSys pool.
Definition rndparticlesys.h:27