Fix other keks + add scr_addbool for good mesure

This commit is contained in:
FutureRave 2022-01-15 19:18:15 +00:00
parent 7fab6e136e
commit 5231077b95
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
5 changed files with 36 additions and 7 deletions

View File

@ -524,7 +524,7 @@ namespace Components
{ {
for (auto& asset : AssetHandler::EmptyAssets) for (auto& asset : AssetHandler::EmptyAssets)
{ {
Game::Sys_Error(25, reinterpret_cast<char*>(0x724428), Game::DB_GetXAssetTypeName(asset.first), asset.second.data()); Game::Com_PrintWarning(25, reinterpret_cast<const char*>(0x724428), Game::DB_GetXAssetTypeName(asset.first), asset.second.data());
} }
AssetHandler::EmptyAssets.clear(); AssetHandler::EmptyAssets.clear();

View File

@ -177,7 +177,7 @@ namespace Components
const auto* gentity = Script::GetEntFromEntRef(id); const auto* gentity = Script::GetEntFromEntRef(id);
const auto* client = Script::GetClientFromEnt(gentity); const auto* client = Script::GetClientFromEnt(gentity);
Game::Scr_AddInt(client->isBot); Game::Scr_AddBool(client->isBot == 1);
}); });
Script::AddFunction("BotStop", [](Game::scr_entref_t id) // Usage: <bot> BotStop(); Script::AddFunction("BotStop", [](Game::scr_entref_t id) // Usage: <bot> BotStop();

View File

@ -654,7 +654,7 @@ namespace Components
return; return;
} }
Game::Scr_AddInt((ent->client->flags & Game::PLAYER_FLAG_FROZEN) != 0); Game::Scr_AddBool((ent->client->flags & Game::PLAYER_FLAG_FROZEN) != 0);
}); });
Script::AddFunction("DebugCode", [](Game::scr_entref_t) // gsc: DebugCode(<int toggle>) Script::AddFunction("DebugCode", [](Game::scr_entref_t) // gsc: DebugCode(<int toggle>)

View File

@ -72,6 +72,7 @@ namespace Game
Com_MatchToken_t Com_MatchToken = Com_MatchToken_t(0x447130); Com_MatchToken_t Com_MatchToken = Com_MatchToken_t(0x447130);
Com_SetSlowMotion_t Com_SetSlowMotion = Com_SetSlowMotion_t(0x446E20); Com_SetSlowMotion_t Com_SetSlowMotion = Com_SetSlowMotion_t(0x446E20);
Com_Quitf_t Com_Quit_f = Com_Quitf_t(0x4D4000); Com_Quitf_t Com_Quit_f = Com_Quitf_t(0x4D4000);
Com_PrintWarning_t Com_PrintWarning = Com_PrintWarning_t(0x4E0200);
Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30); Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30);
Con_DrawSolidConsole_t Con_DrawSolidConsole = Con_DrawSolidConsole_t(0x5A5040); Con_DrawSolidConsole_t Con_DrawSolidConsole = Con_DrawSolidConsole_t(0x5A5040);
@ -325,7 +326,6 @@ namespace Game
SV_Loaded_t SV_Loaded = SV_Loaded_t(0x4EE3E0); SV_Loaded_t SV_Loaded = SV_Loaded_t(0x4EE3E0);
SV_ClientThink_t SV_ClientThink = SV_ClientThink_t(0x44ADD0); SV_ClientThink_t SV_ClientThink = SV_ClientThink_t(0x44ADD0);
Sys_Error_t Sys_Error = Sys_Error_t(0x4E0200);
Sys_FreeFileList_t Sys_FreeFileList = Sys_FreeFileList_t(0x4D8580); Sys_FreeFileList_t Sys_FreeFileList = Sys_FreeFileList_t(0x4D8580);
Sys_IsDatabaseReady_t Sys_IsDatabaseReady = Sys_IsDatabaseReady_t(0x4CA4A0); Sys_IsDatabaseReady_t Sys_IsDatabaseReady = Sys_IsDatabaseReady_t(0x4CA4A0);
Sys_IsDatabaseReady2_t Sys_IsDatabaseReady2 = Sys_IsDatabaseReady2_t(0x441280); Sys_IsDatabaseReady2_t Sys_IsDatabaseReady2 = Sys_IsDatabaseReady2_t(0x441280);
@ -338,6 +338,7 @@ namespace Game
Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads = Sys_SuspendOtherThreads_t(0x45A190); Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads = Sys_SuspendOtherThreads_t(0x45A190);
Sys_ListFiles_t Sys_ListFiles = Sys_ListFiles_t(0x45A660); Sys_ListFiles_t Sys_ListFiles = Sys_ListFiles_t(0x45A660);
Sys_Milliseconds_t Sys_Milliseconds = Sys_Milliseconds_t(0x42A660); Sys_Milliseconds_t Sys_Milliseconds = Sys_Milliseconds_t(0x42A660);
Sys_Error_t Sys_Error = Sys_Error_t(0x43D570);
TeleportPlayer_t TeleportPlayer = TeleportPlayer_t(0x496850); TeleportPlayer_t TeleportPlayer = TeleportPlayer_t(0x496850);
@ -1018,6 +1019,28 @@ namespace Game
return GraphGetValueFromFraction(graph->knotCount, graph->knots, fraction) * graph->scale; return GraphGetValueFromFraction(graph->knotCount, graph->knots, fraction) * graph->scale;
} }
void IncInParam()
{
Scr_ClearOutParams();
if (scrVmPub->top == scrVmPub->maxStack)
{
Sys_Error("Internal script stack overflow");
}
scrVmPub->top++;
scrVmPub->inparamcount++;
}
void Scr_AddBool(int value)
{
assert(value == 0 || value == 1);
IncInParam();
scrVmPub->top->type = VAR_INTEGER;
scrVmPub->top->u.intValue = value;
}
#pragma optimize("", off) #pragma optimize("", off)
__declspec(naked) float UI_GetScoreboardLeft(void* /*a1*/) __declspec(naked) float UI_GetScoreboardLeft(void* /*a1*/)
{ {

View File

@ -151,6 +151,9 @@ namespace Game
typedef void(__cdecl * Com_Quitf_t)(); typedef void(__cdecl * Com_Quitf_t)();
extern Com_Quitf_t Com_Quit_f; extern Com_Quitf_t Com_Quit_f;
typedef void(__cdecl * Com_PrintWarning_t)(int, const char*, ...);
extern Com_PrintWarning_t Com_PrintWarning;
typedef char* (__cdecl * Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha); typedef char* (__cdecl * Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha);
extern Con_DrawMiniConsole_t Con_DrawMiniConsole; extern Con_DrawMiniConsole_t Con_DrawMiniConsole;
@ -780,9 +783,6 @@ namespace Game
typedef void(__cdecl* SV_ClientThink_t)(client_s*, usercmd_s*); typedef void(__cdecl* SV_ClientThink_t)(client_s*, usercmd_s*);
extern SV_ClientThink_t SV_ClientThink; extern SV_ClientThink_t SV_ClientThink;
typedef int(__cdecl * Sys_Error_t)(int, char *, ...);
extern Sys_Error_t Sys_Error;
typedef void(__cdecl * Sys_FreeFileList_t)(char** list); typedef void(__cdecl * Sys_FreeFileList_t)(char** list);
extern Sys_FreeFileList_t Sys_FreeFileList; extern Sys_FreeFileList_t Sys_FreeFileList;
@ -822,6 +822,9 @@ namespace Game
typedef void(__cdecl * Sys_SuspendOtherThreads_t)(); typedef void(__cdecl * Sys_SuspendOtherThreads_t)();
extern Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads; extern Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads;
typedef void(__cdecl * Sys_Error_t)(char const*, ...);
extern Sys_Error_t Sys_Error;
typedef void(__cdecl * UI_AddMenuList_t)(UiContext *dc, MenuList *menuList, int close); typedef void(__cdecl * UI_AddMenuList_t)(UiContext *dc, MenuList *menuList, int close);
extern UI_AddMenuList_t UI_AddMenuList; extern UI_AddMenuList_t UI_AddMenuList;
@ -1050,9 +1053,12 @@ namespace Game
void SV_KickClient(client_t* client, const char* reason); void SV_KickClient(client_t* client, const char* reason);
void SV_KickClientError(client_t* client, const std::string& reason); void SV_KickClientError(client_t* client, const std::string& reason);
void IncInParam();
void Scr_iPrintLn(int clientNum, const std::string& message); void Scr_iPrintLn(int clientNum, const std::string& message);
void Scr_iPrintLnBold(int clientNum, const std::string& message); void Scr_iPrintLnBold(int clientNum, const std::string& message);
void Scr_NotifyId(unsigned int id, unsigned __int16 stringValue, unsigned int paramcount); void Scr_NotifyId(unsigned int id, unsigned __int16 stringValue, unsigned int paramcount);
void Scr_AddBool(int value);
void IN_KeyUp(kbutton_t* button); void IN_KeyUp(kbutton_t* button);
void IN_KeyDown(kbutton_t* button); void IN_KeyDown(kbutton_t* button);