Merge branch 'develop' into scr-method-function

This commit is contained in:
Edo 2022-04-10 14:03:35 +02:00 committed by GitHub
commit fa25cb25a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 19 deletions

View File

@ -377,7 +377,7 @@ namespace Components
Bots::AddMethods();
// Reset activate so test clients can be used after unloading bot warfare
// In case a loaded mod didn't call "BotStop" before the VM shutdown
Script::OnVMShutdown([]
{
for (auto i = 0u; i < std::extent_v<decltype(g_botai)>; i++)

View File

@ -1131,19 +1131,23 @@ namespace Game
}
}
bool PM_IsAdsAllowed(Game::playerState_s* playerState)
__declspec(naked) bool PM_IsAdsAllowed(playerState_s* /*ps*/)
{
bool result;
__asm
{
mov esi, playerState
mov ebx, 0x5755A0
call ebx
mov result, al // AL
}
push eax
pushad
return result;
mov esi, [esp + 0x24 + 0x4] // ps
mov ecx, 0x5755A0
call ecx
mov [esp + 0x20], eax
popad
pop eax
ret
}
}
__declspec(naked) void FS_AddLocalizedGameDirectory(const char* /*path*/, const char* /*dir*/)

View File

@ -1111,7 +1111,7 @@ namespace Game
void FS_AddLocalizedGameDirectory(const char *path, const char *dir);
bool PM_IsAdsAllowed(Game::playerState_s* playerState);
bool PM_IsAdsAllowed(playerState_s* ps);
void ShowMessageBox(const std::string& message, const std::string& title);

View File

@ -23,16 +23,24 @@ namespace Utils
return result;
}
std::string ToLower(std::string input)
std::string ToLower(std::string text)
{
std::transform(input.begin(), input.end(), input.begin(), ::tolower);
return input;
std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input)
{
return static_cast<char>(std::tolower(input));
});
return text;
}
std::string ToUpper(std::string input)
std::string ToUpper(std::string text)
{
std::transform(input.begin(), input.end(), input.begin(), ::toupper);
return input;
std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input)
{
return static_cast<char>(std::toupper(input));
});
return text;
}
std::string DumpHex(const std::string& data, const std::string& separator)

View File

@ -75,8 +75,10 @@ namespace Utils
const char *VA(const char *fmt, ...);
int IsSpace(int c);
std::string ToLower(std::string input);
std::string ToUpper(std::string input);
std::string ToLower(std::string text);
std::string ToUpper(std::string text);
bool EndsWith(const std::string& haystack, const std::string& needle);
std::vector<std::string> Split(const std::string& str, const char delim);
void Replace(std::string& string, const std::string& find, const std::string& replace);
bool EndsWith(const std::string& haystack, const std::string& needle);
bool StartsWith(const std::string& haystack, const std::string& needle);