1919//
2020
2121#include " hud.h"
22- #include " cl_util.h"
2322#include " netadr.h"
2423#include " pmtrace.h"
2524
3130#include " mobility_int.h"
3231#include " vgui_parser.h"
3332#include " cl_dll/IGameMenuExports.h"
33+ #include " particleman.h"
34+ #include " IParticleMan_Active.h"
35+ #include " CMiniMem.h"
36+ #include " environment.h"
37+
38+ #include " cl_util.h"
3439
3540cl_enginefunc_t gEngfuncs = { };
3641render_api_t gRenderAPI = { };
@@ -40,6 +45,7 @@ int g_iXash = 0; // indicates a buildnum
4045int g_iMobileAPIVersion = 0 ;
4146
4247IGameMenuExports *g_pMenu = nullptr ;
48+ IParticleMan *g_pParticleMan = NULL ;
4349
4450static IGameMenuExports *GetNativeMenuExports ( void )
4551{
@@ -68,6 +74,8 @@ void InitInput (void);
6874void Game_HookEvents ( void );
6975void IN_Commands ( void );
7076void Input_Shutdown (void );
77+ void CL_LoadParticleMan ();
78+ void CL_UnloadParticleMan ();
7179
7280/*
7381==========================
@@ -84,11 +92,13 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
8492 gEngfuncs = *pEnginefuncs;
8593
8694 // Register cvar to allow using old touch menus (1 = use old cfg-based menus)
95+
8796 CVAR_CREATE (" cl_oldtouchmenus" , " 0" , FCVAR_CLIENTDLL | FCVAR_ARCHIVE );
8897
8998 sscanf ( CVAR_GET_STRING ( " host_ver" ), " %d" , &g_iXash );
9099
91100 Game_HookEvents ();
101+ CL_LoadParticleMan ();
92102
93103 return 1 ;
94104}
@@ -105,6 +115,17 @@ void DLLEXPORT HUD_Shutdown( void )
105115 gHUD .Shutdown ();
106116 Input_Shutdown ();
107117 Localize_Free ();
118+ g_Environment.Clear ();
119+ if (g_pParticleMan)
120+ {
121+ CL_UnloadParticleMan ();
122+ }
123+ auto miniMem = CMiniMem::Instance ();
124+ if (miniMem)
125+ {
126+ miniMem->Reset ();
127+ miniMem->Shutdown ();
128+ }
108129}
109130
110131
@@ -217,7 +238,12 @@ int DLLEXPORT HUD_VidInit( void )
217238
218239 isLoaded = true ;
219240
220- // VGui_Startup();
241+ if (g_pParticleMan)
242+ {
243+ g_pParticleMan->ResetParticles ();
244+ g_Environment.Reset ();
245+ g_Environment.RestoreWeather ();
246+ }
221247
222248 return 1 ;
223249}
@@ -468,6 +494,24 @@ extern "C" int DLLEXPORT HUD_GetPlayerTeam(int iplayer)
468494 return 0 ;
469495}
470496
497+ void CL_UnloadParticleMan ()
498+ {
499+ if (g_pParticleMan)
500+ {
501+ delete g_pParticleMan;
502+ g_pParticleMan = NULL ;
503+ }
504+ }
505+
506+ void CL_LoadParticleMan ()
507+ {
508+ g_pParticleMan = new IParticleMan_Active ();
509+ if (g_pParticleMan)
510+ {
511+ g_pParticleMan->SetUp (&gEngfuncs );
512+ }
513+ }
514+
471515#include " APIProxy.h"
472516
473517cldll_func_dst_t *g_pcldstAddrs;
0 commit comments