mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
64
Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.cpp
Normal file
64
Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plConditionalObject.h"
|
||||
#include "plLogicModBase.h"
|
||||
|
||||
plConditionalObject::plConditionalObject() :
|
||||
bSatisfied(false),
|
||||
fToggle(false),
|
||||
fLogicMod(nil),
|
||||
fReset(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
plConditionalObject::~plConditionalObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
|
105
Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.h
Normal file
105
Sources/Plasma/NucleusLib/pnModifier/plConditionalObject.h
Normal file
@ -0,0 +1,105 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plConditionalObject_inc
|
||||
#define plConditionalObject_inc
|
||||
|
||||
#include "../pnKeyedObject/hsKeyedObject.h"
|
||||
#include "hsBitVector.h"
|
||||
#include "../pnNetCommon/plSynchedValue.h"
|
||||
|
||||
class plLogicModBase;
|
||||
|
||||
class plConditionalObject : public hsKeyedObject
|
||||
{
|
||||
private:
|
||||
// since 'this' is not derived from synchedObject, its synched values must be associated
|
||||
// with it's logicModifier (which is a synchedObject). Thus it's a synched value 'friend'.
|
||||
hsBool bSatisfied;
|
||||
hsBool fToggle;
|
||||
public:
|
||||
enum
|
||||
{
|
||||
kLocalElement = 0,
|
||||
kNOT,
|
||||
};
|
||||
protected:
|
||||
plLogicModBase* fLogicMod;
|
||||
hsBitVector fFlags;
|
||||
hsBool fReset;
|
||||
public:
|
||||
plConditionalObject();
|
||||
virtual ~plConditionalObject();
|
||||
|
||||
CLASSNAME_REGISTER( plConditionalObject );
|
||||
GETINTERFACE_ANY( plConditionalObject, hsKeyedObject );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr) { hsKeyedObject::Read(stream, mgr); bSatisfied = stream->ReadBool(); fToggle = stream->ReadBool();}
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr){ hsKeyedObject::Write(stream, mgr); stream->WriteBool( bSatisfied ); stream->WriteBool(fToggle);}
|
||||
|
||||
virtual void SetLogicMod(plLogicModBase* pMod) { fLogicMod = pMod; }
|
||||
|
||||
// virtual hsBool MsgReceive(plMessage* msg) = 0;
|
||||
|
||||
virtual hsBool Satisfied() { if(HasFlag(kNOT)) return !bSatisfied; else return bSatisfied; }
|
||||
void SetSatisfied(hsBool b) { bSatisfied=b; }
|
||||
hsBool IsToggle() { return fToggle; }
|
||||
void SetToggle(hsBool b) { fToggle = b; }
|
||||
|
||||
// this is used if condtiton 1 is dependent on another condition's state at the
|
||||
// time of a message coming into condition 1;
|
||||
virtual hsBool Verify(plMessage* msg) { return true; }
|
||||
|
||||
virtual void Evaluate() = 0;
|
||||
|
||||
virtual void Reset() = 0;
|
||||
virtual hsBool ResetOnTrigger() { return fReset; }
|
||||
|
||||
hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
void SetFlag(int f) { fFlags.SetBit(f); }
|
||||
void ClearFlag(int which) { fFlags.ClearBit( which ); }
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // plConditionalObject_inc
|
403
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp
Normal file
403
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp
Normal file
@ -0,0 +1,403 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plLogicModBase.h"
|
||||
#include "plgDispatch.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "hsTimer.h"
|
||||
#include "../pnSceneObject/plSceneObject.h"
|
||||
#include "../pnNetCommon/plGenericVar.h"
|
||||
#include "../pnNetCommon/plNetApp.h"
|
||||
#include "../pnNetCommon/plNetSharedState.h"
|
||||
#include "../../PubUtilLib/plNetMessage/plNetMessage.h" // breaks project dependancy levels
|
||||
#include "../pnMessage/plNotifyMsg.h"
|
||||
#include "../pnMessage/plEnableMsg.h"
|
||||
#include "../pnMessage/plServerReplyMsg.h"
|
||||
|
||||
void plLogicModBase::ConsoleTrigger(plKey playerKey)
|
||||
{
|
||||
// Setup the event data in case this is a OneShot responder that needs it
|
||||
proPickedEventData *ed = TRACKED_NEW proPickedEventData;
|
||||
ed->fPicker = playerKey;
|
||||
ed->fPicked = nil;
|
||||
fNotify->AddEvent(ed);
|
||||
|
||||
Trigger(false);
|
||||
|
||||
// Whoops, trigger and untrigger use the same message, so if we do this right away
|
||||
// it will just untrigger twice. So...uhh, we don't untrigger!
|
||||
// UnTrigger();
|
||||
}
|
||||
|
||||
void plLogicModBase::ConsoleRequestTrigger()
|
||||
{
|
||||
RequestTrigger();
|
||||
}
|
||||
|
||||
plLogicModBase::plLogicModBase() :
|
||||
fCounter(0),
|
||||
fCounterLimit(0),
|
||||
fTimer(0.0f),
|
||||
fNotify(nil),
|
||||
fDisabled(false)
|
||||
{
|
||||
fNotify = TRACKED_NEW plNotifyMsg;
|
||||
}
|
||||
|
||||
plLogicModBase::~plLogicModBase()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fCommandList.Count(); i++ )
|
||||
{
|
||||
hsRefCnt_SafeUnRef(fCommandList[i]);
|
||||
}
|
||||
|
||||
hsRefCnt_SafeUnRef(fNotify);
|
||||
}
|
||||
|
||||
void plLogicModBase::AddTarget(plSceneObject* so)
|
||||
{
|
||||
plSingleModifier::AddTarget(so);
|
||||
}
|
||||
|
||||
void plLogicModBase::RegisterForMessageType(UInt16 hClass)
|
||||
{
|
||||
plgDispatch::Dispatch()->RegisterForExactType( hClass, GetKey() );
|
||||
}
|
||||
|
||||
//
|
||||
// Update generic shared state (which reflects trigger state) on server
|
||||
// by sending TestAndSet request. By locking and unlocking the sharedState,
|
||||
// we can guarantee that only one logicMod instance can trigger at a time.
|
||||
// The server will confirm or deny our request to lock and set the state.
|
||||
//
|
||||
void plLogicModBase::IUpdateSharedState(bool triggered) const
|
||||
{
|
||||
plNetSharedState ss("TrigState");
|
||||
plGenericVar* sv = TRACKED_NEW plGenericVar("Triggered");
|
||||
sv->Value().SetBool(triggered); // attempting to set trig state to true
|
||||
ss.AddVar(sv);
|
||||
|
||||
bool lock = triggered;
|
||||
|
||||
// if unlocking, then the server does not need to store this state, since it's back to its default state
|
||||
ss.SetServerMayDelete(!lock);
|
||||
|
||||
plNetMsgTestAndSet ts;
|
||||
ts.SetNetProtocol(kNetProtocolCli2Game);
|
||||
ts.CopySharedState(&ss);
|
||||
ts.ObjectInfo()->SetFromKey(GetKey());
|
||||
ts.SetLockRequest(lock); // if triggering, lock state, else unlock state
|
||||
plNetClientApp::GetInstance()->SendMsg(&ts);
|
||||
plNetClientApp::GetInstance()->DebugMsg("\tLM: Attempting to set logic mod shared lock to %s, t=%f\n",
|
||||
triggered ? "Triggered" : "UnTriggered", hsTimer::GetSysSeconds());
|
||||
}
|
||||
|
||||
hsBool plLogicModBase::MsgReceive(plMessage* msg)
|
||||
{
|
||||
// read messages:
|
||||
plServerReplyMsg* pSMsg = plServerReplyMsg::ConvertNoRef(msg);
|
||||
if (pSMsg)
|
||||
{
|
||||
hsAssert(pSMsg->GetType() != plServerReplyMsg::kUnInit, "uninit server reply msg");
|
||||
|
||||
#if 1
|
||||
char str[256];
|
||||
sprintf(str, "LM: LogicModifier %s recvd trigger request reply:%s, wasRequesting=%d, t=%f\n", GetKeyName(),
|
||||
pSMsg->GetType() == plServerReplyMsg::kDeny ? "denied" : "confirmed",
|
||||
HasFlag(kRequestingTrigger), hsTimer::GetSysSeconds());
|
||||
plNetClientApp::GetInstance()->DebugMsg(str);
|
||||
#endif
|
||||
|
||||
if (pSMsg->GetType() == plServerReplyMsg::kDeny)
|
||||
{
|
||||
if (HasFlag(kRequestingTrigger))
|
||||
{
|
||||
plNetClientApp::GetInstance()->DebugMsg("\tLM: Denied, clearing requestingTrigger");
|
||||
ClearFlag(kRequestingTrigger);
|
||||
}
|
||||
else
|
||||
plNetClientApp::GetInstance()->DebugMsg("\tLM: Denied, but not requesting?");
|
||||
}
|
||||
else
|
||||
{
|
||||
hsBool netRequest=false; // we're triggering as a result of a local activation
|
||||
PreTrigger(netRequest);
|
||||
IUpdateSharedState(false /* untriggering */);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
plEnableMsg* pEnable = plEnableMsg::ConvertNoRef(msg);
|
||||
if (pEnable)
|
||||
{
|
||||
if (pEnable->Cmd(plEnableMsg::kDisable))
|
||||
fDisabled = true;
|
||||
else
|
||||
if (pEnable->Cmd(plEnableMsg::kEnable))
|
||||
{
|
||||
ClearFlag(kTriggered);
|
||||
ClearFlag(kRequestingTrigger);
|
||||
|
||||
fDisabled = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return plSingleModifier::MsgReceive(msg);
|
||||
}
|
||||
|
||||
void plLogicModBase::RequestTrigger(hsBool netRequest)
|
||||
{
|
||||
if (HasFlag(kTriggered))
|
||||
{
|
||||
#if 1
|
||||
char str[256];
|
||||
sprintf(str, "LM: %s ignoring RequestTrigger(), already triggered, t=%f\n", GetKeyName(),
|
||||
hsTimer::GetSysSeconds());
|
||||
plNetClientApp::GetInstance()->DebugMsg(str);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasFlag(kRequestingTrigger))
|
||||
{
|
||||
#if 1
|
||||
char str[256];
|
||||
sprintf(str, "LM: %s ignoring RequestTrigger(), already requesting trigger, t=%f\n", GetKeyName(),
|
||||
hsTimer::GetSysSeconds());
|
||||
plNetClientApp::GetInstance()->DebugMsg(str);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
if ( plNetApp::GetInstance()->GetFlagsBit(plNetClientApp::kLocalTriggers))
|
||||
{
|
||||
PreTrigger(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
IUpdateSharedState(true /* triggering */); // request arbitration from server
|
||||
SetFlag(kRequestingTrigger);
|
||||
|
||||
#if 1
|
||||
char str[256];
|
||||
sprintf(str, "LM: %s Setting RequestingTriggert=%f\n", GetKeyName(), hsTimer::GetSysSeconds());
|
||||
plNetClientApp::GetInstance()->DebugMsg(str);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// return false is counter test fails
|
||||
//
|
||||
hsBool plLogicModBase::IEvalCounter()
|
||||
{
|
||||
if (fCounterLimit > 0)
|
||||
{
|
||||
fCounter = fCounter + 1;
|
||||
if (fCounter != fCounterLimit)
|
||||
{
|
||||
Reset(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void plLogicModBase::PreTrigger(hsBool netRequest)
|
||||
{
|
||||
if (fDisabled)
|
||||
return;
|
||||
|
||||
Trigger(netRequest);
|
||||
}
|
||||
|
||||
void plLogicModBase::Trigger(hsBool netRequest)
|
||||
{
|
||||
#if 1
|
||||
char str[256];
|
||||
sprintf(str, "LogicModifier %s is triggering, activatorType=%d\n",
|
||||
GetKeyName(), HasFlag(kTypeActivator));
|
||||
plNetClientApp::GetInstance()->DebugMsg(str);
|
||||
#endif
|
||||
|
||||
ClearFlag(kRequestingTrigger);
|
||||
if (!HasFlag(kMultiTrigger))
|
||||
SetFlag(kTriggered);
|
||||
fNotify->SetSender(this->GetKey());
|
||||
fNotify->SetState(1.0f);
|
||||
fNotify->AddActivateEvent(true);
|
||||
// hsRefCnt_SafeRef(fNotify);
|
||||
plgDispatch::MsgSend( fNotify );
|
||||
CreateNotifyMsg();
|
||||
if (HasFlag(kOneShot))
|
||||
fDisabled = true;
|
||||
}
|
||||
|
||||
void plLogicModBase::UnTrigger()
|
||||
{
|
||||
if (!HasFlag(kTriggered))
|
||||
return;
|
||||
|
||||
#ifdef HS_DEBUGGING
|
||||
char str[256];
|
||||
sprintf(str, "LogicModifier %s is Un-triggering, activatorType=%d\n",
|
||||
GetKeyName(), HasFlag(kTypeActivator));
|
||||
plNetClientApp::GetInstance()->DebugMsg(str);
|
||||
#endif
|
||||
fNotify->SetSender(this->GetKey());
|
||||
fNotify->SetState(0.0f);
|
||||
fNotify->AddActivateEvent(false);
|
||||
// hsRefCnt_SafeRef(fNotify);
|
||||
plgDispatch::MsgSend( fNotify );
|
||||
CreateNotifyMsg();
|
||||
Reset(true);
|
||||
}
|
||||
|
||||
void plLogicModBase::Reset(bool bCounterReset)
|
||||
{
|
||||
ClearFlag(kTriggered);
|
||||
if (bCounterReset)
|
||||
fCounter = 0;
|
||||
}
|
||||
|
||||
void plLogicModBase::CreateNotifyMsg()
|
||||
{
|
||||
fNotify = TRACKED_NEW plNotifyMsg;
|
||||
for (int i = 0; i < fReceiverList.Count(); i++)
|
||||
fNotify->AddReceiver(fReceiverList[i]);
|
||||
}
|
||||
|
||||
void plLogicModBase::AddNotifyReceiver(plKey receiver)
|
||||
{
|
||||
fReceiverList.Append(receiver);
|
||||
fNotify->AddReceiver(receiver);
|
||||
}
|
||||
|
||||
void plLogicModBase::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plSingleModifier::Read(stream, mgr);
|
||||
int n = stream->ReadSwap32();
|
||||
fCommandList.SetCountAndZero(n);
|
||||
for(int i = 0; i < n; i++ )
|
||||
{
|
||||
plMessage* pMsg = plMessage::ConvertNoRef(mgr->ReadCreatable(stream));
|
||||
fCommandList[i] = pMsg;
|
||||
}
|
||||
if (fNotify)
|
||||
delete fNotify;
|
||||
plNotifyMsg* pNMsg = plNotifyMsg::ConvertNoRef(mgr->ReadCreatable(stream));
|
||||
fNotify = pNMsg;
|
||||
|
||||
fFlags.Read(stream);
|
||||
fDisabled = stream->Readbool();
|
||||
for (int d = 0; d < fNotify->GetNumReceivers(); d++)
|
||||
fReceiverList.Append(fNotify->GetReceiver(d));
|
||||
}
|
||||
|
||||
void plLogicModBase::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plSingleModifier::Write(stream, mgr);
|
||||
stream->WriteSwap32(fCommandList.GetCount());
|
||||
for(int i = 0; i < fCommandList.GetCount(); i++ )
|
||||
mgr->WriteCreatable( stream, fCommandList[i] );
|
||||
mgr->WriteCreatable( stream, fNotify );
|
||||
fFlags.Write(stream);
|
||||
stream->Writebool(fDisabled);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Maintainers Marker Component
|
||||
//
|
||||
//
|
||||
#if 0
|
||||
#include "../plModifier/plMaintainersMarkerModifier.h"
|
||||
|
||||
//Class that accesses the paramblock below.
|
||||
class plMaintainersMarkerComponent : public plComponent
|
||||
{
|
||||
public:
|
||||
plMaintainersMarkerComponent();
|
||||
void DeleteThis() { delete this; }
|
||||
hsBool SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg);
|
||||
hsBool PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg);
|
||||
hsBool Convert(plMaxNode *node, plErrorMsg *pErrMsg);
|
||||
};
|
||||
|
||||
//Max desc stuff necessary.
|
||||
CLASS_DESC(plMaintainersMarkerComponent, gMaintainersDesc, "Maintainers Marker", "MaintainersMarker", COMP_TYPE_TYPE, Class_ID(0x7d7f1f72, 0x405355f5))
|
||||
|
||||
//The MAX paramblock stuff below
|
||||
ParamBlockDesc2 gMaintainersBk
|
||||
(
|
||||
1, _T("maintainersMarker"), 0, &gMaintainersDesc, P_AUTO_CONSTRUCT, plComponent::kRefComp,
|
||||
end
|
||||
);
|
||||
|
||||
plMaintainersMarkerComponent::plMaintainersMarkerComponent()
|
||||
{
|
||||
fClassDesc = &gMaintainersDesc;
|
||||
fClassDesc->MakeAutoParamBlocks(this);
|
||||
}
|
||||
|
||||
hsBool plMaintainersMarkerComponent::SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg)
|
||||
{
|
||||
node->SetForceLocal(true);
|
||||
return true;
|
||||
}
|
||||
hsBool plMaintainersMarkerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
|
||||
{
|
||||
plMaintainersMarkerModifier* pSpawn = TRACKED_NEW plMaintainersMarkerModifier;
|
||||
node->AddModifier(pSpawn);
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool plMaintainersMarkerComponent::PreConvert(plMaxNode *pNode, plErrorMsg *pErrMsg)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
128
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h
Normal file
128
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.h
Normal file
@ -0,0 +1,128 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plLogicModBase_inc
|
||||
#define plLogicModBase_inc
|
||||
|
||||
#include "plSingleModifier.h"
|
||||
#include "../pnNetCommon/plSynchedValue.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
class plConditionalObject;
|
||||
class plSceneObject;
|
||||
class plNotifyMsg;
|
||||
class plVolumeSensorConditionalObjectNoArbitration;
|
||||
class plLogicModBase : public plSingleModifier
|
||||
{
|
||||
public:
|
||||
enum Flags
|
||||
{
|
||||
kLocalElement = 0,
|
||||
kReset,
|
||||
kTriggered,
|
||||
kOneShot,
|
||||
kRequestingTrigger,
|
||||
kTypeActivator, // this LogicMod is part of an Activator Component (not a Responder)
|
||||
kMultiTrigger,
|
||||
};
|
||||
|
||||
protected:
|
||||
hsTArray<plMessage*> fCommandList;
|
||||
hsTArray<plKey> fReceiverList;
|
||||
UInt32 fCounterLimit;
|
||||
hsScalar fTimer;
|
||||
hsBitVector fFlags;
|
||||
UInt32 fCounter;
|
||||
plNotifyMsg* fNotify;
|
||||
bool fDisabled;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) {return false;}
|
||||
void IUpdateSharedState(bool triggered) const;
|
||||
hsBool IEvalCounter();
|
||||
virtual void PreTrigger(hsBool netRequest);
|
||||
virtual void Trigger(hsBool netRequest);
|
||||
virtual void UnTrigger();
|
||||
|
||||
void CreateNotifyMsg();
|
||||
|
||||
public:
|
||||
friend plVolumeSensorConditionalObjectNoArbitration;
|
||||
plLogicModBase();
|
||||
~plLogicModBase();
|
||||
CLASSNAME_REGISTER( plLogicModBase );
|
||||
GETINTERFACE_ANY( plLogicModBase, plSingleModifier );
|
||||
|
||||
void AddTarget(plSceneObject* so);
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual hsBool VerifyConditions(plMessage* msg) { return true;}
|
||||
|
||||
virtual void Reset(bool bCounterReset);
|
||||
|
||||
void SetDisabled(bool disabled) { fDisabled = disabled; }
|
||||
bool Disabled() { return fDisabled; }
|
||||
|
||||
plNotifyMsg* GetNotify() { return fNotify; }
|
||||
|
||||
void AddCommand(plMessage* msg) { fCommandList.Append(msg); }
|
||||
void SetOneShot(hsBool b) { if (b) SetFlag(kOneShot); else ClearFlag(kOneShot); }
|
||||
void RegisterForMessageType(UInt16 hClass);
|
||||
|
||||
virtual void RequestTrigger(hsBool netRequest=false);
|
||||
virtual void RequestUnTrigger() { UnTrigger(); }
|
||||
|
||||
hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
void SetFlag(int f) { fFlags.SetBit(f); }
|
||||
void ClearFlag(int which) { fFlags.ClearBit(which); }
|
||||
|
||||
void AddNotifyReceiver(plKey receiver);
|
||||
|
||||
// for debug purposes only!
|
||||
void ConsoleTrigger(plKey playerKey);
|
||||
void ConsoleRequestTrigger();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // plLogicModifier_inc
|
102
Sources/Plasma/NucleusLib/pnModifier/plModifier.cpp
Normal file
102
Sources/Plasma/NucleusLib/pnModifier/plModifier.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "plModifier.h"
|
||||
#include "../pnSceneObject/plSceneObject.h"
|
||||
#include "../pnSceneObject/plDrawInterface.h"
|
||||
#include "../pnSceneObject/plSimulationInterface.h"
|
||||
#include "../pnSceneObject/plCoordinateInterface.h"
|
||||
#include "../pnSceneObject/plAudioInterface.h"
|
||||
#include "../pnMessage/plTimeMsg.h"
|
||||
|
||||
plModifier::plModifier()
|
||||
{
|
||||
}
|
||||
|
||||
plModifier::~plModifier()
|
||||
{
|
||||
}
|
||||
|
||||
plDrawInterface* plModifier::IGetTargetDrawInterface(int iTarg) const
|
||||
{
|
||||
return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileDrawInterface() : nil;
|
||||
}
|
||||
|
||||
plSimulationInterface* plModifier::IGetTargetSimulationInterface(int iTarg) const
|
||||
{
|
||||
return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileSimulationInterface() : nil;
|
||||
}
|
||||
|
||||
plCoordinateInterface* plModifier::IGetTargetCoordinateInterface(int iTarg) const
|
||||
{
|
||||
return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileCoordinateInterface() : nil;
|
||||
}
|
||||
|
||||
plAudioInterface* plModifier::IGetTargetAudioInterface(int iTarg) const
|
||||
{
|
||||
return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileAudioInterface() : nil;
|
||||
}
|
||||
|
||||
plObjInterface* plModifier::IGetTargetGenericInterface(int iTarg, UInt32 classIdx) const
|
||||
{
|
||||
return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileGenericInterface((UInt16)classIdx) : nil;
|
||||
}
|
||||
|
||||
plModifier* plModifier::IGetTargetModifier(int iTarg, int iMod) const
|
||||
{
|
||||
return GetTarget(iTarg) ? GetTarget(iTarg)->GetVolatileModifier(iMod) : nil;
|
||||
}
|
||||
|
||||
hsBool plModifier::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plEvalMsg* eval = plEvalMsg::ConvertNoRef(msg);
|
||||
if( eval )
|
||||
{
|
||||
UInt32 dirty = ~0L;
|
||||
IEval(eval->DSeconds(), eval->DelSeconds(), dirty);
|
||||
return true;
|
||||
}
|
||||
|
||||
return plSynchedObject::MsgReceive(msg);
|
||||
}
|
||||
|
92
Sources/Plasma/NucleusLib/pnModifier/plModifier.h
Normal file
92
Sources/Plasma/NucleusLib/pnModifier/plModifier.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plModifier_inc
|
||||
#define plModifier_inc
|
||||
|
||||
#include "../pnNetCommon/plSynchedObject.h"
|
||||
|
||||
class hsStream;
|
||||
class hsResMgr;
|
||||
class plMessage;
|
||||
class plSceneObject;
|
||||
class plObjInterface;
|
||||
class plDrawInterface;
|
||||
class plSimulationInterface;
|
||||
class plCoordinateInterface;
|
||||
class plAudioInterface;
|
||||
struct hsMatrix44;
|
||||
|
||||
class plModifier : public plSynchedObject
|
||||
{
|
||||
protected:
|
||||
|
||||
plDrawInterface* IGetTargetDrawInterface(int iTarg) const;
|
||||
plSimulationInterface* IGetTargetSimulationInterface(int iTarg) const;
|
||||
plCoordinateInterface* IGetTargetCoordinateInterface(int iTarg) const;
|
||||
plAudioInterface* IGetTargetAudioInterface(int iTarg) const;
|
||||
plObjInterface* IGetTargetGenericInterface(int iTarg, UInt32 classIdx) const;
|
||||
plModifier* IGetTargetModifier(int iTarg, int iMod) const;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) = 0; // called only by owner object's Eval()
|
||||
|
||||
friend class plSceneObject;
|
||||
public:
|
||||
|
||||
plModifier();
|
||||
virtual ~plModifier();
|
||||
|
||||
CLASSNAME_REGISTER( plModifier );
|
||||
GETINTERFACE_ANY( plModifier, plSynchedObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
virtual int GetNumTargets() const = 0;
|
||||
virtual plSceneObject* GetTarget(int iTarg) const = 0;
|
||||
virtual void AddTarget(plSceneObject* so) = 0;
|
||||
virtual void RemoveTarget(plSceneObject* so) = 0;
|
||||
|
||||
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l) {}
|
||||
|
||||
};
|
||||
|
||||
#endif // plModifier_inc
|
79
Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.cpp
Normal file
79
Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "plMultiModifier.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
|
||||
plMultiModifier::plMultiModifier()
|
||||
{
|
||||
}
|
||||
|
||||
plMultiModifier::~plMultiModifier()
|
||||
{
|
||||
}
|
||||
|
||||
void plMultiModifier::Read(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plModifier::Read(s, mgr);
|
||||
fFlags.Read(s);
|
||||
}
|
||||
|
||||
void plMultiModifier::Write(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plModifier::Write(s, mgr);
|
||||
fFlags.Write(s);
|
||||
}
|
||||
|
||||
void plMultiModifier::RemoveTarget(plSceneObject* so)
|
||||
{
|
||||
for (int i=0; i< fTargets.Count(); i++)
|
||||
{
|
||||
if (fTargets[i] == so)
|
||||
{
|
||||
fTargets.Remove(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
81
Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h
Normal file
81
Sources/Plasma/NucleusLib/pnModifier/plMultiModifier.h
Normal file
@ -0,0 +1,81 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plMultiModifier_inc
|
||||
#define plMultiModifier_inc
|
||||
|
||||
#include "plModifier.h"
|
||||
#include "hsBitVector.h"
|
||||
#include "../pnNetCommon/plSynchedValue.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
class plSceneObject;
|
||||
class plMultiModMsg;
|
||||
|
||||
class plMultiModifier : public plModifier
|
||||
{
|
||||
protected:
|
||||
hsTArray<plSceneObject*> fTargets;
|
||||
hsBitVector fFlags;
|
||||
|
||||
public:
|
||||
plMultiModifier();
|
||||
virtual ~plMultiModifier();
|
||||
|
||||
CLASSNAME_REGISTER( plMultiModifier );
|
||||
GETINTERFACE_ANY( plMultiModifier, plModifier );
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) = 0;
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual int GetNumTargets() const { return fTargets.Count(); }
|
||||
virtual plSceneObject* GetTarget(int w) const { hsAssert(w < GetNumTargets(), "Bad target"); return fTargets[w]; }
|
||||
virtual void AddTarget(plSceneObject* so) {fTargets.Append(so);}
|
||||
virtual void RemoveTarget(plSceneObject* so);
|
||||
|
||||
hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
plMultiModifier& SetFlag(int f) { fFlags.SetBit(f); return *this; }
|
||||
|
||||
};
|
||||
|
||||
#endif // plMultiModifier_inc
|
71
Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.cpp
Normal file
71
Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "plSingleModifier.h"
|
||||
|
||||
#include "hsStream.h"
|
||||
|
||||
plSingleModifier::plSingleModifier()
|
||||
:
|
||||
fTarget(nil)
|
||||
{
|
||||
}
|
||||
|
||||
plSingleModifier::~plSingleModifier()
|
||||
{
|
||||
}
|
||||
|
||||
void plSingleModifier::Read(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plModifier::Read(s, mgr);
|
||||
fFlags.Read(s);
|
||||
}
|
||||
|
||||
void plSingleModifier::Write(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
plModifier::Write(s, mgr);
|
||||
|
||||
fFlags.Write(s);
|
||||
|
||||
}
|
||||
|
86
Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h
Normal file
86
Sources/Plasma/NucleusLib/pnModifier/plSingleModifier.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plSingleModifier_inc
|
||||
#define plSingleModifier_inc
|
||||
|
||||
#include "plModifier.h"
|
||||
#include "hsBitVector.h"
|
||||
#include "../pnNetCommon/plSynchedValue.h"
|
||||
|
||||
class plSceneObject;
|
||||
class plSingleModMsg;
|
||||
|
||||
class plSingleModifier : public plModifier
|
||||
{
|
||||
protected:
|
||||
plSceneObject* fTarget;
|
||||
hsBitVector fFlags;
|
||||
|
||||
virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty) = 0;
|
||||
|
||||
public:
|
||||
plSingleModifier();
|
||||
virtual ~plSingleModifier();
|
||||
|
||||
CLASSNAME_REGISTER( plSingleModifier );
|
||||
GETINTERFACE_ANY( plSingleModifier, plModifier );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual int GetNumTargets() const { return 1; }
|
||||
virtual plSceneObject* GetTarget(int iTarg) const {return fTarget;}
|
||||
virtual void AddTarget(plSceneObject* so) {SetTarget(so);}
|
||||
virtual void RemoveTarget(plSceneObject* so) {fTarget = 0;}
|
||||
|
||||
|
||||
virtual plSceneObject* GetTarget() const { return fTarget; }
|
||||
virtual void SetTarget(plSceneObject* so) { fTarget = so; }
|
||||
|
||||
hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
|
||||
plSingleModifier& SetFlag(int f) { fFlags.SetBit(f); return *this; }
|
||||
plSingleModifier& ClearFlag(int f) { fFlags.ClearBit(f); return *this; }
|
||||
|
||||
};
|
||||
|
||||
#endif // plSingleModifier_inc
|
70
Sources/Plasma/NucleusLib/pnModifier/pnModifierCreatable.h
Normal file
70
Sources/Plasma/NucleusLib/pnModifier/pnModifierCreatable.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pnModifierCreatable_inc
|
||||
#define pnModifierCreatable_inc
|
||||
|
||||
#include "../pnFactory/plCreator.h"
|
||||
|
||||
#include "plModifier.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plModifier );
|
||||
|
||||
#include "plSingleModifier.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plSingleModifier );
|
||||
|
||||
#include "plMultiModifier.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plMultiModifier );
|
||||
|
||||
#include "plConditionalObject.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plConditionalObject );
|
||||
|
||||
#include "plLogicModBase.h"
|
||||
|
||||
REGISTER_NONCREATABLE( plLogicModBase );
|
||||
|
||||
|
||||
|
||||
#endif // pnModifierCreatable_inc
|
Reference in New Issue
Block a user