[General]: Small cleanup (#870)
This commit is contained in:
parent
48e82543db
commit
58bf01196e
@ -101,7 +101,7 @@ namespace Components::GSC
|
|||||||
LoadCustomScriptsFromFolder(mapDir);
|
LoadCustomScriptsFromFolder(mapDir);
|
||||||
|
|
||||||
// Mode specific
|
// Mode specific
|
||||||
const auto modeDir = Utils::String::Format("scripts/mp/{}", (*Game::g_gametype)->current.string);
|
const auto* modeDir = Utils::String::Format("scripts/mp/{}", (*Game::g_gametype)->current.string);
|
||||||
LoadCustomScriptsFromFolder(modeDir);
|
LoadCustomScriptsFromFolder(modeDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ namespace Components
|
|||||||
|
|
||||||
Game::unzClose(this->searchPath.iwd->handle);
|
Game::unzClose(this->searchPath.iwd->handle);
|
||||||
|
|
||||||
auto _free = Utils::Hook::Call<void(void*)>(0x6B5CF2);
|
// Use game's free function
|
||||||
_free(this->searchPath.iwd->buildBuffer);
|
Utils::Hook::Call<void(void*)>(0x6B5CF2)(this->searchPath.iwd->buildBuffer);
|
||||||
_free(this->searchPath.iwd);
|
Utils::Hook::Call<void(void*)>(0x6B5CF2)(this->searchPath.iwd);
|
||||||
|
|
||||||
ZeroMemory(&this->searchPath, sizeof this->searchPath);
|
ZeroMemory(&this->searchPath, sizeof this->searchPath);
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ namespace Game
|
|||||||
MSG_ReadDeltaUsercmdKey_t MSG_ReadDeltaUsercmdKey = MSG_ReadDeltaUsercmdKey_t(0x491F00);
|
MSG_ReadDeltaUsercmdKey_t MSG_ReadDeltaUsercmdKey = MSG_ReadDeltaUsercmdKey_t(0x491F00);
|
||||||
MSG_ReadBitsCompress_t MSG_ReadBitsCompress = MSG_ReadBitsCompress_t(0x4DCC30);
|
MSG_ReadBitsCompress_t MSG_ReadBitsCompress = MSG_ReadBitsCompress_t(0x4DCC30);
|
||||||
MSG_WriteBitsCompress_t MSG_WriteBitsCompress = MSG_WriteBitsCompress_t(0x4319D0);
|
MSG_WriteBitsCompress_t MSG_WriteBitsCompress = MSG_WriteBitsCompress_t(0x4319D0);
|
||||||
|
Huff_offsetReceive_t Huff_offsetReceive = Huff_offsetReceive_t(0x466060);
|
||||||
|
|
||||||
NetadrToSockadr_t NetadrToSockadr = NetadrToSockadr_t(0x4B4B40);
|
NetadrToSockadr_t NetadrToSockadr = NetadrToSockadr_t(0x4B4B40);
|
||||||
|
|
||||||
@ -389,6 +390,8 @@ namespace Game
|
|||||||
|
|
||||||
bool* s_havePlaylists = reinterpret_cast<bool*>(0x1AD3680);
|
bool* s_havePlaylists = reinterpret_cast<bool*>(0x1AD3680);
|
||||||
|
|
||||||
|
huffman_t* msgHuff = reinterpret_cast<huffman_t*>(0x1CB9EC0);
|
||||||
|
|
||||||
const char* TableLookup(StringTable* stringtable, int row, int column)
|
const char* TableLookup(StringTable* stringtable, int row, int column)
|
||||||
{
|
{
|
||||||
if (!stringtable || !stringtable->values || row >= stringtable->rowCount || column >= stringtable->columnCount) return "";
|
if (!stringtable || !stringtable->values || row >= stringtable->rowCount || column >= stringtable->columnCount) return "";
|
||||||
|
@ -263,6 +263,9 @@ namespace Game
|
|||||||
typedef int(*MSG_WriteBitsCompress_t)(bool trainHuffman, const unsigned char* from, unsigned char* to, int size);
|
typedef int(*MSG_WriteBitsCompress_t)(bool trainHuffman, const unsigned char* from, unsigned char* to, int size);
|
||||||
extern MSG_WriteBitsCompress_t MSG_WriteBitsCompress;
|
extern MSG_WriteBitsCompress_t MSG_WriteBitsCompress;
|
||||||
|
|
||||||
|
typedef void(*Huff_offsetReceive_t)(nodetype* node, int* ch, const unsigned char* fin, int* offset);
|
||||||
|
extern Huff_offsetReceive_t Huff_offsetReceive;
|
||||||
|
|
||||||
typedef void(*NetadrToSockadr_t)(netadr_t *a, sockaddr *s);
|
typedef void(*NetadrToSockadr_t)(netadr_t *a, sockaddr *s);
|
||||||
extern NetadrToSockadr_t NetadrToSockadr;
|
extern NetadrToSockadr_t NetadrToSockadr;
|
||||||
|
|
||||||
@ -727,6 +730,8 @@ namespace Game
|
|||||||
|
|
||||||
extern bool* s_havePlaylists;
|
extern bool* s_havePlaylists;
|
||||||
|
|
||||||
|
extern huffman_t* msgHuff;
|
||||||
|
|
||||||
constexpr auto MAX_MSGLEN = 0x20000;
|
constexpr auto MAX_MSGLEN = 0x20000;
|
||||||
|
|
||||||
ScreenPlacement* ScrPlace_GetFullPlacement();
|
ScreenPlacement* ScrPlace_GetFullPlacement();
|
||||||
|
@ -11011,6 +11011,31 @@ namespace Game
|
|||||||
snd_alias_list_t* aliasList;
|
snd_alias_list_t* aliasList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct nodetype
|
||||||
|
{
|
||||||
|
nodetype* left;
|
||||||
|
nodetype* right;
|
||||||
|
nodetype* parent;
|
||||||
|
int weight;
|
||||||
|
int symbol;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct huff_t
|
||||||
|
{
|
||||||
|
int blocNode;
|
||||||
|
int blocPtrs;
|
||||||
|
nodetype* tree;
|
||||||
|
nodetype* loc[257];
|
||||||
|
nodetype** freelist;
|
||||||
|
nodetype nodeList[768];
|
||||||
|
nodetype* nodePtrs[768];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct huffman_t
|
||||||
|
{
|
||||||
|
huff_t compressDecompress;
|
||||||
|
};
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#ifndef IDA
|
#ifndef IDA
|
||||||
|
@ -24,7 +24,7 @@ namespace Utils::String
|
|||||||
std::string ToLower(const std::string& text)
|
std::string ToLower(const std::string& text)
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
std::ranges::transform(text, std::back_inserter(result), [](const unsigned char input)
|
std::ranges::transform(text, std::back_inserter(result), [](const unsigned char input) -> char
|
||||||
{
|
{
|
||||||
return static_cast<char>(std::tolower(input));
|
return static_cast<char>(std::tolower(input));
|
||||||
});
|
});
|
||||||
@ -35,7 +35,7 @@ namespace Utils::String
|
|||||||
std::string ToUpper(const std::string& text)
|
std::string ToUpper(const std::string& text)
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
std::ranges::transform(text, std::back_inserter(result), [](const unsigned char input)
|
std::ranges::transform(text, std::back_inserter(result), [](const unsigned char input) -> char
|
||||||
{
|
{
|
||||||
return static_cast<char>(std::toupper(input));
|
return static_cast<char>(std::toupper(input));
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ namespace Utils::String
|
|||||||
Entry stringPool[Buffers];
|
Entry stringPool[Buffers];
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Arg> // This should display a nice "null" instead of a number
|
template <typename Arg> // This should display a nice "nullptr" instead of a number
|
||||||
static void SanitizeFormatArgs(Arg& arg)
|
static void SanitizeFormatArgs(Arg& arg)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<Arg, char*> || std::is_same_v<Arg, const char*>)
|
if constexpr (std::is_same_v<Arg, char*> || std::is_same_v<Arg, const char*>)
|
||||||
|
Loading…
Reference in New Issue
Block a user