coastline 0.0.4
Loading...
Searching...
No Matches
vehiclemodel.h File Reference
#include "common/carphysics.h"
#include "common/displaylistops.h"
#include "common/ptr32.h"
#include "common/render.h"
Include dependency graph for vehiclemodel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  VehicleModel
 The model of a car as it is loaded from the cartridge. More...

Macros

#define VEHICLE_WHEELS   4
 The wheels of a vehicle.
#define VEHICLE_LODS   3
#define VEHICLE_DISPLAY_LISTS   10
#define VEHICLE_MATERIALS   12
#define VEHICLE_MATERIAL_PAINT   2
#define VEHICLE_MATERIAL_HEADLIGHTS   10
#define VEHICLE_MATERIAL_REAR_LIGHTS   11

Typedefs

typedef struct VehicleModel VehicleModel
 The model of a car as it is loaded from the cartridge.

Enumerations

enum  { TACHOMETER_NEEDLE , TACHOMETER_BAR_DIMMED , TACHOMETER_BAR_HIDDEN }
 How a car shows the revolutions of its engine. More...
enum  { VEHICLE_WHEEL_DL_NORMAL , VEHICLE_WHEEL_DL_1 , VEHICLE_WHEEL_DL_SNOW , VEHICLE_WHEEL_DISPLAY_LISTS }
 The display lists of a wheel of a car: the plain wheel, one not drawn, and one in the snow. More...
enum  {
  VEHICLE_DL_NEAR_DETAIL = 3 , VEHICLE_DL_BODY , VEHICLE_DL_HEADLIGHT_BEAMS , VEHICLE_DL_UNDERSIDE ,
  VEHICLE_DL_TEXTURED = 8 , VEHICLE_DL_HIGHLIGHTED
}
 The display lists of the model of a car that the renderer draws. More...

Functions

void LoadCar (s32 slot, s32 car, void *source)
 Load a car model into a slot, fix up its pointers, and record the car.
void LoadVehicleModelFromRom (VehicleModel *model, s32 car)
 Load a car model from platform asset storage.
void SetMaterialColor (VehicleModel *model, s32 red, s32 green, s32 blue)
 Paint the materials of a model a colour of 5 bits a channel.
void FixupVehicleModelPointers (VehicleModel *model)
 Relocate loaded model pointers on N64.

Variables

VehicleModel g_aVehicleModels []
 The models of the cars the vehicles drive, in slots.
s32 g_adwVehicleModelSlotCars []
 The car whose model each slot holds.

Macro Definition Documentation

◆ VEHICLE_WHEELS

#define VEHICLE_WHEELS   4

The wheels of a vehicle.

◆ VEHICLE_LODS

#define VEHICLE_LODS   3

The levels of detail of the model, the nearest first.

◆ VEHICLE_DISPLAY_LISTS

#define VEHICLE_DISPLAY_LISTS   10

The display lists of each level of detail.

◆ VEHICLE_MATERIALS

#define VEHICLE_MATERIALS   12

The textures of the materials of a car.

◆ VEHICLE_MATERIAL_PAINT

#define VEHICLE_MATERIAL_PAINT   2

The texture whose palette is the paint.

◆ VEHICLE_MATERIAL_HEADLIGHTS

#define VEHICLE_MATERIAL_HEADLIGHTS   10

The texture whose palette is the headlights.

◆ VEHICLE_MATERIAL_REAR_LIGHTS

#define VEHICLE_MATERIAL_REAR_LIGHTS   11

The texture whose palette is the rear lights.

Typedef Documentation

◆ VehicleModel

typedef struct VehicleModel VehicleModel

The model of a car as it is loaded from the cartridge.

Its fields join this structure as they are reconstructed.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

How a car shows the revolutions of its engine.

Enumerator
TACHOMETER_NEEDLE 

A rotating needle over the dashboard face.

TACHOMETER_BAR_DIMMED 

A segmented bar with unlit segments dimmed.

TACHOMETER_BAR_HIDDEN 

A segmented bar with unlit segments hidden.

◆ anonymous enum

anonymous enum

The display lists of a wheel of a car: the plain wheel, one not drawn, and one in the snow.

Enumerator
VEHICLE_WHEEL_DL_NORMAL 

The plain wheel.

VEHICLE_WHEEL_DL_1 

