coastline 0.0.4
Loading...
Searching...
No Matches
bossrallyvehicle.h
Go to the documentation of this file.
1#pragma once
2
3#include <common/render.h>
4
5#include "common/carphysics.h"
8#include "common/profile.h"
9#include "common/racerslot.h"
10#include "common/rigidbody.h"
11#include "common/track.h"
12#include "common/types.h"
16#include "common/vehiclefwd.h"
17#include "common/vehiclemodel.h"
18#include "common/wheelframe.h"
19
21#define VEHICLE_GHOST 2
23#define MAX_VEHICLES 16
25#define VEHICLE_LAP_TIMES 12
26
27#ifdef __cplusplus
34class Vehicle {
35private:
37 union {
39 struct {
40 f32 matrix[4][4];
41 union {
42 f32 wheelMatrices[4][4][4];
44 };
45 };
46 };
48 s32 index;
49 s32 gridIndex;
50 char playerName[0x1a];
55 u8 abUnknownDa0[0x80]; /* +0xda0 */
66 f32 brake;
67 s32 gear;
87 void (*driver)(Vehicle *vehicle);
102 s32 flyMode;
104 struct TrackSection *section;
107 s32 maxGate;
108 s32 gate;
109 s32 lap;
111 f32 lapTime;
114 s32 bestLap;
119 const char *message;
121 const char *subMessage;
123 char messageText[20];
140 u8 abUnknown111c[4]; /* +0x111c */
145 f32 sprayMtx[4][4];
148 u8 abUnknown271c[4]; /* +0x271c */
163 u8 abUnknown28fc[4]; /* +0x28fc */
171 s16 shadowCorners[2][2];
174 u8 color[3];
176 f32 opacity;
177 s32 customCarModel;
179 u8 gridX;
180 u8 gridY;
185 s32 shadowCornerValid[4];
186 u8 abUnknown29ec[4]; /* +0x29ec */
187 ConvertedModelVertex shadowQuad[4];
188 s32 damageTextureEntries[VEHICLE_DENT_SIDES];
189 s32 damageTextureLevels[VEHICLE_DENT_SIDES];
190 Vec3f previousCollisionPosition;
191 char checkpointMessageText[20];
192 u8 abUnknown2ad0[0x98]; /* +0x2ad0 */
193 void ColorSpraySegment(s32 wheel);
194 void AgeSpraySegment(s32 wheel, s32 age);
195
205 void ComputeTrackPosition(void);
206
212
220
226
231 void BindPlayerInputToVehicle(void);
236 void ChooseVehicleCar(void);
237
242 void SetVehicleVelocity(f32 x, f32 y, f32 z);
247 void ResetVehicleState(void);
252 void InitVehiclePhysics(void);
262 void SetVehicleModelSlot(s32 slot);
267 void ClearVehicleDamageState(void);
272 void SetupVehicleForRaceStart(void);
277 void ResetVehicleEffects(void);
282 void RespawnVehicle(void);
287 void UpdateCameraChase(CameraFrame *camera, f32 share);
292 void UpdateCameraLookAtTarget(void);
297 void ComputeCameraBasis(CameraFrame *camera);
302 void PlaceTrackCamera(void);
307 void InitCameraForVehicle(void);
308
313 void ResolveVehicleTrackCollision(CameraFrame *camera, Vec3f *target);
318 void SetVehiclePosition(f32 x, f32 y, f32 z);
328 void SetVehicleFrameMatrix(f32 m[4][4]);
333 void RotateVehicleByEuler(f32 yaw, f32 pitch, f32 roll);
338 void SetVehicleTurnRate(f32 x, f32 y, f32 z);
339
340public:
347 void ClearCameraChanged(void);
348
355 void ManageAiRacerSlots(void);
356
363 void UpdateVehicleSounds(void);
364
366 void SetupFromRecording(void);
372 inline void ConfigureRaceControls(bool localPlayer);
378 inline void PrepareRaceVehicle(s32 vehicleIndex);
380 inline void PrepareEmptyRaceView(void);
381
386 void SetCustomDecals(s32 value) {
387 customDecals = value;
388 }
393 void SetCustomCarModel(s32 value) {
394 customCarModel = value;
395 }
400 void SetSelectedCar(s32 value) {
401 selectedCar = value;
402 }
403
410 void CopySnapshotState(const Vehicle &from);
418 void InterpolateSnapshotState(const Vehicle &from, const Vehicle &to, long double share);
424 void SaveLastLapSnapshot(void);
431 void MarkNearbyInstanceShadows(u8 *mask, u8 bit) const {
432 for (s32 nearbyIndex = 0; nearbyIndex < nearbyInstanceCount; ++nearbyIndex) {
433 mask[nearbyInstances[nearbyIndex]] |= bit;
434 }
435 }
440 inline void UpdateShadowScreenRect(const ViewportRect *viewports);
446 inline void MoveTireSpraySegments(s32 step, s16 fall);
460 void SpawnTireSmoke();
467 void EmitTireSpray();
472 void SetExhaustTimer(f32 value) {
473 exhaustTimer = value;
474 }
476 s32 GetWrongWayFrames() const {
477 return wrongWayFrames;
478 }
483 s32 SetWrongWayFrames(s32 value) {
484 return wrongWayFrames = value;
485 }
487 u8 GetGridX() const {
488 return gridX;
489 }
494 u8 SetGridX(u8 value) {
495 return gridX = value;
496 }
498 u8 GetGridY() const {
499 return gridY;
500 }
505 u8 SetGridY(u8 value) {
506 return gridY = value;
507 }
509 f32 GetMessageTime() const {
510 return messageTime;
511 }
513 f32 GetSubMessageTime() const {
514 return subMessageTime;
515 }
523 void UpdateRaceTimers();
554 void InstallVehicleModel(s32 slot, s32 car);
563 void DeformVehicleMeshByImpact(Vec3f *direction, s16 amount);
568 inline void ApplyImpactDamageTexture(s32 side);
570 s32 AdvanceSkidFrames() {
571 return skidFrames++;
572 }
578 inline s32 CastGroundRay();
585 inline void DriveRearWheel(RigidBody *body, RigidBody *wheel, f32 dt);
592 inline void DriveFrontWheel(RigidBody *body, RigidBody *wheel, f32 dt);
598 inline void ApplyWheelSideGrip(RigidBody *body, f32 dt);
600 f32 GetAccelerator() const {
601 return accelerator;
602 }
607 f32 SetAccelerator(f32 value) {
608 return accelerator = value;
609 }
611 CameraFrame *GetActiveCamera() const {
612 return activeCamera;
613 }
618 CameraFrame *SetActiveCamera(CameraFrame *value) {
619 return activeCamera = value;
620 }
622 auto &GetAiTarget() {
623 return aiTarget;
624 }
626 const auto &GetAiTarget() const {
627 return aiTarget;
628 }
630 s32 GetBestLap() const {
631 return bestLap;
632 }
637 s32 SetBestLap(s32 value) {
638 return bestLap = value;
639 }
641 f32 GetBestLapTime() const {
642 return bestLapTime;
643 }
648 f32 SetBestLapTime(f32 value) {
649 return bestLapTime = value;
650 }
652 auto &GetBody() {
653 return body;
654 }
656 const auto &GetBody() const {
657 return body;
658 }
660 f32 GetBrake() const {
661 return brake;
662 }
667 f32 SetBrake(f32 value) {
668 return brake = value;
669 }
671 s32 GetCameraChanged() const {
672 return cameraChanged;
673 }
678 s32 SetCameraChanged(s32 value) {
679 return cameraChanged = value;
680 }
682 f32 GetCameraHeading() const {
683 return cameraHeading;
684 }
689 f32 SetCameraHeading(f32 value) {
690 return cameraHeading = value;
691 }
693 auto &GetCameras() {
694 return cameras;
695 }
697 const auto &GetCameras() const {
698 return cameras;
699 }
701 s32 GetCarModel() const {
702 return carModel;
703 }
705 f32 GetChaseLag() const {
706 return chaseLag;
707 }
712 f32 SetChaseLag(f32 value) {
713 return chaseLag = value;
714 }
716 auto &GetChasePosition() {
717 return chasePosition;
718 }
720 const auto &GetChasePosition() const {
721 return chasePosition;
722 }
724 f32 GetChaseSpeed() const {
725 return chaseSpeed;
726 }
731 f32 SetChaseSpeed(f32 value) {
732 return chaseSpeed = value;
733 }
735 auto &GetCheckpointMessageText() {
736 return checkpointMessageText;
737 }
739 const auto &GetCheckpointMessageText() const {
740 return checkpointMessageText;
741 }
743 s32 GetChosenTransmission() const {
744 return chosenTransmission;
745 }
747 f32 GetCollisionPull() const {
748 return collisionPull;
749 }
754 f32 SetCollisionPull(f32 value) {
755 return collisionPull = value;
756 }
758 auto &GetColor() {
759 return color;
760 }
762 const auto &GetColor() const {
763 return color;
764 }
766 s32 GetCustomCarModel() const {
767 return customCarModel;
768 }
770 const auto &GetDamageTextureLevels() const {
771 return damageTextureLevels;
772 }
774 s16 GetDentJitter() const {
775 return dentJitter;
776 }
781 s16 SetDentJitter(s16 value) {
782 return dentJitter = value;
783 }
785 auto &GetDents() {
786 return dents;
787 }
789 const auto &GetDents() const {
790 return dents;
791 }
793 f32 GetDistance() const {
794 return distance;
795 }
800 f32 SetDistance(f32 value) {
801 return distance = value;
802 }
804 s32 GetDistanceLaps() const {
805 return distanceLaps;
806 }
811 s32 SetDistanceLaps(s32 value) {
812 return distanceLaps = value;
813 }
815 f32 GetDopplerFactor() const {
816 return dopplerFactor;
817 }
822 f32 SetDopplerFactor(f32 value) {
823 return dopplerFactor = value;
824 }
826 auto GetDriver() const {
827 return driver;
828 }
830 void ClearDriver() {
831 driver = nullptr;
832 }
837 void SetDriver(void (*value)(Vehicle *vehicle)) {
838 driver = value;
839 }
841 s32 GetEffectPriority() const {
842 return effectPriority;
843 }
848 s32 SetEffectPriority(s32 value) {
849 return effectPriority = value;
850 }
852 s32 GetEffectSound() const {
853 return effectSound;
854 }
859 s32 SetEffectSound(s32 value) {
860 return effectSound = value;
861 }
863 s32 GetEffectVolume() const {
864 return effectVolume;
865 }
870 s32 SetEffectVolume(s32 value) {
871 return effectVolume = value;
872 }
874 f32 GetEngineRpm() const {
875 return engineRpm;
876 }
881 f32 SetEngineRpm(f32 value) {
882 return engineRpm = value;
883 }
885 f32 GetFinalDrive() const {
886 return finalDrive;
887 }
892 f32 SetFinalDrive(f32 value) {
893 return finalDrive = value;
894 }
896 s32 GetFlyMode() const {
897 return flyMode;
898 }
900 f32 GetFogFactor() const {
901 return fogFactor;
902 }
907 f32 SetFogFactor(f32 value) {
908 return fogFactor = value;
909 }
911 s32 GetForcedForwardFrames() const {
912 return forcedForwardFrames;
913 }
918 s32 SetForcedForwardFrames(s32 value) {
919 return forcedForwardFrames = value;
920 }
922 s32 GetForcedReverseFrames() const {
923 return forcedReverseFrames;
924 }
929 s32 SetForcedReverseFrames(s32 value) {
930 return forcedReverseFrames = value;
931 }
933 auto &GetForces() {
934 return forces;
935 }
937 const auto &GetForces() const {
938 return forces;
939 }
941 s32 GetForwardFrames() const {
942 return forwardFrames;
943 }
948 s32 SetForwardFrames(s32 value) {
949 return forwardFrames = value;
950 }
952 auto &GetFrame() {
953 return frame;
954 }
956 const auto &GetFrame() const {
957 return frame;
958 }
963 f32 SetFrontLoad(f32 value) {
964 return frontLoad = value;
965 }
970 u8 SetFrontSliding(u8 value) {
971 return frontSliding = value;
972 }
974 s32 GetGate() const {
975 return gate;
976 }
981 s32 SetGate(s32 value) {
982 return gate = value;
983 }
985 s32 GetGear() const {
986 return gear;
987 }
992 s32 SetGear(s32 value) {
993 return gear = value;
994 }
996 s32 GetGearCount() const {
997 return gearCount;
998 }
1003 s32 SetGearCount(s32 value) {
1004 return gearCount = value;
1005 }
1007 auto &GetGearRatios() {
1008 return gearRatios;
1009 }
1011 const auto &GetGearRatios() const {
1012 return gearRatios;
1013 }
1015 u8 GetGhostMode() const {
1016 return ghostMode;
1017 }
1022 u8 SetGhostMode(u8 value) {
1023 return ghostMode = value;
1024 }
1026 s32 GetGridIndex() const {
1027 return gridIndex;
1028 }
1033 s32 SetGridIndex(s32 value) {
1034 return gridIndex = value;
1035 }
1037 char *GetPlayerName() {
1038 return playerName;
1039 }
1041 const char *GetPlayerName() const {
1042 return playerName;
1043 }
1048 s32 SetGroundHits(s32 value) {
1049 return groundHits = value;
1050 }
1052 s32 GetGroundInstanceCount() const {
1053 return groundInstanceCount;
1054 }
1059 s32 SetGroundInstanceCount(s32 value) {
1060 return groundInstanceCount = value;
1061 }
1065 const auto &GetGroundInstances() const {
1066 return groundInstances;
1067 }
1069 const auto &GetNearbyInstances() const {
1070 return nearbyInstances;
1071 }
1073 s32 GetInTunnel() const {
1074 return inTunnel;
1075 }
1080 s32 SetInTunnel(s32 value) {
1081 return inTunnel = value;
1082 }
1084 s32 GetIndex() const {
1085 return index;
1086 }
1091 s32 SetIndex(s32 value) {
1092 return index = value;
1093 }
1095 auto &GetInitialChasePosition() {
1096 return initialChasePosition;
1097 }
1099 const auto &GetInitialChasePosition() const {
1100 return initialChasePosition;
1101 }
1103 PlayerInputState *GetInput() const {
1104 return input;
1105 }
1107 auto &GetJoltOffset() {
1108 return joltOffset;
1109 }
1111 const auto &GetJoltOffset() const {
1112 return joltOffset;
1113 }
1115 auto &GetJoltPosition() {
1116 return joltPosition;
1117 }
1119 const auto &GetJoltPosition() const {
1120 return joltPosition;
1121 }
1123 auto &GetJoltVelocity() {
1124 return joltVelocity;
1125 }
1127 const auto &GetJoltVelocity() const {
1128 return joltVelocity;
1129 }
1131 s32 GetLap() const {
1132 return lap;
1133 }
1138 s32 SetLap(s32 value) {
1139 return lap = value;
1140 }
1142 f32 GetLapTime() const {
1143 return lapTime;
1144 }
1149 f32 SetLapTime(f32 value) {
1150 return lapTime = value;
1151 }
1153 auto &GetLapTimes() {
1154 return lapTimes;
1155 }
1157 const auto &GetLapTimes() const {
1158 return lapTimes;
1159 }
1161 f32 GetLookAhead() const {
1162 return lookAhead;
1163 }
1168 f32 SetLookAhead(f32 value) {
1169 return lookAhead = value;
1170 }
1172 auto &GetLookAt() {
1173 return lookAt;
1174 }
1176 const auto &GetLookAt() const {
1177 return lookAt;
1178 }
1180 auto &GetMatrix() {
1181 return matrix;
1182 }
1184 const auto &GetMatrix() const {
1185 return matrix;
1186 }
1188 s32 GetMaxGate() const {
1189 return maxGate;
1190 }
1195 s32 SetMaxGate(s32 value) {
1196 return maxGate = value;
1197 }
1199 const char *GetMessage() const {
1200 return message;
1201 }
1203 const char *GetSubMessage() const {
1204 return subMessage;
1205 }
1210 const char *SetMessage(const char *value) {
1211 return message = value;
1212 }
1214 auto &GetMessageText() {
1215 return messageText;
1216 }
1218 const auto &GetMessageText() const {
1219 return messageText;
1220 }
1225 f32 SetMessageTime(f32 value) {
1226 return messageTime = value;
1227 }
1229 VehicleModel *GetModel() const {
1230 return model;
1231 }
1236 VehicleModel *SetModel(VehicleModel *value) {
1237 return model = value;
1238 }
1243 s32 SetNearbyInstanceCount(s32 value) {
1244 return nearbyInstanceCount = value;
1245 }
1247 auto &GetNearestRacers() {
1248 return nearestRacers;
1249 }
1251 const auto &GetNearestRacers() const {
1252 return nearestRacers;
1253 }
1255 f32 GetOdometer() const {
1256 return odometer;
1257 }
1262 f32 SetOdometer(f32 value) {
1263 return odometer = value;
1264 }
1266 f32 GetOpacity() const {
1267 return opacity;
1268 }
1273 f32 SetOpacity(f32 value) {
1274 return opacity = value;
1275 }
1277 f32 GetPitchInput() const {
1278 return pitchInput;
1279 }
1284 f32 SetPitchInput(f32 value) {
1285 return pitchInput = value;
1286 }
1288 auto &GetPlacedVelocity() {
1289 return placedVelocity;
1290 }
1292 const auto &GetPlacedVelocity() const {
1293 return placedVelocity;
1294 }
1296 s32 GetPointIndex() const {
1297 return pointIndex;
1298 }
1303 s32 SetPointIndex(s32 value) {
1304 return pointIndex = value;
1305 }
1310 CameraFrame *SetPreviousCamera(CameraFrame *value) {
1311 return previousCamera = value;
1312 }
1314 auto &GetPreviousCollisionPosition() {
1315 return previousCollisionPosition;
1316 }
1318 const auto &GetPreviousCollisionPosition() const {
1319 return previousCollisionPosition;
1320 }
1322 auto &GetPreviousListenerPosition() {
1324 }
1326 const auto &GetPreviousListenerPosition() const {
1328 }
1330 auto &GetPreviousPosition() {
1331 return previousPosition;
1332 }
1334 const auto &GetPreviousPosition() const {
1335 return previousPosition;
1336 }
1338 PlayerProfile *GetProfile() const {
1339 return profile;
1340 }
1345 PlayerProfile *SetProfile(PlayerProfile *value) {
1346 return profile = value;
1347 }
1349 s32 GetRacePosition() const {
1350 return racePosition;
1351 }
1356 s32 SetRacePosition(s32 value) {
1357 return racePosition = value;
1358 }
1360 RacerSlot *GetRacer() const {
1361 return racer;
1362 }
1367 RacerSlot *SetRacer(RacerSlot *value) {
1368 return racer = value;
1369 }
1374 f32 SetRearLoad(f32 value) {
1375 return rearLoad = value;
1376 }
1381 u8 SetRearSliding(u8 value) {
1382 return rearSliding = value;
1383 }
1388 s32 SetRearWheelDrive(s32 value) {
1389 return rearWheelDrive = value;
1390 }
1392 s32 GetReverseFrames() const {
1393 return reverseFrames;
1394 }
1399 s32 SetReverseFrames(s32 value) {
1400 return reverseFrames = value;
1401 }
1403 f32 GetRollInput() const {
1404 return rollInput;
1405 }
1410 f32 SetRollInput(f32 value) {
1411 return rollInput = value;
1412 }
1414 struct TrackSection *GetSection() const {
1415 return section;
1416 }
1421 struct TrackSection *SetSection(struct TrackSection *value) {
1422 return section = value;
1423 }
1425 auto &GetShadowCornerValid() {
1426 return shadowCornerValid;
1427 }
1429 const auto &GetShadowCornerValid() const {
1430 return shadowCornerValid;
1431 }
1433 const auto &GetShadowCorners() const {
1434 return shadowCorners;
1435 }
1437 auto &GetShadowQuad() {
1438 return shadowQuad;
1439 }
1441 const auto &GetShadowQuad() const {
1442 return shadowQuad;
1443 }
1445 s16 GetSkidFrames() const {
1446 return skidFrames;
1447 }
1452 s16 SetSkidFrames(s16 value) {
1453 return skidFrames = value;
1454 }
1456 s32 GetSkipDrive() const {
1457 return skipDrive;
1458 }
1463 s32 SetSkipDrive(s32 value) {
1464 return skipDrive = value;
1465 }
1467 s32 GetSlotCooldown() const {
1468 return slotCooldown;
1469 }
1474 s32 SetSlotCooldown(s32 value) {
1475 return slotCooldown = value;
1476 }
1478 auto &GetSmokeTimers() {
1479 return smokeTimers;
1480 }
1482 const auto &GetSmokeTimers() const {
1483 return smokeTimers;
1484 }
1486 f32 GetSpeedKph() const {
1487 return speedKph;
1488 }
1493 f32 SetSpeedKph(f32 value) {
1494 return speedKph = value;
1495 }
1497 auto &GetSprayAdvanced() {
1498 return sprayAdvanced;
1499 }
1501 const auto &GetSprayAdvanced() const {
1502 return sprayAdvanced;
1503 }
1505 auto &GetSprayFramesLeft() {
1506 return sprayFramesLeft;
1507 }
1509 const auto &GetSprayFramesLeft() const {
1510 return sprayFramesLeft;
1511 }
1513 auto &GetSprayOrigin() {
1514 return sprayOrigin;
1515 }
1517 const auto &GetSprayOrigin() const {
1518 return sprayOrigin;
1519 }
1521 auto &GetSprayPhases() {
1522 return sprayPhases;
1523 }
1525 const auto &GetSprayPhases() const {
1526 return sprayPhases;
1527 }
1529 auto &GetSpraySegmentSurfaces() {
1530 return spraySegmentSurfaces;
1531 }
1533 const auto &GetSpraySegmentSurfaces() const {
1534 return spraySegmentSurfaces;
1535 }
1537 auto &GetSpraySurfaces() {
1538 return spraySurfaces;
1539 }
1541 const auto &GetSpraySurfaces() const {
1542 return spraySurfaces;
1543 }
1545 auto &GetSprayVelocities() {
1546 return sprayVelocities;
1547 }
1549 const auto &GetSprayVelocities() const {
1550 return sprayVelocities;
1551 }
1553 auto &GetSprayVertices() {
1554 return sprayVertices;
1555 }
1557 const auto &GetSprayVertices() const {
1558 return sprayVertices;
1559 }
1561 const auto &GetSprayMatrix() const {
1562 return sprayMtx;
1563 }
1565 f32 GetSteerAngle() const {
1566 return steerAngle;
1567 }
1572 f32 SetSteerAngle(f32 value) {
1573 return steerAngle = value;
1574 }
1576 s8 GetSteerReturn() const {
1577 return steerReturn;
1578 }
1583 s8 SetSteerReturn(s8 value) {
1584 return steerReturn = value;
1585 }
1587 f32 GetSteering() const {
1588 return steering;
1589 }
1594 f32 SetSteering(f32 value) {
1595 return steering = value;
1596 }
1598 s32 GetSteeringMode() const {
1599 return steeringMode;
1600 }
1605 const char *SetSubMessage(const char *value) {
1606 return subMessage = value;
1607 }
1612 f32 SetSubMessageTime(f32 value) {
1613 return subMessageTime = value;
1614 }
1616 s32 GetSuspensionStiffness() const {
1617 return suspensionStiffness;
1618 }
1620 s32 GetTableIndex() const {
1621 return tableIndex;
1622 }
1627 s32 SetTableIndex(s32 value) {
1628 return tableIndex = value;
1629 }
1631 f32 GetThrottle() const {
1632 return throttle;
1633 }
1638 f32 SetThrottle(f32 value) {
1639 return throttle = value;
1640 }
1642 f32 GetTimeLeft() const {
1643 return timeLeft;
1644 }
1649 f32 SetTimeLeft(f32 value) {
1650 return timeLeft = value;
1651 }
1653 s32 GetTireType() const {
1654 return tireType;
1655 }
1657 auto &GetTorqueCurve() {
1658 return torqueCurve;
1659 }
1661 const auto &GetTorqueCurve() const {
1662 return torqueCurve;
1663 }
1665 f32 GetTotalTime() const {
1666 return totalTime;
1667 }
1672 f32 SetTotalTime(f32 value) {
1673 return totalTime = value;
1674 }
1676 auto &GetTrackDirection() {
1677 return trackDirection;
1678 }
1680 const auto &GetTrackDirection() const {
1681 return trackDirection;
1682 }
1684 auto &GetTrackForward() {
1685 return trackForward;
1686 }
1688 const auto &GetTrackForward() const {
1689 return trackForward;
1690 }
1692 auto &GetTrackOffset() {
1693 return trackOffset;
1694 }
1696 const auto &GetTrackOffset() const {
1697 return trackOffset;
1698 }
1700 auto &GetTrackPoint() {
1701 return trackPoint;
1702 }
1704 const auto &GetTrackPoint() const {
1705 return trackPoint;
1706 }
1708 auto &GetTrackSide() {
1709 return trackSide;
1710 }
1712 const auto &GetTrackSide() const {
1713 return trackSide;
1714 }
1716 f32 GetTrackSideDistance() const {
1717 return trackSideDistance;
1718 }
1723 f32 SetTrackSideDistance(f32 value) {
1724 return trackSideDistance = value;
1725 }
1727 f32 GetTrackSideOffset() const {
1728 return trackSideOffset;
1729 }
1734 f32 SetTrackSideOffset(f32 value) {
1735 return trackSideOffset = value;
1736 }
1738 auto &GetTrackUp() {
1739 return trackUp;
1740 }
1742 const auto &GetTrackUp() const {
1743 return trackUp;
1744 }
1746 s32 GetTransmission() const {
1747 return transmission;
1748 }
1753 s32 SetTransmission(s32 value) {
1754 return transmission = value;
1755 }
1757 auto &GetWheelBodies() {
1758 return wheelBodies;
1759 }
1761 const auto &GetWheelBodies() const {
1762 return wheelBodies;
1763 }
1765 auto &GetWheelFrames() {
1766 return wheelFrames;
1767 }
1769 const auto &GetWheelFrames() const {
1770 return wheelFrames;
1771 }
1773 auto &GetWheelMatrices() {
1774 return wheelMatrices;
1775 }
1777 const auto &GetWheelMatrices() const {
1778 return wheelMatrices;
1779 }
1780
1787 void ApplyPlayerVehicleInput(void);
1788
1795 void UpdateVehiclePhysicsFrame(void);
1796
1806 void SetVehiclePaintColorRgb(u8 red, u8 green, u8 blue);
1807
1814 void TransformAllWheelMatrices(void);
1815
1822 void ComputeAiVehicleInput(void);
1823
1830 void InitPlayerVehicleSlot(void);
1831
1839 void SetVehicleCarId(s32 carId);
1840
1847 void UpdateCameraSystem(void);
1848};
1849#endif /* __cplusplus */
1850
1851#ifdef __cplusplus
1852extern "C" {
1853#endif
1862
1871
1880
1887extern u8 g_abPlayerColorsRgb[20][3];
1888#ifdef __cplusplus
1889}
1890#endif
1891
1892#ifdef __cplusplus
1900#endif
#define MAX_VEHICLES
The capacity of the race engine's vehicle array.
Definition bossrallyvehicle.h:23
void AiVehicleControllerCallback(Vehicle *vehicle)
Dispatch the computer controller through its vehicle method.
#define VEHICLE_LAP_TIMES
The number of completed lap times stored per vehicle.
Definition bossrallyvehicle.h:25
void UpdateVehicleSpeedAndPhysics(Vehicle *vehicle)
Refresh displayed speed when the second wheel has contact, then advance vehicle physics.
u8 g_abPlayerColorsRgb[20][3]
Player and computer vehicle paint colours, indexed by player or race slot, in RGB byte order.
void PlayerVehicleControllerCallback(Vehicle *vehicle)
Translate player controls, advance vehicle physics, and process player effects and respawning.
void UpdateCameraLookAtTarget(Vehicle *vehicle)
Put the look-at point above a vehicle, ahead of it by a lead that shrinks with its speed.
void ComputeCameraBasis(Vehicle *vehicle, CameraFrame *camera)
Point a camera at the look-at point of a vehicle and build its axes about the world up.
void UpdateCameraSystem(Vehicle *vehicle)
Update every camera of a vehicle for a frame.
void ResolveVehicleTrackCollision(Vehicle *vehicle, CameraFrame *camera, Vec3f *target)
Keep a camera out of the track: if the line from the look-at point of a vehicle to the camera passes ...
void PlaceTrackCamera(Vehicle *vehicle)
Make the trackside camera active, placed ahead of and beside a vehicle.
void UpdateCameraChase(Vehicle *vehicle, CameraFrame *camera, f32 share)
Move the chase camera behind a vehicle, blending the direction it was in towards the one behind the v...
void InitCameraForVehicle(Vehicle *vehicle)
Set up the cameras of a vehicle at the start of a race.
void ClearCameraChanged(Vehicle *vehicle)
Clear the flag of a vehicle that marks the change of its camera.
#define CAR_GEAR_RATIOS
The gears of a gearbox, neutral first.
Definition carphysics.h:11
The state the renderer shares between the parts of a frame.
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.
void ComputeTrackPosition(Vehicle *vehicle)
Find the point of the route nearest a vehicle along a curve through the points, with the axes of the ...
void EmitTireSpray(Vehicle *vehicle)
Throw the newest segment of the spray of each wheel from the surface under it, while the wheel is on ...
void SpawnTireSmoke(Vehicle *vehicle)
Count down to the next puff of smoke of each wheel, faster with the speed of the vehicle and the spin...
void SpawnExhaustParticle(Vehicle *vehicle)
Count down to the next puff of exhaust, faster as the engine revs, and blow it out behind the vehicle...
The saved settings and progress of a player, and the size of the championship.
void SetupFromRecording(Vehicle *vehicle)
Apply the control options from the current input recording.
#define RACER_SLOTS
The racers of a race.
Definition racerslot.h:11
void SaveLastLapSnapshot(Vehicle *vehicle)
At the start of the last lap, give each local player a buffer to record the lap into and take a snaps...
The rigid bodies of the physics: their state, forces and inertia, and the quaternion and 3 by 3 matri...
A frame of reference: three axes and a position, the rows of a 4 by 4 matrix whose last column Finish...
Definition render.h:30
A model vertex converted into the renderer's working format.
Definition convertedvertex.h:7
The input of one player.
Definition playerinput.h:32
The saved settings and progress of a player.
Definition profile.h:23
A racer of a race.
Definition racerslot.h:28
A force on a rigid body, in a list.
Definition rigidbody.h:42
A rigid body: the body of a vehicle or of one of its wheels.
Definition rigidbody.h:60
A section of the route.
Definition track.h:38
A point or direction in space.
Definition vecmath.h:17
The model of a car as it is loaded from the cartridge.
Definition vehiclemodel.h:55
A vehicle.
Definition vehicle.h:143
s8 steerReturn
Definition vehicle.h:193
s32 sprayAdvanced[VEHICLE_WHEELS]
Definition vehicle.h:280
f32 pitchInput
Definition vehicle.h:306
f32 speedKph
Definition vehicle.h:263
s32 tireType
Definition vehicle.h:198
f32 odometer
Definition vehicle.h:264
CameraFrame frame
Definition vehicle.h:145
s32 selectedCar
Definition vehicle.h:334
Vtx sprayVertices[VEHICLE_WHEELS][SPRAY_SEGMENTS][SPRAY_SEGMENT_VERTICES]
Definition vehicle.h:284
f32 throttle
Definition vehicle.h:184
s32 effectVolume
Definition vehicle.h:232
RacerSlot * racer
Definition vehicle.h:213
s32 maxGate
Definition vehicle.h:243
CameraFrame * previousCamera
Definition vehicle.h:312
Vec3f aiTarget
Definition vehicle.h:218
Vec3f sprayOrigin
Definition vehicle.h:297
s32 gate
Definition vehicle.h:244
s32 groundSurface
Definition vehicle.h:330
u8 rearSliding
Definition vehicle.h:191
s32 customDecals
Definition vehicle.h:196
s32 suspensionStiffness
Definition vehicle.h:199
RigidBody wheelBodies[VEHICLE_WHEELS]
Definition vehicle.h:159
f32 steerAngle
Definition vehicle.h:165
f32 lapTimes[VEHICLE_LAP_TIMES]
Definition vehicle.h:248
s32 pointIndex
Definition vehicle.h:241
s32 slotCooldown
Definition vehicle.h:214
s32 forwardFrames
Definition vehicle.h:209
f32 messageTime
Definition vehicle.h:256
f32 torqueCurve[4]
Definition vehicle.h:170
s32 carModel
Definition vehicle.h:335
s32 groundHits
Definition vehicle.h:261
f32 cameraHeading
Definition vehicle.h:302
s16 dentJitter
Definition vehicle.h:352
Vec3f trackSide
Definition vehicle.h:221
u8 gridY
Definition vehicle.h:346
f32 dopplerFactor
Definition vehicle.h:234
TrackSection * section
Definition vehicle.h:240
Vec3f exhaustPosition
Definition vehicle.h:270
u16 groundInstances[RAY_INSTANCES]
Definition vehicle.h:322
s32 groundInstanceCount
Definition vehicle.h:324
f32 finalDrive
Definition vehicle.h:178
f32 totalTime
Definition vehicle.h:251
s16 skidFrames
Definition vehicle.h:156
Vec3f joltOffset
Definition vehicle.h:268
s32 transmission
Definition vehicle.h:182
Vec3f chasePosition
Definition vehicle.h:318
s32 bestLap
Definition vehicle.h:250
u8 frontSliding
Definition vehicle.h:188
void(* driver)(struct Vehicle *vehicle)
Definition vehicle.h:216
Vec3f joltVelocity
Definition vehicle.h:267
s32 nearbyInstanceCount
Definition vehicle.h:328
s32 effectPriority
Definition vehicle.h:233
f32 frontLoad
Definition vehicle.h:187
Vec3f joltPosition
Definition vehicle.h:265
Vec3f smokePositions[VEHICLE_WHEELS]
Definition vehicle.h:273
s32 wrongWayFrames
Definition vehicle.h:343
s32 effectSound
Definition vehicle.h:230
char messageText[0xFD4 - 0xFC0]
Definition vehicle.h:259
s32 forcedForwardFrames
Definition vehicle.h:203
f32 exhaustTimer
Definition vehicle.h:269
u16 nearbyInstances[RAY_INSTANCES]
Definition vehicle.h:326
Vec3f trackPoint
Definition vehicle.h:219
s16 shadowCorners[2][2]
Definition vehicle.h:331
u8 gridX
Definition vehicle.h:344
s32 spraySurfaces[VEHICLE_WHEELS]
Definition vehicle.h:277
const char * message
Definition vehicle.h:255
f32 engineRpm
Definition vehicle.h:166
Vec3f sprayPositions[VEHICLE_WHEELS]
Definition vehicle.h:281
s16 spraySegmentSurfaces[VEHICLE_WHEELS][SPRAY_SEGMENTS]
Definition vehicle.h:291
f32 smokeTimers[VEHICLE_WHEELS]
Definition vehicle.h:271
f32 bestLapTime
Definition vehicle.h:249
f32 sprayPhases[VEHICLE_WHEELS]
Definition vehicle.h:279
s32 flyMode
Definition vehicle.h:237
f32 accelerator
Definition vehicle.h:307
f32 chaseLag
Definition vehicle.h:315
PlayerInputState * input
Definition vehicle.h:348
f32 matrix[4][4]
Definition vehicle.h:147
s32 lap
Definition vehicle.h:245
WheelFrame wheelFrames[VEHICLE_WHEELS]
Definition vehicle.h:150
f32 sprayFramesLeft[VEHICLE_WHEELS]
Definition vehicle.h:275
f32 collisionPull
Definition vehicle.h:319
f32 distance
Definition vehicle.h:253
Vec3f placedVelocity
Definition vehicle.h:262
f32 lookAhead
Definition vehicle.h:316
CameraFrame cameras[VEHICLE_CAMERAS]
Definition vehicle.h:313
f32 steering
Definition vehicle.h:305
f32 subMessageTime
Definition vehicle.h:258
Vec3f trackDirection
Definition vehicle.h:242
s16 dents[VEHICLE_DENT_SIDES]
Definition vehicle.h:350
s32 skipDrive
Definition vehicle.h:195
f32 rearLoad
Definition vehicle.h:190
f32 opacity
Definition vehicle.h:339
RacerSlot * nearestRacers[RACER_SLOTS]
Definition vehicle.h:211
Mtx sprayMtx
Definition vehicle.h:299
s32 chosenTransmission
Definition vehicle.h:201
Vec3f lookAt
Definition vehicle.h:317
s32 inTunnel
Definition vehicle.h:300
s32 cameraChanged
Definition vehicle.h:235
Vec3f initialChasePosition
Definition vehicle.h:321
f32 rollInput
Definition vehicle.h:308
u8 color[3]
Definition vehicle.h:336
f32 fogFactor
Definition vehicle.h:309
s32 rearWheelDrive
Definition vehicle.h:180
s32 steeringMode
Definition vehicle.h:200
RigidBody body
Definition vehicle.h:158
s32 racePosition
Definition vehicle.h:254
s32 index
Definition vehicle.h:155
s16 sprayVelocities[VEHICLE_WHEELS][SPRAY_SEGMENTS][SPRAY_SEGMENT_VERTICES][3]
Definition vehicle.h:288
s32 gearCount
Definition vehicle.h:179
f32 groundDistance
Definition vehicle.h:329
Vec3f trackUp
Definition vehicle.h:222
s32 gear
Definition vehicle.h:186
Vec3f previousListenerPosition
Definition vehicle.h:228
f32 timeLeft
Definition vehicle.h:252
CameraFrame * activeCamera
Definition vehicle.h:310
PlayerProfile * profile
Definition vehicle.h:197
Vec3f trackForward
Definition vehicle.h:220
f32 brake
Definition vehicle.h:185
f32 trackSideDistance
Definition vehicle.h:223
s32 distanceLaps
Definition vehicle.h:246
s32 tableIndex
Definition vehicle.h:183
f32 trackSideOffset
Definition vehicle.h:226
s32 reverseFrames
Definition vehicle.h:207
u8 ghostMode
Definition vehicle.h:337
VehicleModel * model
Definition vehicle.h:349
f32 lapTime
Definition vehicle.h:247
f32 chaseSpeed
Definition vehicle.h:314
s32 forcedReverseFrames
Definition vehicle.h:205
Vec3f previousPosition
Definition vehicle.h:239
const char * subMessage
Definition vehicle.h:257
RigidBodyForce forces[VEHICLE_FORCES]
Definition vehicle.h:162
f32 gearRatios[CAR_GEAR_RATIOS]
Definition vehicle.h:167
Vec3f trackOffset
Definition vehicle.h:225
f32 wheelMatrices[VEHICLE_WHEELS][4][4]
Definition vehicle.h:149
The rectangle of the screen a view fills.
Definition render.h:134
The axes and the position of a wheel, the rows of its matrix.
Definition wheelframe.h:11
The track data a race loads below the program: its triangles and placed models, and the route the veh...
#define RAY_INSTANCES
The most placed models CastRayAgainstTrack() lists.
Definition track.h:336
The integer and floating-point types of the console, for headers shared with Windows.
signed char s8
Definition ultratypes.h:23
short s16
Definition ultratypes.h:24
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
void SetVehiclePosition(Vehicle *vehicle, f32 x, f32 y, f32 z)
Put a vehicle at a position, with its body and the states of its steps.
void ChooseVehicleCar(Vehicle *vehicle)
Choose the car of a vehicle.
void RotateVehicleByEuler(Vehicle *vehicle, f32 yaw, f32 pitch, f32 roll)
Turn the body of a vehicle by angles about its vertical, sideways and forward axes,...
void SimulateVehiclePhysicsSubstep(Vehicle *vehicle)
Step the physics of a vehicle on the ground for a frame: drive its wheels, push it by its springs,...
void ManageAiRacerSlots(Vehicle *player)
Move the vehicles the computer drives to the racers nearest a player, so that the racers around the p...
void InitPlayerVehicleSlot(Vehicle *vehicle)
Bind a vehicle to the input of its player and reset it for a race.
void SetVehicleVelocity(Vehicle *vehicle, f32 x, f32 y, f32 z)
Set the velocity of a vehicle.
void ClearVehicleDamageState(Vehicle *vehicle)
Clear the dents of a vehicle.
void InitVehicleColorAndPhysics(Vehicle *vehicle)
Paint the model of a vehicle its colour and set up its physics.
Vehicle g_aVehicles[MAX_VEHICLES]
The active vehicles of a race, with players in the first slots.
void ResetVehicleState(Vehicle *vehicle)
Reset the frames, cameras, velocity, place on the route and gearbox of a vehicle for its car.
void SetVehicleFrameMatrix(Vehicle *vehicle, f32(*m)[4])
Set the frame of a vehicle and the orientation of its body from a matrix.
void SetVehicleTurnRate(Vehicle *vehicle, f32 x, f32 y, f32 z)
Set the angular velocity of a vehicle.
void UpdateVehiclePhysicsFrame(Vehicle *vehicle)
Run a frame of a vehicle: fly it, or put it on the ground, drive its wheels and step its physics.
void ResetVehicleEffects(Vehicle *vehicle)
Clear the smoke and the spray of the wheels of a vehicle.
void InitVehicleOrientationFromAngle(Vehicle *vehicle, f32 angle)
Turn a vehicle upright to face an angle about the vertical.
void TransformAllWheelMatrices(Vehicle *vehicle)
Place the matrix of a vehicle, leant into its skid, and the matrices of its wheels,...
void SetVehicleModelSlot(Vehicle *vehicle, s32 slot)
Give a vehicle the model of a slot.
void InitVehiclePhysics(Vehicle *vehicle)
Set up the body of a vehicle and the bodies of its wheels, and their forces, for the model of its car...
void UpdateVehicleEngineAndGearbox(Vehicle *vehicle)
Steer a vehicle by the stick, change its gears, and run its engine: its revolutions follow the front ...
void InstallVehicleModel(Vehicle *vehicle, s32 slot, s32 car)
Load the model of a car into a slot and give it to a vehicle.
void SetupVehicleForRaceStart(Vehicle *vehicle)
Put a vehicle on the grid for the start of the race, with its model, cameras and effects reset.
void BindPlayerInputToVehicle(Vehicle *vehicle)
Give a vehicle the input of the player of the same index.
void RespawnVehicle(Vehicle *vehicle)
Put a vehicle that has been upside down too long, or has fallen below the track, back on the route at...
@ VEHICLE_CAMERAS
Definition vehiclecamera.h:17
void DeformVehicleMeshByImpact(Vehicle *vehicle, Vec3f *direction, s16 amount)
Dent the model on the side of an impact unless the side is already dented deeply enough.
#define VEHICLE_DENT_SIDES
The sides around a car that dent apart, by the direction of the blow.
Definition vehicleeffects.h:7
#define SPRAY_SEGMENTS
The segments of the spray a wheel throws.
Definition vehicleeffects.h:10
#define SPRAY_SEGMENT_VERTICES
The vertices of each segment of the spray, of which the first two are drawn.
Definition vehicleeffects.h:12
@ VEHICLE_FORCES
Definition vehicleforces.h:28
#define VEHICLE_WHEELS
The wheels of a vehicle.
Definition vehiclemodel.h:14
void UpdateVehicleSounds(Vehicle *vehicle)
Play the engine, the impacts, and the rumble of a vehicle for a frame.
void UpdateHudMessageTimers(Vehicle *vehicle)
Count down the time of the message of a vehicle, or failing one its smaller message,...
void UpdateVehicleGridPosition(Vehicle *vehicle)
Find the cell of the grid a vehicle is in, then its place on the route.
void UpdateRaceTimers(Vehicle *vehicle)
Run the clocks of a vehicle as the mode of play keeps them.
void CheckWrongWayWarning(Vehicle *vehicle)
Show "WRONG WAY", flashing, once a vehicle has faced against the track for a while.
s32 UpdateVehicleTrackPosition(Vehicle *vehicle)
Find the nearest point of the route to a vehicle and add how far it went along the route to its dista...