@@ -357,34 +357,6 @@ UI_TIMESTAMP Player_died_popup_wait;
357357
358358UI_TIMESTAMP Multi_ping_timestamp;
359359
360-
361- const auto OnMissionAboutToEndHook = scripting::Hook<>::Factory(
362- " On Mission About To End" , " Called when a mission is about to end but has not run any mission-ending logic" , {});
363-
364- const auto OnMissionEndHook = scripting::OverridableHook<>::Factory(
365- " On Mission End" , " Called when a mission has ended" , {});
366-
367- const auto OnStateAboutToEndHook = scripting::Hook<>::Factory(
368- " On State About To End" , " Called when a game state is about to end but has not run any state-ending logic" ,
369- {
370- {" OldState" , " gamestate" , " The game state that has ended." },
371- {" NewState" , " gamestate" , " The game state that will begin next." },
372- });
373-
374- const auto OnStateEndHook = scripting::OverridableHook<>::Factory(
375- " On State End" , " Called when a game state has ended" ,
376- {
377- {" OldState" , " gamestate" , " The game state that has ended." },
378- {" NewState" , " gamestate" , " The game state that will begin next." },
379- });
380-
381- const auto OnCameraSetUpHook = scripting::Hook<>::Factory(
382- " On Camera Set Up" , " Called every frame when the camera is positioned and oriented for rendering." ,
383- {
384- {" Camera" , " camera" , " The camera about to be used for rendering." },
385- });
386-
387-
388360// builtin mission list stuff
389361int Game_builtin_mission_count = 92 ;
390362fs_builtin_mission Game_builtin_mission_list[MAX_BUILTIN_MISSIONS] = {
@@ -861,14 +833,14 @@ static void game_flash_diminish(float frametime)
861833
862834void game_level_close ()
863835{
864- if (OnMissionAboutToEndHook->isActive ())
836+ if (scripting::hooks:: OnMissionAboutToEndHook->isActive ())
865837 {
866- OnMissionAboutToEndHook->run ();
838+ scripting::hooks:: OnMissionAboutToEndHook->run ();
867839 }
868840
869841 // WMC - this is actually pretty damn dangerous, but I don't want a modder
870842 // to accidentally use an override here without realizing it.
871- if (!OnMissionEndHook->isActive () || !OnMissionEndHook->isOverride ())
843+ if (!scripting::hooks:: OnMissionEndHook->isActive () || !scripting::hooks:: OnMissionEndHook->isOverride ())
872844 {
873845 // save player-persistent variables and containers
874846 mission_campaign_save_on_close_variables (); // Goober5000
@@ -948,9 +920,9 @@ void game_level_close()
948920 Error (LOCATION, " Scripting Mission End override is not fully supported yet." );
949921 }
950922
951- if (OnMissionEndHook->isActive ())
923+ if (scripting::hooks:: OnMissionEndHook->isActive ())
952924 {
953- OnMissionEndHook->run ();
925+ scripting::hooks:: OnMissionEndHook->run ();
954926 }
955927}
956928
@@ -3192,8 +3164,8 @@ camid game_render_frame_setup()
31923164 if (Viewer_mode & VM_FREECAMERA) {
31933165 Viewer_obj = nullptr ;
31943166
3195- if (OnCameraSetUpHook->isActive ()) {
3196- OnCameraSetUpHook->run (scripting::hook_param_list (
3167+ if (scripting::hooks:: OnCameraSetUpHook->isActive ()) {
3168+ scripting::hooks:: OnCameraSetUpHook->run (scripting::hook_param_list (
31973169 scripting::hook_param (" Camera" , ' o' , scripting::api::l_Camera.Set (cam_get_current ()))));
31983170 }
31993171
@@ -3327,8 +3299,8 @@ camid game_render_frame_setup()
33273299 main_cam->set_position (&eye_pos);
33283300 main_cam->set_rotation (&eye_orient);
33293301
3330- if (OnCameraSetUpHook->isActive ()) {
3331- OnCameraSetUpHook->run (scripting::hook_param_list (
3302+ if (scripting::hooks:: OnCameraSetUpHook->isActive ()) {
3303+ scripting::hooks:: OnCameraSetUpHook->run (scripting::hook_param_list (
33323304 scripting::hook_param (" Camera" , ' o' , scripting::api::l_Camera.Set (Main_camera))));
33333305 }
33343306
@@ -5100,18 +5072,18 @@ void game_leave_state( int old_state, int new_state )
51005072 break ;
51015073 }
51025074
5103- if (OnStateAboutToEndHook->isActive () || OnStateEndHook->isActive ())
5075+ if (scripting::hooks:: OnStateAboutToEndHook->isActive () || scripting::hooks:: OnStateEndHook->isActive ())
51045076 {
51055077 auto script_param_list = scripting::hook_param_list (
51065078 scripting::hook_param (" OldState" , ' o' , scripting::api::l_GameState.Set (scripting::api::gamestate_h (old_state))),
51075079 scripting::hook_param (" NewState" , ' o' , scripting::api::l_GameState.Set (scripting::api::gamestate_h (new_state))));
51085080
5109- if (OnStateAboutToEndHook->isActive ())
5110- OnStateAboutToEndHook->run (script_param_list);
5081+ if (scripting::hooks:: OnStateAboutToEndHook->isActive ())
5082+ scripting::hooks:: OnStateAboutToEndHook->run (script_param_list);
51115083
5112- if (OnStateEndHook->isActive () && OnStateEndHook->isOverride (script_param_list))
5084+ if (scripting::hooks:: OnStateEndHook->isActive () && scripting::hooks:: OnStateEndHook->isOverride (script_param_list))
51135085 {
5114- OnStateEndHook->run (script_param_list);
5086+ scripting::hooks:: OnStateEndHook->run (script_param_list);
51155087 return ;
51165088 }
51175089 }
@@ -5535,13 +5507,13 @@ void game_leave_state( int old_state, int new_state )
55355507 }
55365508
55375509 // WMC - Now run scripting stuff
5538- if (OnStateEndHook->isActive ())
5510+ if (scripting::hooks:: OnStateEndHook->isActive ())
55395511 {
55405512 auto script_param_list = scripting::hook_param_list (
55415513 scripting::hook_param (" OldState" , ' o' , scripting::api::l_GameState.Set (scripting::api::gamestate_h (old_state))),
55425514 scripting::hook_param (" NewState" , ' o' , scripting::api::l_GameState.Set (scripting::api::gamestate_h (new_state))));
55435515
5544- OnStateEndHook->run (script_param_list);
5516+ scripting::hooks:: OnStateEndHook->run (script_param_list);
55455517 }
55465518}
55475519
0 commit comments