A wheel the renderer does not draw.

VEHICLE_WHEEL_DL_SNOW 

The wheel in the snow.

VEHICLE_WHEEL_DISPLAY_LISTS 

The number of display lists of a wheel.

◆ anonymous enum

anonymous enum

The display lists of the model of a car that the renderer draws.

Enumerator
VEHICLE_DL_NEAR_DETAIL 

Details drawn only near the camera, at the nearest level.

VEHICLE_DL_BODY 

The paint, under the reflection of the sky.

VEHICLE_DL_HEADLIGHT_BEAMS 

The beams of the headlights, at night or in the rain.

VEHICLE_DL_UNDERSIDE 

The underside, when the camera is below the car.

VEHICLE_DL_TEXTURED 

Lit, textured parts, cut out by the alpha of their textures.

VEHICLE_DL_HIGHLIGHTED 

The parts that take the specular highlight.

Function Documentation

◆ LoadCar()

void LoadCar ( s32 slot,
s32 car,
void * source )

Load a car model into a slot, fix up its pointers, and record the car.

Parameters
slotThe slot of g_aVehicleModels.
carThe index of the car in g_aCarModels.
sourceA decompressed N64 model to copy, or NULL to load the asset. Windows treats a non-null source as fatal.
Ghidra address:
USA: 0x8021d5e4
Ghidra address:
Asia: 0x8021D134
Ghidra address:
EUR: 0x8021e7e4
Ghidra address:
JPN: 0x8021e0b4
Ghidra address:
BRD3D: 0x10035520
Ghidra address:
BRGlide: 0x1002ebd1

◆ LoadVehicleModelFromRom()

void LoadVehicleModelFromRom ( VehicleModel * model,
s32 car )

Load a car model from platform asset storage.

Parameters
modelWhere to decompress it.
carThe index of the car in g_aCarModels.
Ghidra address:
USA: 0x8021d534
Ghidra address:
Asia: 0x8021D084
Ghidra address:
EUR: 0x8021e734
Ghidra address:
JPN: 0x8021e004
Ghidra address:
BRD3D: 0x10037740
Ghidra address:
BRGlide: 0x10030de0

◆ SetMaterialColor()

void SetMaterialColor ( VehicleModel * model,
s32 red,
s32 green,
s32 blue )

Paint the materials of a model a colour of 5 bits a channel.

Parameters
modelThe model.
redThe red of the colour, from 0 to 31.
greenThe green of the colour, from 0 to 31.
blueThe blue of the colour, from 0 to 31.
Ghidra address:
USA: 0x8021d140
Ghidra address:
Asia: 0x8021CC90
Ghidra address:
EUR: 0x8021e340
Ghidra address:
JPN: 0x8021dc10
Ghidra address:
BRD3D: 0x100350ee
Ghidra address:
BRGlide: 0x1002e79f

◆ FixupVehicleModelPointers()

void FixupVehicleModelPointers ( VehicleModel * model)

Relocate loaded model pointers on N64.

Windows does not require relocation here.

Parameters
modelThe model.
Ghidra address:
USA: 0x8021d32c
Ghidra address:
Asia: 0x8021CE7C
Ghidra address:
EUR: 0x8021e52c
Ghidra address:
JPN: 0x8021ddfc
Ghidra address:
BRD3D: 0x1003551b
Ghidra address:
BRGlide: 0x1002ebcc

Variable Documentation

◆ g_aVehicleModels

VehicleModel g_aVehicleModels[]
extern

The models of the cars the vehicles drive, in slots.

The link script places them.

Ghidra address:
USA: 0x803c8000
Ghidra address:
Asia: 0x803C8000
Ghidra address:
EUR: 0x803c8000
Ghidra address:
JPN: 0x803c8000
Ghidra address:
BRD3D: 0x100c12a0
Ghidra address:
BRGlide: 0x100bcdd0

◆ g_adwVehicleModelSlotCars

s32 g_adwVehicleModelSlotCars[]
extern

The car whose model each slot holds.

Ghidra address:
USA: 0x8031b238
Ghidra address:
Asia: 0x8031ACE8
Ghidra address:
EUR: 0x8031d738
Ghidra address:
JPN: 0x8031c368
Ghidra address:
BRD3D: 0x106c6558
Ghidra address:
BRGlide: 0x106ed5e8