1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin

This commit is contained in:
JWPlatt
2011-03-12 12:34:52 -05:00
commit a20a222fc2
3976 changed files with 1301355 additions and 0 deletions

View File

@ -0,0 +1,50 @@
/*==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/>.
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 plAttachMsg_inc
#define plAttachMsg_inc
#include "plRefMsg.h"
#include "hsStream.h"
class hsResMgr;
class plAttachMsg : public plRefMsg
{
public:
plAttachMsg() {}
// child is the plSceneObject being added as a child to the receiver. If rcv is not loaded, this will have no effect.
// flags should be either:
// plRefMsg::kOnRequest - I'm adding this child to the receiver
// plRefMsg::kOnRemove - I'm detaching this child from the receiver
plAttachMsg(const plKey &rcv, hsKeyedObject* child, UInt8 context, const plKey snd=nil) : plRefMsg(rcv, context) { SetSender(snd); SetRef(child); }
CLASSNAME_REGISTER( plAttachMsg );
GETINTERFACE_ANY( plAttachMsg, plRefMsg );
};
#endif // plAttachMsg_inc

View File

@ -0,0 +1,93 @@
/*==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/>.
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 plAudioSysMsg_inc
#define plAudioSysMsg_inc
#include "plMessage.h"
#include "hsStream.h"
#include "hsResMgr.h"
class plKey;
class plAudioSysMsg : public plMessage
{
int fAudFlag;
plKey pObj;
hsBool fBoolFlag;
public:
enum
{
kActivate = 0,
kDeActivate,
kDestroy,
kInitialize,
kPing,
kSetVol,
kMuteAll,
kUnmuteAll,
kRequestMuteState,
kChannelVolChanged,
kRegisteringSound,
kForceListUpdate
};
plAudioSysMsg() : pObj(nil){SetBCastFlag(plMessage::kBCastByExactType);}
plAudioSysMsg(const plKey &s) : pObj(nil){SetBCastFlag(plMessage::kBCastByExactType);SetSender(s);}
plAudioSysMsg(int i) : pObj(nil){fAudFlag = i; SetBCastFlag(plMessage::kBCastByExactType );}
plAudioSysMsg(const plKey &s,
const plKey &r,
const double* t) : pObj(nil){SetBCastFlag(plMessage::kBCastByExactType);}
~plAudioSysMsg(){;}
CLASSNAME_REGISTER( plAudioSysMsg );
GETINTERFACE_ANY( plAudioSysMsg, plMessage );
int GetAudFlag() { return fAudFlag; }
plKey GetSceneObject() { return pObj; }
void SetSceneObject(plKey &k) { pObj = k; }
hsBool GetBoolFlag() { return fBoolFlag; }
void SetBoolFlag( hsBool b ) { fBoolFlag = b; }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->WriteSwap(fAudFlag);
mgr->WriteKey(stream, pObj);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->ReadSwap(&fAudFlag);
pObj = mgr->ReadKey(stream);
}
};
#endif // plAudioSysMsg

View File

@ -0,0 +1,157 @@
/*==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/>.
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 "plCameraMsg.h"
#include "hsStream.h"
#include "hsResMgr.h"
#include "../pnKeyedObject/plKey.h"
//
//
// camera modifier message implementation
//
//
plCameraMsg::plCameraMsg() :
fNewCam(nil),
fTriggerer(nil),
fTransTime(0),
fSubject(nil),
fPipe(nil),
fConfig(nil),
fActivated(false)
{
}
plCameraMsg::plCameraMsg(const plKey &s, const plKey &r, const double* t) :
fNewCam(nil),
fTriggerer(nil),
fTransTime(0),
fSubject(nil),
fPipe(nil),
fConfig(nil),
fActivated(false),
plMessage(s, r, t)
{
}
// IO
void plCameraMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream);
fTransTime = stream->ReadSwapDouble();
fActivated = stream->ReadBool();
fNewCam = mgr->ReadKey(stream);
fTriggerer = mgr->ReadKey(stream);
fConfig.Read(stream);
}
void plCameraMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream);
stream->WriteSwapDouble(fTransTime);
stream->WriteBool(fActivated);
mgr->WriteKey(stream, fNewCam);
mgr->WriteKey(stream, fTriggerer);
fConfig.Write(stream);
}
void plCameraConfig::Read(hsStream* stream)
{
fAccel = stream->ReadSwapFloat();
fDecel = stream->ReadSwapFloat();
fVel = stream->ReadSwapFloat();
fFPAccel = stream->ReadSwapFloat();
fFPDecel = stream->ReadSwapFloat();
fFPVel = stream->ReadSwapFloat();
fFOVw = stream->ReadSwapFloat();
fFOVh = stream->ReadSwapFloat();
fOffset.fX = stream->ReadSwapFloat();
fOffset.fY = stream->ReadSwapFloat();
fOffset.fZ = stream->ReadSwapFloat();
fWorldspace = stream->ReadBool();
}
void plCameraConfig::Write(hsStream* stream)
{
stream->WriteSwapFloat(fAccel);
stream->WriteSwapFloat(fDecel);
stream->WriteSwapFloat(fVel);
stream->WriteSwapFloat(fFPAccel);
stream->WriteSwapFloat(fFPDecel);
stream->WriteSwapFloat(fFPVel);
stream->WriteSwapFloat(fFOVw);
stream->WriteSwapFloat(fFOVh);
stream->WriteSwapFloat(fOffset.fX);
stream->WriteSwapFloat(fOffset.fY);
stream->WriteSwapFloat(fOffset.fZ);
stream->WriteBool(fWorldspace);
}
// IO
void plCameraTargetFadeMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fSubject = mgr->ReadKey(stream);
fFadeOut = stream->ReadBool();
}
void plCameraTargetFadeMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fSubject);
stream->WriteBool(fFadeOut);
}
// IO
void plIfaceFadeAvatarMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fSubject = mgr->ReadKey(stream);
fFadeOut = stream->ReadBool();
fEnable = stream->ReadBool();
fDisable = stream->ReadBool();
}
void plIfaceFadeAvatarMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fSubject);
stream->WriteBool(fFadeOut);
stream->WriteBool(fEnable);
stream->WriteBool(fDisable);
}

View File

@ -0,0 +1,245 @@
/*==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/>.
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 plCameraMsg_inc
#define plCameraMsg_inc
//
// camera message class
//
#include "../pnMessage/plMessage.h"
#include "hsBitVector.h"
#include "hsGeometry3.h"
class plSceneObject;
class plPipeline;
class hsStream;
class hsResMgr;
class plCameraConfig
{
public:
plCameraConfig() :
fAccel(0),fDecel(0),
fVel(0),fFPAccel(0),
fFPDecel(0),fFPVel(0),
fFOVw(0),fFOVh(0),fType(0),fWorldspace(false){fOffset.Set(0,0,0);}
plCameraConfig(int flags) :
fAccel(0),fDecel(0),
fVel(0),fFPAccel(0),
fFPDecel(0),fFPVel(0),
fFOVw(0),fFOVh(0),fType(0),fWorldspace(false) { fType |= flags;fOffset.Set(0,0,0);}
enum
{
kOffset = 0x0001,
kSpeeds = 0x0002,
kFOV = 0x0004,
};
int fType;
hsPoint3 fOffset;
hsScalar fAccel;
hsScalar fDecel;
hsScalar fVel;
hsScalar fFPAccel;
hsScalar fFPDecel;
hsScalar fFPVel;
hsScalar fFOVw, fFOVh;
hsBool fWorldspace;
void Read(hsStream* stream);
void Write(hsStream* stream);
};
class plCameraTargetFadeMsg : public plMessage
{
protected:
plKey fSubject;
hsBool fFadeOut;
public:
plKey GetSubjectKey() { return fSubject; }
void SetSubjectKey(const plKey &x) { fSubject = x; }
hsBool FadeOut() { return fFadeOut; }
void SetFadeOut(hsBool b) { fFadeOut = b; }
plCameraTargetFadeMsg(){;}
plCameraTargetFadeMsg(const plKey &s,
const plKey &r,
const double* t){;}
CLASSNAME_REGISTER( plCameraTargetFadeMsg );
GETINTERFACE_ANY( plCameraTargetFadeMsg, plMessage );
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
class plCameraMsg : public plMessage
{
protected:
plKey fNewCam;
plKey fTriggerer;
double fTransTime;
plSceneObject* fSubject;
plPipeline* fPipe;
plCameraConfig fConfig;
hsBool fActivated;
public:
plKey GetNewCam() { return fNewCam; }
plKey GetTriggerer() { return fTriggerer; }
double GetTransTime() { return fTransTime; }
plSceneObject* GetSubject() { return fSubject; }
plPipeline* GetPipeline() { return fPipe; }
hsBool GetActivated() { return fActivated; }
plCameraConfig* GetConfig() { return &fConfig; }
void SetNewCam(const plKey &x) { fNewCam = x; }
void SetTriggerer(const plKey &x) { fTriggerer = x; }
void SetTransTime(double x) { fTransTime = x; }
void SetSubject(plSceneObject* x) { fSubject = x; }
void SetPipeline(plPipeline* x) { fPipe = x; }
void SetActivated(hsBool x) { fActivated = x; }
plCameraMsg();
plCameraMsg(const plKey &s,
const plKey &r,
const double* t);
CLASSNAME_REGISTER( plCameraMsg );
GETINTERFACE_ANY( plCameraMsg, plMessage );
enum ModCmds
{
kSetSubject = 0,
kCameraMod,
kSetAsPrimary,
kTransitionTo,
kPush,
kPop,
// kSetOffset,
// kRegionOffset,
kEntering,
// kSetFirstPerson,
// kRegionFirstPerson,
// kRegionPush,
kCut,
// kModDestroy,
kResetOnEnter,
kResetOnExit,
kChangeParams,
kWorldspace,
kCreateNewDefaultCam,
kRegionPushCamera,
kRegionPopCamera,
kRegionPushPOA,
kRegionPopPOA,
kFollowLocalPlayer,
kResponderTrigger,
kSetFOV,
kAddFOVKeyframe,
kStartZoomIn,
kStartZoomOut,
kStopZoom,
kSetAnimated,
kPythonOverridePush,
kPythonOverridePop,
kPythonOverridePushCut,
kPythonSetFirstPersonOverrideEnable,
kPythonUndoFirstPerson,
kUpdateCameras,
kResponderSetThirdPerson,
kResponderUndoThirdPerson,
kNonPhysOn,
kNonPhysOff,
kResetPanning,
kNumCmds
};
hsBitVector fCmd;
hsBool Cmd(int n) { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
void ClearCmd(int n) { fCmd.ClearBit(n); }
// IO
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
class plIfaceFadeAvatarMsg : public plMessage
{
protected:
plKey fSubject;
hsBool fFadeOut;
hsBool fEnable, fDisable;
public:
plKey GetSubjectKey() { return fSubject; }
void SetSubjectKey(const plKey &x) { fSubject = x; }
hsBool FadeOut() { return fFadeOut; }
void SetFadeOut(hsBool b) { fFadeOut = b; }
void Enable() { fEnable = true; }
void Disable() { fDisable = true; }
hsBool GetEnable() { return fEnable; }
hsBool GetDisable() { return fDisable; }
plIfaceFadeAvatarMsg() : fEnable(false),fDisable(false){;}
plIfaceFadeAvatarMsg(const plKey &s,
const plKey &r,
const double* t): fEnable(false),fDisable(false){;}
CLASSNAME_REGISTER( plIfaceFadeAvatarMsg );
GETINTERFACE_ANY( plIfaceFadeAvatarMsg, plMessage );
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
#endif // plCameraMsg_inc

View File

@ -0,0 +1,50 @@
/*==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/>.
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 "plClientMsg.h"
void plClientMsg::IReset()
{
fMsgFlag = 0;
fAgeName = nil;
}
void plClientMsg::AddRoomLoc(plLocation loc)
{
if (loc.IsValid())
fRoomLocs.push_back(loc);
else
hsStatusMessage("Trying to load an invalid room, ignoring");
}
void plClientMsg::Read(hsStream* stream, hsResMgr* mgr)
{
hsAssert(0, "Shouldn't read a plClientMsg");
}
void plClientMsg::Write(hsStream* stream, hsResMgr* mgr)
{
hsAssert(0, "Shouldn't write a plClientMsg");
}

View File

@ -0,0 +1,153 @@
/*==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/>.
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 plClientMsg_inc
#define plClientMsg_inc
#include "../pnMessage/plMessage.h"
#include "../pnMessage/plRefMsg.h"
#include "hsStream.h"
#include "hsResMgr.h"
#include "hsUtils.h"
#include "hsStlUtils.h"
#include "../pnKeyedObject/plUoid.h"
//
// Handles various types of client (app) msgs, relating
// to loading rooms, players, camera, and progress bars
//
class plClientMsg : public plMessage
{
int fMsgFlag;
char* fAgeName;
std::vector<plLocation> fRoomLocs;
void IReset();
class GraphicsSettings
{
public:
GraphicsSettings() : fWidth (800), fHeight(600), fColorDepth(32), fWindowed(false), fNumAASamples(0),
fMaxAnisoSamples(0), fVSync(false) {}
int fWidth;
int fHeight;
int fColorDepth;
hsBool fWindowed;
int fNumAASamples;
int fMaxAnisoSamples;
hsBool fVSync;
};
public:
enum
{
kLoadRoom,
kLoadRoomHold,
kUnloadRoom,
kLoadNextRoom, // For internal client use only
kLoadAgeKeys,
kReleaseAgeKeys,
kQuit, // exit the app
kInitComplete,
kDisableRenderScene,
kEnableRenderScene,
kResetGraphicsDevice,
kSetGraphicsDefaults,
};
// graphics settings fields
GraphicsSettings fGraphicsSettings;
plClientMsg() { IReset();}
plClientMsg(const plKey &s) { IReset();}
plClientMsg(int i) { IReset(); fMsgFlag = i; }
plClientMsg(const plKey &s, const plKey &r, const double* t) { IReset(); }
~plClientMsg() { delete [] fAgeName; }
CLASSNAME_REGISTER(plClientMsg);
GETINTERFACE_ANY(plClientMsg, plMessage);
int GetClientMsgFlag() const { return fMsgFlag; }
void AddRoomLoc(plLocation loc);
// Used for kLoadAgeKeys, kLetGoOfAgeKeys only
const char* GetAgeName() const { return fAgeName; }
void SetAgeName(const char* age) { delete [] fAgeName; fAgeName = hsStrcpy(age); }
int GetNumRoomLocs() { return fRoomLocs.size(); }
const plLocation& GetRoomLoc(int i) const { return fRoomLocs[i]; }
const std::vector<plLocation>& GetRoomLocs() { return fRoomLocs; }
// IO
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
class plClientRefMsg : public plRefMsg
{
public:
enum
{
kLoadRoom = 0,
kLoadRoomHold,
kManualRoom,
};
plClientRefMsg(): fType(-1), fWhich(-1) {};
plClientRefMsg(const plKey &r, UInt8 refMsgFlags, Int8 which , Int8 type)
: plRefMsg(r, refMsgFlags), fType(type), fWhich(which) {}
CLASSNAME_REGISTER( plClientRefMsg );
GETINTERFACE_ANY( plClientRefMsg, plRefMsg );
Int8 fType;
Int8 fWhich;
// IO - not really applicable to ref msgs, but anyway
void Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadSwap(&fWhich);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap(fWhich);
}
};
#endif // plClientMsg

View File

@ -0,0 +1,87 @@
/*==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/>.
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 plCmdIfaceModMsg_inc
#define plCmdIfaceModMsg_inc
#include "plMessage.h"
#include "hsBitVector.h"
#include "hsResMgr.h"
#include "hsStream.h"
class plControlConfig;
class plCmdIfaceModMsg : public plMessage
{
protected:
public:
plCmdIfaceModMsg() : fInterface(nil), fIndex(0), fControlCode(0){SetBCastFlag(plMessage::kBCastByExactType);}
plCmdIfaceModMsg(const plKey* s,
const plKey* r,
const double* t) : fInterface(nil){;}
CLASSNAME_REGISTER( plCmdIfaceModMsg );
GETINTERFACE_ANY( plCmdIfaceModMsg, plMessage );
enum
{
kAdd = 0,
kRemove,
kPushInterface,
kPopInterface,
kIndexCallback,
kDisableMouseControls,
kEnableMouseControls,
kDisableControlCode,
kEnableControlCode,
kNumCmds
};
hsBitVector fCmd;
plControlConfig* fInterface;
UInt32 fControlCode;
int fIndex;
hsBool Cmd(int n) { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
void ClearCmd(int n) { fCmd.ClearBit(n); }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
}
};
#endif // plCmdIfaceModMsg_inc

View File

@ -0,0 +1,50 @@
/*==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/>.
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 plCollisionMsg_inc
#define plCollisionMsg_inc
#include "plMessage.h"
class hsStream;
class hsResMgr;
class plCollisionMsg : public plMessage
{
public:
plCollisionMsg() : plMessage() {}
plCollisionMsg(const plKey* s, const plKey* r);
CLASSNAME_REGISTER( plCollisionMsg );
GETINTERFACE_ANY( plCollisionMsg, plMessage );
// IO
void Read(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgRead(stream, mgr); }
void Write(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgWrite(stream, mgr); }
};
#endif // plCollisionMsg_inc

View 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/>.
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 plCorrectionMsg_inc
#define plCorrectionMsg_inc
#include "plMessage.h"
#include "hsMatrix44.h"
class plCorrectionMsg : public plMessage
{
public:
plCorrectionMsg() : plMessage(nil, nil, nil) { }
plCorrectionMsg(plKey &r, const hsMatrix44& l2w, const hsMatrix44& w2l, hsBool dirtySynch = false)
: plMessage(nil, r, nil),
fLocalToWorld(l2w),
fWorldToLocal(w2l),
fDirtySynch(dirtySynch)
{ }
CLASSNAME_REGISTER( plCorrectionMsg );
GETINTERFACE_ANY( plCorrectionMsg, plMessage );
hsMatrix44 fLocalToWorld;
hsMatrix44 fWorldToLocal;
hsBool fDirtySynch;
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fLocalToWorld.Read(stream);
fWorldToLocal.Read(stream);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fLocalToWorld.Write(stream);
fWorldToLocal.Write(stream);
}
};
#endif // plCorrectionMsg_inc

View File

@ -0,0 +1,91 @@
/*==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/>.
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 plCursorChangeMsg_inc
#define plCursorChangeMsg_inc
//
// this message is to fake out a gadget to see if it would potentially trigger...
//
#include "../pnMessage/plMessage.h"
#include "hsBitVector.h"
class hsStream;
class hsResMgr;
class plCursorChangeMsg : public plMessage
{
protected:
public:
plCursorChangeMsg() : fType(0),fPriority(0){;}
plCursorChangeMsg(int i, int p) { fType = i;fPriority =p; }
plCursorChangeMsg(const plKey &s,
const plKey &r,
const double* t) : fType(0),fPriority(0){;}
CLASSNAME_REGISTER( plCursorChangeMsg );
GETINTERFACE_ANY( plCursorChangeMsg, plMessage );
enum
{
kNoChange = 0,
kCursorUp,
kCursorLeft,
kCursorRight,
kCursorDown,
kCursorPoised,
kCursorClicked,
kCursorUnClicked,
kCursorHidden,
kCursorOpen,
kCursorGrab,
kCursorArrow,
kNullCursor
};
int fType;
int fPriority;
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fType = stream->ReadSwap32();
fPriority = stream->ReadSwap32();
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap32(fType);
stream->WriteSwap32(fPriority);
}
};
#endif // plCursorChangeMsg_inc

View File

@ -0,0 +1,60 @@
/*==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/>.
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 plDISpansMsg_inc
#define plDISpansMsg_inc
#include "plMessage.h"
#include "hsStream.h"
class hsKeyedObject;
class plDISpansMsg : public plMessage
{
public:
enum {
kAddingSpan,
kRemovingSpan
};
UInt8 fType;
enum {
kLeaveEmptyDrawable = 0x1
};
UInt8 fFlags;
Int32 fIndex;
plDISpansMsg() : plMessage(), fType(0), fFlags(0), fIndex(-1) {}
plDISpansMsg(const plKey &r, UInt8 type, int index, int flags) : plMessage(nil, r, nil), fType(type), fIndex(index), fFlags(flags) {}
CLASSNAME_REGISTER( plDISpansMsg );
GETINTERFACE_ANY( plDISpansMsg, plMessage );
void Read(hsStream* stream, hsResMgr* mgr) {}
void Write(hsStream* stream, hsResMgr* mgr) {}
};
#endif // plDISpansMsg_inc

View File

@ -0,0 +1,114 @@
/*==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/>.
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 plEnableMsg_inc
#define plEnableMsg_inc
#include "plMessage.h"
#include "hsBitVector.h"
class hsStream;
class plEnableMsg : public plMessage
{
public:
enum
{
kDisable = 0,
kEnable,
kDrawable,
kPhysical,
kAudible,
kAll,
kByType
};
hsBitVector fCmd;
hsBitVector fTypes;
hsBool Cmd(int n) const { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
void AddType(UInt16 t) { fTypes.SetBit(t); }
void RemoveType(UInt16 t) { fTypes.ClearBit(t); }
hsBool Type(UInt16 t) const { return fTypes.IsBitSet(t); }
const hsBitVector& Types() const { return fTypes; }
plEnableMsg() { }
plEnableMsg(const plKey &s, int which , int type) : plMessage()
{ SetCmd(which); SetCmd(type); }
CLASSNAME_REGISTER( plEnableMsg );
GETINTERFACE_ANY( plEnableMsg, plMessage );
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream);
fTypes.Read(stream);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream);
fTypes.Write(stream);
}
enum MsgContentFlags
{
kCmd,
kTypes,
};
void ReadVersion(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgReadVersion(stream, mgr);
hsBitVector contentFlags;
contentFlags.Read(stream);
if (contentFlags.IsBitSet(kCmd))
fCmd.Read(stream);
if (contentFlags.IsBitSet(kTypes))
fTypes.Read(stream);
}
void WriteVersion(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWriteVersion(stream, mgr);
hsBitVector contentFlags;
contentFlags.SetBit(kCmd);
contentFlags.SetBit(kTypes);
contentFlags.Write(stream);
fCmd.Write(stream);
fTypes.Write(stream);
}
};
#endif // plEnableMsg_inc

View File

@ -0,0 +1,141 @@
/*==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/>.
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 "plEnvEffectMsg.h"
/* Die, die, everybody die!
// real-time effects (non environmental);
plAudioEffectMsg::plAudioEffectMsg() :
fEffect(0),
delayModPct(0),
feedbackPct(0),
lfOscillator(0),
feedbackDelay(0),
waveform(0),
phaseDifferential(0),
gainDB(0),
attack(0),
release(0),
compThreshhold(0),
compRatio(0),
attackPreDelay(0),
intensity(0),
effectCenter(0),
effectWidth(0),
lfCutoff(0),
leftFeedbackDelay(0),
rightFeedbackDelay(0),
swapLeftRightDelay(0),
modulationRate(0)
{
SetBCastFlag(plMessage::kPropagateToModifiers);
}
plAudioEffectMsg::plAudioEffectMsg(const plKey &s,const plKey &r,const double* t) :
fEffect(0),
wetDryPct(0),
delayModPct(0),
feedbackPct(0),
lfOscillator(0),
feedbackDelay(0),
waveform(0),
phaseDifferential(0),
gainDB(0),
attack(0),
release(0),
compThreshhold(0),
compRatio(0),
attackPreDelay(0),
intensity(0),
effectCenter(0),
effectWidth(0),
lfCutoff(0),
leftFeedbackDelay(0),
rightFeedbackDelay(0),
swapLeftRightDelay(0),
modulationRate(0)
{
SetBCastFlag(plMessage::kPropagateToModifiers);
}
// IO
void plAudioEffectMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plEnvEffectMsg::Read(stream, mgr);
stream->ReadSwap(&fEffect);
stream->ReadSwap(&wetDryPct);
stream->ReadSwap(&delayModPct);
stream->ReadSwap(&feedbackPct);
stream->ReadSwap(&lfOscillator);
stream->ReadSwap(&feedbackDelay);
stream->ReadSwap(&waveform);
stream->ReadSwap(&phaseDifferential);
stream->ReadSwap(&gainDB);
stream->ReadSwap(&attack);
stream->ReadSwap(&release);
stream->ReadSwap(&compThreshhold);
stream->ReadSwap(&compRatio);
stream->ReadSwap(&attackPreDelay);
stream->ReadSwap(&intensity);
stream->ReadSwap(&effectCenter);
stream->ReadSwap(&effectWidth);
stream->ReadSwap(&lfCutoff);
stream->ReadSwap(&leftFeedbackDelay);
stream->ReadSwap(&rightFeedbackDelay);
stream->ReadSwap(&swapLeftRightDelay);
stream->ReadSwap(&modulationRate);
}
void plAudioEffectMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plEnvEffectMsg::Write(stream, mgr);
stream->WriteSwap(fEffect);
stream->WriteSwap(wetDryPct);
stream->WriteSwap(delayModPct);
stream->WriteSwap(feedbackPct);
stream->WriteSwap(lfOscillator);
stream->WriteSwap(feedbackDelay);
stream->WriteSwap(waveform);
stream->WriteSwap(phaseDifferential);
stream->WriteSwap(gainDB);
stream->WriteSwap(attack);
stream->WriteSwap(release);
stream->WriteSwap(compThreshhold);
stream->WriteSwap(compRatio);
stream->WriteSwap(attackPreDelay);
stream->WriteSwap(intensity);
stream->WriteSwap(effectCenter);
stream->WriteSwap(effectWidth);
stream->WriteSwap(lfCutoff);
stream->WriteSwap(leftFeedbackDelay);
stream->WriteSwap(rightFeedbackDelay);
stream->WriteSwap(swapLeftRightDelay);
stream->WriteSwap(modulationRate);
}
*/

