Initial gamelib integration AAS2 with some animation and physics and another integration pass on idLib.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,73 @@ struct punctuation_t {
|
||||
int n;
|
||||
};
|
||||
|
||||
// Recovered from the lexer PDB enums and the subtype tests in lexer.cpp.
|
||||
enum lexerTokenType_t : int {
|
||||
TT_STRING = 1,
|
||||
TT_LITERAL = 2,
|
||||
TT_NUMBER = 3,
|
||||
TT_NAME = 4,
|
||||
TT_PUNCTUATION = 5
|
||||
};
|
||||
|
||||
enum lexerNumberSubtype_t : int {
|
||||
TT_INTEGER = 0x0001,
|
||||
TT_DECIMAL = 0x0002,
|
||||
TT_HEX = 0x0004,
|
||||
TT_OCTAL = 0x0008,
|
||||
TT_BINARY = 0x0010,
|
||||
TT_LONG = 0x0020,
|
||||
TT_UNSIGNED = 0x0040,
|
||||
TT_FLOAT = 0x0080,
|
||||
TT_IPADDRESS = 0x0100,
|
||||
TT_IPPORT = 0x0200,
|
||||
TT_VALUESVALID = 0x0400,
|
||||
TT_INFINITE = 0x0800,
|
||||
TT_INDEFINITE = 0x1000,
|
||||
TT_NAN = 0x2000
|
||||
};
|
||||
|
||||
enum lexerPunctuation_t : int {
|
||||
P_RSHIFT_ASSIGN = 0, P_LSHIFT_ASSIGN, P_PARMS, P_PRECOMPMERGE,
|
||||
P_LOGIC_AND, P_LOGIC_OR, P_LOGIC_GEQ, P_LOGIC_LEQ, P_LOGIC_EQ,
|
||||
P_LOGIC_UNEQ, P_MUL_ASSIGN, P_DIV_ASSIGN, P_MOD_ASSIGN,
|
||||
P_ADD_ASSIGN, P_SUB_ASSIGN, P_INC, P_DEC, P_BIN_AND_ASSIGN,
|
||||
P_BIN_OR_ASSIGN, P_BIN_XOR_ASSIGN, P_RSHIFT, P_LSHIFT,
|
||||
P_SCOPE_RESOLUTION, P_MEMBER_SELECTION_OBJECT,
|
||||
P_MEMBER_SELECTION_POINTER, P_POINTER_TO_MEMBER_OBJECT,
|
||||
P_POINTER_TO_MEMBER_POINTER, P_MUL, P_DIV, P_MOD, P_ADD, P_SUB,
|
||||
P_ASSIGN, P_BIN_AND, P_BIN_OR, P_BIN_XOR, P_BIN_NOT, P_LOGIC_NOT,
|
||||
P_LOGIC_GREATER, P_LOGIC_LESS, P_COMMA, P_SEMICOLON, P_COLON,
|
||||
P_QUESTIONMARK, P_PARENTHESESOPEN, P_PARENTHESESCLOSE, P_BRACEOPEN,
|
||||
P_BRACECLOSE, P_SQBRACKETOPEN, P_SQBRACKETCLOSE, P_BACKSLASH,
|
||||
P_PRECOMP, P_DOLLAR, P_APOSTROPHE, P_QUOTE, P_AT
|
||||
};
|
||||
|
||||
enum lexerFlags_t : int {
|
||||
LEXFL_NOERRORS = 0x1,
|
||||
LEXFL_NOWARNINGS = 0x2,
|
||||
LEXFL_NOFATALERRORS = 0x4,
|
||||
LEXFL_VCSTYLEREPORTS = 0x8,
|
||||
LEXFL_NOSTRINGCONCAT = 0x10,
|
||||
LEXFL_NOSTRINGESCAPECHARS = 0x20,
|
||||
LEXFL_NODOLLARPRECOMPILE = 0x40,
|
||||
LEXFL_NOBASEINCLUDES = 0x80,
|
||||
LEXFL_NOGLOBALDEFINES = 0x100,
|
||||
LEXFL_ALLOWPATHNAMES = 0x200,
|
||||
LEXFL_ALLOWNUMBERNAMES = 0x400,
|
||||
LEXFL_ALLOWIPADDRESSES = 0x800,
|
||||
LEXFL_ALLOWFLOATEXCEPTIONS = 0x1000,
|
||||
LEXFL_ALLOWMULTICHARLITERALS = 0x2000,
|
||||
LEXFL_ALLOWBACKSLASHSTRINGCONCAT = 0x4000,
|
||||
LEXFL_ONLYSTRINGS = 0x8000,
|
||||
LEXFL_NOEMITSTRINGESCAPECHARS = 0x10000,
|
||||
LEXFL_ALLOWRAWSTRINGBLOCKS = 0x20000,
|
||||
LEXFL_THROWFATAL = 0x40000,
|
||||
LEXFL_NOSTRINGS = 0x80000,
|
||||
LEXFL_ALLOWWILDCARD = 0x100000,
|
||||
LEXFL_REPORT_MULTIPLE_ERRORS = 0x200000
|
||||
};
|
||||
|
||||
class alignas(4) idLexer {
|
||||
public:
|
||||
explicit idLexer(int flags = 0);
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <cstdio>
|
||||
|
||||
// Exact tungsten idStr storage layout (tungsten.exe.h type 12142). This is a
|
||||
// deliberately small ABI facade; more recovered text methods will be added as
|
||||
// text/str.cpp replaces the BFG baseline.
|
||||
// deliberately small ABI facade; more authoritative text methods will be
|
||||
// added as text/str.cpp is reconstructed.
|
||||
class idStr {
|
||||
public:
|
||||
idStr()
|
||||
@@ -81,6 +81,29 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Recovered from shared/idlib/text/str.cpp. Resource names are lowercase,
|
||||
// use forward slashes, and discard leading slashes except for UNC names.
|
||||
void MakeNameCanonical() {
|
||||
for (int index = 0; index < len; ++index) {
|
||||
if (data[index] >= 'A' && data[index] <= 'Z') {
|
||||
data[index] = static_cast<char>(data[index] + ('a' - 'A'));
|
||||
} else if (data[index] == '\\') {
|
||||
data[index] = '/';
|
||||
}
|
||||
}
|
||||
if (!(len >= 2 && data[0] == '/' && data[1] == '/')) {
|
||||
int leading = 0;
|
||||
while (leading < len && data[leading] == '/') {
|
||||
++leading;
|
||||
}
|
||||
if (leading > 0) {
|
||||
std::memmove(data, data + leading,
|
||||
static_cast<std::size_t>(len - leading + 1));
|
||||
len -= leading;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Append(const char* text) {
|
||||
if (text == nullptr || *text == '\0') {
|
||||
return;
|
||||
@@ -105,6 +128,30 @@ public:
|
||||
Append(text.c_str());
|
||||
}
|
||||
|
||||
idStr& StripFileExtension() {
|
||||
for (int index = len - 1; index >= 0; --index) {
|
||||
const char value = data[index];
|
||||
if (value == '\\' || value == '/') {
|
||||
break;
|
||||
}
|
||||
if (value == '.') {
|
||||
data[index] = '\0';
|
||||
len = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
idStr& SetFileExtension(const char* extension) {
|
||||
StripFileExtension();
|
||||
if (extension != nullptr && extension[0] != '.') {
|
||||
Append('.');
|
||||
}
|
||||
Append(extension);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Format(const char* format, ...) {
|
||||
char buffer[4096];
|
||||
va_list arguments;
|
||||
|
||||
Reference in New Issue
Block a user