wavelength 1.0.0
Loading...
Searching...
No Matches
tnlfreestyle.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "gfx/freestylus.h"
6#include "gfx/gfxtunnel.h"
8#include "gfx/ship.h"
9#include "gfx/tnlactivator.h"
10#include "gfx/tnlsabretrail.h"
11#include "math/interpolator.h"
12#include "math/transform.h"
13#include "math/vector2.h"
14#include "math/vector3.h"
15#include "rnd/rndtransanim.h"
17#include "script/dataarray.h"
18
29public:
41 TnlFreestyle(int nPlayer, int nType, Ship *pShip, TnlActivator *pActivator, GfxTunnel *pTunnel);
42
50
64 DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption, int bFreestyle);
65
72 void Reset();
73
83 void SetActive(bool bActive, int bVictory, bool bQuick);
84
93 void SetPlaying(bool bPlaying, int nColumn);
94
101 void Sample();
102
110 void SetStick(const Vector3 &stick);
111
120 void Scratch(float flTick, float flDuration);
121
130 void Poll(float flTicks, float flTime);
131
139
146 void Draw();
147
162 void ComputeXfms(bool bCam,
163 RndTransAnim *pAnim,
164 const Vector3 *pStick,
165 float (*pShipXfm)[kTransformRowFloatCount],
166 Transform *pCamXfm,
167 float flTime,
168 float flTicks,
169 float flElapsed);
170
177 void BeginPass();
178
185 void EndPass();
186
194
202
210 int GetTrack();
211
221 void GetPassFlags(int *pbCam, int *pbShip, int *pbShowShip);
222
229 static float sEnterDelay;
230
237 static float sExitDelay;
238
245 static float sMaxChangePerMs;
246
253 static float sCamMaxChangePerMs;
254
262 static float sLaneScale;
263
270 static float sInvLaneScale;
271
278 static std::unique_ptr<Freestylus> sFreestylus;
279
286
293
300
307
314
321
328
335
342
349
356
363
370
377
378private:
379 std::unique_ptr<TnlSabreTrail> mTrail;
380 int mPlayer;
381 int mActive;
382 int mAssembled;
383 int mVictory;
384 int mPlaying;
385 int mType;
386 GfxTunnel *mTunnel;
387 Ship *mShip;
388 TnlActivator *mActivator;
389 float mStartTick;
390 std::unique_ptr<LinearInterpolator> mAssembly;
391 std::unique_ptr<LinearInterpolator> mCamBlend;
393 unsigned char mReserved34[0xc]; // +0x34 to +0x3f are not yet identified.
394 Vector3 mStick;
395 Vector3 mShipPos;
396 Vector3 mPathAxis;
399 QuadraticApproach mTumbleX;
400 QuadraticApproach mTumbleY;
401 QuadraticApproach mCamX;
402 QuadraticApproach mCamY;
403 QuadraticApproach mConstraint;
404};
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 at a speed quadratic in the distance left.
Definition quadraticapproach.h:10
Animation of a transformable's local transform by rotation, translation, and scale keys.
Definition rndtransanim.h:20
Ship of one player, which rides the tracks of the tunnel and fires beams at the gems.
Definition ship.h:41
The activator of a player, the frame at the bottom of the track that carries the catcher.
Definition tnlactivator.h:16
void Draw()
Draw the freestylus, and the trail of a scratch freestyle.
void UpdateTrail()
Draw the needle of a scratch freestyle at the ship.
void Poll(float flTicks, float flTime)
Advance the assembly, the curves, and the freestylus, and place the ship and the camera.
static Vector2 sInvRange
The reciprocals of sRange.
Definition tnlfreestyle.h:292
void SetActive(bool bActive, int bVictory, bool bQuick)
Assemble the freestylus, or take it apart.
static Vector3 sConstraintChangeFunc
The curve of the constraint, constraint_change_func.
Definition tnlfreestyle.h:376
static float sMaxChangePerMs
The greatest speed of the position, max_change_per_ms.
Definition tnlfreestyle.h:245
static Vector2 sCamRange
The reach of the camera, cam_range.
Definition tnlfreestyle.h:341
void BeginPass()
Hand the ship and the camera to the freestyle.
void ComputeXfms(bool bCam, RndTransAnim *pAnim, const Vector3 *pStick, float(*pShipXfm)[kTransformRowFloatCount], Transform *pCamXfm, float flTime, float flTicks, float flElapsed)
Work out the transforms of the ship and of the camera from the stick.
static Vector3 sChangeFunc
The curve of the position, change_func.
Definition tnlfreestyle.h:355
void Scratch(float flTick, float flDuration)
Sweep the needle of a scratch freestyle for a note.
void OnAssembled()
Handle the end of the assembly.
static Vector3 sCamWinOffset
The offset of the camera of a victory, cam_win_offset.
Definition tnlfreestyle.h:327
static float sCamMaxChangePerMs
The greatest speed of the camera, cam_max_change_per_ms.
Definition tnlfreestyle.h:253
static Vector3 sCamWinLookOffset
The offset the camera of a victory looks at, cam_win_look_offset.
Definition tnlfreestyle.h:334
void LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption, int bFreestyle)
Load the settings of the trail, of the freestyle of the kind, and of the lanes.
void Sample()
Start a sample on the freestylus and on the trail.
static Vector3 sCamChangeFunc
The curve of the camera, cam_change_func.
Definition tnlfreestyle.h:369
int GetTrack()
Report the track the ship of the freestyle is over.
void GetPassFlags(int *pbCam, int *pbShip, int *pbShowShip)
Report what the freestyle takes over.
static Vector3 sCamLookOffset
The offset the camera looks at, cam_look_offset.
Definition tnlfreestyle.h:320
static Vector3 sCamOffset
The offset of the camera, cam_offset.
Definition tnlfreestyle.h:313
static float sEnterDelay
The delay of the assembly in ticks, enter_delay.
Definition tnlfreestyle.h:229
~TnlFreestyle()
Delete the shared freestylus, the trail, and the curves.
static Vector2 sConstrainedCamRange
The reach of the camera of a constrained freestyle, constrained_cam_range.
Definition tnlfreestyle.h:348
static std::unique_ptr< Freestylus > sFreestylus
The freestylus the freestyles share, or null.
Definition tnlfreestyle.h:278
static float sExitDelay
The delay of the disassembly in ticks, exit_delay.
Definition tnlfreestyle.h:237
static Vector3 sTumbleChangeFunc
The curve of the tumble, tumble_change_func.
Definition tnlfreestyle.h:362
static float sLaneScale
The scale of a stick towards the lanes ahead, 1 for several players on this console and 2 otherwise.
Definition tnlfreestyle.h:262
static float sInvLaneScale
The reciprocal of sLaneScale.
Definition tnlfreestyle.h:270
void SetPlaying(bool bPlaying, int nColumn)
Record whether the player plays, which grows the beams and draws the trail.
void Reset()
End the freestyle at once, keeping an assembled freestylus.
TnlFreestyle(int nPlayer, int nType, Ship *pShip, TnlActivator *pActivator, GfxTunnel *pTunnel)
Create the trail, the curves, and the shared freestylus of the first freestyle.
void EndPass()
Give the ship and the camera back.
void OnDisassemble()
Handle the start of the disassembly.
void SetStick(const Vector3 &stick)
Set the position of the stick.
static Vector2 sRange
The reach of the stick across and along the track, range.
Definition tnlfreestyle.h:285
static Vector3 sConstrainedCenter
The place of a constrained freestyle, constrained_center.
Definition tnlfreestyle.h:306
static Vector3 sCenter
The place of the freestyle, center.
Definition tnlfreestyle.h:299
Affine transform stored as three basis rows and a translation row.
Definition transform.h:18
Two-component vector, used for texture coordinates.
Definition vector2.h:12
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:14
constexpr int kTransformRowFloatCount
Floats in a row of a transform held as a bare array, x, y, z, and padding.
Definition transform.h:29