resonance 1.0.1
Loading...
Searching...
No Matches
TnlGem Class Reference

One gem on the tunnel, as TnlGemManager keeps it sorted by mFrame. More...

#include <tnlgem.h>

Collaboration diagram for TnlGem:

Public Types

enum  State { kStateNone = 0 , kStateFlashPending = 1 , kStateFlashed = 2 }
 Progress of the flash a gem shows as the playhead arrives. More...

Public Member Functions

 TnlGem (char nKind, char nTrack, char nColor, bool bFlash, float flFrame, float flBlend, float flAppearFrame)
 Describe a gem that holds no drawing resource and never expires.
float Place (TnlGemManager *pManager, float flFrame)
 Place the gem for one frame and report what drawing it costs.
void Release ()
 Give back the instance or the particle the gem holds.
void Flash (AppTunnel *pTunnel)
 Start a gem flash at the position of the gem's instance or particle.

Public Attributes

char mKind
char mTrack
char mState
char mColor
float mFrame
float mBlend
float mAppearFrame
float mExpireFrame
TnlGemMeshKind * mMeshKind
TnlGemEffectKind * mEffectKind
std::list< Transform >::iterator mInstance
Rnd::Particle * mParticle

Detailed Description

One gem on the tunnel, as TnlGemManager keeps it sorted by mFrame.

The class is not polymorphic and emits no RTTI. No descriptor, tag, or file path identifies it, and its name is inferred from the gem kinds it draws. It is 0x24 bytes, the element of the std::list at TnlGemManager +0x18. AppTunnel builds one on the stack for every gem it places and hands it to TnlGemManager::Add(), which stores a copy.

A gem holds no drawing resource until TnlGemManager::Update() places it. Placing a mesh kind adds one instance transform to a TnlGemMeshKind multi-mesh, and placing an effect kind takes one particle from a TnlGemEffectKind particle system. Release() gives the resource back.

Member Enumeration Documentation

◆ State

Progress of the flash a gem shows as the playhead arrives.

Enumerator
kStateNone 

The gem does not flash.

kStateFlashPending 

The gem flashes once the playhead is 20 frames short of it.

kStateFlashed 

The flash has started.

Constructor & Destructor Documentation

◆ TnlGem()

TnlGem::TnlGem ( char nKind,
char nTrack,
char nColor,
bool bFlash,
float flFrame,
float flBlend,
float flAppearFrame )

Describe a gem that holds no drawing resource and never expires.

AppTunnel calls it at 0x004478c4 and 0x00447b40.

Parameters
nKindThe kind TnlGemManager::AddMeshKind() or TnlGemManager::AddEffectKind() returned.
nTrackThe ring of the tunnel the gem sits on.
nColorThe colour index an effect gem's particle takes, as TnlColorIndexFromName() numbers the player colours.
bFlashWhether the gem flashes as the playhead arrives.
flFrameThe tunnel frame of the gem.
flBlendThe position across the ring.
flAppearFrameThe tunnel frame from which the gem is drawn.
Ghidra address:
NTSC-U/C: 0x00415790
Ghidra address:
PAL: 0x0044f2e0

Member Function Documentation

◆ Place()

float TnlGem::Place ( TnlGemManager * pManager,
float flFrame )

Place the gem for one frame and report what drawing it costs.

A mesh gem takes an instance of the finest TnlGemMeshKind the first time, and then moves its instance to the first level whose mLodDistance, added to flFrame, falls short of mFrame. An effect gem takes a particle the first time, coloured by mColor and sized by the system's low size, and is not moved afterwards. An effect gem whose system has no free particle stays unplaced and costs nothing.

Parameters
pManagerThe manager that owns the gem kinds.
flFrameThe tunnel frame of the playhead.
Returns
The drawing cost of the gem.
Ghidra address:
NTSC-U/C: 0x00411e38
Ghidra address:
PAL: 0x0044b918

◆ Release()

void TnlGem::Release ( )

Give back the instance or the particle the gem holds.

AppTunnel calls it at 0x004483bc, and TnlGemManager inlines it.

Ghidra address:
NTSC-U/C: 0x004157e8
Ghidra address:
PAL: 0x0044f338

◆ Flash()

void TnlGem::Flash ( AppTunnel * pTunnel)

Start a gem flash at the position of the gem's instance or particle.

Does nothing for a gem that holds neither. The out-of-line copy has no callers, and TnlGemManager::Update() inlines it.

Parameters
pTunnelThe tunnel that owns the flash particles.
Ghidra address:
NTSC-U/C: 0x00415868
Ghidra address:
PAL: 0x0044f3b8

Member Data Documentation

◆ mKind

char TnlGem::mKind

Below 0x40 a TnlGemMeshKind index, else a TnlGemEffectKind one.

◆ mTrack

char TnlGem::mTrack

The ring of the tunnel the gem sits on.

◆ mState

char TnlGem::mState

The flash progress, one of State.

◆ mColor

char TnlGem::mColor

The colour index of an effect gem's particle.

◆ mFrame

float TnlGem::mFrame

The tunnel frame of the gem, the sort key.

◆ mBlend

float TnlGem::mBlend

The position across the ring.

◆ mAppearFrame

float TnlGem::mAppearFrame

The tunnel frame from which the gem is drawn. The tunnel frame after which the gem is dropped, 1e9 until a later gem at the same frame, ring, and position appears.

◆ mExpireFrame

float TnlGem::mExpireFrame

◆ mMeshKind

TnlGemMeshKind* TnlGem::mMeshKind

The level whose multi-mesh holds mInstance, or null.

◆ mEffectKind

TnlGemEffectKind* TnlGem::mEffectKind

The kind whose system mParticle belongs to, or null. The gem's transform in mMeshKind's multi-mesh, set while mMeshKind is.

◆ mInstance

std::list<Transform>::iterator TnlGem::mInstance

◆ mParticle

Rnd::Particle* TnlGem::mParticle

The gem's particle, set while mEffectKind is.


The documentation for this class was generated from the following file: