1#ifndef COASTLINE_TRACK_H
2#define COASTLINE_TRACK_H
57#define TRACK_SECTION_ALTERNATE 0x0001
60#define TRACK_SECTION_VISITED 0x8000
86#define TRACK_INSTANCE_LIGHT_RAMP 0x0003
89#define TRACK_INSTANCE_TWO_SIDED 0x0004
92#define TRACK_INSTANCE_TRANSLUCENT 0x0008
95#define TRACK_INSTANCE_SHELTER 0x0010
101#define TRACK_INSTANCE_CLEAR_SKY 0x0020
104#define TRACK_INSTANCE_FLAT 0x0080
107#define TRACK_INSTANCE_NIGHT_LIT 0x0100
110#define TRACK_INSTANCE_NO_SHADOW 0x0200
113#define TRACK_INSTANCE_RAMPED 0x0400
116#define TRACK_INSTANCE_DARK_OR_WET 0x0800
119#define TRACK_INSTANCE_UNROTATED 0x2000
122#define TRACK_INSTANCE_ARCADE 0x4000
125#define TRACK_INSTANCE_MODE_FLAGS \
126 (TRACK_INSTANCE_TWO_SIDED | TRACK_INSTANCE_CLEAR_SKY | TRACK_INSTANCE_FLAT | \
127 TRACK_INSTANCE_RAMPED)
130#define TRACK_SURFACE_START 2
133#define TRACK_SURFACE_PAVED 3
136#define TRACK_SURFACE_SLOW 4
151#define TRACK_SPECIALS 16
180#define TRACK_GATES 10
193#if TGR_PLATFORM == TGR_PLATFORM_N64
202#if TGR_PLATFORM == TGR_PLATFORM_N64
272#if TGR_PLATFORM == TGR_PLATFORM_N64
296#define g_aTrackGates g_LoadedTrack.gates
336#define RAY_INSTANCES 32
363 u16 *groundInstances,
364 s32 *groundInstanceCount,
365 u16 *nearbyInstances,
370#if TGR_BOSS_RALLY && defined(__cplusplus)
433#if TGR_BOSS_RALLY && defined(__cplusplus)
451#define TRACK_HEADER_SIZE 0x230
456#define TRACK_MAX_SIZE 4000000
458#define TRACK_MAX_SIZE 0x171400
460#define TRACK_MAX_INSTANCES 0x800
463#define TRACK_SECTION_HEADER_SIZE 0x20
465#define TRACK_SECTION_DATA_SIZE 0x800
The state the renderer shares between the parts of a frame.
The graphics binary interface types the gu routines fill in for the RSP microcode.
Pointers of 32 bits in the data the game reads from files and in its display lists.
#define TGR_PTR(T)
A pointer of 32 bits to T.
Definition ptr32.h:152
A command of a display list of the game.
Definition gbicommand.h:30
A texture of a model and its palette.
Definition render.h:63
A gate of a lap: a line across the route, seen from above.
Definition track.h:183
f32 seconds
Definition track.h:185
Vec2f ends[2]
Definition track.h:184
The triangles of a cell of the grid of the track: where they start in the list, and how many.
Definition track.h:145
u16 start
Definition track.h:146
u16 count
Definition track.h:147
A model placed on the track.
Definition track.h:63
Vec3f vector
Definition track.h:67
u16 polygonCount
Definition track.h:82
u16 groups
Definition track.h:77
u16 vertexCount
Definition track.h:80
f32 matrix[4][4]
Definition track.h:65
u16 flags
Definition track.h:79
f32 invScale
Definition track.h:71
Gfx * displayList
Definition track.h:75
u16 triangleCount
Definition track.h:81
u16 hidesGroups
Definition track.h:78
f32 w
Definition track.h:68
A point of the route, across the track.
Definition track.h:30
Vec3f position
Definition track.h:32
Vec3f right
Definition track.h:33
Vec3f left
Definition track.h:31
f32 distance
Definition track.h:34
A section of the route.
Definition track.h:38
u16 flags
Definition track.h:51
struct TrackSection * child
Definition track.h:39
struct TrackSection * parent
Definition track.h:42
u8 gridMaxX
Definition track.h:48
u8 gridMinY
Definition track.h:47
TrackPoint points[]
Definition track.h:53
struct TrackSection * reverseNext
Definition track.h:44
struct TrackSection * next
Definition track.h:41
u8 gridMaxY
Definition track.h:49
TrackPoint previousPoint
Definition track.h:52
u8 gridMinX
Definition track.h:46
u16 pointCount
Definition track.h:50
A special object of a track.
Definition track.h:166
f32 spinAngle
Definition track.h:173
s32 instance
Definition track.h:168
union TrackSpecial::@012065046060276125162265276330377072350010376373 target
u8 type
Definition track.h:176
Vec3f * path
Definition track.h:170
s32 pathLength
Definition track.h:174
A triangle of the track: its corners and what it belongs to.
Definition track.h:139
u16 vertices[3]
Definition track.h:140
u16 instance
Definition track.h:141
A point or direction in a plane.
Definition vecmath.h:24
A point or direction in space.
Definition vecmath.h:17
u16 NextGridCellInstance(TrackGridCursor *cursor)
Take the next placed model of a cell of the grid.
u16 GetInstanceGridCellCount(TrackGridCursor *cursor)
The placed models left in a cell.
s32 g_nOpaqueVisibleInstanceCount
The opaque models at the start of the list.
#define TRACK_SECTION_HEADER_SIZE
The bytes of the header of each of the two sections of the route of the loaded track.
Definition track.h:463
u16 NextGridCellTriangle(TrackGridCursor *cursor)
Take the next triangle of a cell of the grid.
TrackSection * g_pRootTrackSection
The starting route section, at its address within the loaded track.
u32 LookupTrackGridCell(f32 x, f32 y)
The triangles of the cell of the grid of the track under a point.
TrackHeader g_LoadedTrack
The loaded track.
u32 g_dwTrackTextureRomOffset
Where the textures of the loaded track are on the cartridge, after its compressed geometry.
#define TRACK_SPECIALS
The special objects a track header lists.
Definition track.h:151
s32 g_dwStreamDmaPrevSegment
The segment of textures last streamed, or -1.
u32 g_dwCurrentTrackRomOffset
Where the loaded track is on the cartridge.
#define TRACK_SECTION_DATA_SIZE
The bytes of the data of each of the two sections of the route of the loaded track.
Definition track.h:465
u16 g_awTrackDebugWords[5]
Two words of the loaded track, 0x3960 and 0x3968 bytes into it, that the loading prints.
u8 g_abTrackSection1Data[TRACK_SECTION_DATA_SIZE]
The data of the first route section of the loaded track.
TrackGate g_aTrackGates[TRACK_GATES]
The first gate of the loaded track, addressed separately by the original code.
u32 LookupInstanceCellAtPoint(f32 x, f32 y)
The placed models of the cell of the grid of the track under a point.
u32 LookupInstanceGridCell(s32 column, s32 row)
The placed models of a cell of the grid of the track.
u8 g_abTrackSection2Data[TRACK_SECTION_DATA_SIZE]
The data of the second route section of the loaded track.
s32 g_dwStreamedSnowMode
The snow mode the textures were last streamed for, or -1.
u16 g_awVisibleInstanceList[]
The placed models drawn this frame, by index.
u8 g_abTrackSection1Header[TRACK_SECTION_HEADER_SIZE]
The header of the first route section of the loaded track.
u32 FindTrackGridCellByIndex(s32 column, s32 row)
The triangles of a cell of the grid of the track by its column and row.
u8 g_abTrackSection2Header[TRACK_SECTION_HEADER_SIZE]
The header of the second route section of the loaded track.
u16 GetTrackGridCellCount(TrackGridCursor *cursor)
The triangles left in a cell.
s32 CastRayAgainstTrack(Vec3f *outPoint, Vec3f *outNormal, Vec3f *origin, u16 *groundInstances, s32 *groundInstanceCount, u16 *nearbyInstances, s32 *nearbyCount, f32 *groundDistance, s32 *groundSurface)
Drop a vertical line through a point onto the track.
@ TRACK_SPECIAL_SPIN_Z
Definition track.h:155
@ TRACK_SPECIAL_AIRPLANE_PATH_RIGHT
Definition track.h:160
@ TRACK_SPECIAL_SPIN_X
Definition track.h:156
@ TRACK_SPECIAL_AIRPLANE_TRIGGER
Definition track.h:161
@ TRACK_SPECIAL_AIRPLANE_PATH_LEFT
Definition track.h:159
@ TRACK_SPECIAL_SPIN_Y
Definition track.h:157
@ TRACK_SPECIAL_AIRPLANE
Definition track.h:158
@ TRACK_SPECIAL_WATERFALL
Definition track.h:162
s32 g_nDebugHiddenInstanceIndex
The placed model left undrawn while debugging.
#define TRACK_GATES
The gates a track can have.
Definition track.h:180
void LoadTrackGeometryFromRom(s32 track)
Decompress a track and its sections from the cartridge into g_LoadedTrack, and prepare it.
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
float f32
Definition ultratypes.h:38
unsigned short u16
Definition ultratypes.h:19
int s32
Definition ultratypes.h:25
unsigned char u8
Definition ultratypes.h:18
A display list command for the Fast3D microcode.
Definition gbi.h:132
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...