coastline 0.0.4
Loading...
Searching...
No Matches
trackrelocation.h File Reference
#include "common/fileio.h"
#include "common/track.h"
Include dependency graph for trackrelocation.h:

Go to the source code of this file.

Functions

void ReadAndRelocateTrackHeader (TrackHeader *track, GameFile *file)
 Read TRACK_HEADER_SIZE bytes, swap header fields, and relocate embedded track pointers.
void LoadTextureMapFile (const char *path)
 Replace the active high-resolution texture map and select texture quality from video memory.
void LoadTrackTextureMap (int track)
 Load a track's backend-specific high-resolution texture map.
void ByteSwapTrackData (TrackHeader *track)
 Swap and relocate track payloads, prepare textures, and convert instance and route data.
void ComputeTrackMaxCellIndex (TrackHeader *track)
 Replace the surface count with the maximum grid triangle index plus one, omitting entry zero.
void ByteSwapTerrainVertex (TrackPoint *point)
 Swap the coordinates and distance of one route point in place.
void ByteSwapTrackInstance (TrackInstance *instance)
 Swap instance fields and relocate the model pointer in place.
void ByteSwapTrackInstances (TrackHeader *track)
 Swap and relocate every loaded instance in a track.
void ByteSwapTrackAnimationTable (TrackHeader *track)
 Swap special animation records, relocating and converting moving-object path coordinates.
void ByteSwapTrackSegmentList (TrackHeader *track)
 Relocate section-list entries and convert each route section in place.
void ByteSwapTrackSegment (TrackSection *section)
 Swap route-section fields and points and relocate section links.
void ByteSwapTrackVec3Array (TrackHeader *track)
 Swap every track camera point's three coordinates in place.
void CopyTextureAndPaletteFromSegment (ModelTexture *textures, int count)
 Copy initial images and palettes for two-frame animated track textures into writable buffers.

Variables

u8 g_abTrackGeometryBuffer [TRACK_MAX_SIZE]
 Storage for the loaded track geometry, with TRACK_MAX_SIZE bytes of capacity.

Function Documentation

◆ ReadAndRelocateTrackHeader()

void ReadAndRelocateTrackHeader ( TrackHeader * track,
GameFile * file )

Read TRACK_HEADER_SIZE bytes, swap header fields, and relocate embedded track pointers.

Parameters
trackWritable storage for the header and the track data referenced by its offsets.
fileThe open track file positioned at its header; checked reads handle failures.
Ghidra address:
BRD3D: 0x10038510
Ghidra address:
BRGlide: 0x10031b80

◆ LoadTextureMapFile()

void LoadTextureMapFile ( const char * path)

Replace the active high-resolution texture map and select texture quality from video memory.

Parameters
pathThe null-terminated map path. A missing file produces an empty map and defaults.
Ghidra address:
BRD3D: 0x10037990
Ghidra address:
BRGlide: 0x10031030

◆ LoadTrackTextureMap()

void LoadTrackTextureMap ( int track)

Load a track's backend-specific high-resolution texture map.

Parameters
trackA valid index in g_apszTrackFilenames.
Ghidra address:
BRD3D: 0x10037a90
Ghidra address:
BRGlide: 0x10031140

◆ ByteSwapTrackData()

void ByteSwapTrackData ( TrackHeader * track)

Swap and relocate track payloads, prepare textures, and convert instance and route data.

Parameters
trackThe loaded track with a relocated header and big-endian payload arrays.
Ghidra address:
BRD3D: 0x10037e10
Ghidra address:
BRGlide: 0x100314d0

◆ ComputeTrackMaxCellIndex()

void ComputeTrackMaxCellIndex ( TrackHeader * track)

Replace the surface count with the maximum grid triangle index plus one, omitting entry zero.

Parameters
trackThe track whose grid starts and triangle indices already use host byte order.
Ghidra address:
BRD3D: 0x10037fa0
Ghidra address:
BRGlide: 0x10031660

◆ ByteSwapTerrainVertex()

void ByteSwapTerrainVertex ( TrackPoint * point)

Swap the coordinates and distance of one route point in place.

Parameters
pointA route point whose numeric fields are in the opposite byte order.
Ghidra address:
BRD3D: 0x10038380
Ghidra address:
BRGlide: 0x10031a40

◆ ByteSwapTrackInstance()

void ByteSwapTrackInstance ( TrackInstance * instance)

Swap instance fields and relocate the model pointer in place.

Parameters
instanceA loaded track instance with unswapped fields.
Ghidra address:
BRD3D: 0x10038010
Ghidra address:
BRGlide: 0x100316d0

◆ ByteSwapTrackInstances()

void ByteSwapTrackInstances ( TrackHeader * track)

Swap and relocate every loaded instance in a track.

Parameters
trackThe relocated header whose instance array remains in file byte order.
Ghidra address:
BRD3D: 0x10037fe0
Ghidra address:
BRGlide: 0x100316a0

◆ ByteSwapTrackAnimationTable()

void ByteSwapTrackAnimationTable ( TrackHeader * track)

Swap special animation records, relocating and converting moving-object path coordinates.

Parameters
trackThe relocated track whose special animation records remain in file byte order.
Ghidra address:
BRD3D: 0x10038b20
Ghidra address:
BRGlide: 0x10032190

◆ ByteSwapTrackSegmentList()

void ByteSwapTrackSegmentList ( TrackHeader * track)

Relocate section-list entries and convert each route section in place.

Parameters
trackThe relocated track header with an unconverted section pointer array.
Ghidra address:
BRD3D: 0x10038250
Ghidra address:
BRGlide: 0x10031910

◆ ByteSwapTrackSegment()

void ByteSwapTrackSegment ( TrackSection * section)

Swap route-section fields and points and relocate section links.

Parameters
sectionA section loaded in file byte order.
Ghidra address:
BRD3D: 0x100382a0
Ghidra address:
BRGlide: 0x10031960

◆ ByteSwapTrackVec3Array()

void ByteSwapTrackVec3Array ( TrackHeader * track)

Swap every track camera point's three coordinates in place.

Parameters
trackThe relocated header whose camera point array remains in file byte order.
Ghidra address:
BRD3D: 0x10038410
Ghidra address:
BRGlide: 0x10031a80

◆ CopyTextureAndPaletteFromSegment()

void CopyTextureAndPaletteFromSegment ( ModelTexture * textures,
int count )

Copy initial images and palettes for two-frame animated track textures into writable buffers.

Parameters
texturesThe relocated texture descriptors, backed by the active track texture segment.
countThe number of descriptors in textures.
Ghidra address:
BRD3D: 0x10038450
Ghidra address:
BRGlide: 0x10031ac0

Variable Documentation

◆ g_abTrackGeometryBuffer

u8 g_abTrackGeometryBuffer[TRACK_MAX_SIZE]
extern

Storage for the loaded track geometry, with TRACK_MAX_SIZE bytes of capacity.

Ghidra address:
BRD3D: 0x106c8e78
Ghidra address:
BRGlide: 0x106eff08