coastline 0.0.4
Loading...
Searching...
No Matches
driving.h
Go to the documentation of this file.
1#ifndef COASTLINE_DRIVING_H
2#define COASTLINE_DRIVING_H
3
10
11#include <PR/ultratypes.h>
12
13#include "common/frameclear.h"
14#include "common/track.h"
15#include "common/vecmath.h"
16#include "common/vehicle.h"
17
18#if TGR_BOSS_RALLY
19#include "common/inputpoll.h"
20#include "common/vehicleaccess.h"
21#endif
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
28#define TRACE_DEPTH 8
29
38extern Vec3f g_vUpAxis;
39
51
62
73extern f32 g_afVehicleJolts[];
74
85
96
108
119
129extern s32 g_dwTraceUnusedA;
130
140extern s32 g_dwTraceUnusedB;
141
151extern s32 g_bTraceBlocked;
152
162extern s32 g_bAiNudgeLeft;
163
173extern s32 g_bAiNudgeRight;
174
185
196
207
219
230
241
252
264
275
286
299void AddVehicleJolt(s32 index, f32 amount);
300
301#if TGR_PLATFORM == TGR_PLATFORM_N64 && (TGR_REGION == TGR_REGION_JP || TGR_REGION == TGR_REGION_EU)
312#endif /* TGR_PLATFORM_N64 && (TGR_REGION_JP || TGR_REGION_EU) */
313
324
325#if TGR_BOSS_RALLY
326#ifdef __cplusplus
328static inline void ApplyPlayerVehicleEffects(Vehicle *vehicle) {
329 if (g_dwInputButtonMask & 0x10000) {
330 VEHICLE_GET(vehicle, Body).unreconstructed202 = 0x80;
331 }
332 if (g_dwInputButtonMask & 0x20000) {
333 VEHICLE_GET(vehicle, Body).unreconstructed203 = 0x80;
334 }
335 if (g_dwInputButtonMask & 0x40000) {
336 VEHICLE_GET(vehicle, Body).unreconstructed204 = 0x80;
337 }
338 if (g_dwInputButtonMask & 0x80000) {
339 VEHICLE_GET(vehicle, Body).replayEffects[0] = 0x80;
340 }
341 if (g_dwInputButtonMask & 0x80) {
342 VEHICLE_GET(vehicle, Body).replayEffects[1] = 0x80;
343 }
344}
345#endif /* __cplusplus */
347void ApplyPlayerVehicleRespawnRequest(Vehicle *vehicle);
348#endif
349
363s32 TraceTrackSplineRecursive(Vehicle *vehicle, s32 depth, s32 pointIndex, TrackSection *section);
364
376
388
389#ifdef __cplusplus
390}
391#endif
392
393#endif /* COASTLINE_DRIVING_H */
Vec3f g_avTraceCenterLine[TRACE_DEPTH]
The centre points of the line the search follows.
f32 g_afVehicleJolts[]
The jolts each vehicle took, from 0 to 5.
Vec3f g_avTraceLeftHalf[TRACE_DEPTH]
The points halfway between the left lane and centre line of the search.
Vec3f g_avBestCenterLine[TRACE_DEPTH]
The centre points of the deepest straight line found.
Vec3f g_avBestLeftLane[TRACE_DEPTH]
The lanes and the middle of the deepest straight line.
Vec3f g_vTraceHalfwayPoint
The centre point halfway along the deepest straight line found.
Vec3f g_avTraceLeftLane[TRACE_DEPTH]
The points of the line a search follows: a fifth of the way in from each side, halfway from there to ...
s32 g_dwBestTraceLength
The number of points in the deepest straight line.
Vec3f g_vUpAxis
The axis that points up.
Vec3f g_avBestRightLane[TRACE_DEPTH]
The right lane points of the deepest straight line found.
s32 g_dwBestTracePoint
The point index in the section at the deepest end of the search.
s32 g_bTraceBlocked
Set when a searched line crosses outside the route; never read.
#define TRACE_DEPTH
The points of the route a search for a straight line looks ahead.
Definition driving.h:28
s32 TraceTrackSplineRecursive(Vehicle *vehicle, s32 depth, s32 pointIndex, TrackSection *section)
Search the route ahead of a vehicle for straight lines it could drive, keeping the deepest.
Vec3f g_avTraceRightLane[TRACE_DEPTH]
The right lane points of the line the search follows.
void ProcessVehicleInputAndPhysics(Vehicle *vehicle)
Read the controls of a vehicle, choose the view of a replay, and step the vehicle.
TrackSection * g_pBestTraceSection
The section and point at the deepest end of the search.
Vec3f g_vTraceFarPoint
The last point of the deepest line, and its point halfway.
s32 g_dwTraceUnusedB
Cleared at the start of a search and never read.
s32 g_bAiNudgeLeft
Whether a computer's vehicle should ease to the left or to the right of where it steers.
s32 g_dwTraceUnusedA
Cleared at the start of a search and never read.
void UpdateAiVehicleBehavior(Vehicle *vehicle)
Drive a computer's vehicle for a frame: steer for a point ahead, keep to the route,...
void ChooseReplayCamera(Vehicle *vehicle)
Stand the trackside camera of a vehicle at the nearest point of the track no more than 10 below the v...
void ComputeTrackPosition(Vehicle *vehicle)
Find the point of the route nearest a vehicle along a curve through the points, with the axes of the ...
s32 g_dwBestTraceDepth
The deepest level found by a straight-line search.
f32 g_aafAiVelocityRetention[SEASONS][SEASON_RACES][2]
How much of its velocity a computer's vehicle retains each frame in the championship,...
void AddVehicleJolt(s32 index, f32 amount)
Add a jolt to a vehicle, at most 2.5 at once and 5 in all.
Vec3f g_avTraceRightHalf[TRACE_DEPTH]
The points halfway between the right lane and centre line of the search.
s32 g_bReplayCockpitNext
Whether a replay switches from the trackside camera to the cockpit next.
s32 g_bAiNudgeRight
Whether a computer's vehicle should ease to the right of where it steers.
#define SEASON_RACES
Definition profile.h:17
#define SEASONS
Definition profile.h:16
A section of the route.
Definition track.h:38
A point or direction in space.
Definition vecmath.h:17
A vehicle.
Definition vehicle.h:143
The track data a race loads below the program: its triangles and placed models, and the route the veh...
Integer and floating-point types of libultra.
float f32
Definition ultratypes.h:38
int s32
Definition ultratypes.h:25
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...
The vehicles of a race, the cars they are, and their place on the track.