coastline 0.0.4
Loading...
Searching...
No Matches
snapshot.h
Go to the documentation of this file.
1#ifndef COASTLINE_PLATFORM_WIN_SNAPSHOT_H
2#define COASTLINE_PLATFORM_WIN_SNAPSHOT_H
3
8
10#include "common/racerslot.h"
11#include "common/snapshotops.h"
12#include "common/vehicle.h"
13
16
19private:
20 unsigned sequence;
21 RacerSlot racers[RACER_SLOTS];
22 [[maybe_unused]] unsigned char unreconstructedA04[4]; /* +0xa04 */
23 Vehicle vehicles[MAX_VEHICLES];
24 ViewportRect viewport;
25 unsigned unreconstructed2c0e0; /* +0x2c0e0 */
26 ParticleSnapshot particles;
27 [[maybe_unused]] unsigned char unreconstructed2e0ec[4]; /* +0x2e0ec */
28
29public:
31 unsigned GetSequence() const {
32 return sequence;
33 }
34
39 void SetSequence(unsigned value) {
40 sequence = value;
41 }
42
44 return *vehicles[0].GetActiveCamera();
45 }
46#if TGR_PLATFORM == TGR_PLATFORM_SDL
51 const Vehicle &GetVehicle(int index) const {
52 return vehicles[index];
53 }
54
58 return vehicles;
59 }
60
62 return particles;
63 }
64#endif /* TGR_PLATFORM == TGR_PLATFORM_SDL */
66 void Capture();
68 inline void RenderRacingScreen();
76 inline void
77 InterpolateFrom(const FrameSnapshot &from, const FrameSnapshot &to, long double share);
78};
79
80#ifdef __cplusplus
81extern "C" {
82#endif
83
98
99#if TGR_PLATFORM == TGR_PLATFORM_SDL
105#define g_abFrameSnapshotInUse (*GetSdlSnapshotUsage())
106#else
111#endif
120
132extern float g_fFrameSnapshotBlendCarry;
136extern unsigned g_dwFrameSnapshotBlendStartTime;
137
145
155
156#if TGR_PLATFORM == TGR_PLATFORM_SDL
165#endif /* TGR_PLATFORM == TGR_PLATFORM_SDL */
166
174
182
190
199
200#ifdef __cplusplus
201}
202#endif
203
204#endif // COASTLINE_PLATFORM_WIN_SNAPSHOT_H
#define MAX_VEHICLES
The capacity of the race engine's vehicle array.
Definition bossrallyvehicle.h:23
Captured race geometry, cameras, and particles for interpolation between simulation steps.
Definition snapshot.h:18
const ParticleSnapshot & GetParticles() const
Definition snapshot.h:61
void Capture()
Capture active vehicles, racers, the primary viewport, and particles from the race.
unsigned GetSequence() const
Definition snapshot.h:31
void InterpolateFrom(const FrameSnapshot &from, const FrameSnapshot &to, long double share)
Interpolate vehicle poses and cameras while copying racers, viewport, and particles.
const Vehicle & GetVehicle(int index) const
Definition snapshot.h:51
void RenderRacingScreen()
Render the racing screen from this snapshot using the active renderer.
Vehicle * GetVehicles()
Definition snapshot.h:57
const CameraFrame & GetPrimaryCamera() const
Definition snapshot.h:43
void SetSequence(unsigned value)
Assign a capture sequence without modifying the stored race frame.
Definition snapshot.h:39
#define RACER_SLOTS
The racers of a race.
Definition racerslot.h:11
FrameSnapshot g_InterpolatedFrameSnapshot
Temporary output of interpolation between two captured race frames.
unsigned g_dwFrameSnapshotBlendStartTime
The millisecond timer value of the previous interpolation update, or zero before the first.
int g_dwFrameSnapshotCurrentSlot
The most recent completed snapshot slot, or -1 before the first capture.
int g_dwFrameSnapshotBlendFromSlot
The earlier snapshot selected for the current blend, or -1 before selection.
void InitFrameSnapshotSlots(void)
Initialise slot flags, sequence counters, and interpolation timers once per valid pool.
int g_dwInterpolatedFrameCount
The number of frames rendered from interpolated snapshots since the slots were set up.
int GetInterpolatedFrameCount(void)
Get the number of frames rendered from interpolated snapshots since the slots were set up.
@ FRAME_SNAPSHOT_COUNT
Definition snapshot.h:15
void InvalidateFrameSnapshotSlots(void)
Mark the snapshots of frames as not set up.
FrameSnapshot g_aFrameSnapshots[FRAME_SNAPSHOT_COUNT]
The rotating snapshot pool, indexed by the current, previous, and blend slot selectors.
int g_bFrameSnapshotsInitialized
Whether the snapshots of frames are set up.
float g_fFrameSnapshotBlendCarry
Fractional interpolation progress retained from the previous rendered frame.
int g_dwFrameSnapshotPreviousSlot
The completed snapshot slot preceding the current slot, or -1 before two captures.
int(* GetSdlSnapshotUsage(void))[FRAME_SNAPSHOT_COUNT]
int g_nLastInterpolatedSnapshot
The later snapshot slot selected for interpolation, or -1 before selection.
#define g_abFrameSnapshotInUse
Slot-use flags for the active SDL engine's snapshot pool.
Definition snapshot.h:105
FrameSnapshot * InterpolateFrameSnapshots(float share)
Blend the last two snapshots of the race into g_InterpolatedFrameSnapshot as InterpolateFrameSnapshot...
int AcquireNextFrameSnapshotSlot(void)
Select the oldest unused slot, advancing the current and previous completed slot selectors.
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
Captured particle pool and list indices for one race simulation frame.
Definition particlesnapshot.h:6
A racer of a race.
Definition racerslot.h:28
A vehicle.
Definition vehicle.h:143
The rectangle of the screen a view fills.
Definition render.h:134
The vehicles of a race, the cars they are, and their place on the track.