|
coastline 0.0.4
|
The track data a race loads below the program: its triangles and placed models, and the route the vehicles follow. More...
#include <PR/gbi.h>#include <PR/ultratypes.h>#include "common/ptr32.h"#include "common/render.h"#include "common/vecmath.h"

Go to the source code of this file.
Classes | |
| struct | TrackPoint |
| A point of the route, across the track. More... | |
| struct | TrackSection |
| A section of the route. More... | |
| struct | TrackInstance |
| A model placed on the track. More... | |
| struct | TrackSurface |
| A triangle of the track: its corners and what it belongs to. More... | |
| struct | TrackGridCursor |
| The triangles of a cell of the grid of the track: where they start in the list, and how many. More... | |
| struct | TrackSpecial |
| A special object of a track. More... | |
| struct | TrackGate |
| A gate of a lap: a line across the route, seen from above. More... | |
| struct | TrackHeader |
| The header of the loaded track. More... | |
Macros | |
| #define | TRACK_SECTION_ALTERNATE 0x0001 |
| The flag of a branch the computer drivers do not take, and that the walks do not enter. | |
| #define | TRACK_SECTION_VISITED 0x8000 |
| The flag a walk sets on the sections it has visited. | |
| #define | TRACK_INSTANCE_LIGHT_RAMP 0x0003 |
| The bits of the flags of a placed model that pick its light from g_adwLightRampColors. | |
| #define | TRACK_INSTANCE_TWO_SIDED 0x0004 |
| The flag of a placed model drawn from both sides. | |
| #define | TRACK_INSTANCE_TRANSLUCENT 0x0008 |
| The flag of a placed model drawn after the others, the farthest first. | |
| #define | TRACK_INSTANCE_SHELTER 0x0010 |
| The flag of a placed model that keeps rain and snow off a camera under it, and echoes. | |
| #define | TRACK_INSTANCE_CLEAR_SKY 0x0020 |
| The flag of a placed model drawn without fog, and hidden in the snow, the rain, and at night except on the tracks whose spray shows in the snow. | |
| #define | TRACK_INSTANCE_FLAT 0x0080 |
| The flag of a placed model drawn with flat shading. | |
| #define | TRACK_INSTANCE_NIGHT_LIT 0x0100 |
| The flag of a placed model lit at half the light of the sun at night. | |
| #define | TRACK_INSTANCE_NO_SHADOW 0x0200 |
| The flag of a placed model that the vehicles cast no shadow on. | |
| #define | TRACK_INSTANCE_RAMPED 0x0400 |
| The flag of a placed model lit by its light ramp instead of the sun. | |
| #define | TRACK_INSTANCE_DARK_OR_WET 0x0800 |
| The flag of a placed model shown only at night or in the rain. | |
| #define | TRACK_INSTANCE_UNROTATED 0x2000 |
| The flag of a placed model whose matrix holds only its position and a scale. | |
| #define | TRACK_INSTANCE_ARCADE 0x4000 |
| The flag of a placed model shown only in arcade races and the first season. | |
| #define | TRACK_INSTANCE_MODE_FLAGS |
| The flags of a placed model that change the modes it is drawn with. | |
| #define | TRACK_SURFACE_START 2 |
| The surface a wheel and its spray take before the wheel touches the track. | |
| #define | TRACK_SURFACE_PAVED 3 |
| The surface whose tyre smoke is pale and that throws spray only in the rain: the paved road. | |
| #define | TRACK_SURFACE_SLOW 4 |
| The surface that slows a vehicle, except in snow. | |
| #define | TRACK_SPECIALS 16 |
| The special objects a track header lists. | |
| #define | TRACK_GATES 10 |
| The gates a track can have. | |
| #define | RAY_INSTANCES 32 |
| The most placed models CastRayAgainstTrack() lists. | |
| #define | TRACK_HEADER_SIZE 0x230 |
| The size of the header of a track. | |
| #define | TRACK_MAX_SIZE 0x171400 |
| #define | TRACK_MAX_INSTANCES 0x800 |
| #define | TRACK_SECTION_HEADER_SIZE 0x20 |
| The bytes of the header of each of the two sections of the route of the loaded track. | |
| #define | TRACK_SECTION_DATA_SIZE 0x800 |
| The bytes of the data of each of the two sections of the route of the loaded track. | |
Typedefs | |
| typedef struct TrackSection | TrackSection |
| A section of the route. | |
Enumerations | |
| enum | { TRACK_SPECIAL_SPIN_Z , TRACK_SPECIAL_SPIN_X , TRACK_SPECIAL_SPIN_Y , TRACK_SPECIAL_AIRPLANE , TRACK_SPECIAL_AIRPLANE_PATH_LEFT , TRACK_SPECIAL_AIRPLANE_PATH_RIGHT , TRACK_SPECIAL_AIRPLANE_TRIGGER , TRACK_SPECIAL_WATERFALL } |
| The kinds of the special objects of a track. More... | |
Functions | |
| 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. | |
| u32 | LookupTrackGridCell (f32 x, f32 y) |
| The triangles of the cell of the grid of the track under a point. | |
| u16 | NextGridCellTriangle (TrackGridCursor *cursor) |
| Take the next triangle of a cell of the grid. | |
| u32 | LookupInstanceGridCell (s32 column, s32 row) |
| The placed models of a cell of the grid of the track. | |
| u16 | NextGridCellInstance (TrackGridCursor *cursor) |
| Take the next placed model of a cell of the grid. | |
| void | LoadTrackGeometryFromRom (s32 track) |
| Decompress a track and its sections from the cartridge into g_LoadedTrack, and prepare it. | |
| u32 | FindTrackGridCellByIndex (s32 column, s32 row) |
| The triangles of a cell of the grid of the track by its column and row. | |
| u32 | LookupInstanceCellAtPoint (f32 x, f32 y) |
| The placed models of the cell of the grid of the track under a point. | |
| u16 | GetTrackGridCellCount (TrackGridCursor *cursor) |
| The triangles left in a cell. | |
| u16 | GetInstanceGridCellCount (TrackGridCursor *cursor) |
| The placed models left in a cell. | |
Variables | |
| TrackHeader | g_LoadedTrack |
| The loaded track. | |
| TrackSection * | g_pRootTrackSection |
| The starting route section, at its address within the loaded track. | |
| TrackGate | g_aTrackGates [TRACK_GATES] |
| The first gate of the loaded track, addressed separately by the original code. | |
| u16 | g_awVisibleInstanceList [] |
| The placed models drawn this frame, by index. | |
| s32 | g_nOpaqueVisibleInstanceCount |
| The opaque models at the start of the list. | |
| s32 | g_nDebugHiddenInstanceIndex |
| The placed model left undrawn while debugging. | |
| u8 | g_abTrackSection1Header [TRACK_SECTION_HEADER_SIZE] |
| The header of the first route section of the loaded track. | |
| u8 | g_abTrackSection1Data [TRACK_SECTION_DATA_SIZE] |
| The data of the first route section of the loaded track. | |
| u8 | g_abTrackSection2Header [TRACK_SECTION_HEADER_SIZE] |
| The header of the second route section of the loaded track. | |
| u8 | g_abTrackSection2Data [TRACK_SECTION_DATA_SIZE] |
| The data of the second route section of the loaded track. | |
| u32 | g_dwCurrentTrackRomOffset |
| Where the loaded track is on the cartridge. | |
| u32 | g_dwTrackTextureRomOffset |
| Where the textures of the loaded track are on the cartridge, after its compressed geometry. | |
| s32 | g_dwStreamDmaPrevSegment |
| The segment of textures last streamed, or -1. | |
| s32 | g_dwStreamedSnowMode |
| The snow mode the textures were last streamed for, or -1. | |
| u16 | g_awTrackDebugWords [5] |
| Two words of the loaded track, 0x3960 and 0x3968 bytes into it, that the loading prints. | |
The track data a race loads below the program: its triangles and placed models, and the route the vehicles follow.
The route is a tree of sections. Each section is a line of points across the track, with the edges of the track at each point and the distance left from it to the finish. A section can branch into others, which follow it as its children.
| #define TRACK_SECTION_ALTERNATE 0x0001 |
The flag of a branch the computer drivers do not take, and that the walks do not enter.
| #define TRACK_SECTION_VISITED 0x8000 |
The flag a walk sets on the sections it has visited.
| #define TRACK_INSTANCE_LIGHT_RAMP 0x0003 |
The bits of the flags of a placed model that pick its light from g_adwLightRampColors.
| #define TRACK_INSTANCE_TWO_SIDED 0x0004 |
The flag of a placed model drawn from both sides.
| #define TRACK_INSTANCE_TRANSLUCENT 0x0008 |
The flag of a placed model drawn after the others, the farthest first.
| #define TRACK_INSTANCE_SHELTER 0x0010 |
The flag of a placed model that keeps rain and snow off a camera under it, and echoes.
| #define TRACK_INSTANCE_CLEAR_SKY 0x0020 |
The flag of a placed model drawn without fog, and hidden in the snow, the rain, and at night except on the tracks whose spray shows in the snow.
| #define TRACK_INSTANCE_FLAT 0x0080 |
The flag of a placed model drawn with flat shading.
| #define TRACK_INSTANCE_NIGHT_LIT 0x0100 |
The flag of a placed model lit at half the light of the sun at night.
| #define TRACK_INSTANCE_NO_SHADOW 0x0200 |
The flag of a placed model that the vehicles cast no shadow on.
| #define TRACK_INSTANCE_RAMPED 0x0400 |
The flag of a placed model lit by its light ramp instead of the sun.
| #define TRACK_INSTANCE_DARK_OR_WET 0x0800 |
The flag of a placed model shown only at night or in the rain.
| #define TRACK_INSTANCE_UNROTATED 0x2000 |
The flag of a placed model whose matrix holds only its position and a scale.
| #define TRACK_INSTANCE_ARCADE 0x4000 |
The flag of a placed model shown only in arcade races and the first season.
| #define TRACK_INSTANCE_MODE_FLAGS |
The flags of a placed model that change the modes it is drawn with.
| #define TRACK_SURFACE_START 2 |
The surface a wheel and its spray take before the wheel touches the track.
| #define TRACK_SURFACE_PAVED 3 |
The surface whose tyre smoke is pale and that throws spray only in the rain: the paved road.
| #define TRACK_SURFACE_SLOW 4 |
The surface that slows a vehicle, except in snow.
| #define TRACK_SPECIALS 16 |
The special objects a track header lists.
| #define TRACK_GATES 10 |
The gates a track can have.
| #define RAY_INSTANCES 32 |
The most placed models CastRayAgainstTrack() lists.
| #define TRACK_HEADER_SIZE 0x230 |
The size of the header of a track.
| #define TRACK_MAX_SIZE 0x171400 |
The most bytes a track may take.
| #define TRACK_MAX_INSTANCES 0x800 |
The most placed models a track may have.
| #define TRACK_SECTION_HEADER_SIZE 0x20 |
The bytes of the header of each of the two sections of the route of the loaded track.
| #define TRACK_SECTION_DATA_SIZE 0x800 |
The bytes of the data of each of the two sections of the route of the loaded track.
| typedef struct TrackSection TrackSection |
A section of the route.
Its fields join this structure as they are reconstructed.
| anonymous enum |
The kinds of the special objects of a track.
| 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.
The ground is the nearest triangle facing up at most 1.5 above the point, and failing one, the nearest within a unit above that.
| outPoint | Receives the height of the ground in its z, unless it is NULL. |
| outNormal | Receives the normal of the ground, unless it is NULL. |
| origin | The point the line drops through. |
| groundInstances | Receives the placed models of the ground, the nearest first. |
| groundInstanceCount | Set to 1, however many groundInstances were found, so that its readers take only the nearest. |
| nearbyInstances | Receives the placed models near the ground, the latest first. |
| nearbyCount | Receives the number of nearbyInstances. |
| groundDistance | Receives how far the ground is below the point. |
| groundSurface | Receives the index of the triangle of the ground. |
The triangles of the cell of the grid of the track under a point.
| x | The x of the point, in the units of the world. |
| y | The y of the point. |
| u16 NextGridCellTriangle | ( | TrackGridCursor * | cursor | ) |
Take the next triangle of a cell of the grid.
| cursor | Where the triangles of the cell go on and how many are left, which this advances. |
The placed models of a cell of the grid of the track.
| column | The column of the cell, from 0 to 63. |
| row | The row of the cell, from 0 to 63. |
| u16 NextGridCellInstance | ( | TrackGridCursor * | cursor | ) |
Take the next placed model of a cell of the grid.
| cursor | Where the models of the cell go on and how many are left, which this advances. |
| void LoadTrackGeometryFromRom | ( | s32 | track | ) |
Decompress a track and its sections from the cartridge into g_LoadedTrack, and prepare it.
| track | The index of the track among the descriptors of g_apTrackMenuItems. |
The triangles of a cell of the grid of the track by its column and row.
| column | The column of the cell, from 0 to 63. |
| row | The row of the cell, from 0 to 63. |
The placed models of the cell of the grid of the track under a point.
| x | The x of the point, in the units of the world. |
| y | The y of the point. |
| u16 GetTrackGridCellCount | ( | TrackGridCursor * | cursor | ) |
The triangles left in a cell.
| cursor | The cursor of the cell. |
| u16 GetInstanceGridCellCount | ( | TrackGridCursor * | cursor | ) |
The placed models left in a cell.
| cursor | The cursor of the cell. |
|
extern |
The loaded track.
The menus use the same memory for their music. The link script places it.
|
extern |
The starting route section, at its address within the loaded track.
|
extern |
The first gate of the loaded track, addressed separately by the original code.
|
extern |
The placed models drawn this frame, by index.
|
extern |
The opaque models at the start of the list.
|
extern |
The placed model left undrawn while debugging.
|
extern |
The header of the first route section of the loaded track.
|
extern |
The data of the first route section of the loaded track.
|
extern |
The header of the second route section of the loaded track.
|
extern |
The data of the second route section of the loaded track.
|
extern |
Where the loaded track is on the cartridge.
|
extern |
Where the textures of the loaded track are on the cartridge, after its compressed geometry.
|
extern |
The segment of textures last streamed, or -1.
|
extern |
The snow mode the textures were last streamed for, or -1.
|
extern |
Two words of the loaded track, 0x3960 and 0x3968 bytes into it, that the loading prints.
The link script places them.