2
3
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:
rarified
2021-05-15 12:49:46 -06:00
parent c3f4a640a3
commit 96903e8dca
4002 changed files with 159 additions and 644 deletions

View File

@ -0,0 +1,51 @@
/*==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 pfCharacterCreatable_inc
#define pfCharacterCreatable_inc
#include "../pnFactory/plCreator.h"
#include "pfMarkerMgr.h"
REGISTER_NONCREATABLE(pfMarkerMgr);
#endif // pfCharacterCreatable_inc

View File

@ -0,0 +1,267 @@
/*==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 "pfMarkerInfo.h"
#include "pfMarkerMgr.h"
#include "../plModifier/plGameMarkerModifier.h"
#include "../plMessage/plLoadCloneMsg.h"
#include "../pnMessage/plWarpMsg.h"
#include "../pnSceneObject/plCoordinateInterface.h"
#include "../plMessage/plAnimCmdMsg.h"
#include "../pnMessage/plEnableMsg.h"
#include "../pnMessage/plSoundMsg.h"
#include "../pnSceneObject/plAudioInterface.h"
// For Init
#include "../pnMessage/plClientMsg.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../plResMgr/plResManager.h"
#include "../plResMgr/plKeyFinder.h"
plUoid pfMarkerInfo::fMarkerUoid;
static const int kFreezeLen = 10; // How long a marker is frozen after you hit it
void pfMarkerInfo::Init()
{
plResManager* resMgr = (plResManager*)hsgResMgr::ResMgr();
// Force the client to keep the GlobalMarkers keys loaded, so we don't load them every time we clone
plClientMsg* loadAgeKeysMsg = TRACKED_NEW plClientMsg(plClientMsg::kLoadAgeKeys);
loadAgeKeysMsg->SetAgeName("GlobalMarkers");
loadAgeKeysMsg->Send(resMgr->FindKey(kClient_KEY));
//
// Get the Uoid for the markers
//
plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers");
if (markerLoc.IsValid())
fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), "MarkerRoot");
else
fMarkerUoid.Invalidate();
}
pfMarkerInfo::pfMarkerInfo(const hsPoint3& pos, bool isNew) :
fMod(nil),
fPosition(pos),
fType(kMarkerOpen),
fLastChange(0),
fVisible(true),
fIsNew(isNew),
fSpawned(false)
{
}
void pfMarkerInfo::Spawn(MarkerType type)
{
if (!fMarkerUoid.IsValid())
{
plResManager* resMgr = (plResManager*)hsgResMgr::ResMgr();
plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers");
if (markerLoc.IsValid())
fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), "MarkerRoot");
else
{
hsAssert(false, "Unable to spawn markers because the marker age was not loaded or found");
return;
}
}
fType = type;
fLastChange = 0;
plLoadCloneMsg* cloneMsg = TRACKED_NEW plLoadCloneMsg(fMarkerUoid, pfMarkerMgr::Instance()->GetKey(), 0);
cloneMsg->SetBCastFlag(plMessage::kNetPropagate, false);
fKey = cloneMsg->GetCloneKey();
cloneMsg->Send();
}
void pfMarkerInfo::InitSpawned(plKey markerKey)
{
fKey = markerKey;
fSpawned = true;
plSceneObject* so = plSceneObject::ConvertNoRef(fKey->GetObjectPtr());
fMod = (plGameMarkerModifier*)so->GetModifierByType(plGameMarkerModifier::Index());
hsAssert(fMod, "Couldn't find marker modifier");
fMod->FixupAnimKeys();
// Warp it into position
hsMatrix44 pos;
pos.Reset();
pos.SetTranslate(&fPosition);
plWarpMsg* warpMsg = TRACKED_NEW plWarpMsg(pfMarkerMgr::Instance()->GetKey(), fKey, plWarpMsg::kFlushTransform, pos);
warpMsg->Send();
// update its state
Show(fVisible);
IPlayColor(true);
if (fType == kMarkerLocalSelected)
IPlayBounce(true);
}
void pfMarkerInfo::Show(bool show)
{
fVisible = show;
if (fSpawned) {
plEnableMsg* msg = TRACKED_NEW plEnableMsg;
msg->SetBCastFlag(plMessage::kPropagateToChildren);
msg->SetCmd(plEnableMsg::kDrawable);
msg->SetCmd(plEnableMsg::kPhysical);
msg->SetCmd(show ? plEnableMsg::kEnable : plEnableMsg::kDisable);
msg->SetSender(pfMarkerMgr::Instance()->GetKey());
msg->Send(fKey);
}
}
void pfMarkerInfo::SetFrozen(double freezeStartTime)
{
fLastChange = freezeStartTime;
IPlayBounce(true);
}
void pfMarkerInfo::Update(double curTime)
{
if (fLastChange != 0 && (curTime - fLastChange) > kFreezeLen)
{
fLastChange = 0;
IPlayBounce(false);
}
if (fIsNew)
{
IPlaySound(true);
fIsNew = false;
}
}
void pfMarkerInfo::Remove()
{
if (fKey)
{
plLoadCloneMsg* cloneMsg = TRACKED_NEW plLoadCloneMsg(fKey, pfMarkerMgr::Instance()->GetKey(), 0, false);
cloneMsg->SetBCastFlag(plMessage::kNetPropagate, false);
cloneMsg->Send();
fKey = nil;
fMod = nil;
}
}
void pfMarkerInfo::SetType(pfMarkerInfo::MarkerType type)
{
if (fType == kMarkerLocalSelected)
IPlayBounce(false);
IPlayColor(false);
fType = type;
IPlayColor(true);
if (fType == kMarkerLocalSelected)
IPlayBounce(true);
}
void pfMarkerInfo::IPlayBounce(bool play)
{
if (fMod && fSpawned)
{
// Send anim start/stop msg
plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg;
animMsg->SetCmd(play ? plAnimCmdMsg::kContinue : plAnimCmdMsg::kStop);
animMsg->SetCmd(plAnimCmdMsg::kSetLooping);
animMsg->SetCmd(plAnimCmdMsg::kGoToBegin);
animMsg->SetSender(pfMarkerMgr::Instance()->GetKey());
animMsg->Send(fMod->fBounceAnimKey);
}
}
void pfMarkerInfo::IPlayColor(bool play)
{
if (fMod && fSpawned)
{
// Play the correct color anim
plKey key = nil;
switch (fType)
{
case kMarkerOpen:
case kMarkerLocal:
case kMarkerLocalSelected:
key = fMod->fOpenAnimKey;
break;
case kMarkerGreen:
key = fMod->fGreenAnimKey;
break;
case kMarkerRed:
key = fMod->fRedAnimKey;
break;
}
plAnimCmdMsg* animMsg = TRACKED_NEW plAnimCmdMsg;
animMsg->SetCmd(play ? plAnimCmdMsg::kContinue : plAnimCmdMsg::kStop);
animMsg->SetCmd(plAnimCmdMsg::kSetLooping);
animMsg->SetCmd(plAnimCmdMsg::kGoToBegin);
animMsg->SetSender(pfMarkerMgr::Instance()->GetKey());
animMsg->AddReceiver(key);
animMsg->Send();
}
}
void pfMarkerInfo::IPlaySound(bool place)
{
if (fMod && fSpawned)
{
const plAudioInterface* ai = fMod->GetTarget()->GetAudioInterface();
plSoundMsg* msg = TRACKED_NEW plSoundMsg;
msg->fIndex = place ? fMod->fPlaceSndIdx : fMod->fHitSndIdx;
msg->SetCmd(plSoundMsg::kPlay);
msg->SetSender(pfMarkerMgr::Instance()->GetKey());
msg->Send(ai->GetKey());
}
}

View File

@ -0,0 +1,100 @@
/*==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 pfMarkerInfo_h_inc
#define pfMarkerInfo_h_inc
#include "../pnKeyedObject/plKey.h"
#include "../pnKeyedObject/plUoid.h"
#include "hsGeometry3.h"
class plMessage;
class plGameMarkerModifier;
class pfMarkerInfo
{
public:
enum MarkerType { kMarkerOpen, kMarkerGreen, kMarkerRed, kMarkerLocal, kMarkerLocalSelected };
protected:
// MarkerMgr will set this up
static plUoid fMarkerUoid;
plKey fKey;
plGameMarkerModifier* fMod;
hsPoint3 fPosition;
MarkerType fType;
double fLastChange; // Last time this marker changed hands
bool fVisible;
bool fIsNew;
bool fSpawned;
void IPlayBounce(bool play);
void IPlayColor(bool play);
void IPlaySound(bool place);
public:
pfMarkerInfo(const hsPoint3& pos, bool isNew);
~pfMarkerInfo() {}
static void Init();
plKey GetKey() { return fKey; }
void Spawn(MarkerType type);
void InitSpawned(plKey markerKey);
void Remove();
void Update(double curTime);
void Show(bool show);
bool IsVisible() { return fVisible; }
void SetType(pfMarkerInfo::MarkerType type);
pfMarkerInfo::MarkerType GetType() { return fType; }
void SetFrozen(double freezeStartTime);
bool IsFrozen() { return fLastChange != 0; }
void PlayHitSound() { IPlaySound(false); }
};
#endif // pfMarkerInfo_h_inc

View File

@ -0,0 +1,329 @@
/*==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 "pfMarkerMgr.h"
#include "../pfMessage/pfMarkerMsg.h"
#include "pfMarkerInfo.h"
#include "../plModifier/plCloneSpawnModifier.h"
#include "../plStatusLog/plStatusLog.h"
#include "../plMessage/plLoadCloneMsg.h"
#include "../pnMessage/plTimeMsg.h"
#include "../pnMessage/plNotifyMsg.h"
#include "../plNetClient/plNetClientMgr.h"
#include "plgDispatch.h"
////////////////////////////////////////////////////////////////////////////////
pfMarkerMgr* pfMarkerMgr::fInstance = nil;
const UInt32 pfMarkerMgr::kNoMarkerSelected = (UInt32)(-1);
pfMarkerMgr* pfMarkerMgr::Instance()
{
if (!pfMarkerMgr::fInstance)
{
pfMarkerMgr::fInstance = TRACKED_NEW pfMarkerMgr;
pfMarkerMgr::fInstance->IInit();
}
return pfMarkerMgr::fInstance;
}
void pfMarkerMgr::Shutdown()
{
if (pfMarkerMgr::fInstance)
{
pfMarkerMgr::fInstance->IShutdown();
pfMarkerMgr::fInstance = nil;
}
}
////////////////////////////////////////////////////////////////////////////////
pfMarkerMgr::pfMarkerMgr(): fSelectedMarker(kNoMarkerSelected), fShowingLocalMarkers(false), fMarkersRespawn(false)
{
fLog = plStatusLogMgr::GetInstance().CreateStatusLog(20, "Marker.log", plStatusLog::kAlignToTop | plStatusLog::kFilledBackground);
pfMarkerInfo::Init();
}
pfMarkerMgr::~pfMarkerMgr()
{
delete fLog;
}
void pfMarkerMgr::IInit()
{
fMyKey = RegisterAs(kMarkerMgr_KEY);
plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
}
void pfMarkerMgr::IShutdown()
{
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
while (curMarker != fMarkers.end())
{
curMarker->second->Remove();
DEL(curMarker->second);
++curMarker;
}
fMarkers.clear();
plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey());
UnRegisterAs(kMarkerMgr_KEY);
}
pfMarkerInfo* pfMarkerMgr::IFindMarker(plKey markerKey, UInt32& id)
{
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
while (curMarker != fMarkers.end())
{
if (curMarker->second->GetKey() == markerKey)
{
id = curMarker->first;
return curMarker->second;
}
++curMarker;
}
id = kNoMarkerSelected;
return nil;
}
void pfMarkerMgr::IUpdate()
{
// Update all markers
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
while (curMarker != fMarkers.end())
{
curMarker->second->Update(hsTimer::GetSeconds());
++curMarker;
}
}
void pfMarkerMgr::IMarkerHit(plKey markerKey, plKey playerKey)
{
if (playerKey != plNetClientMgr::GetInstance()->GetLocalPlayerKey())
return; // not the local player, abort
// make sure the marker isn't frozen
UInt32 id;
pfMarkerInfo* hitMarker = IFindMarker(markerKey, id);
if (!hitMarker)
return; // abort, something weird is going on
if (hitMarker->IsFrozen())
return; // marker frozen, abort
// tell people about it
pfMarkerMsg* msg = TRACKED_NEW pfMarkerMsg;
msg->fType = pfMarkerMsg::kMarkerCaptured;
msg->fMarkerID = id;
msg->Send();
}
void pfMarkerMgr::AddMarker(double x, double y, double z, UInt32 id, bool justCreated)
{
if (fMarkers.find(id) != fMarkers.end())
{
// delete existing one if we're changing its location
fMarkers[id]->Remove();
DEL(fMarkers[id]);
}
hsPoint3 pos((hsScalar)x, (hsScalar)y, (hsScalar)z);
fMarkers[id] = TRACKED_NEW pfMarkerInfo(pos, justCreated);
fMarkers[id]->Spawn(pfMarkerInfo::kMarkerOpen);
}
void pfMarkerMgr::RemoveMarker(UInt32 id)
{
if (fMarkers.find(id) == fMarkers.end())
return;
fMarkers[id]->Remove();
DEL(fMarkers[id]);
fMarkers.erase(id);
}
void pfMarkerMgr::RemoveAllMarkers()
{
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
while (curMarker != fMarkers.end())
{
curMarker->second->Remove();
DEL(curMarker->second);
++curMarker;
}
fMarkers.clear();
}
void pfMarkerMgr::ClearSelectedMarker()
{
if (fSelectedMarker != kNoMarkerSelected)
{
if (fMarkers.find(fSelectedMarker) != fMarkers.end())
fMarkers[fSelectedMarker]->SetType(pfMarkerInfo::kMarkerOpen);
fSelectedMarker = kNoMarkerSelected;
}
}
void pfMarkerMgr::SetSelectedMarker(UInt32 id)
{
ClearSelectedMarker();
if (id != kNoMarkerSelected)
{
if (fMarkers.find(id) != fMarkers.end())
{
fMarkers[id]->SetType(pfMarkerInfo::kMarkerLocalSelected);
fSelectedMarker = id;
}
}
}
UInt32 pfMarkerMgr::GetSelectedMarker()
{
return fSelectedMarker;
}
// for QUEST games (no teams)
void pfMarkerMgr::CaptureMarker(UInt32 id, bool captured)
{
if (fMarkers.find(id) == fMarkers.end())
return;
if (fMarkersRespawn)
fMarkers[id]->SetFrozen(hsTimer::GetSeconds());
else
fMarkers[id]->Show(!captured);
fMarkers[id]->PlayHitSound();
fMarkers[id]->SetType(captured ? pfMarkerInfo::kMarkerGreen : pfMarkerInfo::kMarkerOpen);
}
// for TEAM games (0 = not captured)
void pfMarkerMgr::CaptureMarker(UInt32 id, int team)
{
if (fMarkers.find(id) == fMarkers.end())
return;
if (fMarkersRespawn)
fMarkers[id]->SetFrozen(hsTimer::GetSeconds());
else
fMarkers[id]->Show(team == 0); // 0 = uncaptured
fMarkers[id]->PlayHitSound();
if (team == 0)
fMarkers[id]->SetType(pfMarkerInfo::kMarkerOpen);
else if (team == 1)
fMarkers[id]->SetType(pfMarkerInfo::kMarkerGreen);
else
fMarkers[id]->SetType(pfMarkerInfo::kMarkerRed);
}
void pfMarkerMgr::LocalShowMarkers(bool show)
{
fShowingLocalMarkers = show;
if (show)
{
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
while (curMarker != fMarkers.end())
curMarker->second->Show(true);
}
else
{
std::map<UInt32, pfMarkerInfo*>::iterator curMarker = fMarkers.begin();
while (curMarker != fMarkers.end())
curMarker->second->Show(false);
}
}
bool pfMarkerMgr::AreLocalMarkersShowing()
{
return fShowingLocalMarkers;
}
hsBool pfMarkerMgr::MsgReceive(plMessage* msg)
{
plEvalMsg* evalMsg = plEvalMsg::ConvertNoRef(msg);
if (evalMsg)
{
IUpdate();
return true;
}
// Somebody hit a marker
plNotifyMsg* notify = plNotifyMsg::ConvertNoRef(msg);
if (notify)
{
proCollisionEventData* cEvent = (proCollisionEventData*)notify->FindEventRecord(proEventData::kCollision);
if (cEvent)
{
plKey markerKey = cEvent->fHittee;
plKey playerKey = cEvent->fHitter;
if (plNetClientMgr::GetInstance()->IsAPlayerKey(cEvent->fHittee))
{
// swap the above, since the hittee is actually the player
playerKey = cEvent->fHittee;
markerKey = cEvent->fHitter;
}
IMarkerHit(markerKey, playerKey);
}
return true;
}
plLoadCloneMsg* cloneMsg = plLoadCloneMsg::ConvertNoRef(msg);
if (cloneMsg)
{
plKey cloneKey = cloneMsg->GetCloneKey();
if (cloneMsg->GetIsLoading() && cloneKey)
{
UInt32 id;
pfMarkerInfo* marker = IFindMarker(cloneKey, id);
marker->InitSpawned(cloneKey);
}
return true;
}
return hsKeyedObject::MsgReceive(msg);
}

View File

@ -0,0 +1,113 @@
/*==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 pfMarkerMgr_h_inc
#define pfMarkerMgr_h_inc
#include "../pnKeyedObject/hsKeyedObject.h"
#include <map>
class plStatusLog;
////////////////////////////////////////////////////////////////////////////////
class pfMarkerMsg;
class pfMarkerGame;
class pfMarkerInfo;
class pfMarkerMgr : public hsKeyedObject
{
protected:
friend class pfMarkerInfo;
friend class pfMarkerInfoOwned;
// Because for some reason if I ask for my key, the refs hit zero when I release it (0 initial refs?)
plKey fMyKey;
plStatusLog* fLog;
static pfMarkerMgr* fInstance;
bool fShowingLocalMarkers;
bool fMarkersRespawn;
UInt32 fSelectedMarker;
static const UInt32 kNoMarkerSelected;
std::map<UInt32, pfMarkerInfo*> fMarkers; // key is marker id number
void IInit();
void IShutdown();
pfMarkerInfo* IFindMarker(plKey markerKey, UInt32& id);
void IUpdate();
void IMarkerHit(plKey markerKey, plKey playerKey);
pfMarkerMgr();
~pfMarkerMgr();
public:
CLASSNAME_REGISTER(pfMarkerMgr);
GETINTERFACE_ANY(pfMarkerMgr, hsKeyedObject);
static pfMarkerMgr* Instance();
static void Shutdown();
hsBool MsgReceive(plMessage* msg);
void AddMarker(double x, double y, double z, UInt32 id, bool justCreated);
void RemoveMarker(UInt32 id);
void RemoveAllMarkers();
void ClearSelectedMarker();
void SetSelectedMarker(UInt32 id);
UInt32 GetSelectedMarker();
void SetMarkersRespawn(bool respawn) {fMarkersRespawn = respawn;}
bool GetMarkersRespawn() {return fMarkersRespawn;}
void CaptureMarker(UInt32 id, bool captured); // for QUEST games (no teams)
void CaptureMarker(UInt32 id, int team); // for TEAM games (0 = not captured)
// Shows your markers locally, so you can see where they are
void LocalShowMarkers(bool show = true);
bool AreLocalMarkersShowing();
};
#endif // pfMarkerMgr_h_inc

View File

@ -0,0 +1,626 @@
/*==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==*/
//#pragma warning(disable: 4503 4786)
//#define HK_HARDCORE
//
//#include <hkmath/vector3.h> // for havok Vector3
////#include <.//gpi/math/quaternion.h> // for havok Vector3
//#include <hkgeometry/geomdef.h> // for havok Vertex
//
//
//#include "hsTypes.h"
//#include "../plInterp/plController.h"
//#include "plPlayerModifier.h"
//#include "hsTimer.h"
//#include "../pnSceneObject/plSceneObject.h"
//#include "../pnSceneObject/plSimulationInterface.h"
//#include "../pnInputCore/plControlEventCodes.h"
//#include "../pnMessage/plTimeMsg.h"
//#include "../pnMessage/plWarpMsg.h"
//#include "../pnMessage/plCameraMsg.h"
//#include "../pnSceneObject/plCoordinateInterface.h"
//#include "plgDispatch.h"
//#include "../pfCamera/plCameraModifier.h"
//#include "hsResMgr.h"
//#include "../pnKeyedObject/plKey.h"
//#include "../plNetClient/plNetClientMgr.h"
//#include "../plModifier/plSpawnModifier.h"
//#include "../plMessage/plMatrixUpdateMsg.h"
//
//#include "../pnTimer/plTimerCallbackManager.h"
//#include "../plAudio/plAudioSystem.h"
//#include "../plMessage/plInputEventMsg.h"
//#include "../plMessage/plSpawnRequestMsg.h"
//#include "../plMessage/plSpawnModMsg.h"
//#include "../plMessage/plPlayerMsg.h"
//#include "../pnMessage/plAudioSysMsg.h"
//#include "../pfCamera/plCameraBrain.h"
//
//#include "../plHavok1/plHKPhysical.h"
//
//hsScalar plPlayerModifier::fTurnRate = 1.0f;
//hsScalar plPlayerModifier::fAcceleration = 80.0f;
//hsScalar plPlayerModifier::fDeceleration = 80.0f;
//hsScalar plPlayerModifier::fMaxVelocity = 200.0f;
//
//plPlayerModifier::plPlayerModifier() :
//bUseDesiredFacing(false),
//bUseDesiredMatrix(false)
//{
// fCurSpeed = 0.0f;
// fLastTime = 0.0;
// bMoving = false;
// fRotationScalar = 1.0f;
// bIgnoreDesiredMatrix = false;
// SetFlag( kWantsToSpawn );
//}
//
//plPlayerModifier::~plPlayerModifier()
//{
// for (int i = 0; i < fSpawnPoints.Count(); i++)
// delete fSpawnPoints[i];
// fSpawnPoints.SetCount(0);
//}
//
//// Adding RemoveTarget override of plSingleModifier to tell everyone we
//// told in AddTarget about our subject that he's gone now.
//void plPlayerModifier::RemoveTarget(plSceneObject* so)
//{
// if( fTarget && fTarget->IsLocallyOwned()==plSynchedObject::kYes )
// {
// plCameraMsg* pMsg = TRACKED_NEW plCameraMsg;
// pMsg->SetCmd(plCameraMsg::kSetSubject);
// pMsg->SetSubject(nil);
// pMsg->SetBCastFlag( plMessage::kBCastByExactType );
// plgDispatch::MsgSend(pMsg);
//
// plAudioSysMsg* pAudMsg1 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerCoordinateRefCamera);
// plAudioSysMsg* pAudMsg2 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerVelocityRefCamera);
// plAudioSysMsg* pAudMsg3 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerFacingRefCamera);
// plgDispatch::MsgSend(pAudMsg1);
// plgDispatch::MsgSend(pAudMsg2);
// plgDispatch::MsgSend(pAudMsg3);
// }
// plSingleModifier::RemoveTarget(so);
//}
//
//void plPlayerModifier::AddTarget(plSceneObject* so)
//{
// fTarget = so;
// plSimulationInterface * pSI = IGetTargetSimulationInterface(0); // so->GetSimulationInterface(); //
//
// plgDispatch::Dispatch()->RegisterForExactType(plEvalMsg::Index(), GetKey());
//
// // set the desired rotation vector...
//// hsAssert(fTarget->GetCoordinateInterface(), "Player modifier target has no coordinate interface");
//
// // These are now set in the component
//// if(pSI)
//// {
//// pSI->SetProperty(plSimulationInterface::kAffectLOS, false);
//// pSI->SetProperty(kUpright, true);
//// }
//
// //
// // setup for local player if necessary
// //
// int locallyOwned=so->IsLocallyOwned();
// if (locallyOwned==plSynchedObject::kMaybe) // don't know since we're still loading, defer
// SetFlag(kNeedsLocalSetup);
// else if (locallyOwned==plSynchedObject::kYes)
// IDoLocalSetup(so);
//}
//
//void plPlayerModifier::IDoLocalSetup(plSceneObject* so)
//{
// plCameraMsg* pMsg = TRACKED_NEW plCameraMsg;
// pMsg->SetCmd(plCameraMsg::kSetSubject);
// pMsg->SetSubject(so);
// pMsg->SetBCastFlag( plMessage::kBCastByExactType );
// plgDispatch::MsgSend(pMsg);
//
// // this is to solve the problem of physical vs nonphysical players...
//// plCameraMsg* pMsg2 = TRACKED_NEW plCameraMsg;
//// pMsg2->SetBCastFlag(plMessage::kBCastByExactType);
//// pMsg2->SetCmd(plCameraMsg::kSetOffset);
//// pMsg2->SetCmd(plCameraMsg::kEntering);
//// pMsg2->SetTriggerer(so->GetKey());
//// pMsg2->SetOffsetY(50);
//// pMsg2->SetOffsetZ(10);
//// plgDispatch::MsgSend(pMsg2);
//}
//
//void plPlayerModifier::IMakeUsListener( plSceneObject *so )
//{
// // set the listener to use us...
// plAudioSysMsg* pAudMsg1 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerFacingRef);
// pAudMsg1->SetSceneObject(so->GetKey());
// plAudioSysMsg* pAudMsg2 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerCoordinateRef);
// pAudMsg2->SetSceneObject(so->GetKey());
// plAudioSysMsg* pAudMsg3 = TRACKED_NEW plAudioSysMsg(plAudioSysMsg::kSetListenerVelocityRef);
// pAudMsg3->SetSceneObject(so->GetKey());
// plgDispatch::MsgSend(pAudMsg1);
// plgDispatch::MsgSend(pAudMsg2);
// plgDispatch::MsgSend(pAudMsg3);
//
// // Now that we have a valid listener, unmute the audio system
// plgAudioSys::SetMuted( false );
//}
//
//hsBool plPlayerModifier::MsgReceive(plMessage* msg)
//{
// plControlEventMsg* pCommandMsg = plControlEventMsg::ConvertNoRef(msg);
// if (pCommandMsg)
// return(HandleControlInput(pCommandMsg));
//
// plMatrixUpdateMsg* pMMsg = plMatrixUpdateMsg::ConvertNoRef( msg );
// if (pMMsg && HasFlag(kHasSpawned))
// {
// hsAssert(GetTarget()->IsLocallyOwned()==plSynchedObject::kNo, "master objects should not get correction msgs");
// fDesiredMatrix = pMMsg->fMatrix;
// if (bIgnoreDesiredMatrix)
// bIgnoreDesiredMatrix = false;
// else
// {
// bUseDesiredMatrix = true;
// }
// return true;
// }
//
// plSpawnModMsg* pSpawn = plSpawnModMsg::ConvertNoRef(msg);
// if (pSpawn && HasFlag(kWantsToSpawn))
// {
// spawnPt* pt = TRACKED_NEW spawnPt;
// pt->pt = pSpawn->fPos;
//
// hsVector3 temp(fTarget->GetCoordinateInterface()->GetLocalToWorld().GetTranslate() - pt->pt);
// pt->dist = temp.MagnitudeSquared();
// fSpawnPoints.Append(pt);
// }
// plPlayerMsg* pPMsg = plPlayerMsg::ConvertNoRef(msg);
// if (pPMsg)
// {
// if (pPMsg->Cmd(plPlayerMsg::kWarpToSpawnPoint))
// {
// WarpToSpawnPoint();
// return true;
// }
// }
// return plSingleModifier::MsgReceive(msg);
//}
//
//hsBool plPlayerModifier::HandleControlInput(plControlEventMsg* pMsg)
//{
// hsBool ret=false;
//
// if (pMsg->ControlActivated() && (pMsg->GetControlCode() == B_CONTROL_ROTATE_RIGHT || pMsg->GetControlCode() == B_CONTROL_ROTATE_LEFT || pMsg->GetControlCode() == A_CONTROL_TURN))
// {
// fRotationScalar = pMsg->GetPct();
// if ( HasMovementFlag( pMsg->GetControlCode() ) )
// bIgnoreDesiredMatrix = true;
// }
// if (pMsg->ControlActivated() && !HasMovementFlag( pMsg->GetControlCode() ) )
// {
// SetMovementFlag( pMsg->GetControlCode() );
// if ( pMsg->GetControlCode() == B_CONTROL_TURN_TO )
// {
// //fFacingTarget = pMsg->GetTurnToPt();
// }
// }
// else
// if ( !pMsg->ControlActivated() && HasMovementFlag( pMsg->GetControlCode() ) )
// {
// ClearMovementFlag( pMsg->GetControlCode() );
// }
//
// ret = true;
// return ret;
//}
//
//void plPlayerModifier::SetMoving(hsBool b)
//{
// if (b != bMoving)
// {
// plPlayerMsg* pMsg = TRACKED_NEW plPlayerMsg;
//
// if (b)
// pMsg->SetCmd( plPlayerMsg::kMovementStarted );
// else
// pMsg->SetCmd( plPlayerMsg::kMovementStopped );
//
// plgDispatch::MsgSend( pMsg );
// bMoving = b;
// }
//}
//
//
//hsPoint3 forceForward(0,-200,0);
//hsPoint3 forceRight(-200,0,0);
//hsPoint3 forceUp(0,0,15);
//
//hsBool plPlayerModifier::IEval(double secs, hsScalar del, UInt32 dirty)
//{
// // setup for local player if necessary
// if (HasFlag(kNeedsLocalSetup))
// {
// int locallyOwned=fTarget->IsLocallyOwned();
// if (locallyOwned==plSynchedObject::kYes)
// IDoLocalSetup(fTarget);
// else
// if (locallyOwned==plSynchedObject::kNo)
// ClearFlag(kNeedsLocalSetup);
// }
//
// if (HasFlag(kWantsToSpawn))
// {
// if (fTarget->IsLocallyOwned()==plSynchedObject::kNo)
// {
// // if our target is a proxy player, don't warp him to a spawn point;
// // we will receive his location as a state update.
// ClearFlag(kWantsToSpawn);
// }
// else
// if (fSpawnPoints.Count()
// // if MP game, make sure we're connected before spawning
// && (!plNetClientMgr::GetInstance()->IsEnabled() ||
// plNetClientMgr::GetInstance()->HasJoined())
// )
// {
// int i;
//#if 0
// for (i = 0; i < fSpawnPoints.Count(); i++)
// {
// for (int j = i + 1; j < fSpawnPoints.Count(); j++)
// {
// if (fSpawnPoints[j]->dist < fSpawnPoints[i]->dist)
// {
// spawnPt* pt;
// pt = fSpawnPoints[j];
// fSpawnPoints[j] = fSpawnPoints[i];
// fSpawnPoints[i] = pt;
// }
// }
// }
// hsPoint3 warpPoint = fSpawnPoints[0]->pt;
//#else
// // choose spawnPoint based on netID, not distance
// int netID = plNetClientMgr::GetInstance()->GetClientNum();
// if (netID==-1)
// netID=0;
// hsPoint3 warpPoint = netID>=fSpawnPoints.Count() ?
// fSpawnPoints[fSpawnPoints.Count()-1]->pt : fSpawnPoints[netID]->pt;
//#endif
// // Send msg for net synchronization
// plWarpMsg* warpMsg = TRACKED_NEW plWarpMsg;
// warpMsg->fPos = warpPoint;
// warpMsg->AddReceiver( fTarget->GetKey() );
// warpMsg->SetWarpFlags(warpMsg->GetWarpFlags() | plWarpMsg::kFlushTransform | plWarpMsg::kZeroVelocity );
// plgDispatch::MsgSend( warpMsg );
//#ifdef HS_DEBUGGING
// char str[256];
// sprintf(str, "%s has %d spawnPoints. Using pt %f %f %f\n",
// GetKeyName(), fSpawnPoints.GetCount(),
// fSpawnPoints[0]->pt.fX,fSpawnPoints[0]->pt.fY,fSpawnPoints[0]->pt.fZ);
// hsStatusMessage(str);
//#endif
// for (i = 0; i < fSpawnPoints.Count(); i++)
// delete fSpawnPoints[i];
//
// fSpawnPoints.SetCount(0);
// ClearFlag(kWantsToSpawn);
// }
// else
// {
// plSpawnRequestMsg* pMsg = TRACKED_NEW plSpawnRequestMsg;
// pMsg->SetSender(GetKey());
// plgDispatch::MsgSend( pMsg );
// }
// bIgnoreDesiredMatrix = true;
// return true;
// }
// else
// {
// if( !HasFlag( kHasSpawned ) )
// {
// // Don't make us listener until we have actually spawned
// IMakeUsListener( fTarget );
// SetFlag(kHasSpawned);
// }
// }
//
// if (!fTarget->GetCoordinateInterface())
// return true;
//
// // update our desired position:
//// hsScalar eTime = secs - fLastTime;
// hsScalar eTime = hsTimer::GetDelSysSeconds();
//
// hsPoint3 newLinearForce(0,0,0);
//
// hsMatrix44 targetMatrix;
// if (bUseDesiredMatrix)
// targetMatrix = fDesiredMatrix;
// else
// targetMatrix = fTarget->GetCoordinateInterface()->GetLocalToWorld();
// hsPoint3 playerPos = targetMatrix.GetTranslate();
// hsVector3 view, up, right;
// targetMatrix.GetAxis(&view, &up, &right);
//
// hsScalar speed = fMaxVelocity;
// hsScalar turn = fTurnRate;
//
// if (HasMovementFlag(B_CONTROL_MODIFIER_FAST))
// {
// turn *= 0.25;
// speed *= 3.5;
// }
// if (HasMovementFlag(B_CONTROL_MOVE_FORWARD))
// {
// playerPos += view * speed * eTime;
// newLinearForce = newLinearForce + forceForward * speed * eTime; // calc force for physics
// }
// if (HasMovementFlag(B_CONTROL_MOVE_BACKWARD))
// {
// playerPos += view * speed * eTime * -1;
// newLinearForce = newLinearForce + forceForward * speed * eTime * -1; // calc force for physics
// }
// if (HasMovementFlag(B_CONTROL_STRAFE_LEFT))
// {
// playerPos += right * speed * eTime * -1;
//
// newLinearForce = newLinearForce + forceRight * speed * eTime * -1;
// }
// if (HasMovementFlag(B_CONTROL_STRAFE_RIGHT))
// {
// playerPos += right * speed * eTime;
//
// newLinearForce = newLinearForce + forceRight * speed * eTime;
// }
// if (HasMovementFlag(B_CONTROL_MOVE_DOWN))
// {
// playerPos += up * speed * eTime * -1;
//
// newLinearForce = newLinearForce + forceUp * speed * eTime * -1;
// }
// if (HasMovementFlag(B_CONTROL_MOVE_UP))
// {
// playerPos += up * speed * eTime;
//
// newLinearForce = newLinearForce + forceUp * speed * eTime;
// }
//
//
// fDesiredPosition = playerPos;
//
// // move toward our desired position...
//
// hsPoint3 curPos = targetMatrix.GetTranslate();
// hsPoint3 newPos;
//
// hsVector3 dir(fDesiredPosition - curPos);
// hsScalar distToGoal=dir.Magnitude();
//
// if (dir.MagnitudeSquared() > 0.0f)
// dir.Normalize();
//
// hsVector3 vel( view * fCurSpeed );
//
// IAdjustVelocity(fAcceleration, fDeceleration, &dir, &vel, fMaxVelocity, distToGoal, eTime);
// fCurSpeed = vel.Magnitude();
//
// hsScalar distMoved = IClampVelocity(&vel, fMaxVelocity, eTime);
//
// // compute final pos
// if (distMoved > distToGoal)
// newPos = fDesiredPosition;
// else
// newPos = curPos + vel;
//
// // calculate rotation matrix
//
// hsVector3 rotUp(0,0,1);
// hsVector3 rotRight(1,0,0);
// hsMatrix44 rot;
//
// if ( HasMovementFlag( B_CONTROL_TURN_TO ) )
// {
// // compute view goal
//
// hsVector3 fPlayerViewGoal(&fFacingTarget,&curPos);
// fPlayerViewGoal.fZ = 0;
// fPlayerViewGoal.Normalize();
//
// // compute degrees needed to turn left/right
// hsVector3 cross = fPlayerViewGoal % view;
// hsScalar dot = fPlayerViewGoal * view;
// hsScalar rad = hsACosine(dot);
// fRotationScalar = 1.0f;
//
// if (cross.fZ<0)
// {
// SetMovementFlag( B_CONTROL_ROTATE_LEFT );
// }
// else
// {
// SetMovementFlag( B_CONTROL_ROTATE_RIGHT );
// }
// if (dot >= 0.999f)
// {
// ClearMovementFlag( B_CONTROL_TURN_TO );
// ClearMovementFlag( B_CONTROL_ROTATE_RIGHT );
// ClearMovementFlag( B_CONTROL_ROTATE_LEFT );
// }
// }
//
// hsScalar angle = 0;
//
// if ( HasMovementFlag( B_CONTROL_ROTATE_RIGHT ) )
// {
// angle = fTurnRate * eTime * -1 * fRotationScalar;
// }
//
// if ( HasMovementFlag( B_CONTROL_ROTATE_LEFT ) || HasMovementFlag( A_CONTROL_TURN ) )
// {
// angle = fTurnRate * eTime * fRotationScalar;
// }
//
// hsMatrix44 justRot(targetMatrix);
// hsPoint3 zero(0,0,0);
// justRot.SetTranslate(&zero);
//
// if(angle) {
// hsQuat q(angle, &rotUp);
// q.NormalizeIfNeeded();
// q.MakeMatrix(&rot);
//
// justRot = rot * justRot;
//
// targetMatrix = rot * targetMatrix;
// }
//
// // use the desired rotation matrix to set position and rotation:
//
//
// plSimulationInterface * SI = IGetTargetSimulationInterface(0);
//
// if(SI)
// {
// Havok::Vector3 hkLocalForce(newLinearForce.fX, newLinearForce.fY, newLinearForce.fZ);
// if (bUseDesiredMatrix)
// {
// hsMatrix44 inv;
//
// fDesiredMatrix.GetInverse(&inv);
//
// // we're just going to set the position on the simulation interface directly
// // because it will then be further modified by the simulation and its final position
// // will *then* be sent to the coordinate interface
// SI->SetTransform(fDesiredMatrix, inv);
// }
//
// SI->SetRotation(justRot);//rot);
// SI->ApplyForce(plSimulationInterface::kForce, hkLocalForce);
// } else {
// hsMatrix44 inv;
// targetMatrix.SetTranslate(&newPos);
// targetMatrix.GetInverse(&inv);
//
// plCoordinateInterface* pCI = pCI = IGetTargetCoordinateInterface(0);
// pCI->SetTransform(targetMatrix, inv);
//
//
// }
//
// fLastTime = secs;
// SetMoving(fCurSpeed);
//
// if (bUseDesiredMatrix)
// bUseDesiredMatrix = false;
// return true;
//}
//
////
//// vector version. dir vector should be normalized
////
//void plPlayerModifier::IAdjustVelocity(hsScalar adjAccelRate, hsScalar adjDecelRate,
// hsVector3* dir, hsVector3* vel, hsScalar maxSpeed,
// hsScalar distToGoal, double elapsedTime)
//{
// hsScalar speed = vel->Magnitude(); // save current speed
// *vel = *dir * speed; // change vel to correct dir
//
// // compute accel/decel
// hsScalar finalAccelRate;
// if (IShouldDecelerate(adjDecelRate, speed, distToGoal))
// {
// finalAccelRate = -adjDecelRate;
// }
// else
// {
// finalAccelRate = adjAccelRate;
// }
//
// if (finalAccelRate != 0)
// {
// // compute accel vector in the direction of the goal
// hsVector3 accelVec = *dir * finalAccelRate;
// accelVec = accelVec * elapsedTime;
//
// // add acceleration to velocity
// *vel = *vel + accelVec;
// }
// else
// {
// *vel = *dir * maxSpeed;
// }
//}
//
//hsScalar plPlayerModifier::IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime)
//{
// *vel = *vel * elapsedTime;
// maxSpeed *= elapsedTime;
//
// // clamp speed (clamp if going negative?)
// hsScalar distMoved = vel->Magnitude();
// if (distMoved > maxSpeed)
// {
// vel->Normalize();
// *vel = *vel * maxSpeed;
// return maxSpeed;
// }
// return distMoved;
//}
//
//hsBool32 plPlayerModifier::IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal)
//{
// if (decelSpeed == 0)
// // no deceleration
// return false;
//
// // compute distance required to stop, given decel speed (in units/sec sq)
// hsScalar stopTime = curSpeed / decelSpeed;
// hsScalar avgSpeed = curSpeed * .5f;
// hsScalar stopDist = avgSpeed * stopTime;
//
// return (hsABS(distToGoal) <= hsABS(stopDist)); // stopDist+avgSpeed?
//}
//

