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