|
coastline 0.0.4
|
The ghost cars of the PC port: the frames of their recordings. More...
#include <cstddef>#include <cstdio>#include "common/rigidbody.h"#include "common/vecmath.h"#include "common/vehicle.h"

Go to the source code of this file.
Classes | |
| struct | KeyframeState |
| Vehicle pose and interpolated controls before compact frame encoding. More... | |
| struct | GhostRecordingInfo |
| The metadata stored before the frames of a recording. More... | |
| struct | QuaternionPose |
| The orientation and the position of a vehicle at the start of a key frame. More... | |
Macros | |
| #define | GHOST_FRAME_SIZE 24 |
| The size of a frame of the recording of a ghost car. | |
| #define | GHOST_RECORDING_COUNT 8 |
| The number of entries of g_adwGhostFrameCount. | |
| #define | GHOST_MAX_FRAMES 65536 |
| The maximum number of frames in each recording. | |
Functions | |
| void | PackKeyframeToCompactBuffer (u8 *pBuffer, const KeyframeState *pState) |
| Encode a pose and controls into a compact ghost frame, preserving its final two bytes. | |
| void | DeserializeKeyframeState (KeyframeState *pState, const u8 *pBuffer) |
| Decode a compact ghost frame into pose and controls. | |
| void | InterpolateKeyframeState (KeyframeState *pOut, float fShare, KeyframeState *pFrom, KeyframeState *pTo) |
| Interpolate poses and controls, reversing the target quaternion for distant scalar signs. | |
| u8 * | GetGhostKeyframeBuffer (void) |
| Get the encoded frames of the first recording. | |
| u8 * | GetGhostPlaybackKeyframeBuffer (void) |
| Get the encoded frames used for ghost playback. | |
| unsigned | GetGhostKeyframeDataSize (void) |
| Get the size of the encoded frames of the first recording. | |
| bool | ReadGhostFileData (const char *pszPath, bool bAllowFailure) |
| Read a current or legacy ghost file and validate its Adler checksum. | |
| FILE * | OpenGhostRecording (const char *pszPath) |
| Open a ghost recording: the file itself, such as a saved recording, or the file built from the JSON the import converted it to. | |
| const char * | NextAttractDemoRecording (void) |
| Choose the recording of the next attract demo: the two of the PC release in turn, and then the demo of each imported cartridge. | |
| bool | LoadGhostFile (bool bAllowFailure) |
| Read the ghost file selected in the front end. | |
| bool | SaveGhostFile (void) |
| Write the ghost recording, times, checksum, menu settings, and slot label to the selected file. | |
| unsigned | SetGhostFrameCountFromSize (unsigned dwSize) |
| Set the number of frames of the second recording from its size. | |
| void | ResetGhostRecording (void) |
| Clear the number of frames of the recordings, only the first in time attack and the demonstration and all of them otherwise, and stop recording. | |
| void | StartGhostRecording (void) |
| Start ghost recording. | |
| int | IsGhostRecordingActive (void) |
| Read the ghost recording flag. | |
| void | AdvanceGhostRecordFrame (void) |
| Advance active recordings and the time attack or demonstration ghost playback. | |
| void | ClearGhostPlaybackState (void) |
| Reset every ghost playback frame to zero. | |
| void | UpdateReplayScrubControls (void) |
| Translate replay controls into playback mode and bounded frame changes. | |
| void | FillMemoryPatternBytes (void *pDest, size_t nCount, int nByte) |
| Fill memory with a byte. | |
| void | MatrixToPositionQuaternion (QuaternionPose *pPose, f32 m[4][4]) |
| Get the orientation of a matrix as a quaternion and its translation as a position. | |
| void | PositionQuaternionToMatrix4x4 (f32 matrix[4][4], const QuaternionPose *pPose) |
| Convert a quaternion and position into a matrix, compensating for quaternion magnitude. | |
| void | BuildVehicleKeyframe (KeyframeState *pState, Vehicle *pVehicle) |
| Sample a vehicle pose, wheel motion, and replay effects. | |
| void | RecordVehicleKeyframe (Vehicle *vehicle) |
Sample vehicle and send its keyframe as a local network state update. | |
| unsigned | ApplyRemoteVehicleState (Vehicle *vehicle, int slotIndex) |
| Apply an interpolated network keyframe to a remote vehicle unless the race is paused. | |
| void | ApplyVehicleKeyframe (Vehicle *pVehicle, const KeyframeState *pState) |
| Restore sampled motion and effects, then synchronise integration states. | |
| void | RecordGhostKeyframe (Vehicle *pVehicle) |
| Record one vehicle frame while recording is active and the race is not paused. | |
| void | ApplyGhostKeyframeToVehicle (Vehicle *pVehicle, int nRecording) |
| Restore a ghost frame and estimate velocity from the following frame when available. | |
| void | ApplyGhostKeyframeForVehicle (Vehicle *pVehicle) |
| Restore the ghost frame from the recording slot matching a vehicle index. | |
Variables | |
| GhostRecordingInfo | g_GhostRecordingInfo |
| The metadata of the ghost recording. | |
| unsigned | g_dwGhostRecordingSize |
| The number of metadata bytes written before the frames. | |
| u8 | g_aGhostKeyframes [GHOST_RECORDING_COUNT][GHOST_MAX_FRAMES *GHOST_FRAME_SIZE] |
| The encoded frames of all ghost recordings. | |
| float | g_fGhostBestRaceTime |
| The best race time of the ghost, in seconds. | |
| float | g_fGhostBestLapTime |
| The best lap time of the ghost, in seconds. | |
| int | g_dwLoadedGhostLapCount |
| The lap-count option read from a ghost file. | |
| const char | g_szGhostSaveMagic [4] |
| The four-byte signature of a ghost file. | |
| const unsigned | g_dwGhostFileHeader |
| The zero marker preceding the length in a current ghost file. | |
| unsigned | g_adwGhostFrameCount [GHOST_RECORDING_COUNT] |
| The number of frames of the recordings of the ghost cars. | |
| int | g_bGhostRecordingActive |
| Whether a recording of a ghost car is being made. | |
| int | g_adwGhostPlaybackFrame [GHOST_RECORDING_COUNT] |
| Current playback frame of each recording. | |
The ghost cars of the PC port: the frames of their recordings.
| #define GHOST_FRAME_SIZE 24 |
The size of a frame of the recording of a ghost car.
| #define GHOST_RECORDING_COUNT 8 |
The number of entries of g_adwGhostFrameCount.
| #define GHOST_MAX_FRAMES 65536 |
The maximum number of frames in each recording.
| void PackKeyframeToCompactBuffer | ( | u8 * | pBuffer, |
| const KeyframeState * | pState ) |
Encode a pose and controls into a compact ghost frame, preserving its final two bytes.
| pBuffer | Destination frame. |
| pState | Pose and controls. |
| void DeserializeKeyframeState | ( | KeyframeState * | pState, |
| const u8 * | pBuffer ) |
Decode a compact ghost frame into pose and controls.
Velocities and progress are not written.
| pState | Destination pose and controls. |
| pBuffer | Encoded frame. |
| void InterpolateKeyframeState | ( | KeyframeState * | pOut, |
| float | fShare, | ||
| KeyframeState * | pFrom, | ||
| KeyframeState * | pTo ) |
Interpolate poses and controls, reversing the target quaternion for distant scalar signs.
| pOut | Destination frame. |
| fShare | Interpolation share, clamped from zero to ten. |
| pFrom | Initial frame. |
| pTo | Target frame. |
| u8 * GetGhostKeyframeBuffer | ( | void | ) |
Get the encoded frames of the first recording.
| u8 * GetGhostPlaybackKeyframeBuffer | ( | void | ) |
Get the encoded frames used for ghost playback.
| unsigned GetGhostKeyframeDataSize | ( | void | ) |
Get the size of the encoded frames of the first recording.
| bool ReadGhostFileData | ( | const char * | pszPath, |
| bool | bAllowFailure ) |
Read a current or legacy ghost file and validate its Adler checksum.
| pszPath | The ghost file path. |
| bAllowFailure | Whether a failed load returns success after clearing the metadata and times. |
| FILE * OpenGhostRecording | ( | const char * | pszPath | ) |
Open a ghost recording: the file itself, such as a saved recording, or the file built from the JSON the import converted it to.
| pszPath | The path of the recording. |
| const char * NextAttractDemoRecording | ( | void | ) |
Choose the recording of the next attract demo: the two of the PC release in turn, and then the demo of each imported cartridge.
| bool LoadGhostFile | ( | bool | bAllowFailure | ) |
Read the ghost file selected in the front end.
| bAllowFailure | Whether a failed load returns success. |
| bool SaveGhostFile | ( | void | ) |
Write the ghost recording, times, checksum, menu settings, and slot label to the selected file.
| unsigned SetGhostFrameCountFromSize | ( | unsigned | dwSize | ) |
Set the number of frames of the second recording from its size.
| dwSize | The size of the recording in bytes. |
| void ResetGhostRecording | ( | void | ) |
Clear the number of frames of the recordings, only the first in time attack and the demonstration and all of them otherwise, and stop recording.
| void StartGhostRecording | ( | void | ) |
Start ghost recording.
| int IsGhostRecordingActive | ( | void | ) |
Read the ghost recording flag.
| void AdvanceGhostRecordFrame | ( | void | ) |
Advance active recordings and the time attack or demonstration ghost playback.
| void ClearGhostPlaybackState | ( | void | ) |
Reset every ghost playback frame to zero.
| void UpdateReplayScrubControls | ( | void | ) |
Translate replay controls into playback mode and bounded frame changes.
| void FillMemoryPatternBytes | ( | void * | pDest, |
| size_t | nCount, | ||
| int | nByte ) |
Fill memory with a byte.
| pDest | The memory. |
| nCount | The bytes to fill. |
| nByte | The byte, in the low 8 bits. |
| void MatrixToPositionQuaternion | ( | QuaternionPose * | pPose, |
| f32 | m[4][4] ) |
Get the orientation of a matrix as a quaternion and its translation as a position.
| pPose | Receives the orientation and the position. |
| m | The matrix. |
| void PositionQuaternionToMatrix4x4 | ( | f32 | matrix[4][4], |
| const QuaternionPose * | pPose ) |
Convert a quaternion and position into a matrix, compensating for quaternion magnitude.
| matrix | Destination matrix. |
| pPose | Quaternion and position. |
| void BuildVehicleKeyframe | ( | KeyframeState * | pState, |
| Vehicle * | pVehicle ) |
Sample a vehicle pose, wheel motion, and replay effects.
| pState | Destination frame. |
| pVehicle | Vehicle to sample. |
| void RecordVehicleKeyframe | ( | Vehicle * | vehicle | ) |
Sample vehicle and send its keyframe as a local network state update.
| unsigned ApplyRemoteVehicleState | ( | Vehicle * | vehicle, |
| int | slotIndex ) |
Apply an interpolated network keyframe to a remote vehicle unless the race is paused.
| void ApplyVehicleKeyframe | ( | Vehicle * | pVehicle, |
| const KeyframeState * | pState ) |
Restore sampled motion and effects, then synchronise integration states.
| pVehicle | Destination vehicle. |
| pState | Frame to restore. |
| void RecordGhostKeyframe | ( | Vehicle * | pVehicle | ) |
Record one vehicle frame while recording is active and the race is not paused.
| pVehicle | Vehicle to record. |
| void ApplyGhostKeyframeToVehicle | ( | Vehicle * | pVehicle, |
| int | nRecording ) |
Restore a ghost frame and estimate velocity from the following frame when available.
| pVehicle | Destination vehicle. |
| nRecording | Recording slot. |
| void ApplyGhostKeyframeForVehicle | ( | Vehicle * | pVehicle | ) |
Restore the ghost frame from the recording slot matching a vehicle index.
| pVehicle | Destination vehicle. |
|
extern |
The metadata of the ghost recording.
|
extern |
The number of metadata bytes written before the frames.
|
extern |
The encoded frames of all ghost recordings.
|
extern |
The best race time of the ghost, in seconds.
|
extern |
The best lap time of the ghost, in seconds.
|
extern |
The lap-count option read from a ghost file.
|
extern |
The four-byte signature of a ghost file.
|
extern |
The zero marker preceding the length in a current ghost file.
|
extern |
The number of frames of the recordings of the ghost cars.
|
extern |
Whether a recording of a ghost car is being made.
|
extern |
Current playback frame of each recording.