resonance 1.0.1
Loading...
Searching...
No Matches
tnlutil.h File Reference
#include <cstring>
#include "app/tunnelcache.h"
#include "math/color.h"
#include "math/transform.h"
#include "os/hxstr.h"
#include "rnd/transformable.h"
#include "rnd/tunnel.h"
Include dependency graph for tnlutil.h:

Go to the source code of this file.

Functions

Color TnlColorFromName (const HxStr &name)
 Map a player colour name to the colour the tunnel draws that player in.
Color TnlDimColorFromName (HxStr name)
 Map a player colour name to a darker form of TnlColorFromName().
Color TnlLaneColorFromName (HxStr name)
 Map a player colour name to the lane floor colour, scaled by g_flTunnelBrightness.
int TnlColorIndexFromName (HxStr name)
 Map a player colour name to its index.
void PadTransformRows (Transform &xfm)
 Set the padding word of every row of a transform to 1.
void PlaceOnPath (Rnd::Transformable &trans, float flFrame)
 Move a transformable to the tunnel path transform at one frame.
void PlaceOnRing (Rnd::Transformable &trans, int nRing, float flFrame, float flBlend)
 Move a transformable onto one ring of the tunnel at one frame, pushed outwards by 0.97.

Variables

int g_nAppTunnelTutorial
 Non-zero when AppTunnel was constructed for a tutorial level, from configuration code 0x3a1.
float g_flTunnelBrightness
 The brightness the lane floor colours are scaled by.

Function Documentation

◆ TnlColorFromName()

Color TnlColorFromName ( const HxStr & name)

Map a player colour name to the colour the tunnel draws that player in.

"green" gives green, "red" red, "yellow" yellow, "purple" (0.65, 0, 1), and "null" white. Every other name gives cyan. The alpha is always 1. The title is inferred from the five literals the routine compares against.

The name is taken by reference. TnlBumpFX::Start() passes its parameter straight through with no copy, which a by-value parameter here would require.

Parameters
nameThe colour name.
Returns
The colour.
Ghidra address:
NTSC-U/C: 0x00437e60
Ghidra address:
PAL: 0x00473c10

◆ TnlDimColorFromName()

Color TnlDimColorFromName ( HxStr name)

Map a player colour name to a darker form of TnlColorFromName().

The primary components are 0.7 rather than 1, "purple" gives (0.5, 0, 0.7), and "null" gives grey 0.7. Every other name gives cyan, and the alpha is always 1. The image has no caller.

Parameters
nameThe colour name, taken by value.
Returns
The colour.
Ghidra address:
NTSC-U/C: 0x00437fa8
Ghidra address:
PAL: 0x00473d58

◆ TnlLaneColorFromName()

Color TnlLaneColorFromName ( HxStr name)

Map a player colour name to the lane floor colour, scaled by g_flTunnelBrightness.

The primary components are 0.5, "purple" gives (0.325, 0, 0.5), and "null" gives (0, 0, 0.25), each scaled through ScaleColor(). Every other name gives unscaled white.

Parameters
nameThe colour name, taken by value.
Returns
The colour.
Ghidra address:
NTSC-U/C: 0x00438138
Ghidra address:
PAL: 0x00473ee8

◆ TnlColorIndexFromName()

int TnlColorIndexFromName ( HxStr name)

Map a player colour name to its index.

"null" gives 0, "green" 1, "red" 2, "yellow" 3, and "purple" 4. Every other name gives 0. The program lists no caller.

Parameters
nameThe colour name, taken by value.
Returns
The index.
Ghidra address:
NTSC-U/C: 0x00454770
Ghidra address:
PAL: 0x00491ca0

◆ PadTransformRows()

void PadTransformRows ( Transform & xfm)
inline

Set the padding word of every row of a transform to 1.

Matches the Vector3 constructor the image runs on each row of a stack transform before handing it to Rnd::Tunnel. No other word of the transform is written.

Parameters
xfmThe transform to pad.

◆ PlaceOnPath()

void PlaceOnPath ( Rnd::Transformable & trans,
float flFrame )
inline

Move a transformable to the tunnel path transform at one frame.

The local transform takes the path transform with its rows padded, the object is marked dirty, and its world transform is recomposed at once. TnlBoundary inlines it. The out-of-line copy has no callers.

Parameters
transThe object to move.
flFrameThe path frame.
Ghidra address:
NTSC-U/C: 0x004548d0
Ghidra address:
PAL: 0x00491e00

◆ PlaceOnRing()

void PlaceOnRing ( Rnd::Transformable & trans,
int nRing,
float flFrame,
float flBlend )
inline

Move a transformable onto one ring of the tunnel at one frame, pushed outwards by 0.97.

The same sequence as PlaceOnPath() over Rnd::Tunnel::ProjectSectionToCameraSpace(). TnlGridMarkers inlines it. The out-of-line copy has no callers.

Parameters
transThe object to move.
nRingThe ring.
flFrameThe path frame.
flBlendThe weight of the next ring's translation.
Ghidra address:
NTSC-U/C: 0x00454808
Ghidra address:
PAL: 0x00491d38

Variable Documentation

◆ g_nAppTunnelTutorial

int g_nAppTunnelTutorial
extern

Non-zero when AppTunnel was constructed for a tutorial level, from configuration code 0x3a1.

AppTunnel's constructor writes it at 0x00442344. A non-zero value stops TnlActivator::Update() from blinking the activator and catcher materials.

Ghidra address:
NTSC-U/C: 0x006e42a4
Ghidra address:
PAL: 0x00727bc4

◆ g_flTunnelBrightness

float g_flTunnelBrightness
extern

The brightness the lane floor colours are scaled by.

AppTunnel's constructor sets it to 2 for a game of two to four players, which use the split-screen tunnel, and to 1 otherwise, when it also adds "lat light1" to "tunnel.env".

Ghidra address:
NTSC-U/C: 0x006e42b0
Ghidra address:
PAL: 0x00727bd0