53 lines
845 B
C++
53 lines
845 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "net/defs.hpp"
|
|
|
|
namespace game
|
|
{
|
|
|
|
constexpr size_t MAX_WHEELS = 4;
|
|
|
|
using VehicleFlags = uint8_t;
|
|
|
|
enum VehicleFlag : VehicleFlags
|
|
{
|
|
VF_NONE = 0,
|
|
VF_ACCELERATING = 1,
|
|
VF_BRAKING = 2,
|
|
VF_BROKENWINDOWS = 4,
|
|
VF_LIGHTS_ON = 8,
|
|
VF_REVERSING = 16,
|
|
VF_ORANGE_LIGHTS_ON = 32,
|
|
};
|
|
|
|
struct VehicleSyncState
|
|
{
|
|
VehicleFlags flags = VF_NONE;
|
|
|
|
net::PositionQ pos;
|
|
net::QuatQ rot;
|
|
|
|
net::AngleQ steering;
|
|
|
|
struct
|
|
{
|
|
net::WheelZOffsetQ z_offset; // how much compressed
|
|
net::RotationSpeedQ speed; // rad/s
|
|
} wheels[MAX_WHEELS];
|
|
};
|
|
|
|
using VehicleSyncFieldFlags = uint8_t;
|
|
|
|
enum VehicleSyncFieldFlag
|
|
{
|
|
VSF_FLAGS = 0x01,
|
|
VSF_POSITION = 0x02,
|
|
VSF_ROTATION = 0x04,
|
|
VSF_STEERING = 0x08,
|
|
VSF_WHEELS = 0x10,
|
|
};
|
|
|
|
|
|
} // namespace game
|