diff --git a/Python/PRP/Avatar/pyClothingItem.cpp b/Python/PRP/Avatar/pyClothingItem.cpp index 51810f01..57e1c444 100644 --- a/Python/PRP/Avatar/pyClothingItem.cpp +++ b/Python/PRP/Avatar/pyClothingItem.cpp @@ -28,8 +28,8 @@ PY_METHOD_VA(ClothingItem, getMesh, "Params: lod\n" "Gets the Key of the mesh for the specified LOD") { - int lod = plClothingItem::kLODHigh; - if (!PyArg_ParseTuple(args, "i", &lod)) { + Py_ssize_t lod = plClothingItem::kLODHigh; + if (!PyArg_ParseTuple(args, "n", &lod)) { PyErr_SetString(PyExc_TypeError, "getMesh expects int"); return nullptr; } @@ -41,10 +41,10 @@ PY_METHOD_VA(ClothingItem, setMesh, "Params: lod, mesh\n" "Sets the Key of the mesh for the specified LOD") { - int lod = plClothingItem::kLODHigh; + Py_ssize_t lod = plClothingItem::kLODHigh; pyKey* key; - if (!PyArg_ParseTuple(args, "iO", &lod, &key)) { + if (!PyArg_ParseTuple(args, "nO", &lod, &key)) { PyErr_SetString(PyExc_TypeError, "setMesh expects int, plKey"); return nullptr; } @@ -61,8 +61,8 @@ PY_METHOD_VA(ClothingItem, getElementTexture, "Params: element, layer\n" "Gets the Key of the texture for the specified element and layer") { - int element, layer; - if (!PyArg_ParseTuple(args, "ii", &element, &layer)) { + Py_ssize_t element, layer; + if (!PyArg_ParseTuple(args, "nn", &element, &layer)) { PyErr_SetString(PyExc_TypeError, "getElementTexture expects int, int"); return nullptr; } @@ -74,10 +74,10 @@ PY_METHOD_VA(ClothingItem, setElementTexture, "Params: element idx, layer idx, texture\n" "Sets the texture of the specified element and layer") { - int element, layer; + Py_ssize_t element, layer; pyKey* key; - if (!PyArg_ParseTuple(args, "iiO", &element, &layer, &key)) { + if (!PyArg_ParseTuple(args, "nnO", &element, &layer, &key)) { PyErr_SetString(PyExc_TypeError, "setElementTexture expects int, int, plKey"); return nullptr; } @@ -94,8 +94,8 @@ PY_METHOD_VA(ClothingItem, getElementName, "Params: element idx\n" "Gets the name of the specified element") { - int element; - if (!PyArg_ParseTuple(args, "i", &element)) { + Py_ssize_t element; + if (!PyArg_ParseTuple(args, "n", &element)) { PyErr_SetString(PyExc_TypeError, "getElementName expects int"); return nullptr; } @@ -107,9 +107,9 @@ PY_METHOD_VA(ClothingItem, setElementName, "Params: element idx, name\n" "Sets the name of the specified element") { - int element; + Py_ssize_t element; const char* name; - if (!PyArg_ParseTuple(args, "is", &element, &name)) { + if (!PyArg_ParseTuple(args, "ns", &element, &name)) { PyErr_SetString(PyExc_TypeError, "setElementName expects int, string"); return nullptr; } @@ -136,8 +136,8 @@ PY_METHOD_VA(ClothingItem, delElement, "Params: element idx\n" "Remove an element from the clothingItem") { - int idx; - if (!PyArg_ParseTuple(args, "i", &idx)) { + Py_ssize_t idx; + if (!PyArg_ParseTuple(args, "n", &idx)) { PyErr_SetString(PyExc_TypeError, "delElement expects an int"); return nullptr; } @@ -176,6 +176,7 @@ PY_PROPERTY(plKey, ClothingItem, icon, getIcon, setIcon) PY_PROPERTY(plKey, ClothingItem, accessory, getAccessory, setAccessory) PY_PROPERTY(hsColorRGBA, ClothingItem, defaultTint1, getDefaultTint1, setDefaultTint1) PY_PROPERTY(hsColorRGBA, ClothingItem, defaultTint2, getDefaultTint2, setDefaultTint2) +PY_PROPERTY_RO(ClothingItem, numElements, getNumElements) PyGetSetDef pyClothingItem_GetSet[] = { pyClothingItem_itemName_getset, @@ -189,6 +190,7 @@ PyGetSetDef pyClothingItem_GetSet[] = { pyClothingItem_accessory_getset, pyClothingItem_defaultTint1_getset, pyClothingItem_defaultTint2_getset, + pyClothingItem_numElements_getset, PY_GETSET_TERMINATOR }; diff --git a/Python/PyHSPlasma.pyi b/Python/PyHSPlasma.pyi index cf72abc7..9c22f34f 100644 --- a/Python/PyHSPlasma.pyi +++ b/Python/PyHSPlasma.pyi @@ -1708,6 +1708,7 @@ class plClothingItem(hsKeyedObject): group: int = ... icon: Optional[plKey[plMipmap]] = ... itemName: str = ... + numElements: int = ... sortOrder: int = ... tileset: int = ... type: int = ... diff --git a/core/PRP/Audio/plEAXListenerMod.h b/core/PRP/Audio/plEAXListenerMod.h index 49851db4..6c5ff478 100644 --- a/core/PRP/Audio/plEAXListenerMod.h +++ b/core/PRP/Audio/plEAXListenerMod.h @@ -75,6 +75,15 @@ class HSPLASMA_EXPORT plEAXReverbEffect : public plEAXEffect protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + plKey getSoftRegion() const { return fSoftRegion; } + const EAXREVERBPROPERTIES& getListenerProps() const { return fListenerProps; } + EAXREVERBPROPERTIES& getListenerProps() { return fListenerProps; } + const std::vector& getApertures() const { return fApertures; } + std::vector& getApertures() { return fApertures; } + + void setSoftRegion(plKey region) { fSoftRegion = std::move(region); } }; #endif diff --git a/core/PRP/Avatar/plArmatureEffects.h b/core/PRP/Avatar/plArmatureEffects.h index 40189bb6..57298a78 100644 --- a/core/PRP/Avatar/plArmatureEffects.h +++ b/core/PRP/Avatar/plArmatureEffects.h @@ -39,6 +39,10 @@ class HSPLASMA_EXPORT plArmatureEffectFootSound : public plArmatureEffect protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getMods() const { return fMods; } + std::vector& getMods() { return fMods; } }; @@ -67,6 +71,10 @@ class HSPLASMA_EXPORT plArmatureEffectsMgr : public hsKeyedObject protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getEffects() const { return fEffects; } + std::vector& getEffects() { return fEffects; } }; #endif diff --git a/core/PRP/Avatar/plArmatureMod.h b/core/PRP/Avatar/plArmatureMod.h index 97a5def3..60701c4f 100644 --- a/core/PRP/Avatar/plArmatureMod.h +++ b/core/PRP/Avatar/plArmatureMod.h @@ -43,7 +43,16 @@ class HSPLASMA_EXPORT plArmatureModBase : public plAGMasterMod void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; public: + const std::vector& getMeshes() const { return fMeshKeys; } + std::vector& getMeshes() { return fMeshKeys; } + const std::vector>& getUnusedBones() const { return fUnusedBones; } + std::vector>& getUnusedBones() { return fUnusedBones; } + const std::vector& getBrains() const { return fBrains; } + std::vector& getBrains() { return fBrains; } + plKey getDetector() const { return fDetector; } + void clearBrains(); + void setDetector(plKey detector) { fDetector = std::move(detector); } }; @@ -79,6 +88,33 @@ class HSPLASMA_EXPORT plArmatureMod : public plArmatureModBase protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + plKey getDefaultMesh() const { return fDefaultMesh; } + ST::string getRootName() const { return fRootName; } + plKey getClothingOutfit() const { return fClothingOutfit; } + int getBodyType() const { return fBodyType; } + plKey getEffects() const { return fEffects; } + hsVector3 getMins() const { return fMins; } + hsVector3 getMaxs() const { return fMaxs; } + float getPhysHeight() const { return fPhysHeight; } + float getPhysWidth() const { return fPhysWidth; } + ST::string getFootstepAge() const { return fFootstepAge; } + ST::string getFootstepPage() const { return fFootstepPage; } + ST::string getFootstepType() const { return fFootstepType; } + + void setDefaultMesh(plKey defaultMesh) { fDefaultMesh = std::move(defaultMesh); } + void setRootName(ST::string rootName) { fRootName = std::move(rootName); } + void setClothingOutfit(plKey clothingOutfit) { fClothingOutfit = std::move(clothingOutfit); } + void setBodyType(int bodyType) { fBodyType = bodyType; } + void setEffects(plKey effects) { fEffects = std::move(effects); } + void setMins(hsVector3 mins) { fMins = mins; } + void setMaxs(hsVector3 maxs) { fMaxs = maxs; } + void setPhysHeight(float physHeight) { fPhysHeight = physHeight; } + void setPhysWidth(float physWidth) { fPhysWidth = physWidth; } + void setFootstepAge(ST::string footstepAge) { fFootstepAge = std::move(footstepAge); } + void setFootstepPage(ST::string footstepPage) { fFootstepPage = std::move(footstepPage); } + void setFootstepType(ST::string footstepType) { fFootstepType = std::move(footstepType); } }; diff --git a/core/PRP/Avatar/plAvatarClothing.h b/core/PRP/Avatar/plAvatarClothing.h index 5beec5fe..c162e91d 100644 --- a/core/PRP/Avatar/plAvatarClothing.h +++ b/core/PRP/Avatar/plAvatarClothing.h @@ -53,6 +53,17 @@ class HSPLASMA_EXPORT plClothingOutfit : public plSynchedObject protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + unsigned char getGroup() const { return fGroup; } + plKey getBase() const { return fBase; } + plKey getTargetTexture() const { return fTargetTexture; } + plKey getMaterial() const { return fMaterial; } + + void setGroup(unsigned char group) { fGroup = group; } + void setBase(plKey base) { fBase = std::move(base); } + void setTargetTexture(plKey targetTexture) { fTargetTexture = std::move(targetTexture); } + void setMaterial(plKey material) { fMaterial = std::move(material); } }; @@ -71,6 +82,15 @@ class HSPLASMA_EXPORT plClothingBase : public hsKeyedObject protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + ST::string getName() const { return fName; } + ST::string getLayoutName() const { return fLayoutName; } + plKey getBaseTexture() const { return fBaseTexture; } + + void setName(ST::string name) { fName = std::move(name); } + void setLayoutName(ST::string layoutName) { fLayoutName = std::move(layoutName); } + void setBaseTexture(plKey baseTexture) { fBaseTexture = std::move(baseTexture); } }; #endif diff --git a/core/PRP/Avatar/plClothingItem.cpp b/core/PRP/Avatar/plClothingItem.cpp index 6a928a31..a7b9bf9c 100644 --- a/core/PRP/Avatar/plClothingItem.cpp +++ b/core/PRP/Avatar/plClothingItem.cpp @@ -286,7 +286,7 @@ void plClothingItem::addElement(const ST::string& elementName) fTextures.push_back(new plKey[kLayerMax]); } -void plClothingItem::delElement(int element) +void plClothingItem::delElement(size_t element) { delete[] fTextures[element]; fTextures.erase(fTextures.begin() + element); diff --git a/core/PRP/Avatar/plClothingItem.h b/core/PRP/Avatar/plClothingItem.h index 038450c4..9f338ba4 100644 --- a/core/PRP/Avatar/plClothingItem.h +++ b/core/PRP/Avatar/plClothingItem.h @@ -127,7 +127,7 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject * at LOD of \a lodLevel. * \sa LODLevels */ - plKey getMesh(int lodLevel) const { return fMeshes[lodLevel]; } + plKey getMesh(size_t lodLevel) const { return fMeshes[lodLevel]; } /** Returns the default first tint color for the item. */ hsColorRGBA getDefaultTint1() const @@ -184,7 +184,7 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject * at LOD level \a lodLevel. * \sa LODLevels */ - void setMesh(int lodLevel, plKey mesh) { fMeshes[lodLevel] = std::move(mesh); } + void setMesh(size_t lodLevel, plKey mesh) { fMeshes[lodLevel] = std::move(mesh); } /** Set the default first tint color for this item. */ void setDefaultTint1(const hsColorRGBA& tint); @@ -192,6 +192,9 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject /** Set the default second tint color for this item. */ void setDefaultTint2(const hsColorRGBA& tint); + /** Returns the number of elements in this clothing item. */ + size_t getNumElements() const { return fElementNames.size(); } + /** Remove all elements from the clothing item. */ void clearElements(); @@ -203,7 +206,7 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject * to \a texture. * \sa ClothingLayers */ - void setElementTexture(int element, int layer, plKey texture) + void setElementTexture(size_t element, size_t layer, plKey texture) { fTextures[element][layer] = std::move(texture); } @@ -211,7 +214,7 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject /** * Sets the element name for element number \a element to \a elementName. */ - void setElementName(int element, const ST::string& elementName) + void setElementName(size_t element, const ST::string& elementName) { fElementNames[element] = elementName; } @@ -221,7 +224,7 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject * \a layer. * \sa ClothingLayers */ - plKey getElementTexture(int element, int layer) const + plKey getElementTexture(size_t element, size_t layer) const { return fTextures[element][layer]; } @@ -229,13 +232,13 @@ class HSPLASMA_EXPORT plClothingItem : public hsKeyedObject /** * Returns the element name for element number \a element. */ - ST::string getElementName(int element) const + ST::string getElementName(size_t element) const { return fElementNames[element]; } /** Remove the specified element from the clothing item. */ - void delElement(int element); + void delElement(size_t element); }; #endif diff --git a/core/PRP/Geometry/plMorphArray.h b/core/PRP/Geometry/plMorphArray.h index bf0633a1..1b8bde53 100644 --- a/core/PRP/Geometry/plMorphArray.h +++ b/core/PRP/Geometry/plMorphArray.h @@ -29,6 +29,9 @@ class HSPLASMA_EXPORT plMorphArray void write(hsStream* S, plResManager* mgr); void prcWrite(pfPrcHelper* prc); void prcParse(const pfPrcTag* tag, plResManager* mgr); + + const std::vector& getDeltas() const { return fDeltas; } + std::vector& getDeltas() { return fDeltas; } }; #endif diff --git a/core/PRP/Geometry/plMorphDataSet.h b/core/PRP/Geometry/plMorphDataSet.h index 028bcd9e..ddd1a6ab 100644 --- a/core/PRP/Geometry/plMorphDataSet.h +++ b/core/PRP/Geometry/plMorphDataSet.h @@ -34,6 +34,10 @@ class HSPLASMA_EXPORT plMorphDataSet : public hsKeyedObject protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getMorphs() const { return fMorphs; } + std::vector& getMorphs() { return fMorphs; } }; #endif diff --git a/core/PRP/Geometry/plMorphDelta.cpp b/core/PRP/Geometry/plMorphDelta.cpp index ad5cd862..1b824804 100644 --- a/core/PRP/Geometry/plMorphDelta.cpp +++ b/core/PRP/Geometry/plMorphDelta.cpp @@ -75,24 +75,15 @@ void plVertDelta::prcParse(const pfPrcTag* tag) /* plMorphSpan */ -plMorphSpan::~plMorphSpan() -{ - delete[] fUVWs; -} - void plMorphSpan::read(hsStream* S) { fDeltas.resize(S->readInt()); fNumUVWChans = S->readInt(); - delete[] fUVWs; - if (fNumUVWChans > 0) - fUVWs = new hsVector3[fNumUVWChans * fDeltas.size()]; - else - fUVWs = nullptr; + fUVWs.resize(fNumUVWChans * fDeltas.size()); for (size_t i=0; istartTag("UVWs"); prc->writeParam("Channels", fNumUVWChans); prc->endTag(); - for (size_t i=0; i<(fDeltas.size() * fNumUVWChans); i++) + for (size_t i=0; icloseTag(); @@ -141,14 +132,13 @@ void plMorphSpan::prcParse(const pfPrcTag* tag) subchild = subchild->getNextSibling(); } } else if (child->getName() == "UVWs") { - delete[] fUVWs; fNumUVWChans = child->getParam("Channels", "0").to_uint(); size_t nUVWs = fDeltas.size() * fNumUVWChans; if (child->countChildren() != nUVWs) throw pfPrcParseException(__FILE__, __LINE__, "UVW count mismatch"); - fUVWs = new hsVector3[nUVWs]; + fUVWs.resize(nUVWs); const pfPrcTag* subchild = child->getFirstChild(); - for (size_t i=0; igetNextSibling(); } diff --git a/core/PRP/Geometry/plMorphDelta.h b/core/PRP/Geometry/plMorphDelta.h index 19b60aed..cfd1b79c 100644 --- a/core/PRP/Geometry/plMorphDelta.h +++ b/core/PRP/Geometry/plMorphDelta.h @@ -20,13 +20,11 @@ #include "PRP/plCreatable.h" #include "Math/hsGeometry3.h" -class HSPLASMA_EXPORT plVertDelta +struct HSPLASMA_EXPORT plVertDelta { -protected: unsigned short fIdx, fPadding; hsVector3 fPos, fNorm; -public: void read(hsStream* S); void write(hsStream* S); void prcWrite(pfPrcHelper* prc); @@ -34,16 +32,13 @@ class HSPLASMA_EXPORT plVertDelta }; -class HSPLASMA_EXPORT plMorphSpan +struct HSPLASMA_EXPORT plMorphSpan { -protected: std::vector fDeltas; unsigned short fNumUVWChans; - hsVector3* fUVWs; + std::vector fUVWs; -public: - plMorphSpan() : fNumUVWChans(), fUVWs() { } - ~plMorphSpan(); + plMorphSpan() : fNumUVWChans() { } void read(hsStream* S); void write(hsStream* S); @@ -69,6 +64,13 @@ class HSPLASMA_EXPORT plMorphDelta : public plCreatable protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getSpans() const { return fSpans; } + std::vector& getSpans() { return fSpans; } + float getWeight() const { return fWeight; } + + void setWeight(float weight) { fWeight = weight; } }; #endif diff --git a/core/PRP/Geometry/plMorphSequence.h b/core/PRP/Geometry/plMorphSequence.h index 11d3c06d..f41be648 100644 --- a/core/PRP/Geometry/plMorphSequence.h +++ b/core/PRP/Geometry/plMorphSequence.h @@ -36,6 +36,12 @@ class HSPLASMA_EXPORT plMorphSequence : public plSingleModifier protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getMorphs() const { return fMorphs; } + std::vector& getMorphs() { return fMorphs; } + const std::vector& getSharedMeshes() const { return fSharedMeshes; } + std::vector& getSharedMeshes() { return fSharedMeshes; } }; #endif diff --git a/core/PRP/Modifier/plAnimEventModifier.h b/core/PRP/Modifier/plAnimEventModifier.h index 6beef3b1..f0948cb0 100644 --- a/core/PRP/Modifier/plAnimEventModifier.h +++ b/core/PRP/Modifier/plAnimEventModifier.h @@ -41,7 +41,13 @@ class HSPLASMA_EXPORT plAnimEventModifier : public plSingleModifier void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; public: + const std::vector& getReceivers() const { return fReceivers; } + std::vector& getReceivers() { return fReceivers; } + plMessage* getCallback() const { return fCallback; } + bool isDisabled() const { return fDisabled; } + void setCallback(plMessage* callback); + void setDisabled(bool disabled) { fDisabled = disabled; } }; #endif diff --git a/core/PRP/Modifier/plGameMarkerModifier.h b/core/PRP/Modifier/plGameMarkerModifier.h index cb16c942..44aa3f31 100644 --- a/core/PRP/Modifier/plGameMarkerModifier.h +++ b/core/PRP/Modifier/plGameMarkerModifier.h @@ -36,6 +36,21 @@ class HSPLASMA_EXPORT plGameMarkerModifier : public plSingleModifier protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + plKey getGreenAnimKey() const { return fGreenAnimKey; } + plKey getRedAnimKey() const { return fRedAnimKey; } + plKey getOpenAnimKey() const { return fOpenAnimKey; } + plKey getBounceAnimKey() const { return fBounceAnimKey; } + unsigned short getPlaceSoundIdx() const { return fPlaceSoundIdx; } + unsigned short getHitSoundIdx() const { return fHitSoundIdx; } + + void setGreenAnimKey(plKey greenAnimKey) { fGreenAnimKey = std::move(greenAnimKey); } + void setRedAnimKey(plKey redAnimKey) { fRedAnimKey = std::move(redAnimKey); } + void setOpenAnimKey(plKey openAnimKey) { fOpenAnimKey = std::move(openAnimKey); } + void setBounceAnimKey(plKey bounceAnimKey) { fBounceAnimKey = std::move(bounceAnimKey); } + void setPlaceSoundIdx(unsigned short placeSoundIdx) { fPlaceSoundIdx = placeSoundIdx; } + void setHitSoundIdx(unsigned short hitSoundIdx) { fHitSoundIdx = hitSoundIdx; } }; #endif diff --git a/core/PRP/Modifier/plRandomSoundMod.h b/core/PRP/Modifier/plRandomSoundMod.h index 4fedaf7c..4555df3d 100644 --- a/core/PRP/Modifier/plRandomSoundMod.h +++ b/core/PRP/Modifier/plRandomSoundMod.h @@ -38,6 +38,9 @@ class HSPLASMA_EXPORT plRandomSoundModGroup void addIndex(unsigned short index) { fIndices.push_back(index); } void delIndex(size_t idx) { fIndices.erase(fIndices.begin() + idx); } void clearIndices() { fIndices.clear(); } + + short getGroupedIdx() const { return fGroupedIdx; } + void setGroupedIdx(short groupedIdx) { fGroupedIdx = groupedIdx; } }; diff --git a/core/PRP/Object/plDrawInterface.h b/core/PRP/Object/plDrawInterface.h index a537208e..640085f7 100644 --- a/core/PRP/Object/plDrawInterface.h +++ b/core/PRP/Object/plDrawInterface.h @@ -70,6 +70,13 @@ class HSPLASMA_EXPORT plInstanceDrawInterface : public plDrawInterface protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + unsigned int getTargetID() const { return fTargetID; } + plKey getDrawable() const { return fDrawable; } + + void setTargetID(unsigned int targetID) { fTargetID = targetID; } + void setDrawable(plKey drawable) { fDrawable = std::move(drawable); } }; #endif diff --git a/core/PRP/Physics/plVehicleModifier.cpp b/core/PRP/Physics/plVehicleModifier.cpp index dc05499c..dd17cbc0 100644 --- a/core/PRP/Physics/plVehicleModifier.cpp +++ b/core/PRP/Physics/plVehicleModifier.cpp @@ -21,7 +21,7 @@ void plVehicleModifier::read(hsStream* S, plResManager* mgr) plSingleModifier::read(S, mgr); fRoot = mgr->readKey(S); - for (size_t i=0; i<4; i++) { + for (size_t i=0; ireadKey(S); fWheels[i].fPosition.read(S); fWheels[i].fDirection.read(S); @@ -34,7 +34,7 @@ void plVehicleModifier::write(hsStream* S, plResManager* mgr) plSingleModifier::write(S, mgr); mgr->writeKey(S, fRoot); - for (size_t i=0; i<4; i++) { + for (size_t i=0; iwriteKey(S, fWheels[i].fWheelObj); fWheels[i].fPosition.write(S); fWheels[i].fDirection.write(S); @@ -51,7 +51,7 @@ void plVehicleModifier::IPrcWrite(pfPrcHelper* prc) prc->closeTag(); prc->writeSimpleTag("Wheels"); - for (size_t i=0; i<4; i++) { + for (size_t i=0; istartTag("Wheel"); prc->writeParam("Radius", fWheels[i].fRadius); prc->endTag(); @@ -72,10 +72,10 @@ void plVehicleModifier::IPrcParse(const pfPrcTag* tag, plResManager* mgr) if (tag->getName() == "Root") { fRoot = mgr->prcParseKey(tag->getFirstChild()); } else if (tag->getName() == "Wheels") { - if (tag->countChildren() != 4) + if (tag->countChildren() != kNumWheels) throw pfPrcParseException(__FILE__, __LINE__, "Wheels should contain 4 children"); const pfPrcTag* wheel = tag->getFirstChild(); - for (size_t i=0; i<4; i++) { + for (size_t i=0; igetName() != "Wheel") throw pfPrcTagException(__FILE__, __LINE__, wheel->getName()); fWheels[i].fRadius = wheel->getParam("Radius", "0").to_float(); diff --git a/core/PRP/Physics/plVehicleModifier.h b/core/PRP/Physics/plVehicleModifier.h index ad9742d2..a83323da 100644 --- a/core/PRP/Physics/plVehicleModifier.h +++ b/core/PRP/Physics/plVehicleModifier.h @@ -34,9 +34,11 @@ class HSPLASMA_EXPORT plVehicleModifier : public plSingleModifier Wheel() : fRadius(1.0f) { } }; + enum { kNumWheels = 4 }; + protected: plKey fRoot; - Wheel fWheels[4]; + Wheel fWheels[kNumWheels]; public: void read(hsStream* S, plResManager* mgr) HS_OVERRIDE; @@ -45,6 +47,13 @@ class HSPLASMA_EXPORT plVehicleModifier : public plSingleModifier protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + plKey getRoot() const { return fRoot; } + const Wheel& getWheel(size_t idx) const { return fWheels[idx]; } + Wheel& getWheel(size_t idx) { return fWheels[idx]; } + + void setRoot(plKey root) { fRoot = std::move(root); } }; #endif diff --git a/core/PRP/Region/plHardRegion.h b/core/PRP/Region/plHardRegion.h index db7d5fb6..0d8a027e 100644 --- a/core/PRP/Region/plHardRegion.h +++ b/core/PRP/Region/plHardRegion.h @@ -39,6 +39,10 @@ class HSPLASMA_EXPORT plHardRegionComplex : public plHardRegion protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getSubRegions() const { return fSubRegions; } + std::vector& getSubRegions() { return fSubRegions; } }; diff --git a/core/PRP/Region/plHardRegionPlanes.h b/core/PRP/Region/plHardRegionPlanes.h index 4c36a28e..a06c63d5 100644 --- a/core/PRP/Region/plHardRegionPlanes.h +++ b/core/PRP/Region/plHardRegionPlanes.h @@ -24,13 +24,11 @@ class HSPLASMA_EXPORT plHardRegionPlanes : public plHardRegion CREATABLE(plHardRegionPlanes, kHardRegionPlanes, plHardRegion) public: - class HSPLASMA_EXPORT HardPlane + struct HSPLASMA_EXPORT HardPlane { - public: hsVector3 fNorm, fWorldNorm; hsVector3 fPos, fWorldPos; - public: void read(hsStream* S); void write(hsStream* S); void prcWrite(pfPrcHelper* prc); @@ -49,6 +47,10 @@ class HSPLASMA_EXPORT plHardRegionPlanes : public plHardRegion protected: void IPrcWrite(pfPrcHelper* prc) HS_OVERRIDE; void IPrcParse(const pfPrcTag* tag, plResManager* mgr) HS_OVERRIDE; + +public: + const std::vector& getPlanes() const { return fPlanes; } + std::vector& getPlanes() { return fPlanes; } }; #endif diff --git a/core/PRP/Region/plRelevanceRegion.h b/core/PRP/Region/plRelevanceRegion.h index 01bc2690..bc92d9ae 100644 --- a/core/PRP/Region/plRelevanceRegion.h +++ b/core/PRP/Region/plRelevanceRegion.h @@ -26,18 +26,19 @@ class HSPLASMA_EXPORT plRelevanceRegion : public plObjInterface protected: plKey fRegion; - hsBitVector fRegionsICareAbout; - unsigned int fMgrIdx; public: - plRelevanceRegion() : fMgrIdx((unsigned int)-1) { } - 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; + +public: + plKey getRegion() const { return fRegion; } + + void setRegion(plKey region) { fRegion = std::move(region); } }; #endif