2022-10-09 01:13:17 -04:00
|
|
|
#ifndef _TGAMETYPES
|
|
|
|
|
#define _TGAMETYPES
|
2022-07-18 18:42:58 -04:00
|
|
|
|
|
|
|
|
#include "types.h"
|
2022-10-09 01:13:17 -04:00
|
|
|
|
2022-09-18 01:55:13 -04:00
|
|
|
class CInputStream;
|
|
|
|
|
class COutputStream;
|
|
|
|
|
|
2022-08-09 19:03:51 -04:00
|
|
|
struct TAreaId;
|
|
|
|
|
struct TEditorId;
|
|
|
|
|
struct TUniqueId;
|
2022-07-18 18:42:58 -04:00
|
|
|
|
2022-10-09 19:27:35 -07:00
|
|
|
extern const TAreaId kInvalidAreaId;
|
|
|
|
|
extern const TEditorId kInvalidEditorId;
|
|
|
|
|
extern const TUniqueId kInvalidUniqueId;
|
2022-07-18 18:42:58 -04:00
|
|
|
|
2022-08-09 19:03:51 -04:00
|
|
|
struct TAreaId {
|
2022-09-05 00:01:13 -04:00
|
|
|
int value;
|
2022-08-09 19:03:51 -04:00
|
|
|
|
|
|
|
|
TAreaId() : value(-1) {}
|
2022-09-05 00:01:13 -04:00
|
|
|
TAreaId(int value) : value(value) {}
|
|
|
|
|
int Value() const { return value; }
|
2022-08-09 19:03:51 -04:00
|
|
|
|
|
|
|
|
bool operator==(const TAreaId& other) const { return value == other.value; }
|
|
|
|
|
bool operator!=(const TAreaId& other) const { return value != other.value; }
|
|
|
|
|
};
|
2022-08-12 21:26:00 -04:00
|
|
|
CHECK_SIZEOF(TAreaId, 0x4)
|
2022-08-10 22:33:46 -04:00
|
|
|
|
2022-08-09 19:03:51 -04:00
|
|
|
struct TEditorId {
|
2022-09-05 00:01:13 -04:00
|
|
|
uint value;
|
2022-08-09 19:03:51 -04:00
|
|
|
|
2022-09-05 00:01:13 -04:00
|
|
|
TEditorId(uint value) : value(value) {}
|
2022-09-18 01:55:13 -04:00
|
|
|
TEditorId(CInputStream& in);
|
|
|
|
|
// TODO
|
2022-10-26 21:40:41 -07:00
|
|
|
uint Value() const { return value & 0x3FFFFFF; }
|
2022-11-03 16:21:47 +02:00
|
|
|
uint Id() const { return value & 0xffff; }
|
|
|
|
|
int AreaNum() const { return (value >> 16) & 0x3ff; }
|
2022-09-18 01:55:13 -04:00
|
|
|
|
|
|
|
|
void PutTo(COutputStream&) const;
|
2022-08-10 22:33:46 -04:00
|
|
|
|
2022-10-26 21:40:41 -07:00
|
|
|
bool operator==(const TEditorId& other) const { return Value() == other.Value(); }
|
|
|
|
|
bool operator!=(const TEditorId& other) const { return Value() != other.Value(); }
|
2026-02-28 00:58:47 -07:00
|
|
|
bool operator<(const TEditorId& other) const { return Value() < other.Value(); }
|
2022-08-09 19:03:51 -04:00
|
|
|
};
|
2022-08-12 21:26:00 -04:00
|
|
|
CHECK_SIZEOF(TEditorId, 0x4)
|
2022-08-10 22:33:46 -04:00
|
|
|
|
2022-08-09 19:03:51 -04:00
|
|
|
struct TUniqueId {
|
2022-10-09 01:37:23 -04:00
|
|
|
ushort value;
|
2026-01-18 21:58:48 -08:00
|
|
|
TUniqueId() {}
|
2026-01-08 20:00:32 -08:00
|
|
|
TUniqueId(const ushort version, const ushort id)
|
2026-02-28 00:58:47 -07:00
|
|
|
: value(id | (version << 10)) {}
|
2022-10-16 16:59:20 +03:00
|
|
|
|
2022-10-09 01:37:23 -04:00
|
|
|
ushort Value() const { return value & 0x3FF; }
|
|
|
|
|
ushort Version() const { return (value >> 10) & 0x3F; }
|
2022-08-10 22:33:46 -04:00
|
|
|
|
|
|
|
|
bool operator==(const TUniqueId& other) const { return value == other.value; }
|
|
|
|
|
bool operator!=(const TUniqueId& other) const { return value != other.value; }
|
2022-11-10 04:06:24 +02:00
|
|
|
bool operator<(const TUniqueId& other) const { return value < other.value; }
|
2024-09-25 23:54:05 -06:00
|
|
|
operator bool() const { return *this != kInvalidUniqueId; }
|
2022-09-18 01:55:13 -04:00
|
|
|
|
|
|
|
|
private:
|
2022-08-09 19:03:51 -04:00
|
|
|
};
|
2022-10-03 00:49:11 -04:00
|
|
|
CHECK_SIZEOF(TUniqueId, 0x2)
|
|
|
|
|
|
|
|
|
|
// struct TGameScriptId {
|
|
|
|
|
// TEditorId editorId;
|
|
|
|
|
// bool b;
|
|
|
|
|
// };
|
|
|
|
|
// CHECK_SIZEOF(TGameScriptId, 0x8)
|
2022-08-12 21:26:00 -04:00
|
|
|
|
2022-10-09 01:37:23 -04:00
|
|
|
typedef ushort TSfxId;
|
2022-08-12 21:26:00 -04:00
|
|
|
static TSfxId InvalidSfxId = 0xFFFFu;
|
2022-08-09 19:03:51 -04:00
|
|
|
|
2022-09-19 00:19:46 -04:00
|
|
|
#define ALIGN_UP(x, a) (((x) + (a - 1)) & ~(a - 1))
|
|
|
|
|
|
2022-10-09 01:13:17 -04:00
|
|
|
#endif // _TGAMETYPES
|