wavelength 1.0.0
Loading...
Searching...
No Matches
ovyscore.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "app/hideablepanel.h"
6#include "app/hudpowerup.h"
7#include "app/rampanimator.h"
8#include "math/interpolator.h"
9#include "math/vector3.h"
10#include "rnd/rnddrawable.h"
11#include "rnd/rndmat.h"
12#include "rnd/rndmesh.h"
13#include "rnd/rndtext.h"
15#include "rnd/rndview.h"
16
25class OvyScore : public HideablePanel {
26public:
35
37 static constexpr int kNumCheckpointPositions = 4;
38
53 OvyScore(int nPlayer, int nIndex, RndView *pHudView);
54
61 ~OvyScore() override;
62
70 void Show(bool bShow) override;
71
78 void Reset();
79
90 void SetScore(int nScore);
91
101 void Poll(float fDelta, float fUnused, float fDeltaTicks);
102
109 void Draw();
110
119 void ShowCheckpoint(float fShare, int nPlace);
120
127 static float sMoveInTicks;
128
135 static float sBarGrowTicks;
136
143 static float sStableTicks;
144
151 static float sFadeTicks;
152
159 static float sMoveOutTicks;
160
167
170 return mPowerup.get();
171 }
172
174 int GetScore() const {
175 return mScore;
176 }
177
178private:
179 std::unique_ptr<HudPowerup> mPowerup;
180 RndText *mScoreText;
181 float mScoreTime;
182 int mScore;
183 RndMat *mBackgroundMat;
184 signed char mPlayer;
185 std::unique_ptr<RampAnimator> mPointsSlide;
186 signed char mState;
187 RndTransformable *mTop;
188 RndDrawable *mMesh;
189 LinearInterpolator mMove;
190 float mStableEnd;
191 RndMesh *mBar;
192 RndMat *mBarMat;
193 RampAnimator mBarGrow;
194 Vector3 mTopPos;
195 const Vector3 *mCheckpointPos;
196};
HideablePanel(const char *pszAnim, const char *pszDrawable, bool bShown)
Construct a panel and find its animation and drawable.
Icon of the power-up a player holds, with its name.
Definition hudpowerup.h:14
Straight-line interpolator.
Definition interpolator.h:99
void Reset()
Empty the score and stop the checkpoint display.
HudPowerup * GetPowerup() const
Definition ovyscore.h:169
void Draw()
Draw the score.
static constexpr int kNumCheckpointPositions
The number of places of the ranking at a checkpoint.
Definition ovyscore.h:37
static Vector3 sCheckpointPositions[kNumCheckpointPositions]
The places of the ranking, score_checkpoint_pos_1 to score_checkpoint_pos_4.
Definition ovyscore.h:166
~OvyScore() override
Destroy the score, its slide, and its power-up icon.
void Show(bool bShow) override
Slide the score in or out.
static float sFadeTicks
The ticks the bar takes to fade, score_checkpoint_fade_ticks.
Definition ovyscore.h:151
OvyScore(int nPlayer, int nIndex, RndView *pHudView)
Construct a hidden score of a player.
static float sMoveInTicks
The ticks the score takes to move in, score_checkpoint_move_in_ticks.
Definition ovyscore.h:127
void ShowCheckpoint(float fShare, int nPlace)
Start the checkpoint display.
void SetScore(int nScore)
Record a score, which shows after 600 milliseconds.
static float sStableTicks
The ticks the bar rests, score_checkpoint_stable_ticks.
Definition ovyscore.h:143
void Poll(float fDelta, float fUnused, float fDeltaTicks)
Advance the slide, the checkpoint display, the score text, and the power-up icon.
int GetScore() const
Definition ovyscore.h:174
static float sBarGrowTicks
The ticks the bar takes to grow, score_checkpoint_bar_grow_ticks.
Definition ovyscore.h:135
static float sMoveOutTicks
The ticks the score takes to move back, score_checkpoint_move_out_ticks.
Definition ovyscore.h:159
State
The stages of the checkpoint display, the values of mState.
Definition ovyscore.h:28
@ kStateFade
Definition ovyscore.h:32
@ kStateMoveIn
Definition ovyscore.h:30
@ kStateMoveOut
Definition ovyscore.h:33
@ kStateIdle
Definition ovyscore.h:29
@ kStateGrow
Definition ovyscore.h:31
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 that draws itself and then a list of other drawables.
Definition rnddrawable.h:16
Surface description: blending, lighting colours, culling, and a list of texture stages.
Definition rndmat.h:20
Triangle mesh with a material.
Definition rndmesh.h:31
Text drawn with a bitmap font as a mesh of one quad per character.
Definition rndtext.h:27
Mix-in for an object with a local transform and a world transform derived from its parent's.
Definition rndtransformable.h:17
View that shows the children of another view, its children owner, under its own transform and frame.
Definition rndview.h:27
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:14