mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 18:59:09 +00:00
Merge pull request #411 from Hoikas/plclient-cleaning
Some plClient Cleanups
This commit is contained in:
@ -187,7 +187,6 @@ plClient::plClient()
|
|||||||
fLinkEffectsMgr(nil),
|
fLinkEffectsMgr(nil),
|
||||||
fProgressBar(nil),
|
fProgressBar(nil),
|
||||||
fGameGUIMgr(nil),
|
fGameGUIMgr(nil),
|
||||||
fKIGUIGlue(nil),
|
|
||||||
fWindowActive(false),
|
fWindowActive(false),
|
||||||
fAnimDebugList(nil),
|
fAnimDebugList(nil),
|
||||||
fClampCap(-1),
|
fClampCap(-1),
|
||||||
@ -252,6 +251,15 @@ plClient::~plClient()
|
|||||||
#include "plGImage/plAVIWriter.h"
|
#include "plGImage/plAVIWriter.h"
|
||||||
#include "pfCharacter/pfMarkerMgr.h"
|
#include "pfCharacter/pfMarkerMgr.h"
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static void IUnRegisterAs(T*& ko, plFixedKeyId id)
|
||||||
|
{
|
||||||
|
if (ko) {
|
||||||
|
ko->UnRegisterAs(id);
|
||||||
|
ko = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool plClient::Shutdown()
|
bool plClient::Shutdown()
|
||||||
{
|
{
|
||||||
plSynchEnabler ps(false); // disable dirty state tracking during shutdown
|
plSynchEnabler ps(false); // disable dirty state tracking during shutdown
|
||||||
@ -297,31 +305,13 @@ bool plClient::Shutdown()
|
|||||||
// Take down our GUI control generator
|
// Take down our GUI control generator
|
||||||
pfGUICtrlGenerator::Instance().Shutdown();
|
pfGUICtrlGenerator::Instance().Shutdown();
|
||||||
|
|
||||||
if (plNetClientMgr::GetInstance())
|
if (plNetClientMgr* nc = plNetClientMgr::GetInstance())
|
||||||
{
|
nc->Shutdown();
|
||||||
plNetClientMgr::GetInstance()->Shutdown();
|
if (plAgeLoader* al = plAgeLoader::GetInstance())
|
||||||
plNetClientMgr::GetInstance()->UnRegisterAs(kNetClientMgr_KEY); // deletes NetClientMgr instance
|
al->Shutdown();
|
||||||
plNetClientMgr::SetInstance(nil);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plAgeLoader::GetInstance())
|
|
||||||
{
|
|
||||||
plAgeLoader::GetInstance()->Shutdown();
|
|
||||||
plAgeLoader::GetInstance()->UnRegisterAs(kAgeLoader_KEY); // deletes instance
|
|
||||||
plAgeLoader::SetInstance(nil);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fInputManager)
|
IUnRegisterAs(fInputManager, kInput_KEY);
|
||||||
{
|
IUnRegisterAs(fGameGUIMgr, kGameGUIMgr_KEY);
|
||||||
fInputManager->UnRegisterAs(kInput_KEY);
|
|
||||||
fInputManager = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fGameGUIMgr != nil )
|
|
||||||
{
|
|
||||||
fGameGUIMgr->UnRegisterAs( kGameGUIMgr_KEY );
|
|
||||||
fGameGUIMgr = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < fRooms.Count(); i++)
|
for (int i = 0; i < fRooms.Count(); i++)
|
||||||
{
|
{
|
||||||
@ -342,56 +332,30 @@ bool plClient::Shutdown()
|
|||||||
plSimulationMgr::Shutdown();
|
plSimulationMgr::Shutdown();
|
||||||
plAvatarMgr::ShutDown();
|
plAvatarMgr::ShutDown();
|
||||||
plRelevanceMgr::DeInit();
|
plRelevanceMgr::DeInit();
|
||||||
|
|
||||||
if (fPageMgr)
|
if (fPageMgr)
|
||||||
fPageMgr->Reset();
|
fPageMgr->Reset();
|
||||||
|
|
||||||
if( fKIGUIGlue != nil )
|
IUnRegisterAs(fTransitionMgr, kTransitionMgr_KEY);
|
||||||
{
|
|
||||||
fKIGUIGlue->UnRegisterAs( kKIGUIGlue_KEY );
|
|
||||||
fKIGUIGlue = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fTransitionMgr != nil )
|
|
||||||
{
|
|
||||||
fTransitionMgr->UnRegisterAs( kTransitionMgr_KEY );
|
|
||||||
fTransitionMgr = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete fConsoleEngine;
|
delete fConsoleEngine;
|
||||||
fConsoleEngine = nil;
|
fConsoleEngine = nil;
|
||||||
|
|
||||||
if (fLinkEffectsMgr)
|
IUnRegisterAs(fLinkEffectsMgr, kLinkEffectsMgr_KEY);
|
||||||
{
|
|
||||||
fLinkEffectsMgr->UnRegisterAs( kLinkEffectsMgr_KEY);
|
|
||||||
fLinkEffectsMgr=nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
plClothingMgr::DeInit();
|
plClothingMgr::DeInit();
|
||||||
|
|
||||||
if( fFontCache != nil )
|
IUnRegisterAs(fFontCache, kFontCache_KEY);
|
||||||
{
|
|
||||||
fFontCache->UnRegisterAs( kFontCache_KEY );
|
|
||||||
fFontCache = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
pfMarkerMgr::Shutdown();
|
pfMarkerMgr::Shutdown();
|
||||||
|
|
||||||
delete fAnimDebugList;
|
delete fAnimDebugList;
|
||||||
|
|
||||||
//#ifndef PLASMA_EXTERNAL_RELEASE
|
IUnRegisterAs(fConsole, kConsoleObject_KEY);
|
||||||
if( fConsole != nil )
|
|
||||||
{
|
|
||||||
// UnRegisterAs destroys the object for us
|
|
||||||
fConsole->UnRegisterAs( kConsoleObject_KEY );
|
|
||||||
fConsole = nil;
|
|
||||||
}
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
PythonInterface::finiPython();
|
PythonInterface::finiPython();
|
||||||
|
|
||||||
if (fNewCamera)
|
IUnRegisterAs(fNewCamera, kVirtualCamera1_KEY);
|
||||||
fNewCamera->UnRegisterAs( kVirtualCamera1_KEY );
|
|
||||||
|
|
||||||
// mark the listener for death.
|
// mark the listener for death.
|
||||||
// there's no need to keep this around...
|
// there's no need to keep this around...
|
||||||
@ -408,7 +372,7 @@ bool plClient::Shutdown()
|
|||||||
|
|
||||||
if (pfLocalizationMgr::InstanceValid())
|
if (pfLocalizationMgr::InstanceValid())
|
||||||
pfLocalizationMgr::Shutdown();
|
pfLocalizationMgr::Shutdown();
|
||||||
|
|
||||||
ShutdownDLLs();
|
ShutdownDLLs();
|
||||||
|
|
||||||
plVisLOSMgr::DeInit();
|
plVisLOSMgr::DeInit();
|
||||||
@ -423,7 +387,6 @@ bool plClient::Shutdown()
|
|||||||
|
|
||||||
// This will destruct the client. Do it last.
|
// This will destruct the client. Do it last.
|
||||||
UnRegisterAs(kClient_KEY);
|
UnRegisterAs(kClient_KEY);
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1393,73 +1356,6 @@ extern bool gDataServerLocal;
|
|||||||
#include "plQuality.h"
|
#include "plQuality.h"
|
||||||
#include "plLoadMask.h"
|
#include "plLoadMask.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
class LoginNetClientCommCallback : public plNetClientComm::Callback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Op {kAuth, kCreatePlayer, kGetPlayerList, kLeave, kDeletePlayer};
|
|
||||||
|
|
||||||
LoginNetClientCommCallback() : plNetClientComm::Callback(), fNumCurrentOps(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual void OperationStarted( uint32_t context )
|
|
||||||
{
|
|
||||||
fNumCurrentOps++;
|
|
||||||
}
|
|
||||||
virtual void OperationComplete( uint32_t context, int resultCode )
|
|
||||||
{
|
|
||||||
if (context == kAuth)
|
|
||||||
{
|
|
||||||
if (hsSucceeded(resultCode))
|
|
||||||
{
|
|
||||||
plClient::GetInstance()->fAuthPassed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (context == kGetPlayerList)
|
|
||||||
{
|
|
||||||
if ( hsSucceeded( resultCode ) )
|
|
||||||
{
|
|
||||||
uint32_t numPlayers = fCbArgs.GetInt(0);
|
|
||||||
uint32_t pId = -1;
|
|
||||||
std::string pName;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < numPlayers; i++)
|
|
||||||
{
|
|
||||||
pId = fCbArgs.GetInt((uint16_t)(i*3+1));
|
|
||||||
pName = fCbArgs.GetString((uint16_t)(i*3+2));
|
|
||||||
|
|
||||||
if (pName == plClient::GetInstance()->fUsername)
|
|
||||||
{
|
|
||||||
plClient::GetInstance()->fPlayerID = pId;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (context == kCreatePlayer)
|
|
||||||
{
|
|
||||||
if (hsSucceeded(resultCode))
|
|
||||||
plClient::GetInstance()->fPlayerID = fCbArgs.GetInt(0);
|
|
||||||
}
|
|
||||||
else if (context == kDeletePlayer)
|
|
||||||
{
|
|
||||||
if (hsSucceeded(resultCode))
|
|
||||||
plClient::GetInstance()->fPlayerID = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fNumCurrentOps--;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsActive()
|
|
||||||
{
|
|
||||||
return fNumCurrentOps > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int fNumCurrentOps;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool plClient::StartInit()
|
bool plClient::StartInit()
|
||||||
{
|
{
|
||||||
@ -1816,11 +1712,6 @@ bool plClient::IUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool plClient::IDrawProgress() {
|
bool plClient::IDrawProgress() {
|
||||||
// HACK: Don't draw while we're caching some room loads, otherwise the
|
|
||||||
// progress bar will jump around while we're calculating the size
|
|
||||||
if (fHoldLoadRequests)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Reset our stats
|
// Reset our stats
|
||||||
plProfileManager::Instance().BeginFrame();
|
plProfileManager::Instance().BeginFrame();
|
||||||
|
|
||||||
@ -1853,7 +1744,7 @@ bool plClient::IDraw()
|
|||||||
// tends to cause a device reload each frame.
|
// tends to cause a device reload each frame.
|
||||||
if (fDone)
|
if (fDone)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (plProgressMgr::GetInstance()->IsActive())
|
if (plProgressMgr::GetInstance()->IsActive())
|
||||||
return IDrawProgress();
|
return IDrawProgress();
|
||||||
|
|
||||||
|
@ -123,8 +123,6 @@ protected:
|
|||||||
pfConsoleEngine* fConsoleEngine;
|
pfConsoleEngine* fConsoleEngine;
|
||||||
pfConsole* fConsole;
|
pfConsole* fConsole;
|
||||||
|
|
||||||
pfKI *fKIGUIGlue;
|
|
||||||
|
|
||||||
bool fDone;
|
bool fDone;
|
||||||
bool fWindowActive;
|
bool fWindowActive;
|
||||||
|
|
||||||
@ -296,15 +294,6 @@ public:
|
|||||||
void IWriteDefaultGraphicsSettings(const plFileName& destFile);
|
void IWriteDefaultGraphicsSettings(const plFileName& destFile);
|
||||||
|
|
||||||
plAnimDebugList *fAnimDebugList;
|
plAnimDebugList *fAnimDebugList;
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::string fUsername;
|
|
||||||
std::string fPasswordDigest;
|
|
||||||
std::string fServer;
|
|
||||||
int fPlayerID;
|
|
||||||
bool fRecreatePlayer;
|
|
||||||
bool fAuthPassed;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // plClient_inc
|
#endif // plClient_inc
|
||||||
|
@ -110,6 +110,8 @@ plAgeLoader::~plAgeLoader()
|
|||||||
void plAgeLoader::Shutdown()
|
void plAgeLoader::Shutdown()
|
||||||
{
|
{
|
||||||
plResPatcher::GetInstance()->Shutdown();
|
plResPatcher::GetInstance()->Shutdown();
|
||||||
|
UnRegisterAs(kAgeLoader_KEY);
|
||||||
|
SetInstance(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void plAgeLoader::Init()
|
void plAgeLoader::Init()
|
||||||
|
@ -199,6 +199,10 @@ void plNetClientMgr::Shutdown()
|
|||||||
IRemoveCloneRoom();
|
IRemoveCloneRoom();
|
||||||
|
|
||||||
VaultDestroy();
|
VaultDestroy();
|
||||||
|
|
||||||
|
// commit hara-kiri
|
||||||
|
UnRegisterAs(kNetClientMgr_KEY);
|
||||||
|
SetInstance(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user