load our scripts sooner

This commit is contained in:
m 2023-05-16 04:42:15 -05:00
parent 649d44479b
commit 9227b6622b
2 changed files with 6 additions and 7 deletions

View File

@ -157,15 +157,15 @@ namespace script
allocator.clear(); 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()) if (!game::Com_IsInGame() || game::Com_IsRunningUILevel())
{ {
game::GScr_LoadGametypeScript(); game::Scr_BeginLoadScripts(inst, user);
return; return;
} }
game::GScr_LoadGametypeScript(); game::Scr_BeginLoadScripts(inst, user);
load_scripts(); load_scripts();
} }
@ -191,8 +191,8 @@ namespace script
// Free our scripts when the game ends // Free our scripts when the game ends
game_event::on_g_shutdown_game(clear_script_memory); game_event::on_g_shutdown_game(clear_script_memory);
// Load our scripts when the gametype script is loaded // Load our custom/overriding scripts
utils::hook::call(game::select(0x141AAF37C, 0x1402D8C7F), load_gametype_script_stub); utils::hook::call(game::select(0x141AAE92F, 0x1402D81FF), begin_load_scripts_stub);
// Force GSC checksums to be valid // Force GSC checksums to be valid
utils::hook::call(game::select(0x1408F2E5D, 0x1400E2D22), server_script_checksum_stub); 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)> Scr_GetNumParam{0x0, 0x140171320};
WEAK symbol<unsigned int(scriptInstance_t inst, const char* filename)> Scr_LoadScript{0x1412C83F0, 0x140156610}; 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, WEAK symbol<void(const char* name, const char* key, unsigned int playbackFlags, float volume, void* callbackInfo,
int id)> Cinematic_StartPlayback{0x1412BE3A0}; int id)> Cinematic_StartPlayback{0x1412BE3A0};
@ -243,8 +244,6 @@ namespace game
0x1422E9410, 0x1405811E0 0x1422E9410, 0x1405811E0
}; };
WEAK symbol<void()> GScr_LoadGametypeScript{0x141AAD850, 0x1402D7140};
// Variables // Variables
WEAK symbol<cmd_function_s> cmd_functions{0x15689DF58, 0x14946F860}; WEAK symbol<cmd_function_s> cmd_functions{0x15689DF58, 0x14946F860};
WEAK symbol<CmdArgs> sv_cmd_args{0x15689AE30, 0x14944C740}; WEAK symbol<CmdArgs> sv_cmd_args{0x15689AE30, 0x14944C740};