diff --git a/plugin_vc/game_vc/C3dMarker.h b/plugin_vc/game_vc/C3dMarker.h index 75e298cd..e4b754a0 100644 --- a/plugin_vc/game_vc/C3dMarker.h +++ b/plugin_vc/game_vc/C3dMarker.h @@ -9,15 +9,16 @@ #include "PluginBase.h" #include "CMatrix.h" #include "CRGBA.h" +#include "RenderWare.h" class PLUGIN_API C3dMarker { public: - CMatrix m_mMat; - int m_pAtomic; //!< rawtype:RpAtomic* - int m_pMaterial; //!< rawtype:RpMaterial* + CMatrix m_Matrix; + RpAtomic* m_pAtomic; //!< rawtype:RpAtomic* + RpMaterial* m_pMaterial; //!< rawtype:RpMaterial* unsigned short m_nType; bool m_bIsUsed; - bool m_bMustBeRenderedThisFrame; + bool m_bIsActive; unsigned int m_nIdentifier; CRGBA m_colour; unsigned short m_nPulsePeriod; @@ -31,6 +32,19 @@ class PLUGIN_API C3dMarker { SUPPORTED_10EN_11EN_STEAM void AddMarker(unsigned int nId, unsigned short nType, float fSize, unsigned char bRed, unsigned char bGreen, unsigned char bBlue, unsigned char bAlpha, unsigned int nPulsePeriod, float fPulseFraction, unsigned short nRotateRate); SUPPORTED_10EN_11EN_STEAM void Render(); + + inline void DeleteMarkerObject() { + m_nIdentifier = 0; + m_nStartTime = 0; + m_bIsUsed = false; + m_bIsActive = false; + m_nType = 257; + + RwFrame* frame = RpAtomicGetFrame(m_pAtomic); + RpAtomicDestroy(m_pAtomic); + RwFrameDestroy(frame); + m_pAtomic = nullptr; + } }; VALIDATE_SIZE(C3dMarker, 0x78); diff --git a/plugin_vc/game_vc/C3dMarkers.cpp b/plugin_vc/game_vc/C3dMarkers.cpp index 2c47af7a..e3bd8951 100644 --- a/plugin_vc/game_vc/C3dMarkers.cpp +++ b/plugin_vc/game_vc/C3dMarkers.cpp @@ -10,7 +10,20 @@ PLUGIN_SOURCE_FILE C3dMarker *C3dMarkers::m_aMarkerArray = reinterpret_cast(GLOBAL_ADDRESS_BY_VERSION(0x814018, 0x814020, 0x813020)); RpClump** C3dMarkers::m_pRpClumpArray = (RpClump**)0x974C10; +int &C3dMarkers::NumActiveMarkers = *(int*)0x978E10; + +void C3dMarkers::Init() { + plugin::Call<0x570CA0>(); +} + +void C3dMarkers::Render() { + plugin::Call<0x570BA0>(); +} void C3dMarkers::PlaceMarkerSet(unsigned int id, unsigned short type, CVector& pos, float size, unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned short pulsePeriod, float pulseFraction, short rotateRate) { plugin::Call<0x570270, unsigned int, unsigned short, CVector&, float, unsigned char, unsigned char, unsigned char, unsigned char, unsigned short, float, short>(id, type, pos, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate); } + +C3dMarker* C3dMarkers::PlaceMarker(unsigned int id, unsigned short type, CVector& pos, float size, unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned short pulsePeriod, float pulseFraction, short rotateRate) { + return plugin::CallAndReturn(id, type, pos, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate); +} diff --git a/plugin_vc/game_vc/C3dMarkers.h b/plugin_vc/game_vc/C3dMarkers.h index 724cb6fc..9739d7a9 100644 --- a/plugin_vc/game_vc/C3dMarkers.h +++ b/plugin_vc/game_vc/C3dMarkers.h @@ -22,9 +22,15 @@ class PLUGIN_API C3dMarkers { public: SUPPORTED_10EN_11EN_STEAM static C3dMarker *m_aMarkerArray; // static C3dMarker m_aMarkerArray[32] static RpClump** m_pRpClumpArray; + static int& NumActiveMarkers; public: - static void PlaceMarkerSet(unsigned int id, unsigned short type, CVector& pos, float size, unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned short pulsePeriod, float pulseFraction, short rotateRate); + static void Init(); + + static void Render(); + static C3dMarker* PlaceMarker(unsigned int id, unsigned short type, CVector& pos, float size, unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned short pulsePeriod, float pulseFraction, short rotateRate); + + static void PlaceMarkerSet(unsigned int id, unsigned short type, CVector& pos, float size, unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned short pulsePeriod, float pulseFraction, short rotateRate); }; diff --git a/plugin_vc/game_vc/RenderWare.h b/plugin_vc/game_vc/RenderWare.h index 353e2a68..89332ff6 100644 --- a/plugin_vc/game_vc/RenderWare.h +++ b/plugin_vc/game_vc/RenderWare.h @@ -351,6 +351,7 @@ RwInt32 RpAtomicRegisterPluginStream(RwUInt32 pluginID, RwPluginDataChunkReadCal RwInt32 RpAtomicSetStreamAlwaysCallBack(RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB); // 0x642360 RwInt32 RpAtomicSetStreamRightsCallBack(RwUInt32 pluginID, RwPluginDataChunkRightsCallBack rightsCB); // 0x642380 RwInt32 RpAtomicGetPluginOffset(RwUInt32 pluginID); // 0x6423A0 +inline RwFrame* RpAtomicGetFrame(const RpAtomic* atomic) { return (RwFrame*)atomic->object.object.parent; }; // game inline RpWorldSector* _rpSectorDefaultRenderCallBack(RpWorldSector* sector); // 0x654750 RpWorld* RpWorldUnlock(RpWorld* world); // 0x6547A0 RwBool RpWorldPluginAttach(void); // 0x655070