View File

@ -0,0 +1,149 @@
/*==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 plPlayerModifier_inc
//#define plPlayerModifier_inc
//
//#include "../pnModifier/plSingleModifier.h"
//#include "../pnSceneObject/plSimulationInterface.h"
//#include "hsMatrix44.h"
//
//class plControlEventMsg;
//
//namespace Havok {
// class Vector3;
//}
//
//class plPlayerModifier : public plSingleModifier
//{
//protected:
//
// enum
// {
// kWantsToSpawn = 0,
// kTimerSet,
// kHasSpawned,
// kNeedsLocalSetup
// };
//
// struct spawnPt
// {
// hsPoint3 pt;
// hsScalar dist;
// };
//
// static hsScalar fTurnRate;
//
// static hsScalar fAcceleration;
// static hsScalar fDeceleration;
// static hsScalar fMaxVelocity;
// hsScalar fCurSpeed;
//
//
// double fLastTime;
// hsMatrix44 fDesiredMatrix;
//
// hsPoint3 fDesiredPosition;
// hsPoint3 fFacingTarget;
// bool bUseDesiredFacing;
// bool bUseDesiredMatrix;
// bool bIgnoreDesiredMatrix;
//
// hsScalar fRotationScalar;
// hsTArray<spawnPt*> fSpawnPoints;
//
// void IAdjustVelocity(hsScalar adjAccelRate,
// hsScalar adjDecelRate,
// hsVector3* dir,
// hsVector3* vel,
// hsScalar maxSpeed,
// hsScalar distToGoal,
// double elapsedTime);
//
// hsScalar IClampVelocity(hsVector3* vel, hsScalar maxSpeed, double elapsedTime);
// hsBool32 IShouldDecelerate(hsScalar decelSpeed, hsScalar curSpeed, hsScalar distToGoal);
//
// hsBool HasMovementFlag(int f) const { return fMoveFlags.IsBitSet(f); }
// void SetMovementFlag(int f) { fMoveFlags.SetBit(f); }
// void ClearMovementFlag(int which) { fMoveFlags.ClearBit( which ); }
//
// hsBitVector fMoveFlags;
// hsBitVector fFlags;
//
// void WarpToSpawnPoint() { SetFlag( kWantsToSpawn ); }
//
// hsBool bMoving;
//
// void IApplyForce(plSimulationInterface::plSimpleForce type, const Havok::Vector3 &vec);
// void IDoLocalSetup(plSceneObject*);
// void IMakeUsListener( plSceneObject *so );
//
//public:
// plPlayerModifier();
// virtual ~plPlayerModifier();
//
// CLASSNAME_REGISTER( plPlayerModifier );
// GETINTERFACE_ANY( plPlayerModifier, plSingleModifier );
//
// virtual hsBool MsgReceive(plMessage* msg);
// virtual void AddTarget(plSceneObject* so);
// virtual void RemoveTarget(plSceneObject* so);
//
// hsBool HandleControlInput(plControlEventMsg* pMsg);
// virtual hsBool IEval(double secs, hsScalar del, UInt32 dirty);
//
// void SetMoving(hsBool b);
// hsBool IsMoving() { return bMoving; }
//
// hsBool HasFlag(int f) const { return fFlags.IsBitSet(f); }
// void SetFlag(int f) { fFlags.SetBit(f); }
// void ClearFlag(int which) { fFlags.ClearBit( which ); }
//
// static void SetTurnRate(float f) {fTurnRate = f;}
// static void SetAcceleration(float f) {fAcceleration = f;}
// static void SetDeceleration(float f) {fDeceleration = f;}
// static void SetVelocity(float f) {fMaxVelocity = f;}
//
//
//};
//
//#endif plPlayerModifier_inc