Temp-Classes/script/types.hpp

103 lines
1.9 KiB
C++
Raw Normal View History

#pragma once
#include <cstdint>
#include "scrVector.hpp"
#ifndef BOOL
#define BOOL int
#endif
using Void = void;
using Any = int;
using Hash = std::uint32_t;
using Entity = std::int32_t;
using Player = std::int32_t;
using FireId = std::int32_t;
using Interior = std::int32_t;
using Ped = Entity;
using Vehicle = Entity;
using Cam = std::int32_t;
using Object = Entity;
using Pickup = Object;
using Blip = std::int32_t;
using Camera = Entity;
using ScrHandle = Entity;
using Vector3 = rage::scrVector;
#define PLAYER_INDEX alignas(8) Player
#define ENTITY_INDEX alignas(8) Entity
#define PED_INDEX alignas(8) Ped
#define VEHICLE_INDEX alignas(8) Vehicle
#define INTERIOR_INDEX alignas(8) Interior
#define NETWORK_INDEX alignas(8) int
#define SCR_HASH alignas(8) Hash
#define SCR_INT alignas(8) int
#define SCR_BOOL alignas(8) BOOL
#define SCR_FLOAT alignas(8) float
#define SCR_VEC3 Vector3
template <int SIZE>
struct SCR_TEXT_LABEL
{
2023-06-15 04:16:19 +08:00
alignas(8) char Data[SIZE];
private:
2023-06-15 04:16:19 +08:00
alignas(8) char _PAD[SIZE];
public:
2023-06-15 04:16:19 +08:00
operator char* () { return Data; }
};
#define TEXT_LABEL_15 SCR_TEXT_LABEL<16>
#define TEXT_LABEL_23 SCR_TEXT_LABEL<24>
#define TEXT_LABEL_31 SCR_TEXT_LABEL<32>
#define TEXT_LABEL_63 SCR_TEXT_LABEL<64>
template <typename T, int SIZE>
struct SCR_ARRAY
{
2023-06-15 04:16:19 +08:00
SCR_INT Size;
alignas(8) T Data[SIZE];
2023-06-15 04:16:19 +08:00
T& operator [](int index)
{
return Data[index];
}
};
template <typename T>
struct SCR_BITSET
{
2023-06-15 04:16:19 +08:00
alignas(8) int Value;
2023-06-15 04:16:19 +08:00
bool IsSet(T val)
{
return Value & (1 << (int)val);
}
2023-06-15 04:16:19 +08:00
void Set(T val)
{
Value |= (1 << (int)val);
}
2023-06-15 04:16:19 +08:00
void Clear(T val)
{
Value &= ~(1 << (int)val);
}
};
struct Color3
{
2023-06-15 04:16:19 +08:00
SCR_INT R;
SCR_INT G;
SCR_INT B;
};
static_assert(sizeof(Color3) == 3 * 8);
// serialized bitbuffer data of rage::rlGamerHandle + some padding for last gen compatibility
struct GAMER_HANDLE
{
private:
2023-06-15 04:16:19 +08:00
uint64_t Data[13];
};
2023-06-15 04:16:19 +08:00
static_assert(sizeof(GAMER_HANDLE) == 13 * 8);
#define NUM_CONTACTS 80