Merge pull request #714 from mjkzy/scripts-fix

load our scripts sooner
This commit is contained in:
Maurice Heumann 2023-05-16 12:08:47 +02:00 committed by GitHub
commit 1013c44eb7
2 changed files with 9 additions and 12 deletions

View File

@ -157,17 +157,15 @@ namespace script
allocator.clear();
}
void load_gametype_script_stub()
void begin_load_scripts_stub(game::scriptInstance_t inst, int user)
{
if (!game::Com_IsInGame() || game::Com_IsRunningUILevel())
{
game::GScr_LoadGametypeScript();
return;
}
game::Scr_BeginLoadScripts(inst, user);
game::GScr_LoadGametypeScript();
if (game::Com_IsInGame() && !game::Com_IsRunningUILevel())
{
load_scripts();
}
}
int server_script_checksum_stub()
{
@ -191,8 +189,8 @@ namespace script
// Free our scripts when the game ends
game_event::on_g_shutdown_game(clear_script_memory);
// Load our scripts when the gametype script is loaded
utils::hook::call(game::select(0x141AAF37C, 0x1402D8C7F), load_gametype_script_stub);
// Load our custom/overriding scripts
utils::hook::call(game::select(0x141AAE92F, 0x1402D81FF), begin_load_scripts_stub);
// Force GSC checksums to be valid
utils::hook::call(game::select(0x1408F2E5D, 0x1400E2D22), server_script_checksum_stub);

View File

@ -195,6 +195,7 @@ namespace game
};
WEAK symbol<unsigned int(scriptInstance_t inst)> Scr_GetNumParam{0x0, 0x140171320};
WEAK symbol<unsigned int(scriptInstance_t inst, const char* filename)> Scr_LoadScript{0x1412C83F0, 0x140156610};
WEAK symbol<void(scriptInstance_t inst, int user)> Scr_BeginLoadScripts{0x1412C7DF0, 0x140156010};
WEAK symbol<void(const char* name, const char* key, unsigned int playbackFlags, float volume, void* callbackInfo,
int id)> Cinematic_StartPlayback{0x1412BE3A0};
@ -243,8 +244,6 @@ namespace game
0x1422E9410, 0x1405811E0
};
WEAK symbol<void()> GScr_LoadGametypeScript{0x141AAD850, 0x1402D7140};
// Variables
WEAK symbol<cmd_function_s> cmd_functions{0x15689DF58, 0x14946F860};
WEAK symbol<CmdArgs> sv_cmd_args{0x15689AE30, 0x14944C740};