Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cl_dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ file(GLOB CS_INPUT_SRC "input/*.cpp")
file(GLOB CS_PM_SRC "../pm_shared/*.cpp")
file(GLOB CS_GAMSH_SRC "../game_shared/*.cpp")
file(GLOB MINIUTL_SRC "../3rdparty/mainui_cpp/miniutl/*.cpp")
file(GLOB CS_PARTICLEMAN_SRC "particleman/*.cpp")

list(REMOVE_ITEM CS_CLIENT_SRC "${CMAKE_CURRENT_SOURCE_DIR}/ev_hldm.cpp")
list(REMOVE_ITEM CS_INPUT_SRC "${CMAKE_CURRENT_SOURCE_DIR}/input/input_sdl.cpp")
Expand All @@ -30,6 +31,7 @@ list(APPEND CS_CLIENT_SRC ${CS_PM_SRC})
list(APPEND CS_CLIENT_SRC ${CS_INPUT_SRC})
list(APPEND CS_CLIENT_SRC ${CS_GAMSH_SRC})
list(APPEND CS_CLIENT_SRC ${MINIUTL_SRC})
list(APPEND CS_CLIENT_SRC ${CS_PARTICLEMAN_SRC})

include_directories(
include
Expand All @@ -47,7 +49,8 @@ include_directories(
../3rdparty/mainui_cpp
../3rdparty/mainui_cpp/controls
../3rdparty/mainui_cpp/menus
../3rdparty/mainui_cpp/miniutl)
../3rdparty/mainui_cpp/miniutl
particleman)

add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL -DSTDINT_H=<cstdint>)

Expand Down
48 changes: 46 additions & 2 deletions cl_dll/cdll_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
//

#include "hud.h"
#include "cl_util.h"
#include "netadr.h"
#include "pmtrace.h"

Expand All @@ -31,6 +30,12 @@
#include "mobility_int.h"
#include "vgui_parser.h"
#include "cl_dll/IGameMenuExports.h"
#include "particleman.h"
#include "IParticleMan_Active.h"
#include "CMiniMem.h"
#include "environment.h"

#include "cl_util.h"

cl_enginefunc_t gEngfuncs = { };
render_api_t gRenderAPI = { };
Expand All @@ -40,6 +45,7 @@ int g_iXash = 0; // indicates a buildnum
int g_iMobileAPIVersion = 0;

IGameMenuExports *g_pMenu = nullptr;
IParticleMan *g_pParticleMan = NULL;

static IGameMenuExports *GetNativeMenuExports( void )
{
Expand Down Expand Up @@ -68,6 +74,8 @@ void InitInput (void);
void Game_HookEvents( void );
void IN_Commands( void );
void Input_Shutdown (void);
void CL_LoadParticleMan();
void CL_UnloadParticleMan();

/*
==========================
Expand All @@ -84,11 +92,13 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
gEngfuncs = *pEnginefuncs;

// Register cvar to allow using old touch menus (1 = use old cfg-based menus)

CVAR_CREATE("cl_oldtouchmenus", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE);

sscanf( CVAR_GET_STRING( "host_ver" ), "%d", &g_iXash );

Game_HookEvents();
CL_LoadParticleMan();

return 1;
}
Expand All @@ -105,6 +115,17 @@ void DLLEXPORT HUD_Shutdown( void )
gHUD.Shutdown();
Input_Shutdown();
Localize_Free();
g_Environment.Clear();
if (g_pParticleMan)
{
CL_UnloadParticleMan();
}
auto miniMem = CMiniMem::Instance();
if (miniMem)
{
miniMem->Reset();
miniMem->Shutdown();
}
}


Expand Down Expand Up @@ -217,7 +238,12 @@ int DLLEXPORT HUD_VidInit( void )

isLoaded = true;

//VGui_Startup();
if (g_pParticleMan)
{
g_pParticleMan->ResetParticles();
g_Environment.Reset();
g_Environment.RestoreWeather();
}

return 1;
}
Expand Down Expand Up @@ -468,6 +494,24 @@ extern "C" int DLLEXPORT HUD_GetPlayerTeam(int iplayer)
return 0;
}

void CL_UnloadParticleMan()
{
if (g_pParticleMan)
{
delete g_pParticleMan;
g_pParticleMan = NULL;
}
}

void CL_LoadParticleMan()
{
g_pParticleMan = new IParticleMan_Active();
if (g_pParticleMan)
{
g_pParticleMan->SetUp(&gEngfuncs);
}
}

#include "APIProxy.h"

cldll_func_dst_t *g_pcldstAddrs;
Expand Down
23 changes: 23 additions & 0 deletions cl_dll/cl_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,31 @@ inline bool UseOldTouchMenusEnabled()
inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); }
inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); }

#ifdef __cplusplus
#include <type_traits>
#ifndef CL_UTIL_MAX_MIN_DEFINED
#define CL_UTIL_MAX_MIN_DEFINED
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
template<typename T, typename U>
inline auto max(T a, U b) -> typename std::decay<decltype((a > b) ? a : b)>::type { return (a > b) ? a : b; }
template<typename T, typename U>
inline auto min(T a, U b) -> typename std::decay<decltype((a < b) ? a : b)>::type { return (a < b) ? a : b; }
#endif
#else
#ifdef max
#undef max
#endif
#define max(a, b) (((a) > (b)) ? (a) : (b))
#ifdef min
#undef min
#endif
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#if !defined(__APPLE__) && !defined(_WIN32)
#define fabs(x) ((x) > 0 ? (x) : 0 - (x))
#endif
Expand Down
9 changes: 6 additions & 3 deletions cl_dll/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "eventscripts.h"
#include "com_weapons.h"
#include "ev_hldm.h"
#include "particleman.h"
#include "particleman_internal.h"

extern vec3_t v_origin;

Expand Down Expand Up @@ -397,12 +399,13 @@ void DLLEXPORT HUD_TempEntUpdate (
TEMPENTITY *pTemp, *pnext, *pprev;
float gravity, gravitySlow, life, fastFreq;

// g_flGravity = cl_gravity;
g_flGravity = cl_gravity;

Vector vAngles;
gEngfuncs.GetViewAngles( (float*)vAngles );

/*
if ( g_pParticleMan )
g_pParticleMan->SetVariables( cl_gravity, vAngles );
*/

// Nothing to simulate
if ( !*ppTempEntActive )
Expand Down
Loading
Loading