From af1db55f678ba2014fc7f857b6dd580a09121cb4 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 12 Jun 2012 17:50:45 -0400 Subject: [PATCH 1/3] Mute the linking sound on client kicks This commit is really quite awesome in that you can now propagate any plLinkToAgeMsg that will mute the link out, link in sounds, or both. Some garbage fields were repurposed for this functionality. The messages were passed correctly on Cyan's MOULa server. Conflicts: Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp --- .../PubUtilLib/plMessage/plLinkToAgeMsg.cpp | 38 +++++++---- .../PubUtilLib/plMessage/plLinkToAgeMsg.h | 22 ++++++- .../plNetClient/plLinkEffectsMgr.cpp | 3 +- .../plNetClient/plNetCliAgeJoiner.cpp | 40 +++++++++++- .../plNetClient/plNetCliAgeJoiner.h | 1 + .../plNetClient/plNetCliAgeLeaver.cpp | 14 ++++- .../plNetClient/plNetCliAgeLeaver.h | 1 + .../PubUtilLib/plNetClient/plNetClientMgr.cpp | 63 ------------------- .../PubUtilLib/plNetClient/plNetClientMgr.h | 3 - .../plNetClient/plNetLinkingMgr.cpp | 6 ++ 10 files changed, 109 insertions(+), 82 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp index 098360ae..13fecb4b 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.cpp @@ -53,11 +53,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // // plLinkToAgeMsg -plLinkToAgeMsg::plLinkToAgeMsg() : fLinkInAnimName(nil) +plLinkToAgeMsg::plLinkToAgeMsg() : fLinkInAnimName(nil), fFlags(0) { } -plLinkToAgeMsg::plLinkToAgeMsg( const plAgeLinkStruct * link ) : fLinkInAnimName(nil) +plLinkToAgeMsg::plLinkToAgeMsg( const plAgeLinkStruct * link ) : fLinkInAnimName(nil), fFlags(0) { fAgeLink.CopyFrom( link ); } @@ -67,12 +67,22 @@ plLinkToAgeMsg::~plLinkToAgeMsg() delete [] fLinkInAnimName; } -// StreamVersion needed for back compatibility. -uint8_t plLinkToAgeInfo_StreamVersion = 0; +void plLinkToAgeMsg::PlayLinkSfx(bool linkIn, bool linkOut) +{ + if (linkIn) + fFlags &= ~kMuteLinkInSfx; + else + fFlags |= kMuteLinkInSfx; + if (linkOut) + fFlags &= ~kMuteLinkOutSfx; + else + fFlags |= kMuteLinkOutSfx; +} + void plLinkToAgeMsg::Read(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgRead( stream, mgr ); - uint8_t ltaVer = stream->ReadByte(); + fFlags = stream->ReadByte(); fAgeLink.Read( stream, mgr ); fLinkInAnimName = stream->ReadSafeString(); } @@ -80,7 +90,7 @@ void plLinkToAgeMsg::Read(hsStream* stream, hsResMgr* mgr) void plLinkToAgeMsg::Write(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgWrite( stream, mgr ); - stream->WriteByte( plLinkToAgeInfo_StreamVersion ); + stream->WriteByte( fFlags ); fAgeLink.Write( stream, mgr ); stream->WriteSafeString(fLinkInAnimName); } @@ -185,6 +195,14 @@ plLinkEffectsTriggerMsg::~plLinkEffectsTriggerMsg() { } +void plLinkEffectsTriggerMsg::MuteLinkSfx(bool mute) +{ + if (mute) + fFlags |= kMuteLinkSfx; + else + fFlags &= ~kMuteLinkSfx; +} + void plLinkEffectsTriggerMsg::Read(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgRead( stream, mgr ); @@ -192,11 +210,7 @@ void plLinkEffectsTriggerMsg::Read(hsStream* stream, hsResMgr* mgr) fInvisLevel = stream->ReadLE32(); fLeavingAge = stream->ReadBool(); fLinkKey = mgr->ReadKey(stream); - - // This variable is for internal use only. Still read/written for backwards compatability. - fEffects = stream->ReadLE32(); - fEffects = 0; - + fFlags = stream->ReadLE32(); fLinkInAnimKey = mgr->ReadKey(stream); } @@ -207,7 +221,7 @@ void plLinkEffectsTriggerMsg::Write(hsStream* stream, hsResMgr* mgr) stream->WriteLE32(fInvisLevel); stream->WriteBool(fLeavingAge); mgr->WriteKey(stream, fLinkKey); - stream->WriteLE32(fEffects); + stream->WriteLE32(fFlags); mgr->WriteKey(stream, fLinkInAnimKey); } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h index 079e30fe..13592be6 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h +++ b/Sources/Plasma/PubUtilLib/plMessage/plLinkToAgeMsg.h @@ -58,6 +58,13 @@ class hsResMgr; class plLinkToAgeMsg : public plMessage { + enum + { + kMuteLinkOutSfx = 1<<0, + kMuteLinkInSfx = 1<<1, + }; + + uint8_t fFlags; plAgeLinkStruct fAgeLink; char* fLinkInAnimName; @@ -72,6 +79,10 @@ public: plAgeLinkStruct * GetAgeLink() { return &fAgeLink; } const plAgeLinkStruct * GetAgeLink() const { return &fAgeLink; } + void PlayLinkSfx(bool linkIn = true, bool linkOut = true); + bool PlayLinkInSfx() const { return (fFlags & kMuteLinkInSfx) == 0; } + bool PlayLinkOutSfx() const { return (fFlags & kMuteLinkOutSfx) == 0; } + const char * GetLinkInAnimName() { return fLinkInAnimName; } void SetLinkInAnimName(const char* name) { delete [] fLinkInAnimName; fLinkInAnimName = hsStrcpy(name); } @@ -117,12 +128,18 @@ public: class plLinkEffectsTriggerMsg : public plMessage { protected: + enum + { + kMuteLinkSfx = 1<<0 + }; + bool fLeavingAge; plKey fLinkKey; plKey fLinkInAnimKey; int fInvisLevel; + int fFlags; public: - plLinkEffectsTriggerMsg() : fLeavingAge(true), fLinkKey(nil), fLinkInAnimKey(nil), fEffects(0), fInvisLevel(0) { } + plLinkEffectsTriggerMsg() : fLeavingAge(true), fLinkKey(nil), fLinkInAnimKey(nil), fEffects(0), fInvisLevel(0), fFlags(0) { } ~plLinkEffectsTriggerMsg(); CLASSNAME_REGISTER( plLinkEffectsTriggerMsg ); @@ -139,6 +156,9 @@ public: void SetLinkInAnimKey(plKey &key); plKey GetLinkInAnimKey() { return fLinkInAnimKey; } + + void MuteLinkSfx(bool mute); + bool MuteLinkSfx() const { return (fFlags & kMuteLinkSfx) != 0; } void Read(hsStream* stream, hsResMgr* mgr); void Write(hsStream* stream, hsResMgr* mgr); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp index 7e979bf5..6cab6095 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp @@ -365,6 +365,7 @@ bool plLinkEffectsMgr::MsgReceive(plMessage *msg) BCMsg->fLinkKey = linkKey; BCMsg->SetLinkFlag(plLinkEffectBCMsg::kLeavingAge, pTriggerMsg->IsLeavingAge()); BCMsg->SetLinkFlag(plLinkEffectBCMsg::kSendCallback, true); + BCMsg->SetLinkFlag(plLinkEffectBCMsg::kMute, pTriggerMsg->MuteLinkSfx()); // Check if you have a Yeesha book, and mute sound if you don't. // 'CleftSolved' gets set when you click on the linking panel in the cleft, @@ -393,7 +394,7 @@ bool plLinkEffectsMgr::MsgReceive(plMessage *msg) if ( linkToACA || linkFromACA || linkToStartup || linkFromStartup || linkToFissureDrop || linkToDsntFromShell) { BCMsg->SetLinkFlag(plLinkEffectBCMsg::kMute); - } + } } } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp index 13f5c20f..8288317f 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp @@ -50,6 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetCliAgeJoiner.h" #include "plNetClientMgr.h" #include "plNetLinkingMgr.h" +#include "plNetObjectDebugger.h" #include "pnSceneObject/plSceneObject.h" #include "pnSceneObject/plCoordinateInterface.h" @@ -59,6 +60,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plNetClientComm/plNetClientComm.h" #include "plAgeLoader/plAgeLoader.h" +#include "plAvatar/plArmatureMod.h" #include "plAvatar/plAvatarMgr.h" #include "plVault/plVault.h" @@ -100,11 +102,13 @@ struct plNCAgeJoiner { FNCAgeJoinerCallback callback; void * userState; bool complete; + bool muteLinkSfx; plOperationProgress* progressBar; plNCAgeJoiner ( const NetCommAge & age, + bool muteSfx, FNCAgeJoinerCallback callback, void * userState ); @@ -157,10 +161,12 @@ void AgeVaultDownloadCallback ( //============================================================================ plNCAgeJoiner::plNCAgeJoiner ( const NetCommAge & age, + bool muteSfx, FNCAgeJoinerCallback callback, void * userState ) : nextOp(kNoOp) , age(age) +, muteLinkSfx(muteSfx) , callback(callback) , userState(userState) , complete(false) @@ -354,7 +360,7 @@ void plNCAgeJoiner::ExecNextOp () { nc->SetFlagsBit(plNetClientApp::kPlayingGame); nc->SetFlagsBit(plNetClientApp::kNeedToSendInitialAgeStateLoadedMsg); plAgeLoader::GetInstance()->NotifyAgeLoaded(true); - Complete(true, "Age joined"); + nextOp = kNoOp; } break; @@ -448,6 +454,36 @@ bool plNCAgeJoiner::MsgReceive (plMessage * msg) { nextOp = kDestroyProgressBar; return true; } + + //======================================================================== + // Done loading all states. Time to link in! + //======================================================================== + plInitialAgeStateLoadedMsg * stateMsg = plInitialAgeStateLoadedMsg::ConvertNoRef(msg); + if(stateMsg) { + plNetObjectDebugger::GetInstance()->LogMsg("OnServerInitComplete"); + nc->SetFlagsBit(plNetClientApp::kLoadingInitialAgeState, false); + + const plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); + + plLinkEffectsTriggerMsg* lem = new plLinkEffectsTriggerMsg(); + lem->SetLeavingAge(false); // linking in + lem->SetLinkKey(nc->GetLocalPlayerKey()); + plKey animKey = avMod->GetLinkInAnimKey(); + lem->SetLinkInAnimKey(animKey); + + // indicate if we are invisible + if (avMod && avMod->IsInStealthMode() && avMod->GetTarget(0)) + lem->SetInvisLevel(avMod->GetStealthLevel()); + + lem->SetBCastFlag(plMessage::kNetPropagate); + lem->MuteLinkSfx(muteLinkSfx); + lem->AddReceiver(hsgResMgr::ResMgr()->FindKey(plUoid(kLinkEffectsMgr_KEY))); + lem->AddReceiver(hsgResMgr::ResMgr()->FindKey(plUoid(kClient_KEY))); + lem->Send(); + + Complete(true, "Age joined"); + return true; + } return false; } @@ -469,6 +505,7 @@ void plNCAgeJoiner::Update () { void NCAgeJoinerCreate ( plNCAgeJoiner ** pjoiner, const NetCommAge & age, + bool muteSfx, FNCAgeJoinerCallback callback, void * userState ) { @@ -478,6 +515,7 @@ void NCAgeJoinerCreate ( plNCAgeJoiner * joiner; *pjoiner = joiner = new plNCAgeJoiner( age, + muteSfx, callback, userState ); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.h index 1369c3a5..fa2266e9 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.h @@ -85,6 +85,7 @@ typedef void (* FNCAgeJoinerCallback)( void NCAgeJoinerCreate ( plNCAgeJoiner ** joiner, const NetCommAge & age, + bool muteSfx, FNCAgeJoinerCallback callback, void * userState ); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp index 843d74c7..5cc98ed7 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.cpp @@ -81,12 +81,14 @@ struct plNCAgeLeaver { NextOp nextOp; bool quitting; + bool muteLinkSfx; bool complete; FNCAgeLeaverCallback callback; void * userState; plNCAgeLeaver ( bool quitting, + bool muteSfx, FNCAgeLeaverCallback callback, void * userState ); @@ -109,10 +111,12 @@ struct plNCAgeLeaver { //============================================================================ plNCAgeLeaver::plNCAgeLeaver ( bool quitting, + bool muteSfx, FNCAgeLeaverCallback callback, void * userState ) : nextOp(kNoOp) , quitting(quitting) +, muteLinkSfx(muteSfx) , complete(false) , callback(callback) , userState(userState) @@ -200,7 +204,13 @@ void plNCAgeLeaver::ExecNextOp () { //==================================================================== case kLinkOutFX: { - nc->StartLinkOutFX(); + plLinkEffectsTriggerMsg* lem = new plLinkEffectsTriggerMsg(); + lem->MuteLinkSfx(muteLinkSfx); + lem->SetLeavingAge(true); + lem->SetLinkKey(nc->GetLocalPlayerKey()); + lem->SetBCastFlag(plMessage::kNetPropagate); + lem->SetBCastFlag(plMessage::kNetForce); // Necessary? + lem->Send(hsgResMgr::ResMgr()->FindKey(plUoid(kLinkEffectsMgr_KEY))); } break; @@ -264,6 +274,7 @@ void plNCAgeLeaver::Update () { void NCAgeLeaverCreate ( plNCAgeLeaver ** pleaver, bool quitting, + bool muteSfx, FNCAgeLeaverCallback callback, void * userState ) { @@ -273,6 +284,7 @@ void NCAgeLeaverCreate ( plNCAgeLeaver * leaver; *pleaver = leaver = new plNCAgeLeaver( quitting, + muteSfx, callback, userState ); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.h index 9e4c9319..1533dfd3 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeLeaver.h @@ -85,6 +85,7 @@ typedef void (* FNCAgeLeaverCallback)( void NCAgeLeaverCreate ( plNCAgeLeaver ** leaver, bool quitting, + bool muteSfx, FNCAgeLeaverCallback callback, void * userState ); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index 649fbb2b..d3d8f82b 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -437,55 +437,6 @@ void plNetClientMgr::IUnloadNPCs() hsAssert(fNPCKeys.empty(), "Still npcs left when linking out"); } -// -// begin linking out sounds and gfx -// -void plNetClientMgr::StartLinkOutFX() -{ - // send msg to trigger link out effect - if (fLocalPlayerKey) - { - plNetLinkingMgr * lm = plNetLinkingMgr::GetInstance(); - - plLinkEffectsTriggerMsg* lem = new plLinkEffectsTriggerMsg(); - lem->SetLeavingAge(true); - lem->SetLinkKey(fLocalPlayerKey); - lem->SetBCastFlag(plMessage::kNetPropagate); - lem->SetBCastFlag(plMessage::kNetForce); // Necessary? - lem->AddReceiver(hsgResMgr::ResMgr()->FindKey(plUoid(kLinkEffectsMgr_KEY))); - lem->Send(); - } -} - -// -// beging linking in sounds snd gfx -// -void plNetClientMgr::StartLinkInFX() -{ - if (fLocalPlayerKey) - { - const plArmatureMod *avMod = plAvatarMgr::GetInstance()->GetLocalAvatar(); - - plLinkEffectsTriggerMsg* lem = new plLinkEffectsTriggerMsg(); - lem->SetLeavingAge(false); // linking in - lem->SetLinkKey(fLocalPlayerKey); - plKey animKey = avMod->GetLinkInAnimKey(); - lem->SetLinkInAnimKey(animKey); - - // indicate if we are invisible - if (avMod && avMod->IsInStealthMode() && avMod->GetTarget(0)) - { - lem->SetInvisLevel(avMod->GetStealthLevel()); - } - - lem->SetBCastFlag(plMessage::kNetPropagate); - - lem->AddReceiver(hsgResMgr::ResMgr()->FindKey(plUoid(kLinkEffectsMgr_KEY))); - lem->AddReceiver(hsgResMgr::ResMgr()->FindKey(plUoid(kClient_KEY))); - plgDispatch::MsgSend(lem); - } -} - // // compute the difference between our clock and the server's in unified time // @@ -1056,20 +1007,6 @@ bool plNetClientMgr::MsgReceive( plMessage* msg ) return true; } - - plInitialAgeStateLoadedMsg *stateMsg = plInitialAgeStateLoadedMsg::ConvertNoRef( msg ); - if( stateMsg != nil ) - { - // done receiving the initial state of the age from the server - plNetObjectDebugger::GetInstance()->LogMsg("OnServerInitComplete"); - - // delete fProgressBar; - // fProgressBar=nil; - - SetFlagsBit(kLoadingInitialAgeState, false); - StartLinkInFX(); - } - plNetVoiceListMsg* voxList = plNetVoiceListMsg::ConvertNoRef(msg); if (voxList) { diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h index 0a32d7d1..b0e074e8 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h @@ -249,9 +249,6 @@ public: static plNetClientMgr* GetInstance() { return plNetClientMgr::ConvertNoRef(fInstance); } - void StartLinkOutFX(); - void StartLinkInFX(); - bool MsgReceive(plMessage* msg); void Shutdown(); int Init(); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index 7a767f5d..2360d3d6 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -100,6 +100,7 @@ struct NlmOpWaitOp : NlmOp { struct NlmJoinAgeOp : NlmOp { NetCommAge age; + bool muteSfx; NlmJoinAgeOp () : NlmOp(kNlmOpJoinAgeOp) { } @@ -107,6 +108,7 @@ struct NlmJoinAgeOp : NlmOp { struct NlmLeaveAgeOp : NlmOp { bool quitting; + bool muteSfx; NlmLeaveAgeOp () : NlmOp(kNlmOpLeaveAgeOp), quitting(false) { } @@ -237,6 +239,7 @@ void plNetLinkingMgr::ExecNextOp () { NCAgeJoinerCreate( &s_ageJoiner, joinAgeOp->age, + joinAgeOp->muteSfx, NCAgeJoinerCallback, waitOp ); @@ -258,6 +261,7 @@ void plNetLinkingMgr::ExecNextOp () { NCAgeLeaverCreate( &s_ageLeaver, leaveAgeOp->quitting, + leaveAgeOp->muteSfx, NCAgeLeaverCallback, waitOp ); @@ -419,12 +423,14 @@ void plNetLinkingMgr::IDoLink(plLinkToAgeMsg* msg) } // Queue leave op NlmLeaveAgeOp * leaveAgeOp = new NlmLeaveAgeOp; + leaveAgeOp->muteSfx = !msg->PlayLinkOutSfx(); QueueOp(leaveAgeOp); } // Queue join op NlmJoinAgeOp * joinAgeOp = new NlmJoinAgeOp; joinAgeOp->age.ageInstId = *GetAgeLink()->GetAgeInfo()->GetAgeInstanceGuid(); + joinAgeOp->muteSfx = !msg->PlayLinkInSfx(); StrCopy( joinAgeOp->age.ageDatasetName, GetAgeLink()->GetAgeInfo()->GetAgeFilename(), From 07ddec2f791199585d351db269bacab773517c8e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 25 Jan 2013 22:22:49 -0500 Subject: [PATCH 2/3] Expose to python --- .../FeatureLib/pfPython/pyNetLinkingMgr.cpp | 10 ++++- .../FeatureLib/pfPython/pyNetLinkingMgr.h | 2 +- .../pfPython/pyNetLinkingMgrGlue.cpp | 10 +++-- .../plNetClient/plNetLinkingMgr.cpp | 40 ++++++++++--------- .../PubUtilLib/plNetClient/plNetLinkingMgr.h | 35 ++++++++++++---- 5 files changed, 63 insertions(+), 34 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp index f71c5b40..c8474177 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp @@ -65,9 +65,15 @@ void pyNetLinkingMgr::SetEnabled( bool b ) const plNetLinkingMgr::GetInstance()->SetEnabled( b ); } -void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim ) +void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx ) { - plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim ); + uint32_t sfx = plNetLinkingMgr::kPlayNone; + if (linkInSfx) + hsSetBits(sfx, plNetLinkingMgr::kPlayLinkIn); + if (linkOutSfx) + hsSetBits(sfx, plNetLinkingMgr::kPlayLinkOut); + + plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim, (plNetLinkingMgr::LinkSfx)sfx ); } void pyNetLinkingMgr::LinkToMyPersonalAge() diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h index 39dec4e3..c49f1aa7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.h @@ -80,7 +80,7 @@ public: void SetEnabled( bool b ) const; // Link to a public instance. PLS will load balance. - void LinkToAge( pyAgeLinkStruct & link, const char* linkAnim ); + void LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx ); // Link to my Personal Age void LinkToMyPersonalAge(); // link to my personal age with the YeehsaBook diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgrGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgrGlue.cpp index 775e3370..6a2ffd5a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgrGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgrGlue.cpp @@ -79,11 +79,13 @@ PYTHON_METHOD_DEFINITION(ptNetLinkingMgr, setEnabled, args) PYTHON_RETURN_NONE; } -PYTHON_METHOD_DEFINITION(ptNetLinkingMgr, linkToAge, args) +PYTHON_METHOD_DEFINITION_WKEY(ptNetLinkingMgr, linkToAge, args, kwargs) { + char* kwlist[] = { "ageLink", "anim", "linkInSfx", "linkOutSfx", nullptr }; PyObject* ageLinkObj = NULL; char* linkAnim = NULL; - if (!PyArg_ParseTuple(args, "O|s", &ageLinkObj, &linkAnim)) + bool linkInSfx, linkOutSfx = true; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|sbb", kwlist, &ageLinkObj, &linkAnim, &linkInSfx, &linkOutSfx)) { PyErr_SetString(PyExc_TypeError, "linkToAge expects a ptAgeLinkStruct and an optional link anim name"); PYTHON_RETURN_ERROR; @@ -94,7 +96,7 @@ PYTHON_METHOD_DEFINITION(ptNetLinkingMgr, linkToAge, args) PYTHON_RETURN_ERROR; } pyAgeLinkStruct* ageLink = pyAgeLinkStruct::ConvertFrom(ageLinkObj); - self->fThis->LinkToAge(*ageLink, linkAnim); + self->fThis->LinkToAge(*ageLink, linkAnim, linkInSfx, linkOutSfx); PYTHON_RETURN_NONE; } @@ -158,7 +160,7 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptNetLinkingMgr, getPrevAgeLink) PYTHON_START_METHODS_TABLE(ptNetLinkingMgr) PYTHON_METHOD_NOARGS(ptNetLinkingMgr, isEnabled, "True if linking is enabled."), PYTHON_METHOD(ptNetLinkingMgr, setEnabled, "Params: enable\nEnable/Disable linking."), - PYTHON_METHOD(ptNetLinkingMgr, linkToAge, "Params: ageLink, linkAnim\nLinks to ageLink (ptAgeLinkStruct, string)"), + PYTHON_METHOD_WKEY(ptNetLinkingMgr, linkToAge, "Params: ageLink, linkAnim\nLinks to ageLink (ptAgeLinkStruct, string)"), PYTHON_BASIC_METHOD(ptNetLinkingMgr, linkToMyPersonalAge, "Link to my Personal Age"), PYTHON_BASIC_METHOD(ptNetLinkingMgr, linkToMyPersonalAgeWithYeeshaBook, "Link to my Personal Age with the YeeshaBook"), PYTHON_BASIC_METHOD(ptNetLinkingMgr, linkToMyNeighborhoodAge, "Link to my Neighborhood Age"), diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index 2360d3d6..69559f4a 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -547,12 +547,14 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg) //////////////////////////////////////////////////////////////////// -bool plNetLinkingMgr::IDispatchMsg( plMessage * msg, uint32_t playerID ) +bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t playerID ) { plNetClientMgr * nc = plNetClientMgr::GetInstance(); - msg->AddReceiver( plNetClientMgr::GetInstance()->GetKey() ); + plLinkToAgeMsg* linkToAge = plLinkToAgeMsg::ConvertNoRef(msg); + if (linkToAge) + linkToAge->PlayLinkSfx(hsTestBits(sfx, kPlayLinkIn), hsTestBits(sfx, kPlayLinkOut)); if ( playerID!=kInvalidPlayerID && playerID!=nc->GetPlayerID() ) { msg->SetBCastFlag( plMessage::kNetAllowInterAge ); @@ -563,17 +565,17 @@ bool plNetLinkingMgr::IDispatchMsg( plMessage * msg, uint32_t playerID ) msg->AddNetReceiver( playerID ); } - return ( msg->Send()!=0 ); + return msg->Send(); } //////////////////////////////////////////////////////////////////// -void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, uint32_t playerID ) +void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, LinkSfx sfx, uint32_t playerID ) { - LinkToAge(link, nil, playerID); + LinkToAge(link, nil, sfx, playerID); } -void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, uint32_t playerID ) +void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, LinkSfx sfx, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -584,11 +586,11 @@ void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, u plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); if (linkAnim) pMsg->SetLinkInAnimName(linkAnim); - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, sfx, playerID ); } // link myself back to my last age -void plNetLinkingMgr::LinkToPrevAge( uint32_t playerID ) +void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -599,7 +601,7 @@ void plNetLinkingMgr::LinkToPrevAge( uint32_t playerID ) if (GetPrevAgeLink()->GetAgeInfo()->HasAgeFilename()) { plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( GetPrevAgeLink() ); - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, sfx, playerID ); } else { @@ -607,7 +609,7 @@ void plNetLinkingMgr::LinkToPrevAge( uint32_t playerID ) } } -void plNetLinkingMgr::LinkToMyPersonalAge( uint32_t playerID ) +void plNetLinkingMgr::LinkToMyPersonalAge( LinkSfx sfx, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -625,10 +627,10 @@ void plNetLinkingMgr::LinkToMyPersonalAge( uint32_t playerID ) link.SetSpawnPoint(hutSpawnPoint); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, sfx, playerID ); } -void plNetLinkingMgr::LinkToMyNeighborhoodAge( uint32_t playerID ) +void plNetLinkingMgr::LinkToMyNeighborhoodAge( LinkSfx sfx, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -644,10 +646,10 @@ void plNetLinkingMgr::LinkToMyNeighborhoodAge( uint32_t playerID ) link.SetLinkingRules( plNetCommon::LinkingRules::kOwnedBook ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, sfx, playerID ); } -void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID ) +void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID, LinkSfx sfx ) { if ( !fLinkingEnabled ) { @@ -659,10 +661,10 @@ void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID ) // send the player our current age info so they can link here. plAgeLinkStruct link; link.GetAgeInfo()->CopyFrom( GetAgeLink()->GetAgeInfo() ); - LinkPlayerToAge( &link, playerID ); + LinkPlayerToAge( &link, playerID, sfx ); } -void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID ) +void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID, LinkSfx sfx ) { if ( !fLinkingEnabled ) { @@ -674,7 +676,7 @@ void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID // send the player the age link so they can link there. link->SetLinkingRules( plNetCommon::LinkingRules::kBasicLink ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, sfx, playerID ); } // @@ -693,7 +695,7 @@ void plNetLinkingMgr::LinkPlayerToPrevAge( uint32_t playerID ) plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); pMsg->SetCmd( kLinkPlayerToPrevAge); - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, kPlayBoth, playerID ); } void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) @@ -709,7 +711,7 @@ void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); pMsg->SetCmd( kLinkPlayerHere ); pMsg->GetArgs()->AddInt( 0, NetCommGetPlayer()->playerInt ); // send them our id. - IDispatchMsg( pMsg, playerID ); + IDispatchMsg( pMsg, kPlayBoth, playerID ); } //////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h index e0322c1d..490f20f8 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h @@ -55,6 +55,16 @@ struct plNCAgeLeaver; class plNetLinkingMgr { +public: + enum LinkSfx + { + kPlayNone = 0, + kPlayLinkIn = 1<<0, + kPlayLinkOut = 1<<1, + kPlayBoth = (kPlayLinkIn | kPlayLinkOut) + }; + +private: static void NCAgeJoinerCallback ( plNCAgeJoiner * joiner, unsigned type, @@ -110,7 +120,7 @@ class plNetLinkingMgr void IDoLink(plLinkToAgeMsg* link); bool IProcessVaultNotifyMsg(plVaultNotifyMsg* msg); - bool IDispatchMsg( plMessage * msg, uint32_t playerID ); + bool IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t playerID ); public: @@ -125,26 +135,35 @@ public: bool Linking () const { return !fLinkedIn && !fLinkingEnabled; } // Link to an age. - void LinkToAge( plAgeLinkStruct * link, uint32_t playerID=kInvalidPlayerID ); - void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, uint32_t playerID=kInvalidPlayerID ); + void LinkToAge( plAgeLinkStruct * link, LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + // Link to my last age. - void LinkToPrevAge( uint32_t playerID=kInvalidPlayerID ); + void LinkToPrevAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + // Link to my Personal Age - void LinkToMyPersonalAge( uint32_t playerID=kInvalidPlayerID ); + void LinkToMyPersonalAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + // Link to my Neighborhood Age - void LinkToMyNeighborhoodAge( uint32_t playerID=kInvalidPlayerID ); + void LinkToMyNeighborhoodAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + // Link a player here. - void LinkPlayerHere( uint32_t playerID ); + void LinkPlayerHere( uint32_t playerID, LinkSfx sfx=kPlayBoth ); + // Link player to specified age - void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID ); + void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID, LinkSfx sfx=kPlayBoth ); + // Link player back to his last age void LinkPlayerToPrevAge( uint32_t playerID ); + // Link us to a players age. void LinkToPlayersAge( uint32_t playerID ); + // Offer a link to player. void OfferLinkToPlayer( const plAgeLinkStruct * info, uint32_t playerID, plKey replyKey ); void OfferLinkToPlayer( const plAgeInfoStruct * info, uint32_t playerID ); void OfferLinkToPlayer( const plAgeLinkStruct * info, uint32_t playerID ); + // Leave the current age void LeaveAge (bool quitting); From 7888cf7010064e00e71b99a9825347017a80a41c Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 27 Jan 2013 18:51:48 -0500 Subject: [PATCH 3/3] Remove redundant bitfield --- .../FeatureLib/pfPython/pyNetLinkingMgr.cpp | 8 +--- .../plNetClient/plNetLinkingMgr.cpp | 37 +++++++++---------- .../PubUtilLib/plNetClient/plNetLinkingMgr.h | 26 ++++--------- 3 files changed, 27 insertions(+), 44 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp index c8474177..52b62a50 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp @@ -67,13 +67,7 @@ void pyNetLinkingMgr::SetEnabled( bool b ) const void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx ) { - uint32_t sfx = plNetLinkingMgr::kPlayNone; - if (linkInSfx) - hsSetBits(sfx, plNetLinkingMgr::kPlayLinkIn); - if (linkOutSfx) - hsSetBits(sfx, plNetLinkingMgr::kPlayLinkOut); - - plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim, (plNetLinkingMgr::LinkSfx)sfx ); + plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim, linkInSfx, linkOutSfx ); } void pyNetLinkingMgr::LinkToMyPersonalAge() diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index 69559f4a..584810ec 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -547,14 +547,12 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg) //////////////////////////////////////////////////////////////////// -bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t playerID ) +bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, uint32_t playerID ) { plNetClientMgr * nc = plNetClientMgr::GetInstance(); msg->AddReceiver( plNetClientMgr::GetInstance()->GetKey() ); plLinkToAgeMsg* linkToAge = plLinkToAgeMsg::ConvertNoRef(msg); - if (linkToAge) - linkToAge->PlayLinkSfx(hsTestBits(sfx, kPlayLinkIn), hsTestBits(sfx, kPlayLinkOut)); if ( playerID!=kInvalidPlayerID && playerID!=nc->GetPlayerID() ) { msg->SetBCastFlag( plMessage::kNetAllowInterAge ); @@ -570,12 +568,12 @@ bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t player //////////////////////////////////////////////////////////////////// -void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, LinkSfx sfx, uint32_t playerID ) +void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, bool linkInSfx, bool linkOutSfx, uint32_t playerID ) { - LinkToAge(link, nil, sfx, playerID); + LinkToAge(link, nil, linkInSfx, linkOutSfx, playerID); } -void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, LinkSfx sfx, uint32_t playerID ) +void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, bool linkInSfx, bool linkOutSfx, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -586,11 +584,12 @@ void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, L plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); if (linkAnim) pMsg->SetLinkInAnimName(linkAnim); - IDispatchMsg( pMsg, sfx, playerID ); + pMsg->PlayLinkSfx(linkInSfx, linkOutSfx); + IDispatchMsg( pMsg, playerID ); } // link myself back to my last age -void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID ) +void plNetLinkingMgr::LinkToPrevAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -601,7 +600,7 @@ void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID ) if (GetPrevAgeLink()->GetAgeInfo()->HasAgeFilename()) { plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( GetPrevAgeLink() ); - IDispatchMsg( pMsg, sfx, playerID ); + IDispatchMsg( pMsg, playerID ); } else { @@ -609,7 +608,7 @@ void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID ) } } -void plNetLinkingMgr::LinkToMyPersonalAge( LinkSfx sfx, uint32_t playerID ) +void plNetLinkingMgr::LinkToMyPersonalAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -627,10 +626,10 @@ void plNetLinkingMgr::LinkToMyPersonalAge( LinkSfx sfx, uint32_t playerID ) link.SetSpawnPoint(hutSpawnPoint); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); - IDispatchMsg( pMsg, sfx, playerID ); + IDispatchMsg( pMsg, playerID ); } -void plNetLinkingMgr::LinkToMyNeighborhoodAge( LinkSfx sfx, uint32_t playerID ) +void plNetLinkingMgr::LinkToMyNeighborhoodAge( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -646,10 +645,10 @@ void plNetLinkingMgr::LinkToMyNeighborhoodAge( LinkSfx sfx, uint32_t playerID ) link.SetLinkingRules( plNetCommon::LinkingRules::kOwnedBook ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); - IDispatchMsg( pMsg, sfx, playerID ); + IDispatchMsg( pMsg, playerID ); } -void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID, LinkSfx sfx ) +void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -661,10 +660,10 @@ void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID, LinkSfx sfx ) // send the player our current age info so they can link here. plAgeLinkStruct link; link.GetAgeInfo()->CopyFrom( GetAgeLink()->GetAgeInfo() ); - LinkPlayerToAge( &link, playerID, sfx ); + LinkPlayerToAge( &link, playerID ); } -void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID, LinkSfx sfx ) +void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID ) { if ( !fLinkingEnabled ) { @@ -676,7 +675,7 @@ void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID // send the player the age link so they can link there. link->SetLinkingRules( plNetCommon::LinkingRules::kBasicLink ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); - IDispatchMsg( pMsg, sfx, playerID ); + IDispatchMsg( pMsg, playerID ); } // @@ -695,7 +694,7 @@ void plNetLinkingMgr::LinkPlayerToPrevAge( uint32_t playerID ) plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); pMsg->SetCmd( kLinkPlayerToPrevAge); - IDispatchMsg( pMsg, kPlayBoth, playerID ); + IDispatchMsg( pMsg, playerID ); } void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) @@ -711,7 +710,7 @@ void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); pMsg->SetCmd( kLinkPlayerHere ); pMsg->GetArgs()->AddInt( 0, NetCommGetPlayer()->playerInt ); // send them our id. - IDispatchMsg( pMsg, kPlayBoth, playerID ); + IDispatchMsg( pMsg, playerID ); } //////////////////////////////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h index 490f20f8..975227ca 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h @@ -55,16 +55,6 @@ struct plNCAgeLeaver; class plNetLinkingMgr { -public: - enum LinkSfx - { - kPlayNone = 0, - kPlayLinkIn = 1<<0, - kPlayLinkOut = 1<<1, - kPlayBoth = (kPlayLinkIn | kPlayLinkOut) - }; - -private: static void NCAgeJoinerCallback ( plNCAgeJoiner * joiner, unsigned type, @@ -120,7 +110,7 @@ private: void IDoLink(plLinkToAgeMsg* link); bool IProcessVaultNotifyMsg(plVaultNotifyMsg* msg); - bool IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t playerID ); + bool IDispatchMsg( plMessage* msg, uint32_t playerID ); public: @@ -135,23 +125,23 @@ public: bool Linking () const { return !fLinkedIn && !fLinkingEnabled; } // Link to an age. - void LinkToAge( plAgeLinkStruct * link, LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); - void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + void LinkToAge( plAgeLinkStruct * link, bool linkInSfx=true, bool linkOutSfx=true, uint32_t playerID=kInvalidPlayerID ); + void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, bool linkInSfx=true, bool linkOutSfx=true, uint32_t playerID=kInvalidPlayerID ); // Link to my last age. - void LinkToPrevAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + void LinkToPrevAge( uint32_t playerID=kInvalidPlayerID ); // Link to my Personal Age - void LinkToMyPersonalAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + void LinkToMyPersonalAge( uint32_t playerID=kInvalidPlayerID ); // Link to my Neighborhood Age - void LinkToMyNeighborhoodAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); + void LinkToMyNeighborhoodAge( uint32_t playerID=kInvalidPlayerID ); // Link a player here. - void LinkPlayerHere( uint32_t playerID, LinkSfx sfx=kPlayBoth ); + void LinkPlayerHere( uint32_t playerID ); // Link player to specified age - void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID, LinkSfx sfx=kPlayBoth ); + void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID ); // Link player back to his last age void LinkPlayerToPrevAge( uint32_t playerID );