View File

@ -0,0 +1,214 @@
/*==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/>.
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 plEnvEffectMsg_inc
#define plEnvEffectMsg_inc
/* I'm dead, hear me cry
#include "../pnMessage/plMessage.h"
#include "hsStream.h"
class hsResMgr;
class plEnvEffectMsg : public plMessage
{
hsBool fEnable;
hsScalar fPriority;
public:
plEnvEffectMsg() : fPriority(1.0), fEnable( true ) { SetBCastFlag(plMessage::kPropagateToModifiers); }
plEnvEffectMsg(const plKey &s,
const plKey &r,
const double* t) : fPriority(1.0), fEnable( true ) {SetBCastFlag(plMessage::kPropagateToModifiers);}
~plEnvEffectMsg(){;}
CLASSNAME_REGISTER( plEnvEffectMsg );
GETINTERFACE_ANY( plEnvEffectMsg, plMessage );
hsBool Enabled() { return fEnable; }
void Enable(hsBool b) { fEnable = b; }
void SetPriority(hsScalar p) { fPriority = p; }
hsScalar GetPriority() { return fPriority; }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fEnable);
stream->ReadSwap(&fPriority);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fEnable);
stream->WriteSwap(fPriority);
}
};
class plEnvAudioEffectMsg : public plEnvEffectMsg
{
public:
int fPreset;
Int32 fRoomAtten, fRoomHFAtten;
hsScalar fRoomRolloffFactor;
hsScalar fDecayTime, fDecayHFRatio;
Int32 fReflect;
hsScalar fReflectDelay;
Int32 fReverb;
hsScalar fReverbDelay;
hsScalar fDiffusion, fDensity;
hsScalar fHFReference;
plEnvAudioEffectMsg(){SetBCastFlag(plMessage::kPropagateToModifiers);}
plEnvAudioEffectMsg(const plKey &s,
const plKey &r,
const double* t){SetBCastFlag(plMessage::kPropagateToModifiers);}
~plEnvAudioEffectMsg(){;}
CLASSNAME_REGISTER( plEnvAudioEffectMsg );
GETINTERFACE_ANY( plEnvAudioEffectMsg, plEnvEffectMsg );
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plEnvEffectMsg::Read(stream, mgr);
stream->ReadSwap(&fPreset);
stream->ReadSwap( &fRoomAtten );
stream->ReadSwap( &fRoomHFAtten );
stream->ReadSwap( &fRoomRolloffFactor );
stream->ReadSwap( &fDecayTime );
stream->ReadSwap( &fDecayHFRatio );
stream->ReadSwap( &fReflect );
stream->ReadSwap( &fReflectDelay );
stream->ReadSwap( &fReverb );
stream->ReadSwap( &fReverbDelay );
stream->ReadSwap( &fDiffusion );
stream->ReadSwap( &fDensity );
stream->ReadSwap( &fHFReference );
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plEnvEffectMsg::Write(stream, mgr);
stream->WriteSwap(fPreset);
stream->WriteSwap( fRoomAtten );
stream->WriteSwap( fRoomHFAtten );
stream->WriteSwap( fRoomRolloffFactor );
stream->WriteSwap( fDecayTime );
stream->WriteSwap( fDecayHFRatio );
stream->WriteSwap( fReflect );
stream->WriteSwap( fReflectDelay );
stream->WriteSwap( fReverb );
stream->WriteSwap( fReverbDelay );
stream->WriteSwap( fDiffusion );
stream->WriteSwap( fDensity );
stream->WriteSwap( fHFReference );
}
};
class plAudioEffectMsg : public plEnvEffectMsg
{
public:
enum effectType
{
kChorus = 0,
kCompressor,
kDistortion,
kEcho,
kFlanger,
kGargle,
kReverb,
kIDL32,
};
enum waveShape
{
kTriangular = 0,
kSquare,
kSine,
};
int fEffect;
int wetDryPct;
int delayModPct;
int feedbackPct;
int lfOscillator;
int feedbackDelay;
int waveform;
int phaseDifferential;
int gainDB;
hsScalar attack;
int release;
int compThreshhold;
int compRatio;
hsScalar attackPreDelay;
int intensity;
int effectCenter;
int effectWidth;
int lfCutoff;
int leftFeedbackDelay;
int rightFeedbackDelay;
hsBool swapLeftRightDelay;
int modulationRate;
plAudioEffectMsg();
plAudioEffectMsg(const plKey &s,
const plKey &r,
const double* t);
~plAudioEffectMsg(){;}
CLASSNAME_REGISTER( plAudioEffectMsg );
GETINTERFACE_ANY( plAudioEffectMsg, plEnvEffectMsg );
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
*/
#endif // plEnvEffectMsg_inc

