-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from Deledrius/plWarpMsg
Add plWarpMsg and pyWarpMsg.
- Loading branch information
Showing
9 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* This file is part of HSPlasma. | ||
* | ||
* HSPlasma 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. | ||
* | ||
* HSPlasma 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 HSPlasma. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "pyWarpMsg.h" | ||
|
||
#include <PRP/Message/plWarpMsg.h> | ||
#include "Math/pyMatrix.h" | ||
#include "pyMessage.h" | ||
|
||
PY_PLASMA_NEW(WarpMsg, plWarpMsg) | ||
|
||
PY_PROPERTY(uint32_t, WarpMsg, warpFlags, getWarpFlags, setWarpFlags) | ||
PY_PROPERTY(hsMatrix44, WarpMsg, transform, getTransform, setTransform) | ||
|
||
static PyGetSetDef pyWarpMsg_GetSet[] = { | ||
pyWarpMsg_warpFlags_getset, | ||
pyWarpMsg_transform_getset, | ||
PY_GETSET_TERMINATOR | ||
}; | ||
|
||
PY_PLASMA_TYPE(WarpMsg, plWarpMsg, "plWarpMsg wrapper") | ||
|
||
PY_PLASMA_TYPE_INIT(WarpMsg) | ||
{ | ||
pyWarpMsg_Type.tp_new = pyWarpMsg_new; | ||
pyWarpMsg_Type.tp_getset = pyWarpMsg_GetSet; | ||
pyWarpMsg_Type.tp_base = &pyMessage_Type; | ||
if (PyType_CheckAndReady(&pyWarpMsg_Type) < 0) | ||
return nullptr; | ||
|
||
PY_TYPE_ADD_CONST(WarpMsg, "kFlushTransform", plWarpMsg::kFlushTransform); | ||
PY_TYPE_ADD_CONST(WarpMsg, "kZeroVelocity", plWarpMsg::kZeroVelocity); | ||
|
||
Py_INCREF(&pyWarpMsg_Type); | ||
return (PyObject*)&pyWarpMsg_Type; | ||
} | ||
|
||
PY_PLASMA_IFC_METHODS(WarpMsg, plWarpMsg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* This file is part of HSPlasma. | ||
* | ||
* HSPlasma 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. | ||
* | ||
* HSPlasma 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 HSPlasma. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _PYWARPMSG_H | ||
#define _PYWARPMSG_H | ||
|
||
#include "PyPlasma.h" | ||
|
||
PY_WRAP_PLASMA(WarpMsg, class plWarpMsg); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* This file is part of HSPlasma. | ||
* | ||
* HSPlasma 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. | ||
* | ||
* HSPlasma 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 HSPlasma. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "plWarpMsg.h" | ||
|
||
void plWarpMsg::read(hsStream* S, plResManager* mgr) | ||
{ | ||
plMessage::read(S, mgr); | ||
|
||
fTransform.read(S); | ||
fWarpFlags = S->readInt(); | ||
} | ||
|
||
void plWarpMsg::write(hsStream* S, plResManager* mgr) | ||
{ | ||
plMessage::write(S, mgr); | ||
|
||
fTransform.write(S); | ||
S->writeInt(fWarpFlags); | ||
} | ||
|
||
void plWarpMsg::IPrcWrite(pfPrcHelper* prc) | ||
{ | ||
plMessage::IPrcWrite(prc); | ||
|
||
prc->startTag("WarpParams"); | ||
prc->writeParamHex("Flags", fWarpFlags); | ||
prc->endTag(true); | ||
prc->writeSimpleTag("WarpTo"); | ||
fTransform.prcWrite(prc); | ||
prc->closeTag(); | ||
} | ||
|
||
void plWarpMsg::IPrcParse(const pfPrcTag* tag, plResManager* mgr) | ||
{ | ||
if (tag->getName() == "WarpParams") { | ||
fWarpFlags = tag->getParam("Flags", "0").to_uint(); | ||
} else if (tag->getName() == "WarpTo") { | ||
fTransform.prcParse(tag->getFirstChild()); | ||
} else { | ||
plMessage::IPrcParse(tag, mgr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* This file is part of HSPlasma. | ||
* | ||
* HSPlasma 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. | ||
* | ||
* HSPlasma 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 HSPlasma. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _PLWARPMSG_H | ||
#define _PLWARPMSG_H | ||
|
||
#include "plMessage.h" | ||
#include "Math/hsMatrix44.h" | ||
|
||
class PLASMA_DLL plWarpMsg : public plMessage | ||
{ | ||
CREATABLE(plWarpMsg, kWarpMsg, plMessage) | ||
|
||
public: | ||
enum { kFlushTransform = 0x1, kZeroVelocity = 0x2 }; | ||
|
||
private: | ||
uint32_t fWarpFlags; | ||
hsMatrix44 fTransform; | ||
|
||
public: | ||
plWarpMsg() : fWarpFlags(), fTransform() { } | ||
|
||
uint32_t getWarpFlags() const { return fWarpFlags; } | ||
void setWarpFlags(uint32_t f) { fWarpFlags = f; } | ||
|
||
hsMatrix44 getTransform() { return fTransform; } | ||
void setTransform(const hsMatrix44& mat) { fTransform = mat; } | ||
|
||
void read(hsStream* S, plResManager* mgr) HS_OVERRIDE; | ||
void write(hsStream* S, plResManager* mgr) HS_OVERRIDE; | ||
|
||
protected: | ||
void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; | ||
void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters