coastline 0.0.4
Loading...
Searching...
No Matches
vehiclephysics.h
Go to the documentation of this file.
1#ifndef COASTLINE_VEHICLEPHYSICS_H
2#define COASTLINE_VEHICLEPHYSICS_H
3
4#include "common/vehicle.h"
5
6#if TGR_BOSS_RALLY
7#include "common/game.h"
8#include "common/ghost.h"
10#include "common/racephases.h"
11#include "common/rallyconfig.h"
12#if TGR_PLATFORM == TGR_PLATFORM_SDL
14#endif
15#include "common/settings.h"
16#include "common/vehicleaccess.h"
17#endif
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
25
28
31
34
43
46
47#if TGR_BOSS_RALLY
49static inline s32 IsVehicleControlAnalogue(s32 control) {
50 return (g_GlobalRallyConfig.pActiveInputBindings[control].wControl & 0x8000) != 0;
51}
52
54static inline s32 IsVehicleSteeringSpeedSensitive(void) {
56}
57
59static inline void UpdateVehicleReplayPose(Vehicle *vehicle) {
61 (g_dwGameMode == GAME_MODE_TIME_ATTACK && VEHICLE_GET(vehicle, Index) == 1 &&
62 VEHICLE_GET(vehicle, Input)->playbackBuffer
63#if TGR_PLATFORM == TGR_PLATFORM_SDL
64 && VEHICLE_GET(vehicle, Input)->playbackLimit <= RECORDING_HEADER_SIZE
65#endif
66 )) {
69 } else if (g_dwGameMode == GAME_MODE_DEMO && VEHICLE_GET(vehicle, Index) == 0 &&
70 VEHICLE_GET(vehicle, Input)->playbackBuffer) {
73 } else {
74 RecordGhostKeyframe(vehicle);
75 }
76}
77
79static inline s32 ShouldStepVehiclePhysics(Vehicle *vehicle) {
81 (g_dwGameMode == GAME_MODE_TIME_ATTACK && VEHICLE_GET(vehicle, Index) == 1 &&
82 VEHICLE_GET(vehicle, Input)->playbackBuffer
83#if TGR_PLATFORM == TGR_PLATFORM_SDL
84 && VEHICLE_GET(vehicle, Input)->playbackLimit <= RECORDING_HEADER_SIZE
85#endif
86 ) ||
87 (g_dwGameMode == GAME_MODE_DEMO && VEHICLE_GET(vehicle, Index) == 0 &&
88 VEHICLE_GET(vehicle, Input)->playbackBuffer)) {
89 return 0;
90 }
92 g_bRaceStartReached || VEHICLE_GET(vehicle, WheelBodies)[1].contactFrames <= 90;
93}
94
96static inline void FinishVehiclePhysicsFrame(Vehicle *vehicle) {
98#if TGR_PLATFORM == TGR_PLATFORM_WIN
99 if (VEHICLE_GET(vehicle, Driver) == PlayerVehicleControllerCallback &&
101 RecordVehicleKeyframe(vehicle);
102 }
103#endif /* TGR_PLATFORM == TGR_PLATFORM_WIN */
104 } else if (!gInstantReplayActive) {
105 vehicle->TransformAllWheelMatrices();
106 }
107}
108#endif /* TGR_BOSS_RALLY */
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* COASTLINE_VEHICLEPHYSICS_H */
void PlayerVehicleControllerCallback(Vehicle *vehicle)
Translate player controls, advance vehicle physics, and process player effects and respawning.
#define g_dwNetworkPlayMode
Definition frontendstate.h:79
The main thread of the game, the weather of a race, and the player slots.
@ GAME_MODE_AFTER_SEASON
Definition game.h:46
@ GAME_MODE_DEMO
Definition game.h:45
@ GAME_MODE_TIME_ATTACK
Definition game.h:43
s32 g_dwGameMode
The mode of play the main menu chose.
The ghost cars of the PC port: the frames of their recordings.
void ApplyGhostKeyframeToVehicle(Vehicle *pVehicle, int nRecording)
Restore a ghost frame and estimate velocity from the following frame when available.
void RecordVehicleKeyframe(Vehicle *vehicle)
Sample vehicle and send its keyframe as a local network state update.
void ApplyGhostKeyframeForVehicle(Vehicle *pVehicle)
Restore the ghost frame from the recording slot matching a vehicle index.
void RecordGhostKeyframe(Vehicle *pVehicle)
Record one vehicle frame while recording is active and the race is not paused.
Whether an instant replay is playing.
s32 gInstantReplayActive
Whether an instant replay is playing.
The settings of the game saved in BossRally.cfg, and their reading from BossRally....
RallyConfig g_GlobalRallyConfig
Settings of the running game.
#define RECORDING_HEADER_SIZE
The bytes of race settings before recorded controller input.
Definition recordingformat.h:9
The settings of the PC port that BossRally.ini and the command line set.
int g_bSpeedSensitiveSteering
Whether speed reduces analogue steering lock, from SpeedSensitive=.
A vehicle.
Definition vehicle.h:143
int s32
Definition ultratypes.h:25
The vehicles of a race, the cars they are, and their place on the track.
void SimulateVehiclePhysicsSubstep(Vehicle *vehicle)
Advance spring, tyre, damping, and collision calculations for a vehicle.
void UpdatePhysicsStep(Vehicle *vehicle)
Advance the player-controlled vehicle for one frame.
void UpdateVehiclePhysicsFrame(Vehicle *vehicle)
Drive or fly a vehicle for a frame, then update its drawing transforms and cameras.
void UpdateVehicleWheelTransforms(Vehicle *vehicle)
Update wheel heights and rebuild their rigid-body orientation matrices.
void TransformAllWheelMatrices(Vehicle *vehicle)
Transform the body and wheel matrices for drawing.
void UpdateVehicleEngineAndGearbox(Vehicle *vehicle)
Update steering, engine torque, and gearbox selection.