Skip to content

Commit

Permalink
xrGame/GamePersistent.cpp: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jul 8, 2018
1 parent ce36942 commit 9bf69e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/xrGame/GamePersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@
#include "ai_debug.h"
#endif // _EDITOR

//static void * ode_alloc (size_t size) { return xr_malloc(size); }
//static void * ode_realloc (void *ptr, size_t oldsize, size_t newsize) { return xr_realloc(ptr,newsize); }
//static void ode_free (void *ptr, size_t size) { return xr_free(ptr); }

// temporary hack to get rid of the Microsoft-specific "__super"
using super = IGame_Persistent;

CGamePersistent::CGamePersistent(void)
{
Expand All @@ -74,12 +69,7 @@ CGamePersistent::CGamePersistent(void)
m_frame_counter = 0;
m_last_stats_frame = u32(-2);
#endif
//
// dSetAllocHandler (ode_alloc );
// dSetReallocHandler (ode_realloc );
// dSetFreeHandler (ode_free );

//
BOOL bDemoMode = (0 != strstr(Core.Params, "-demomode "));
if (bDemoMode)
{
Expand Down Expand Up @@ -115,7 +105,7 @@ CGamePersistent::~CGamePersistent(void)
void CGamePersistent::PreStart(LPCSTR op)
{
pApp->SetLoadingScreen(new UILoadingScreen());
super::PreStart(op);
inherited::PreStart(op);
}

void CGamePersistent::RegisterModel(IRenderVisual* V)
Expand Down Expand Up @@ -158,7 +148,7 @@ void CGamePersistent::OnAppStart()
// load game materials
GMLib.Load();
init_game_globals();
super::OnAppStart();
inherited::OnAppStart();
m_pUI_core = new ui_core();
m_pMainMenu = new CMainMenu();
}
Expand All @@ -171,20 +161,20 @@ void CGamePersistent::OnAppEnd()
xr_delete(m_pMainMenu);
xr_delete(m_pUI_core);

super::OnAppEnd();
inherited::OnAppEnd();

clean_game_globals();

GMLib.Unload();
}

void CGamePersistent::Start(LPCSTR op) { super::Start(op); }
void CGamePersistent::Start(LPCSTR op) { inherited::Start(op); }
void CGamePersistent::Disconnect()
{
// destroy ambient particles
CParticlesObject::Destroy(ambient_particles);

super::Disconnect();
inherited::Disconnect();
// stop all played emitters
GEnv.Sound->stop_emitters();
m_game_params.m_e_game_type = eGameIDNoGame;
Expand All @@ -194,7 +184,7 @@ void CGamePersistent::Disconnect()

void CGamePersistent::OnGameStart()
{
super::OnGameStart();
inherited::OnGameStart();
UpdateGameType();
}

Expand All @@ -215,7 +205,7 @@ LPCSTR GameTypeToString(EGameIDs gt, bool bShort)

void CGamePersistent::UpdateGameType()
{
super::UpdateGameType();
inherited::UpdateGameType();

m_game_params.m_e_game_type = ParseStringToGameType(m_game_params.m_game_type);

Expand All @@ -227,7 +217,7 @@ void CGamePersistent::UpdateGameType()

void CGamePersistent::OnGameEnd()
{
super::OnGameEnd();
inherited::OnGameEnd();

xr_delete(g_stalker_animation_data_storage);
xr_delete(g_stalker_velocity_holder);
Expand Down Expand Up @@ -642,7 +632,7 @@ void CGamePersistent::OnFrame()
}
#endif // MASTER_GOLD
}
super::OnFrame();
inherited::OnFrame();

if (!Device.Paused())
{
Expand Down
4 changes: 4 additions & 0 deletions src/xrGame/GamePersistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class ui_core;

class CGamePersistent : public IGame_Persistent, public IEventReceiver
{
protected:
using inherited = IGame_Persistent;

private:
// ambient particles
CParticlesObject* ambient_particles;
u32 ambient_sound_next_time[20]; // max snd channels
Expand Down

0 comments on commit 9bf69e5

Please sign in to comment.