View File

@ -0,0 +1,118 @@
/*==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/>.
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 plEventCallbackMsg_inc
#define plEventCallbackMsg_inc
#include "hsStream.h"
#include "plMessage.h"
enum CallbackEvent
{
kStart = 0,
kStop,
kReverse,
kTime,
kLoop,
kBegin,
kEnd,
kEventEnd,
kSingleFrameAdjust,
kSingleFrameEval
};
class plEventCallbackMsg : public plMessage
{
protected:
public:
hsScalar fEventTime; // the time for time events
CallbackEvent fEvent; // the event
Int16 fIndex; // the index of the object we want the event to come from
// (where applicable, required for sounds)
Int16 fRepeats; // -1 for infinite repeats, 0 for one call, no repeats
Int16 fUser; // User defined data, useful for keeping track of multiple callbacks
plEventCallbackMsg() : fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;}
plEventCallbackMsg (const plKey &s,
const plKey &r,
const double* t) :
plMessage(s, r, t),
fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;}
plEventCallbackMsg(const plKey &receiver, CallbackEvent e, int idx=0, hsScalar t=0, Int16 repeats=-1, UInt16 user=0) :
plMessage(nil, receiver, nil), fEvent(e), fIndex(idx), fEventTime(t), fRepeats(repeats), fUser(user) {}
~plEventCallbackMsg(){;}
CLASSNAME_REGISTER( plEventCallbackMsg );
GETINTERFACE_ANY( plEventCallbackMsg, plMessage );
// IO
virtual void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fEventTime = stream->ReadSwapFloat();
fEvent = (CallbackEvent)stream->ReadSwap16();
fIndex = stream->ReadSwap16();
fRepeats = stream->ReadSwap16();
fUser = stream->ReadSwap16();
}
virtual void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwapFloat(fEventTime);
stream->WriteSwap16((Int16)fEvent);
stream->WriteSwap16(fIndex);
stream->WriteSwap16(fRepeats);
stream->WriteSwap16(fUser);
}
};
// For when you want to send callbacks, but someone other than the sender/receiver
// needs to modify them along the way.
class plEventCallbackInterceptMsg : public plEventCallbackMsg
{
protected:
plMessage *fMsg;
public:
plMessage *GetMessage() { return fMsg; }
void SetMessage(plMessage *msg) { fMsg = msg; hsRefCnt_SafeRef(msg); }
void SendMessage() { fMsg->SendAndKeep(); }
plEventCallbackInterceptMsg() : plEventCallbackMsg(), fMsg(nil) {}
~plEventCallbackInterceptMsg() { hsRefCnt_SafeUnRef(fMsg); fMsg = nil; }
CLASSNAME_REGISTER( plEventCallbackInterceptMsg );
GETINTERFACE_ANY( plEventCallbackInterceptMsg, plEventCallbackMsg );
virtual void Read(hsStream *stream, hsResMgr *mgr) { plEventCallbackMsg::Read(stream, mgr); }
virtual void Write(hsStream *stream, hsResMgr *mgr) { plEventCallbackMsg::Write(stream, mgr); }
};
#endif // plEventCallbackMsg_inc

View 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/>.
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 plFakeOutMsg_inc
#define plFakeOutMsg_inc
//
// this message is to fake out a gadget to see if it would potentially trigger...
//
#include "../pnMessage/plMessage.h"
#include "hsBitVector.h"
class hsStream;
class hsResMgr;
class plFakeOutMsg : public plMessage
{
protected:
public:
plFakeOutMsg(){SetBCastFlag(plMessage::kPropagateToModifiers);}
plFakeOutMsg(const plKey &s,
const plKey &r,
const double* t){SetBCastFlag(plMessage::kPropagateToModifiers);}
CLASSNAME_REGISTER( plFakeOutMsg );
GETINTERFACE_ANY( plFakeOutMsg, plMessage );
enum
{
kNumCmds = 0,
};
hsBitVector fCmd;
hsBool Cmd(int n) { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
void ClearCmd(int n) { fCmd.ClearBit(n); }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream);
}
};
#endif // plFakeOutMsg_inc

View 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/>.
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 plIntRefMsg_inc
#define plIntRefMsg_inc
#include "plRefMsg.h"
#include "hsStream.h"
class hsResMgr;
class plIntRefMsg : public plRefMsg
{
public:
enum {
kOwner = 1,
kTarget = 2,
kChild = 3,
kDrawable = 4,
kPhysical = 5,
kAudible = 6,
kChildObject = 7,
kNumRefTypes
};
plIntRefMsg() : fType(-1), fWhich(-1), fIdx(-1) {}
plIntRefMsg(const plKey &r, UInt8 flags, Int32 which, Int8 type, Int8 idx=-1) : plRefMsg(r, flags), fWhich((Int16)which), fType(type), fIdx(idx) {}
CLASSNAME_REGISTER( plIntRefMsg );
GETINTERFACE_ANY( plIntRefMsg, plRefMsg );
Int8 fType;
Int8 fIdx;
Int16 fWhich;
// IO - not really applicable to ref msgs, but anyway
void Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadSwap(&fWhich);
stream->ReadSwap(&fIdx);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap(fWhich);
stream->WriteSwap(fIdx);
}
};
#endif // plIntRefMsg_inc

View File

@ -0,0 +1,375 @@
/*==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/>.
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"
#define PLMESSAGE_PRIVATE
#include "plMessage.h"
#include "hsStream.h"
#include "../pnKeyedObject/plKey.h"
#include "hsResMgr.h"
#include "hsTimer.h"
#include "hsTemplates.h"
#include "plgDispatch.h"
#include "hsBitVector.h"
#include <algorithm>
plMessage::plMessage()
: fSender(nil),
fBCastFlags(kLocalPropagate),
fTimeStamp(0),
fNetRcvrPlayerIDs(nil),
dispatchBreak(false)
{
}
plMessage::plMessage(const plKey &s,
const plKey &r,
const double* t)
: fSender(s),
fBCastFlags(kLocalPropagate),
fNetRcvrPlayerIDs(nil),
dispatchBreak(false)
{
if( r )
{
fReceivers.SetCount(1);
fReceivers[0] = r;
}
fTimeStamp = t ? *t : hsTimer::GetSysSeconds();
}
plMessage::~plMessage()
{
delete fNetRcvrPlayerIDs;
}
plMessage& plMessage::SetNumReceivers(int n) { fReceivers.SetCount(n); return *this; }
UInt32 plMessage::GetNumReceivers() const { return fReceivers.GetCount(); }
const plKey& plMessage::GetReceiver(int i) const { return fReceivers[i]; }
plMessage& plMessage::RemoveReceiver(int i) { fReceivers.Remove(i); return *this; }
plMessage& plMessage::ClearReceivers() { fReceivers.SetCount(0); return *this; }
plMessage& plMessage::AddReceiver(const plKey &r) { fReceivers.Append(r); return *this; }
plMessage& plMessage::AddReceivers(const hsTArray<plKey>& rList)
{
int i;
for( i = 0; i < rList.GetCount(); i++ )
AddReceiver(rList[i]);
return *this;
}
hsBool plMessage::Send(const plKey r, hsBool async)
{
if( r )
AddReceiver(r);
return plgDispatch::MsgSend(this,async);
}
hsBool plMessage::SendAndKeep(const plKey r, hsBool async)
{
Ref();
return Send(r, async);
}
void plMessage::IMsgRead(hsStream* s, hsResMgr* mgr)
{
plCreatable::Read(s, mgr);
fSender = mgr->ReadKey(s);
int n;
s->LogReadSwap(&n,"NumberOfReceivers");
fReceivers.SetCount(n);
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
fReceivers[i] = mgr->ReadKey(s);
s->LogReadSwap(&fTimeStamp,"TimeStamp"); // read as double
s->LogReadSwap(&fBCastFlags, "BCastFlags");
}
void plMessage::IMsgWrite(hsStream* s, hsResMgr* mgr)
{
plCreatable::Write(s, mgr);
mgr->WriteKey(s,fSender);
s->WriteSwap32(fReceivers.GetCount());
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
mgr->WriteKey(s,fReceivers[i]);
s->WriteSwap(fTimeStamp); // write as double
s->WriteSwap32(fBCastFlags);
}
enum MsgFlags
{
kMsgSender,
kMsgReceivers,
kMsgTimeStamp,
kMsgBCastFlags,
};
void plMessage::IMsgReadVersion(hsStream* s, hsResMgr* mgr)
{
hsBitVector contentFlags;
contentFlags.Read(s);
if (contentFlags.IsBitSet(kMsgSender))
fSender = mgr->ReadKey(s);
if (contentFlags.IsBitSet(kMsgReceivers))
{
int n = s->ReadSwap32();
fReceivers.SetCount(n);
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
fReceivers[i] = mgr->ReadKey(s);
}
if (contentFlags.IsBitSet(kMsgTimeStamp))
s->ReadSwap(&fTimeStamp); // read as double
if (contentFlags.IsBitSet(kMsgBCastFlags))
fBCastFlags = s->ReadSwap32();
}
void plMessage::IMsgWriteVersion(hsStream* s, hsResMgr* mgr)
{
hsBitVector contentFlags;
contentFlags.SetBit(kMsgSender);
contentFlags.SetBit(kMsgReceivers);
contentFlags.SetBit(kMsgTimeStamp);
contentFlags.SetBit(kMsgBCastFlags);
contentFlags.Write(s);
// kMsgSender
mgr->WriteKey(s,fSender);
// kMsgReceivers
s->WriteSwap32(fReceivers.GetCount());
int i;
for( i = 0; i < fReceivers.GetCount(); i++ )
mgr->WriteKey(s,fReceivers[i]);
// kMsgTimeStamp
s->WriteSwap(fTimeStamp); // write as double
// kMsgBCastFlags
s->WriteSwap32(fBCastFlags);
}
void plMessage::AddNetReceiver( UInt32 plrID )
{
if ( !fNetRcvrPlayerIDs )
fNetRcvrPlayerIDs = TRACKED_NEW std::vector<UInt32>;
fNetRcvrPlayerIDs->push_back( plrID );
}
void plMessage::AddNetReceivers( const std::vector<UInt32> & plrIDs )
{
if ( !fNetRcvrPlayerIDs )
fNetRcvrPlayerIDs = TRACKED_NEW std::vector<UInt32>;
std::copy( plrIDs.begin(), plrIDs.end(), std::back_inserter( *fNetRcvrPlayerIDs ) );
}
/////////////////////////////////////////////////////////////////
// STATIC
int plMsgStdStringHelper::Poke(const std::string & stringref, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
hsAssert( stringref.length()<0xFFFF, "buf too big for plMsgStdStringHelper" );
strlen = stringref.length();
stream->WriteSwap(strlen);
if (strlen)
stream->Write(strlen,stringref.data());
return stream->GetPosition();
}
int plMsgStdStringHelper::PokeBig(const std::string & stringref, hsStream* stream, const UInt32 peekOptions)
{
UInt32 strlen = stringref.length();
stream->WriteSwap(strlen);
if (strlen)
stream->Write(strlen,stringref.data());
return stream->GetPosition();
}
int plMsgStdStringHelper::Poke(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
hsAssert( bufsz<0xFFFF, "buf too big for plMsgStdStringHelper" );
strlen = (plMessage::plStrLen)bufsz;
stream->WriteSwap(strlen);
if (strlen)
stream->Write(strlen,buf);
return stream->GetPosition();
}
int plMsgStdStringHelper::PokeBig(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions)
{
stream->WriteSwap(bufsz);
if (bufsz)
stream->Write(bufsz,buf);
return stream->GetPosition();
}
// STATIC
int plMsgStdStringHelper::Peek(std::string & stringref, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
stream->LogSubStreamStart("push this");
stream->LogReadSwap(&strlen,"StrLen");
stringref.erase();
if (strlen <= stream->GetSizeLeft())
{
stringref.resize(strlen);
if (strlen){
stream->LogRead(strlen,(void*)stringref.data(),"StdString");
stream->LogStringString(xtl::format("Value: %s", stringref.data()).c_str());
}
}
else
{
hsAssert( false, "plMsgStdStringHelper::Peek: overflow peeking string." );
}
stream->LogSubStreamEnd();
return stream->GetPosition();
}
int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, const UInt32 peekOptions)
{
UInt32 bufsz;
stream->LogSubStreamStart("push this");
stream->LogReadSwap(&bufsz,"Bufsz");
stringref.erase();
if (bufsz <= stream->GetSizeLeft())
{
stringref.resize(bufsz);
if (bufsz){
stream->LogRead(bufsz,(void*)stringref.data(),"StdString");
stream->LogStringString(xtl::format("Value: %s", stringref.data()).c_str());
}
}
else
{
hsAssert( false, "plMsgStdStringHelper::PeekBig: overflow peeking string." );
}
stream->LogSubStreamEnd();
return stream->GetPosition();
}
/////////////////////////////////////////////////////////////////
// STATIC
int plMsgXtlStringHelper::Poke(const xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
strlen = stringref.length();
stream->WriteSwap(strlen);
if (strlen)
stream->Write(strlen,stringref.data());
return stream->GetPosition();
}
// STATIC
int plMsgXtlStringHelper::Peek(xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
stream->LogSubStreamStart("push me");
stream->LogReadSwap(&strlen,"StrLen");
stringref.erase();
if (strlen <= stream->GetSizeLeft())
{
stringref.resize(strlen);
if (strlen){
stream->LogRead(strlen,(void*)stringref.data(),"XtlString");
stream->LogStringString(xtl::format("Value: %s", stringref.data()).c_str());
}
}
stream->LogSubStreamEnd();
return stream->GetPosition();
}
/////////////////////////////////////////////////////////////////
// STATIC
int plMsgCStringHelper::Poke(const char * str, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
strlen = (str)?hsStrlen(str):0;
stream->WriteSwap(strlen);
if (strlen)
stream->Write(strlen,str);
return stream->GetPosition();
}
// STATIC
int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const UInt32 peekOptions)
{
plMessage::plStrLen strlen;
stream->LogSubStreamStart("push me");
stream->LogReadSwap(&strlen,"StrLen");
delete [] str;
str = nil;
if (strlen <= stream->GetSizeLeft())
{
if (strlen)
{
str = TRACKED_NEW char[strlen+1];
str[strlen] = '\0';
if (strlen) {
stream->LogRead(strlen,str,"CString");
stream->LogStringString(xtl::format("Value: %s",str).c_str());
}
}
}
stream->LogSubStreamEnd();
return stream->GetPosition();
}
/////////////////////////////////////////////////////////////////
// STATIC
int plMsgCArrayHelper::Poke(const void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions)
{
stream->Write(bufsz,buf);
return stream->GetPosition();
}
// STATIC
int plMsgCArrayHelper::Peek(void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions)
{
stream->LogSubStreamStart("push me");
stream->LogRead(bufsz,buf,"CArray");
stream->LogSubStreamEnd();
return stream->GetPosition();
}

View File

@ -0,0 +1,196 @@
/*==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/>.
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 plMessage_inc
#define plMessage_inc
#include "../pnFactory/plCreatable.h"
#include "../pnKeyedObject/plKey.h"
#include "hsTemplates.h"
#include "hsStlUtils.h"
class plKey;
class hsStream;
// Base class for messages only has enough info to route it
// and send it over the wire (Read/Write).
class plMessage : public plCreatable
{
public:
typedef UInt16 plStrLen;
enum plBCastFlags {
kBCastNone = 0x0,
kBCastByType = 0x1, // To everyone registered for this msg type or msgs this is derived from
kBCastUNUSED_0 = 0x2, // Obsolete option (never used). Was BCastBySender
kPropagateToChildren = 0x4, // Propagate down through SceneObject heirarchy
kBCastByExactType = 0x8, // To everyone registered for this exact msg type.
kPropagateToModifiers = 0x10, // Send the msg to an object and all its modifier
kClearAfterBCast = 0x20, // Clear registration for this type after sending this msg
kNetPropagate = 0x40, // Propagate this message over the network (remotely)
kNetSent = 0x80, // Internal use-This msg has been sent over the network
kNetUseRelevanceRegions = 0x100, // Used along with NetPropagate to filter the msg bcast using relevance regions
kNetForce = 0x200, // Used along with NetPropagate to force the msg to go out (ie. ignore cascading rules)
kNetNonLocal = 0x400, // Internal use-This msg came in over the network (remote msg)
kLocalPropagate = 0x800, // Propagate this message locally (ON BY DEFAULT)
kNetNonDeterministic = kNetForce, // This msg is a non-deterministic response to another msg
kMsgWatch = 0x1000, // Debug only - will break in dispatch before sending this msg
kNetStartCascade = 0x2000, // Internal use-msg is non-local and initiates a cascade of net msgs. This bit is not inherited or computed, it's a property.
kNetAllowInterAge = 0x4000, // If rcvr is online but not in current age, they will receive msg courtesy of pls routing.
kNetSendUnreliable = 0x8000, // Don't use reliable send when net propagating
kCCRSendToAllPlayers = 0x10000, // CCRs can send a plMessage to all online players.
kNetCreatedRemotely = 0x20000, // kNetSent and kNetNonLocal are inherited by child messages sent off while processing a net-propped
// parent. This flag ONLY gets sent on the actual message that went across the wire.
};
private:
bool dispatchBreak;
friend class plDispatch;
friend class plDispatchLog;
protected:
plKey fSender;
hsTArray<plKey> fReceivers;
double fTimeStamp;
UInt32 fBCastFlags;
std::vector<UInt32>* fNetRcvrPlayerIDs;
void IMsgRead(hsStream* stream, hsResMgr* mgr); // default read implementation
void IMsgWrite(hsStream* stream, hsResMgr* mgr); // default write implementation
void IMsgReadVersion(hsStream* stream, hsResMgr* mgr);
void IMsgWriteVersion(hsStream* stream, hsResMgr* mgr);
public:
plMessage();
plMessage(const plKey &s,
const plKey &r,
const double* t);
virtual ~plMessage();
CLASSNAME_REGISTER( plMessage );
GETINTERFACE_ANY( plMessage, plCreatable );
// These must be implemented by all derived message classes (hence pure).
// Derived classes should call the base-class default read/write implementation,
// so the derived Read() should call plMessage::IMsgRead().
virtual void Read(hsStream* stream, hsResMgr* mgr) = 0;
virtual void Write(hsStream* stream, hsResMgr* mgr) = 0;
const plKey GetSender() const { return fSender; }
plMessage& SetSender(const plKey &s) { fSender = s; return *this; }
plMessage& SetNumReceivers(int n);
UInt32 GetNumReceivers() const ;
const plKey& GetReceiver(int i) const;
plMessage& RemoveReceiver(int i);
plMessage& ClearReceivers();
plMessage& AddReceiver(const plKey &r);
plMessage& AddReceivers(const hsTArray<plKey>& rList);
hsBool Send(const plKey r=nil, hsBool async=false); // Message will self-destruct after send.
hsBool SendAndKeep(const plKey r=nil, hsBool async=false); // Message won't self-destruct after send.
const double GetTimeStamp() const { return fTimeStamp; }
plMessage& SetTimeStamp(double t) { fTimeStamp = t; return *this; }
hsBool HasBCastFlag(UInt32 f) const { return 0 != (fBCastFlags & f); }
plMessage& SetBCastFlag(UInt32 f, hsBool on=true) { if( on )fBCastFlags |= f; else fBCastFlags &= ~f; return *this; }
void SetAllBCastFlags(UInt32 f) { fBCastFlags=f; }
UInt32 GetAllBCastFlags() const { return fBCastFlags; }
void AddNetReceiver( UInt32 plrID );
void AddNetReceivers( const std::vector<UInt32> & plrIDs );
std::vector<UInt32>* GetNetReceivers() const { return fNetRcvrPlayerIDs; }
// just before dispatching this message, drop into debugger
void SetBreakBeforeDispatch (bool on) { dispatchBreak = on; }
bool GetBreakBeforeDispatch () const { return dispatchBreak; }
};
/////////////////////////////////////////////////////////////////
// Helpers for reading/writing these types:
// std::string
// xtl::istring
// c strings (char *)
// c arrays (type [])
/////////////////////////////////////////////////////////////////
// reads/writes your std::string field
struct plMsgStdStringHelper
{
static int Poke(const std::string & stringref, hsStream* stream, const UInt32 peekOptions=0);
static int PokeBig(const std::string & stringref, hsStream* stream, const UInt32 peekOptions=0);
static int Poke(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0);
static int PokeBig(const char * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0);
static int Peek(std::string & stringref, hsStream* stream, const UInt32 peekOptions=0);
static int PeekBig(std::string & stringref, hsStream* stream, const UInt32 peekOptions=0);
};
/////////////////////////////////////////////////////////////////
// reads/writes your xtl::istring field
struct plMsgXtlStringHelper
{
static int Poke(const xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions=0);
static int Peek(xtl::istring & stringref, hsStream* stream, const UInt32 peekOptions=0);
};
/////////////////////////////////////////////////////////////////
// reads/writes your char * field
struct plMsgCStringHelper
{
static int Poke(const char * str, hsStream* stream, const UInt32 peekOptions=0);
// deletes str and reallocates. you must delete [] str;
static int Peek(char *& str, hsStream* stream, const UInt32 peekOptions=0);
};
/////////////////////////////////////////////////////////////////
// reads/writes your type [] field
// don't use with byte ordered types like Int16,32.
// fine for Int8, char, and IEEE formatted types like float, double.
struct plMsgCArrayHelper
{
static int Poke(const void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0);
static int Peek(void * buf, UInt32 bufsz, hsStream* stream, const UInt32 peekOptions=0);
};
#endif // plMessage_inc

View File

@ -0,0 +1,138 @@
/*==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/>.
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 "hsResMgr.h"
#include "plMessageWithCallbacks.h"
#include "plEventCallbackMsg.h"
#include "../pnNetCommon/plSynchedObject.h"
#include "plgDispatch.h"
#include "hsBitVector.h"
plMessageWithCallbacks::~plMessageWithCallbacks()
{
Clear();
}
void plMessageWithCallbacks::AddCallback(plMessage* e)
{
hsRefCnt_SafeRef(e);
// make sure callback msgs have the same net propagate properties as the container msg
e->SetBCastFlag(plMessage::kNetPropagate, HasBCastFlag(plMessage::kNetPropagate));
fCallbacks.Append(e);
}
void plMessageWithCallbacks::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
Clear();
// read count
int n = stream->ReadSwap32();
fCallbacks.SetCount(n);
// read callbacks
int i;
for( i = 0; i < n; i++ )
{
fCallbacks[i] = plMessage::ConvertNoRef(mgr->ReadCreatable(stream));
}
}
void plMessageWithCallbacks::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
// write count
int n=fCallbacks.GetCount();
stream->WriteSwap32(n);
// write callbacks
int i;
for( i = 0; i < fCallbacks.GetCount(); i++ )
mgr->WriteCreatable( stream, fCallbacks[i] );
}
enum MsgWithCallbacksFlags
{
kMsgWithCBsCallbacks,
};
void plMessageWithCallbacks::ReadVersion(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgReadVersion(s, mgr);
Clear();
hsBitVector contentFlags;
contentFlags.Read(s);
if (contentFlags.IsBitSet(kMsgWithCBsCallbacks))
{
// read count
int n = s->ReadSwap32();
fCallbacks.SetCount(n);
for (int i = 0; i < n; i++)
fCallbacks[i] = plMessage::ConvertNoRef(mgr->ReadCreatableVersion(s));
}
}
void plMessageWithCallbacks::WriteVersion(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgWriteVersion(s, mgr);
hsBitVector contentFlags;
contentFlags.SetBit(kMsgWithCBsCallbacks);
contentFlags.Write(s);
// write count
int n = fCallbacks.GetCount();
s->WriteSwap32(n);
// write callbacks
for (int i = 0; i < n; i++)
mgr->WriteCreatableVersion(s, fCallbacks[i]);
}
void plMessageWithCallbacks::Clear()
{
int i;
for( i = 0; i < fCallbacks.GetCount(); i++ )
hsRefCnt_SafeUnRef(fCallbacks[i]);
fCallbacks.SetCount(0);
}
void plMessageWithCallbacks::SendCallbacks()
{
int i;
for (i = fCallbacks.GetCount() - 1; i >= 0; i--)
{
plgDispatch::MsgSend(fCallbacks[i]);
fCallbacks.Remove(i);
}
}

View File

@ -0,0 +1,73 @@
/*==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/>.
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 plMessageWithCB_inc
#define plMessageWithCB_inc
#include "plMessage.h"
#include "hsTemplates.h"
#include "plEventCallbackMsg.h"
//
// Base class for messages which contain callbacks
//
class plSynchedObject;
class plEventCallbackMsg;
class hsStream;
class hsResMgr;
class plMessageWithCallbacks : public plMessage
{
private:
hsTArray<plMessage*> fCallbacks;
public:
plMessageWithCallbacks() {}
plMessageWithCallbacks(const plKey &s, const plKey &r, const double* t) : plMessage(s,r,t) {}
~plMessageWithCallbacks();
CLASSNAME_REGISTER( plMessageWithCallbacks );
GETINTERFACE_ANY( plMessageWithCallbacks, plMessage );
void Clear();
void AddCallback(plMessage* e); // will RefCnt the message e.
int GetNumCallbacks() const { return fCallbacks.GetCount(); }
plMessage* GetCallback(int i) const { return fCallbacks[i]; }
plEventCallbackMsg* GetEventCallback(int i) const { return plEventCallbackMsg::ConvertNoRef(fCallbacks[i]); }
void SendCallbacks();
#if 0
// returns true if ok to send in a networked situations
static hsBool NetOKToSend(plSynchedObject* sender, plEventCallbackMsg* cbmsg);
#endif
// IO
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
void ReadVersion(hsStream* s, hsResMgr* mgr);
void WriteVersion(hsStream* s, hsResMgr* mgr);
};
#endif // plMessageWithCB_inc

View File

@ -0,0 +1,74 @@
/*==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/>.
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 plMultiModMsg_inc
#define plMultiModMsg_inc
#include "plMessage.h"
#include "hsBitVector.h"
class hsStream;
class hsResMgr;
class plMultiModMsg : public plMessage
{
public:
plMultiModMsg()
: plMessage(nil, nil, nil) {}
plMultiModMsg(const plKey &s,
const plKey &r,
const double* t)
: plMessage(s, r, t) {}
~plMultiModMsg() {}
CLASSNAME_REGISTER( plMultiModMsg );
GETINTERFACE_ANY( plMultiModMsg, plMessage );
enum ModCmds
{
};
hsBitVector fCmd;
hsBool Cmd(int n) { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream);
}
};
#endif // plMultiModMsg_inc

View File

@ -0,0 +1,45 @@
/*==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/>.
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 "plNodeChangeMsg.h"
#include "hsStream.h"
#include "hsResMgr.h"
void plNodeChangeMsg::Read(hsStream* stream, hsResMgr* mgr)
{
IMsgRead(stream, mgr);
fNodeKey = mgr->ReadKey(stream);
}
void plNodeChangeMsg::Write(hsStream* stream, hsResMgr* mgr)
{
IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fNodeKey);
}

View File

@ -0,0 +1,52 @@
/*==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/>.
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 plNodeChangeMsg_inc
#define plNodeChangeMsg_inc
#include "plMessage.h"
class plNodeChangeMsg : public plMessage
{
protected:
plKey fNodeKey;
public:
plNodeChangeMsg() : fNodeKey(nil) {}
plNodeChangeMsg(plKey s, plKey &r, plKey node, double* t=nil)
: plMessage(s, r, t), fNodeKey(node) {}
CLASSNAME_REGISTER( plNodeChangeMsg );
GETINTERFACE_ANY( plNodeChangeMsg, plMessage );
plKey GetNodeKey() const { return fNodeKey; }
void SetNodeKey(plKey &k) { fNodeKey = k; }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
};
#endif //plNodeChangeMsg_inc

View File

@ -0,0 +1,53 @@
/*==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/>.
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 plNodeRefMsg_inc
#define plNodeRefMsg_inc
#include "plRefMsg.h"
class plNodeRefMsg : public plGenRefMsg
{
public:
enum {
kDrawable,
kPhysical,
kAudible,
kObject,
kNeighbor,
kLight,
kOccluder,
kGeneric
};
plNodeRefMsg() {}
plNodeRefMsg(const plKey &r, UInt8 flags, Int8 which, Int8 type) : plGenRefMsg(r, flags, which, type) {}
CLASSNAME_REGISTER( plNodeRefMsg );
GETINTERFACE_ANY( plNodeRefMsg, plGenRefMsg );
};
#endif // plNodeRefMsg_inc

View File

@ -0,0 +1,386 @@
/*==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/>.
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 _plNotifyMsg_h_
#define _plNotifyMsg_h_
#include "plMessage.h"
#include "hsResMgr.h"
#include "../pnModifier/plSingleModifier.h"
#include "hsUtils.h"
#include "hsGeometry3.h"
//
// repeatable Event data in Notify message
//
// Updated 4.13.2002 mcn - Unions are all well and good, but only work on simple data types, and since
// plKey now isn't so simple...
class proEventData
{
public:
// keep this enum synchronized with the list at the top of PlasmaTypes.py
enum eventType
{
kCollision=1,
kPicked =2,
kControlKey=3,
kVariable=4,
kFacing=5,
kContained=6,
kActivate=7,
kCallback=8,
kResponderState=9,
kMultiStage=10,
kSpawned=11,
kClickDrag=12,
kCoop=13,
kOfferLinkingBook=14,
kBook=15,
kClimbingBlockerHit=16,
kNone
};
proEventData( Int32 evtType = kNone ) : fEventType( evtType )
{
}
virtual ~proEventData() {}
enum dataType
{
kNumber=1,
kKey,
kNotta
};
// what the multstage event types are for multistage.fEvent
enum multiStageEventType
{
kEnterStage=1,
kBeginingOfLoop,
kAdvanceNextStage,
kRegressPrevStage,
kNothing
};
Int32 fEventType; // what type of event (evenType enum)
static proEventData* ICreateEventDataType(Int32 type);
static proEventData* Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
static proEventData* ReadVersion(hsStream* s, hsResMgr* mgr);
void WriteVersion(hsStream* s, hsResMgr* mgr);
protected:
virtual void IInit() {}
virtual void IDestruct() {}
virtual void IRead(hsStream* stream, hsResMgr* mgr) {}
virtual void IWrite(hsStream* stream, hsResMgr* mgr) {}
virtual void IReadVersion(hsStream* s, hsResMgr* mgr) {}
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr) {}
};
// The following macro makes it easy (or easier) to define new event data types
#define proEventType(type) class pro##type##EventData : public proEventData { public: pro##type##EventData() : proEventData( k##type ) {IInit();} virtual ~pro##type##EventData(){IDestruct();}
proEventType(Collision)
hsBool fEnter; // entering? (false is exit)
plKey fHitter; // collision hitter (other probably player)
plKey fHittee; // collision hittee (probably us)
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Picked)
plKey fPicker; // who picked it (problably player)
plKey fPicked; // object that was picked
hsBool fEnabled; // pick (true) or un-pick (false)
hsPoint3 fHitPoint; // where on the picked object that it was picked on
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Spawned)
plKey fSpawner; // who spawned it (typicall plNPCSpawnMod)
plKey fSpawnee; // what was spawned (typically a scene object with an armature mod)
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(ControlKey)
Int32 fControlKey; // what control key was hit
hsBool fDown; // was the key going down (false if going up)
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Variable)
char* fName; // name of variable
Int32 fDataType; // type of data
// Can't be a union, sadly, but it isn't that much of a waste of space...
hsScalar fNumber; // if its a number
plKey fKey; // if its a plKey (pointer to something)
protected:
virtual void IInit();
virtual void IDestruct();
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Facing)
plKey fFacer; // what was facing
plKey fFacee; // what was being faced
hsScalar dot; // the dot prod of their view vectors
hsBool enabled; // Now meets facing requirement (true) or no longer meets requirement (false)
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Contained)
plKey fContained; // who's inside of
plKey fContainer; // this containing volume
hsBool fEntering; // entering volume (true) or exiting (false)
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Activate)
hsBool fActive; // Whether or not to use the data in this field
hsBool fActivate; // the data
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Callback)
Int32 fEventType; // enumerated in plEventCallbackMsg.h
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(ResponderState)
Int32 fState; // what state the responder should be switched to before triggering
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(MultiStage)
Int32 fStage;
Int32 fEvent;
plKey fAvatar; // who was running the stage
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Coop)
UInt32 fID; // player ID of the initiator
UInt16 fSerial; // serial number for the initiator
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(ClickDrag)
plKey picker; // always the local avatar in this case
plKey picked;
hsScalar animPos; // 0.0 to 1.0 animation percentage
};
proEventType(OfferLinkingBook)
plKey offerer; // the avatar offering the linking book to you
int targetAge; // the age the book is for - taken from konstant list of age buttons in xLinkingBookPopupGUI.py
int offeree; // who we are offering the book to
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(Book)
UInt32 fEvent; // The type of event. See pfJournalBook.h for enumsu
UInt32 fLinkID; // The link ID of the image clicked, if an image link event, otherwise unused
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
proEventType(ClimbingBlockerHit)
plKey fBlockerKey; // collision hittee (probably us)
protected:
virtual void IRead(hsStream* stream, hsResMgr* mgr);
virtual void IWrite(hsStream* stream, hsResMgr* mgr);
virtual void IReadVersion(hsStream* s, hsResMgr* mgr);
virtual void IWriteVersion(hsStream* s, hsResMgr* mgr);
};
/////////////////////////////////////////////////////////////////////////////
//
// MESSAGE : plNotifyMsg
// PARAMETERS : none
//
// PURPOSE : This is the message that notifies someone (either a responder or activator)
// : that some event or transition of state has happened
//
//
class plNotifyMsg : public plMessage
{
protected:
virtual void IInit();
public:
plNotifyMsg() { IInit(); }
plNotifyMsg(const plKey &s, const plKey &r);
~plNotifyMsg();
CLASSNAME_REGISTER( plNotifyMsg );
GETINTERFACE_ANY( plNotifyMsg, plMessage );
// data area
enum notificationType
{
kActivator=0,
kVarNotification,
kNotifySelf,
kResponderFF, // Fast forward
kResponderChangeState, // Change state without triggering
};
Int32 fType; // what type of notification
hsScalar fState; // state of the notifier 0.0=false, 1.0=true
Int32 fID; // special ID mostly for responder State transitions
hsTArray<proEventData*> fEvents;// list of events with data
void SetType(notificationType type) { fType = type; }
void SetState(hsScalar state) { fState = state; }
// event records for the notify message
void AddEvent( proEventData* ed);
void AddCollisionEvent( hsBool enter, const plKey &other, const plKey &self, hsBool onlyOneCollision=true );
void AddPickEvent( const plKey &other, const plKey& self, hsBool enabled, hsPoint3 hitPoint );
void AddControlKeyEvent( Int32 key, hsBool down );
void AddVariableEvent( const char* name, hsScalar number );
void AddVariableEvent( const char *name, const plKey &key);
void AddFacingEvent( const plKey &other, const plKey &self, hsScalar dot, hsBool enabled);
void AddContainerEvent( const plKey &container, const plKey &contained, hsBool entering);
void AddActivateEvent( hsBool activate );
void AddCallbackEvent( Int32 event );
void AddResponderStateEvent( Int32 state );
void AddMultiStageEvent( Int32 stage, Int32 event, const plKey& avatar );
void AddCoopEvent(UInt32 id, UInt16 serial);
void AddSpawnedEvent (const plKey &spawner, const plKey &spawned);
void AddClickDragEvent(const plKey& dragger, const plKey& dragee, hsScalar animPos);
void AddOfferBookEvent(const plKey& offerer, int targetAge, int offeree);
void AddBookEvent( UInt32 event, UInt32 linkID = 0 );
void AddHitClimbingBlockerEvent(const plKey &blocker);
proEventData* FindEventRecord( Int32 eventtype );
Int32 GetEventCount() { return fEvents.Count(); }
proEventData* GetEventRecord(Int32 i) { return fEvents[i]; }
void ClearEvents();
// Searches the event records for an event triggered by an avatar, and returns that key
plKey GetAvatarKey();
// IO
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
void ReadVersion(hsStream* s, hsResMgr* mgr);
void WriteVersion(hsStream* s, hsResMgr* mgr);
};
#endif // _plNotifyMsg_h_

View File

@ -0,0 +1,73 @@
/*==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/>.
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 plObjRefMsg_inc
#define plObjRefMsg_inc
#include "plRefMsg.h"
#include "hsStream.h"
class hsResMgr;
class plObjRefMsg : public plRefMsg
{
public:
enum {
kModifier = 0,
kInterface = 4
};
plObjRefMsg(): fType(-1), fWhich(-1) {};
plObjRefMsg(const plKey &r, UInt8 refMsgFlags, Int8 which , Int8 type)
: plRefMsg(r, refMsgFlags), fType(type), fWhich(which) {}
CLASSNAME_REGISTER( plObjRefMsg );
GETINTERFACE_ANY( plObjRefMsg, plRefMsg );
Int8 fType;
Int8 fWhich;
// IO - not really applicable to ref msgs, but anyway
void Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
stream->ReadSwap(&fWhich);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap(fWhich);
}
};
#endif // plObjRefMsg_inc

View File

@ -0,0 +1,93 @@
/*==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/>.
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 plPipeResMakeMsg_inc
#define plPipeResMakeMsg_inc
#include "../pnMessage/plMessage.h"
class plPipeline;
class plPipeResMakeMsg : public plMessage
{
protected:
plPipeline* fPipe;
public:
plPipeResMakeMsg() : plMessage(nil, nil, nil), fPipe(nil) { SetBCastFlag(kBCastByExactType); }
plPipeResMakeMsg(plPipeline* pipe) : plMessage(nil, nil, nil), fPipe(pipe) { SetBCastFlag(kBCastByExactType); }
~plPipeResMakeMsg() {}
CLASSNAME_REGISTER( plPipeResMakeMsg );
GETINTERFACE_ANY( plPipeResMakeMsg, plMessage );
plPipeline* Pipeline() const { return fPipe; }
virtual void Read(hsStream* s, hsResMgr* mgr) { plMessage::IMsgRead(s, mgr); }
virtual void Write(hsStream* s, hsResMgr* mgr) { plMessage::IMsgWrite(s, mgr); }
};
class plPipeRTMakeMsg : public plPipeResMakeMsg
{
public:
plPipeRTMakeMsg() : plPipeResMakeMsg() { }
plPipeRTMakeMsg(plPipeline* pipe) : plPipeResMakeMsg(pipe) { }
~plPipeRTMakeMsg() {}
CLASSNAME_REGISTER( plPipeRTMakeMsg );
GETINTERFACE_ANY( plPipeRTMakeMsg, plPipeResMakeMsg );
};
class plPipeGeoMakeMsg : public plPipeResMakeMsg
{
public:
plPipeGeoMakeMsg() : plPipeResMakeMsg(), fDefault(false) { }
plPipeGeoMakeMsg(plPipeline* pipe, hsBool def) : plPipeResMakeMsg(pipe), fDefault(def) { }
~plPipeGeoMakeMsg() {}
CLASSNAME_REGISTER( plPipeGeoMakeMsg );
GETINTERFACE_ANY( plPipeGeoMakeMsg, plPipeResMakeMsg );
hsBool fDefault;
};
class plPipeTexMakeMsg : public plPipeResMakeMsg
{
public:
plPipeTexMakeMsg() : plPipeResMakeMsg() { }
plPipeTexMakeMsg(plPipeline* pipe) : plPipeResMakeMsg(pipe) { }
~plPipeTexMakeMsg() {}
CLASSNAME_REGISTER( plPipeTexMakeMsg );
GETINTERFACE_ANY( plPipeTexMakeMsg, plPipeResMakeMsg );
};
#endif // plPipeResMakeMsg_inc

View File

@ -0,0 +1,78 @@
/*==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/>.
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 plPlayerPageMsg_inc
#define plPlayerPageMsg_inc
#include "../pnMessage/plMessage.h"
#include "hsResMgr.h"
#include "hsStream.h"
class plKey;
class plPlayerPageMsg : public plMessage
{
protected:
public:
plPlayerPageMsg() : fPlayer(nil),fLocallyOriginated(false),fUnload(false),fLastOut(false),fClientID(-1){;}
plPlayerPageMsg(const plKey &s,
const plKey &r,
const double* t) : fPlayer(nil),fLocallyOriginated(false),fUnload(false),fLastOut(false),fClientID(-1){;}
CLASSNAME_REGISTER( plPlayerPageMsg );
GETINTERFACE_ANY( plPlayerPageMsg, plMessage );
plKey fPlayer;
hsBool fLocallyOriginated;
hsBool fUnload;
int fClientID;
hsBool fLastOut;
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fPlayer = mgr->ReadKey(stream);
fLocallyOriginated = stream->ReadBool();
fLastOut = stream->ReadBool();
fUnload = stream->ReadBool();
fClientID = stream->ReadSwap32();
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fPlayer);
stream->WriteBool(fLocallyOriginated);
stream->WriteBool(fLastOut);
stream->WriteBool(fUnload);
stream->WriteSwap32(fClientID);
}
};
#endif // plPlayerPageMsg_inc

View File

@ -0,0 +1,65 @@
/*==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/>.
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 "plProxyDrawMsg.h"
#include "hsStream.h"
plProxyDrawMsg::plProxyDrawMsg()
: plMessage(nil, nil, nil),
fProxyFlags(0)
{
SetBCastFlag(plMessage::kBCastByExactType);
}
plProxyDrawMsg::plProxyDrawMsg(UInt16 flags)
: plMessage(nil, nil, nil),
fProxyFlags(flags)
{
SetBCastFlag(plMessage::kBCastByExactType);
}
plProxyDrawMsg::plProxyDrawMsg(plKey &rcv, UInt16 flags)
: plMessage(rcv, rcv, nil),
fProxyFlags(flags)
{
}
plProxyDrawMsg::~plProxyDrawMsg()
{
}
void plProxyDrawMsg::Read(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgRead(s, mgr);
fProxyFlags = s->ReadSwap16();
}
void plProxyDrawMsg::Write(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgWrite(s, mgr);
s->WriteSwap16(fProxyFlags);
}

View File

@ -0,0 +1,82 @@
/*==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/>.
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 plProxyDrawMsg_inc
#define plProxyDrawMsg_inc
#include "plMessage.h"
class hsStream;
class hsResMgr;
// Proxy Draw Msg's are sent out to tell
// proxies for the visual objects in the world to
// make themselves visible (or reclaim resources used
// to make themselves visible). This message should only
// be sent out by the core system.
class plProxyDrawMsg : public plMessage
{
protected:
UInt16 fProxyFlags;
public:
plProxyDrawMsg();
plProxyDrawMsg(UInt16 flags); // for broadcast
plProxyDrawMsg(plKey &rcv, UInt16 flags); // send yourself an ack
~plProxyDrawMsg();
CLASSNAME_REGISTER( plProxyDrawMsg );
GETINTERFACE_ANY( plProxyDrawMsg, plMessage );
enum {
kCreate = 0x1,
kDestroy = 0x2,
kDetached = 0x4,
kToggle = 0x8,
kLight = 0x10,
kPhysical = 0x20,
kOccluder = 0x40,
kAudible = 0x80,
kCoordinate = 0x100,
kCamera = 0x200,
kAllTypes = kLight
| kPhysical
| kOccluder
| kAudible
| kCoordinate
| kCamera
};
UInt16 GetProxyFlags() const { return fProxyFlags; }
void SetProxyFlags(UInt16 f) { fProxyFlags = f; }
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
};
#endif // plProxyDrawMsg_inc

View File

@ -0,0 +1,99 @@
/*==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/>.
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 "plRefMsg.h"
#include "hsStream.h"
#include "hsResMgr.h"
#include "../pnKeyedObject/plKey.h"
#include "../pnKeyedObject/hsKeyedObject.h"
plRefMsg::plRefMsg()
: fRef(nil), fOldRef(nil), fContext(0)
{
}
plRefMsg::plRefMsg(const plKey &r, UInt8 c)
: plMessage(nil, r, nil), fRef(nil), fOldRef(nil), fContext(c)
{
if( !fContext )
fContext = kOnCreate;
}
plRefMsg::~plRefMsg()
{
// Un ref fref and foldref.
}
plRefMsg& plRefMsg::SetRef(hsKeyedObject* ref)
{
fRef = ref; // ref count here! paulg
return *this;
}
plRefMsg& plRefMsg::SetOldRef(hsKeyedObject* oldRef)
{
fOldRef = oldRef;
// Ref here!
return *this;
}
void plRefMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fContext);
plKey key;
key = mgr->ReadKey(stream);
fRef = (key ? key->GetObjectPtr() : nil);
key = mgr->ReadKey(stream);
fOldRef = (key ? key->GetObjectPtr() : nil);
}
void plRefMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fContext);
mgr->WriteKey(stream, (fRef ? fRef->GetKey() : nil));
mgr->WriteKey(stream, (fOldRef ? fOldRef->GetKey() : nil));
}
void plGenRefMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Read(stream, mgr);
stream->ReadSwap(&fType);
fWhich = stream->ReadSwap32();
}
void plGenRefMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plRefMsg::Write(stream, mgr);
stream->WriteSwap(fType);
stream->WriteSwap32(fWhich);
}

View File

@ -0,0 +1,93 @@
/*==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/>.
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 plRefMsg_inc
#define plRefMsg_inc
#include "plMessage.h"
class hsStream;
class hsKeyedObject;
class plRefMsg : public plMessage
{
public:
enum Context
{
kOnCreate = 0x1, // fRef just created.
kOnDestroy = 0x2, // fRef about to be destroyed
kOnRequest = 0x4, // fRef wants to be added
kOnRemove = 0x8, // fRef has moved elsewhere
kOnReplace = 0x10 // fRef replaces fOldRef
};
protected:
hsKeyedObject* fRef;
hsKeyedObject* fOldRef; // on replace
UInt8 fContext;
public:
plRefMsg();
plRefMsg(const plKey &r, UInt8 c);
virtual ~plRefMsg();
CLASSNAME_REGISTER( plRefMsg );
GETINTERFACE_ANY( plRefMsg, plMessage );
plRefMsg& SetRef(hsKeyedObject* ref);
hsKeyedObject* GetRef() { return fRef; }
plRefMsg& SetOldRef(hsKeyedObject* oldRef);
hsKeyedObject* GetOldRef() { return fOldRef; }
plRefMsg& SetContext(UInt8 c) { fContext = c; return *this; }
UInt8 GetContext() { return fContext; }
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
class plGenRefMsg : public plRefMsg
{
public:
plGenRefMsg() : fType(-1), fWhich(-1) {}
plGenRefMsg(const plKey &r, UInt8 c, Int32 which, Int8 type) : plRefMsg(r, c), fWhich(which), fType(type) {}
CLASSNAME_REGISTER(plGenRefMsg);
GETINTERFACE_ANY(plGenRefMsg, plRefMsg);
// User variables. You can put anything here, but the standard convention
// is an enum telling what type of ref it is in fType, and an index in
// fWhich, for keeping track of multiple refs of the same type.
Int8 fType;
Int32 fWhich;
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
#endif // plRefMsg_inc

View 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/>.
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 plRemoteAvatarInfoMsg_inc
#define plRemoteAvatarInfoMsg_inc
//
// this message is to fake out a gadget to see if it would potentially trigger...
//
#include "../pnMessage/plMessage.h"
class hsStream;
class hsResMgr;
class plKey;
class plRemoteAvatarInfoMsg : public plMessage
{
protected:
plKey fAvatar;
public:
plRemoteAvatarInfoMsg() : fAvatar(nil){SetBCastFlag(plMessage::kBCastByExactType);}
plRemoteAvatarInfoMsg(const plKey &s,
const plKey &r,
const double* t) : fAvatar(nil){SetBCastFlag(plMessage::kBCastByExactType);}
CLASSNAME_REGISTER( plRemoteAvatarInfoMsg );
GETINTERFACE_ANY( plRemoteAvatarInfoMsg, plMessage );
void SetAvatarKey(plKey p) { fAvatar = p; }
plKey GetAvatarKey() { return fAvatar; }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fAvatar = mgr->ReadKey(stream);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
mgr->WriteKey(stream, fAvatar);
}
};
#endif // plRemoteAvatarInfoMsg_inc

View File

@ -0,0 +1,46 @@
/*==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/>.
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 "plSDLModifierMsg.h"
#include "../PubUtilLib/plSDL/plSDL.h" // ugh.
plSDLModifierMsg::plSDLModifierMsg(const char* sdlName, Action a) :
fSDLName(nil),
fAction(a),
fState(nil),
fPlayerID(0),
fManageStateMem(false),
fFlags(0)
{
SetSDLName(sdlName);
SetBCastFlag(plMessage::kPropagateToModifiers);
}
plSDLModifierMsg::~plSDLModifierMsg()
{
if ( fManageStateMem )
delete fState;
delete [] fSDLName;
}

View File

@ -0,0 +1,84 @@
/*==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/>.
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 plSDLModifierMsg_INC
#define plSDLModifierMsg_INC
#include "../pnMessage/plMessage.h"
#include "hsUtils.h"
//
// A msg sent to an SDL modifier to tell it send or recv state.
//
class hsStream;
class hsResMgr;
class plStateDataRecord;
class plSDLModifierMsg : public plMessage
{
public:
enum Action
{
kActionNone = 0,
kRecv,
kSendToServer,
kSendToServerAndClients
};
protected:
char* fSDLName; // the state descriptor name (ie. "physical")
Action fAction;
plStateDataRecord* fState; // for recving state
bool fManageStateMem; // delete fState?
UInt32 fPlayerID;
UInt32 fFlags;
public:
plSDLModifierMsg(const char* sdlName=nil, Action a=kActionNone);
~plSDLModifierMsg();
CLASSNAME_REGISTER( plSDLModifierMsg );
GETINTERFACE_ANY( plSDLModifierMsg, plMessage );
UInt32 GetFlags() const { return fFlags; }
void SetFlags(UInt32 f) { fFlags = f; }
Action GetAction() const { return fAction; }
void SetAction(Action t) { fAction=t; }
plStateDataRecord* GetState(bool unManageState=false) { if ( unManageState ) fManageStateMem=false; return fState; }
void SetState(plStateDataRecord* s, bool manageState) { fState=s; fManageStateMem=manageState; }
const char* GetSDLName() const { return fSDLName; }
void SetSDLName(const char* s) { delete [] fSDLName; fSDLName=hsStrcpy(s); }
UInt32 GetPlayerID() const { return fPlayerID; }
void SetPlayerID(UInt32 p) { fPlayerID=p; }
// IO
void Read(hsStream* stream, hsResMgr* mgr) { hsAssert(false, "local only msg"); }
void Write(hsStream* stream, hsResMgr* mgr) { hsAssert(false, "local only msg"); }
};
#endif // plSDLModifierMsg_INC

View File

@ -0,0 +1,53 @@
/*==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/>.
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 plSDLNotificationMsg_inc
#define plSDLNotificationMsg_inc
#include "../pnMessage/plMessage.h"
class plSimpleStateVariable;
class plSDLNotificationMsg : public plMessage
{
public:
float fDelta; // change threshold
const plSimpleStateVariable* fVar;
std::string fSDLName; // name of state descriptor
int fPlayerID; // pid of the player who changed the data
std::string fHintString; // hint from the player who changed the data
plSDLNotificationMsg() : fDelta(0), fVar(nil), fPlayerID(0) {}
~plSDLNotificationMsg() { }
CLASSNAME_REGISTER( plSDLNotificationMsg );
GETINTERFACE_ANY( plSDLNotificationMsg, plMessage );
// IO
void Read(hsStream* stream, hsResMgr* mgr) { hsAssert(false, "NA: LocalOnly msg"); }
void Write(hsStream* stream, hsResMgr* mgr) { hsAssert(false, "NA: LocalOnly msg"); }
};
#endif // plSDLNotificationMsg_in

View File

@ -0,0 +1,46 @@
/*==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/>.
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 plSatisfiedMsg_inc
#define plSatisfiedMsg_inc
#include "../pnMessage/plMessage.h"
class plSatisfiedMsg : public plMessage
{
public:
plSatisfiedMsg() {}
plSatisfiedMsg(const plKey &s) : plMessage(s, s, nil) {}
CLASSNAME_REGISTER( plSatisfiedMsg );
GETINTERFACE_ANY( plSatisfiedMsg, plMessage );
virtual void Read(hsStream* stream, hsResMgr* mgr) { IMsgRead(stream, mgr); }
virtual void Write(hsStream* stream, hsResMgr* mgr) { IMsgWrite(stream, mgr); }
};
#endif // plSatisfiedMsg_inc

View File

@ -0,0 +1,50 @@
/*==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/>.
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 plSelfDestructMsg_inc
#define plSelfDestructMsg_inc
#include "plMessage.h"
class plSelfDestructMsg : public plMessage
{
protected:
plSelfDestructMsg(plKey &victim) : plMessage(victim, victim, nil) {}
friend class plKeyImp;
public:
plSelfDestructMsg() { hsAssert(false, "For system use only"); }
CLASSNAME_REGISTER( plSelfDestructMsg );
GETINTERFACE_ANY( plSelfDestructMsg, plMessage );
virtual void Read(hsStream* stream, hsResMgr* mgr) { IMsgRead(stream, mgr); }
virtual void Write(hsStream* stream, hsResMgr* mgr) { IMsgWrite(stream, mgr); }
};
#endif // plSelfDestructMsg_inc

View File

@ -0,0 +1,68 @@
/*==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/>.
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 "plServerReplyMsg.h"
#include "hsStream.h"
#include "hsBitVector.h"
void plServerReplyMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fType);
}
void plServerReplyMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fType);
}
enum ServerReplyFlags
{
kServerReplyType,
};
void plServerReplyMsg::ReadVersion(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgReadVersion(s, mgr);
hsBitVector contentFlags;
contentFlags.Read(s);
if (contentFlags.IsBitSet(kServerReplyType))
s->ReadSwap(&fType);
}
void plServerReplyMsg::WriteVersion(hsStream* s, hsResMgr* mgr)
{
plMessage::IMsgWriteVersion(s, mgr);
hsBitVector contentFlags;
contentFlags.SetBit(kServerReplyType);
contentFlags.Write(s);
// kServerReplyType
s->WriteSwap(fType);
}

View 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/>.
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 plServerReplyMsg_inc
#define plServerReplyMsg_inc
#include "plMessage.h"
class hsStream;
class hsResMgr;
//
// Sent by server to confirm/deny a sharedState lock attempt.
// Used for trigger arbitration.
// Should not set the NetPropagate bcast flag, since it originates on the gameServer.
//
class plServerReplyMsg : public plMessage
{
int fType;
public:
enum
{
kUnInit = -1,
kDeny,
kAffirm,
};
void SetType(int t) { fType = t; }
int GetType() { return fType; }
plServerReplyMsg() : fType(kUnInit) { }
plServerReplyMsg(const plKey &s, const plKey &r, const double* t) : plMessage(s,r,t), fType(kUnInit) { }
CLASSNAME_REGISTER( plServerReplyMsg );
GETINTERFACE_ANY( plServerReplyMsg, plMessage );
// IO
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
void ReadVersion(hsStream* s, hsResMgr* mgr);
void WriteVersion(hsStream* s, hsResMgr* mgr);
};
#endif // plServerReplyMsg_inc

View File

@ -0,0 +1,45 @@
/*==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/>.
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 plSetNetGroupIDMsg_h_inc
#define plSetNetGroupIDMsg_h_inc
#include "plMessage.h"
#include "../pnNetCommon/plNetGroup.h"
// Send this to a SynchedObject to change its NetGroupID
class plSetNetGroupIDMsg : public plMessage
{
public:
CLASSNAME_REGISTER(plSetNetGroupIDMsg);
GETINTERFACE_ANY(plSetNetGroupIDMsg, plMessage);
plNetGroupId fId;
void Read(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgRead(stream, mgr); fId.Read(stream); }
void Write(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgWrite(stream, mgr); fId.Write(stream); }
};
#endif // plSetNetGroupIDMsg_h_inc

View File

@ -0,0 +1,57 @@
/*==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/>.
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 plSharedStateMsg_inc
#define plSharedStateMsg_inc
#include "plMessage.h"
#include "../pnNetCommon/plNetSharedState.h"
class hsStream;
class hsResMgr;
//
// Msg from server containing generic sharedState
//
class plSharedStateMsg : public plMessage
{
protected:
plNetSharedState fSharedState;
public:
plSharedStateMsg() {}
plSharedStateMsg(const plKey &s, const plKey &r, const double* t) : plMessage(s,r,t) {}
CLASSNAME_REGISTER( plSharedStateMsg );
GETINTERFACE_ANY( plSharedStateMsg, plMessage );
void CopySharedState(plNetSharedState* ss) { fSharedState.Copy(ss); }
plNetSharedState* GetSharedState() { return &fSharedState; }
// IO
void Read(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgRead(stream, mgr); fSharedState.Write(stream); }
void Write(hsStream* stream, hsResMgr* mgr) { plMessage::IMsgWrite(stream, mgr); fSharedState.Read(stream); }
};
#endif // plSharedStateMsg_inc

View File

@ -0,0 +1,37 @@
/*==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/>.
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 "plSimulationMsg.h"
void plSimulationMsg::Read(hsStream* stream, hsResMgr *mgr)
{
IMsgRead(stream, mgr);
}
void plSimulationMsg::Write(hsStream* stream, hsResMgr *mgr)
{
IMsgWrite(stream, mgr);
}

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/>.
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 PLSIMULATIONMSG_H
#define PLSIMULATIONMSG_H
#include "../pnMessage/plMessage.h"
// PLSIMULATIONMSG
// Virtual base class for all messages which are specific to the simulation interface
// (and the simulation pool objects)
// Most messages which are intended to go through the Simulation interface to the pool
// objects (without being explictly relayed by the Simulation interface) should subclass
// from this
class plSimulationMsg : public plMessage
{
public:
// pass-through constructors
plSimulationMsg() : plMessage() {};
plSimulationMsg(const plKey &sender, const plKey &receiver, const double *time) : plMessage(sender, receiver, time) {};
CLASSNAME_REGISTER( plSimulationMsg );
GETINTERFACE_ANY( plSimulationMsg, plMessage );
virtual void Read(hsStream *stream, hsResMgr *mgr);
virtual void Write(hsStream *stream, hsResMgr *mgr);
};
#endif // PLSIMULATIONMSG_H

View File

@ -0,0 +1,62 @@
/*==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/>.
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 PLSIMULATIONSYNCHMSG_h
#define PLSIMULATIONSYNCHMSG_h
#include "plMessage.h"
// PLSIMULATIONSYNCHMSG
// periodically sent from one simulated object to another to ensure consistent state
// this is a completely virtual message type
// more meaningful sub-classes are created by specific physics systems
class plSimulationSynchMsg : public plMessage
{
public:
// ???
// This message is not really creatable: it's abstract. It's designed to sneak
// havok-specific data through the generalized simulation logic
CLASSNAME_REGISTER( plSimulationSynchMsg );
GETINTERFACE_ANY( plSimulationSynchMsg, plMessage );
// Don't be fooled: this class is *not* to be instantiated.
void Read(hsStream *stream, hsResMgr *mgr);
void Write(hsStream *stream, hsResMgr *mgr);
};
inline void plSimulationSynchMsg::Read(hsStream *s, hsResMgr *mgr)
{
hsAssert(false, "plSimulationSynchMsg should never be instantiated directly");
}
inline void plSimulationSynchMsg::Write(hsStream *s, hsResMgr *mgr)
{
hsAssert(false, "plSimulationSynchMsg should never be instantiated directly");
}
#endif // PLSIMULATIONSYNCHMSG_h

View File

@ -0,0 +1,74 @@
/*==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/>.
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 plSingleModMsg_inc
#define plSingleModMsg_inc
#include "plMessage.h"
#include "hsBitVector.h"
class hsStream;
class hsResMgr;
class plSingleModMsg : public plMessage
{
public:
plSingleModMsg()
: plMessage(nil, nil, nil) {}
plSingleModMsg(const plKey &s,
const plKey &r,
const double* t)
: plMessage(s, r, t) {}
~plSingleModMsg() {}
CLASSNAME_REGISTER( plSingleModMsg );
GETINTERFACE_ANY( plSingleModMsg, plMessage );
enum ModCmds
{
};
hsBitVector fCmd;
hsBool Cmd(int n) { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fCmd.Read(stream);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fCmd.Write(stream);
}
};
#endif // plSingleModMsg_inc

View File

@ -0,0 +1,78 @@
/*==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/>.
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 "plSoundMsg.h"
#include "hsStream.h"
plSoundMsg::~plSoundMsg()
{
ClearCmd();
}
void plSoundMsg::ClearCmd()
{
plMessageWithCallbacks::Clear();
fCmd.Clear();
}
void plSoundMsg::Read(hsStream* stream, hsResMgr* mgr)
{
plMessageWithCallbacks::Read(stream, mgr);
fCmd.Read(stream);
stream->ReadSwap(&fBegin);
stream->ReadSwap(&fEnd);
fLoop = stream->ReadBool();
fPlaying = stream->ReadBool();
stream->ReadSwap(&fSpeed);
stream->ReadSwap(&fTime);
stream->ReadSwap(&fIndex);
stream->ReadSwap(&fRepeats);
stream->ReadSwap(&fNameStr);
stream->ReadSwap(&fVolume);
fFadeType = (plSoundMsg::FadeType)stream->ReadByte();
}
void plSoundMsg::Write(hsStream* stream, hsResMgr* mgr)
{
plMessageWithCallbacks::Write(stream, mgr);
fCmd.Write(stream);
stream->WriteSwap(fBegin);
stream->WriteSwap(fEnd);
stream->WriteBool(fLoop);
stream->WriteBool(fPlaying);
stream->WriteSwap(fSpeed);
stream->WriteSwap(fTime);
stream->WriteSwap(fIndex);
stream->WriteSwap(fRepeats);
stream->WriteSwap(fNameStr);
stream->WriteSwap(fVolume);
stream->WriteByte( (UInt8)fFadeType );
}

View File

@ -0,0 +1,106 @@
/*==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/>.
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 plSoundMsg_h
#define plSoundMsg_h
#include "plMessageWithCallbacks.h"
#include "hsTemplates.h"
#include "hsBitVector.h"
class plSoundMsg : public plMessageWithCallbacks
{
private:
void IInit() { fLoop=false; fPlaying = false; fBegin=fEnd=fTime=fRepeats=0; fSpeed = 0.f; fVolume = 0.f; fIndex = -1; fNameStr = 0; fFadeType = kLinear; }
public:
plSoundMsg()
: plMessageWithCallbacks(nil, nil, nil) { IInit(); }
plSoundMsg(const plKey &s,
const plKey &r,
const double* t)
: plMessageWithCallbacks(s, r, t) { IInit(); }
~plSoundMsg();
CLASSNAME_REGISTER( plSoundMsg );
GETINTERFACE_ANY( plSoundMsg, plMessageWithCallbacks );
enum ModCmds
{
kPlay=0,
kStop,
kSetLooping,
kUnSetLooping,
kSetBegin,
kToggleState,
kAddCallbacks,
kRemoveCallbacks,
kGetStatus,
kGetNumSounds,
kStatusReply,
kGoToTime,
kSetVolume,
kSetTalkIcon,
kClearTalkIcon,
kSetFadeIn,
kSetFadeOut,
kIsLocalOnly, // Not really a command, just a flag
kSelectFromGroup,
kNumCmds,
kFastForwardPlay,
kFastForwardToggle,
kSynchedPlay,
};
hsBitVector fCmd;
hsBool Cmd(int n) const { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd();
double fBegin;
double fEnd;
hsBool fLoop;
hsScalar fSpeed;
double fTime;
int fIndex;
int fRepeats;
hsBool fPlaying;
UInt32 fNameStr;
hsScalar fVolume; // Range: 0 - silence, 1.f - loudest
enum FadeType
{
kLinear,
kLogarithmic,
kExponential
} fFadeType;
// IO
void Read(hsStream* stream, hsResMgr* mgr);
void Write(hsStream* stream, hsResMgr* mgr);
};
#endif //plWin32Sound_h

View File

@ -0,0 +1,80 @@
/*==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/>.
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 "plTimeMsg.h"
#include "hsTimer.h"
plTimeMsg::plTimeMsg()
: plMessage(nil, nil, nil), fSeconds(0), fDelSecs(0)
{
}
plTimeMsg::plTimeMsg(const plKey &s,
const plKey &r,
const double* t, const hsScalar* d)
: plMessage(s, r, t)
{
fSeconds = t ? *t : hsTimer::GetSysSeconds();
fDelSecs = d ? *d : hsTimer::GetDelSysSeconds();
SetBCastFlag(plMessage::kBCastByExactType);
}
plTimeMsg::~plTimeMsg()
{
}
plEvalMsg::plEvalMsg()
{
}
plEvalMsg::plEvalMsg(const plKey &s,
const plKey &r,
const double* t, const hsScalar* d)
: plTimeMsg(s, r, t, d)
{
}
plEvalMsg::~plEvalMsg()
{
}
plTransformMsg::plTransformMsg()
{
}
plTransformMsg::plTransformMsg(const plKey &s,
const plKey &r,
const double* t, const hsScalar* d)
: plTimeMsg(s, r, t, d)
{
SetBCastFlag(plMessage::kClearAfterBCast);
}
plTransformMsg::~plTransformMsg()
{
}

View File

@ -0,0 +1,118 @@
/*==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/>.
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 plTimeMsg_inc
#define plTimeMsg_inc
#include "plMessage.h"
#include "hsStream.h"
class plTimeMsg : public plMessage
{
protected:
double fSeconds;
hsScalar fDelSecs;
public:
plTimeMsg();
plTimeMsg(const plKey &s,
const plKey &r,
const double* t, const hsScalar* del);
~plTimeMsg();
CLASSNAME_REGISTER( plTimeMsg );
GETINTERFACE_ANY( plTimeMsg, plMessage );
plTimeMsg& SetSeconds(double s) { fSeconds = s; return *this; }
plTimeMsg& SetDelSeconds(hsScalar d) { fDelSecs = d; return *this; }
double DSeconds() { return fSeconds; }
hsScalar DelSeconds() { return fDelSecs; }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
stream->ReadSwap(&fSeconds);
stream->ReadSwap(&fDelSecs);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
stream->WriteSwap(fSeconds);
stream->WriteSwap(fDelSecs);
}
};
class plEvalMsg : public plTimeMsg
{
public:
plEvalMsg();
plEvalMsg(const plKey &s,
const plKey &r,
const double* t, const hsScalar* del);
~plEvalMsg();
CLASSNAME_REGISTER( plEvalMsg );
GETINTERFACE_ANY( plEvalMsg, plTimeMsg );
// IO
void Read(hsStream* stream, hsResMgr* mgr) { plTimeMsg::Read(stream, mgr); }
void Write(hsStream* stream, hsResMgr* mgr) { plTimeMsg::Write(stream, mgr); }
};
class plTransformMsg : public plTimeMsg
{
public:
plTransformMsg();
plTransformMsg(const plKey &s,
const plKey &r,
const double* t, const hsScalar* del);
~plTransformMsg();
CLASSNAME_REGISTER( plTransformMsg );
GETINTERFACE_ANY( plTransformMsg, plTimeMsg );
// IO
void Read(hsStream* stream, hsResMgr* mgr) { plTimeMsg::Read(stream, mgr); }
void Write(hsStream* stream, hsResMgr* mgr) { plTimeMsg::Write(stream, mgr); }
};
// Does the same thing as plTransformMsg, but as you might guess from the name, it's sent later.
// It's a separate message type so that objects can register for just the delayed message when
// it's broadcast.
class plDelayedTransformMsg : public plTransformMsg
{
public:
plDelayedTransformMsg() : plTransformMsg() {}
plDelayedTransformMsg(const plKey &s, const plKey &r, const double* t, const hsScalar* del) : plTransformMsg(s, r, t, del) {}
CLASSNAME_REGISTER( plDelayedTransformMsg );
GETINTERFACE_ANY( plDelayedTransformMsg, plTransformMsg );
};
#endif // plTimeMsg_inc

View File

@ -0,0 +1,84 @@
/*==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/>.
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 plWarpMsg_inc
#define plWarpMsg_inc
#include "hsStream.h"
#include "plMessage.h"
#include "hsMatrix44.h"
class plWarpMsg : public plMessage
{
private:
UInt32 fWarpFlags;
hsMatrix44 fTransform;
public:
enum WarpFlags
{
kFlushTransform = 0x1,
kZeroVelocity = 0x2
};
plWarpMsg() { Clear(); }
plWarpMsg(const hsMatrix44& mat ){ Clear(); fTransform = mat; }
plWarpMsg(const plKey &s,
const plKey &r,
const double* t) { Clear(); }
plWarpMsg(const plKey &s, const plKey &r, UInt32 flags, const hsMatrix44 &mat)
: fWarpFlags(flags), fTransform(mat), plMessage(s, r, nil)
{ };
~plWarpMsg(){}
CLASSNAME_REGISTER( plWarpMsg );
GETINTERFACE_ANY( plWarpMsg, plMessage );
void Clear() { fWarpFlags=0; }
UInt32 GetWarpFlags() { return fWarpFlags; }
void SetWarpFlags(UInt32 f) { fWarpFlags=f; }
void SetTransform(const hsMatrix44& mat) { fTransform=mat; }
hsMatrix44& GetTransform() { return fTransform; }
// IO
void Read(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgRead(stream, mgr);
fTransform.Read(stream);
stream->ReadSwap(&fWarpFlags);
}
void Write(hsStream* stream, hsResMgr* mgr)
{
plMessage::IMsgWrite(stream, mgr);
fTransform.Write(stream);
stream->WriteSwap(fWarpFlags);
}
};
#endif // plWarpMsg_inc

View File

@ -0,0 +1,183 @@
/*==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/>.
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 pnMessageCreatable_inc
#define pnMessageCreatable_inc
#include "../pnFactory/plCreator.h"
#include "plMessage.h"
REGISTER_NONCREATABLE( plMessage );
#include "plRefMsg.h"
REGISTER_CREATABLE( plRefMsg );
REGISTER_CREATABLE( plGenRefMsg );
#include "plObjRefMsg.h"
REGISTER_CREATABLE( plObjRefMsg );
#include "plIntRefMsg.h"
REGISTER_CREATABLE( plIntRefMsg );
#include "plNodeRefMsg.h"
REGISTER_CREATABLE( plNodeRefMsg );
#include "plSatisfiedMsg.h"
REGISTER_CREATABLE( plSatisfiedMsg );
#include "plSingleModMsg.h"
REGISTER_CREATABLE( plSingleModMsg );
#include "plMultiModMsg.h"
REGISTER_CREATABLE( plMultiModMsg );
#include "plTimeMsg.h"
REGISTER_CREATABLE( plTimeMsg );
REGISTER_CREATABLE( plEvalMsg );
REGISTER_CREATABLE( plTransformMsg );
REGISTER_CREATABLE( plDelayedTransformMsg );
#include "plWarpMsg.h"
REGISTER_CREATABLE( plWarpMsg );
#include "plAttachMsg.h"
REGISTER_CREATABLE( plAttachMsg );
#include "plCorrectionMsg.h"
REGISTER_CREATABLE( plCorrectionMsg );
#include "plSoundMsg.h"
REGISTER_CREATABLE( plSoundMsg );
#include "plAudioSysMsg.h"
REGISTER_CREATABLE( plAudioSysMsg );
#include "plEnableMsg.h"
REGISTER_CREATABLE( plEnableMsg );
#include "plServerReplyMsg.h"
REGISTER_CREATABLE( plServerReplyMsg );
#include "plSharedStateMsg.h"
REGISTER_CREATABLE( plSharedStateMsg );
#include "plClientMsg.h"
REGISTER_CREATABLE( plClientMsg );
REGISTER_CREATABLE( plClientRefMsg );
#include "plSimulationMsg.h"
REGISTER_NONCREATABLE( plSimulationMsg );
#include "plSimulationSynchMsg.h"
REGISTER_NONCREATABLE( plSimulationSynchMsg );
#include "plProxyDrawMsg.h"
REGISTER_CREATABLE( plProxyDrawMsg );
#include "plEventCallbackMsg.h"
REGISTER_CREATABLE( plEventCallbackMsg );
REGISTER_CREATABLE( plEventCallbackInterceptMsg );
#include "plSelfDestructMsg.h"
REGISTER_CREATABLE( plSelfDestructMsg );
#include "plCameraMsg.h"
REGISTER_CREATABLE( plCameraMsg );
REGISTER_CREATABLE( plCameraTargetFadeMsg );
REGISTER_CREATABLE( plIfaceFadeAvatarMsg );
#include "plPlayerPageMsg.h"
REGISTER_CREATABLE( plPlayerPageMsg );
#include "plCmdIfaceModMsg.h"
REGISTER_CREATABLE( plCmdIfaceModMsg );
#include "plNotifyMsg.h"
REGISTER_CREATABLE( plNotifyMsg );
#include "plFakeOutMsg.h"
REGISTER_CREATABLE( plFakeOutMsg );
#include "plCursorChangeMsg.h"
REGISTER_CREATABLE( plCursorChangeMsg );
#include "plNodeChangeMsg.h"
REGISTER_CREATABLE( plNodeChangeMsg );
#include "plMessageWithCallbacks.h"
REGISTER_CREATABLE( plMessageWithCallbacks );
#include "plRemoteAvatarInfoMsg.h"
REGISTER_CREATABLE( plRemoteAvatarInfoMsg );
#include "plSDLModifierMsg.h"
REGISTER_CREATABLE(plSDLModifierMsg);
#include "plSDLNotificationMsg.h"
REGISTER_CREATABLE(plSDLNotificationMsg);
#include "plPipeResMakeMsg.h"
REGISTER_CREATABLE(plPipeResMakeMsg);
REGISTER_CREATABLE(plPipeRTMakeMsg);
REGISTER_CREATABLE(plPipeGeoMakeMsg);
REGISTER_CREATABLE(plPipeTexMakeMsg);
#include "plDISpansMsg.h"
REGISTER_CREATABLE(plDISpansMsg);
#include "plSetNetGroupIDMsg.h"
REGISTER_CREATABLE(plSetNetGroupIDMsg);
#endif // pnMessageCreatable_inc