Skip to content

Commit

Permalink
Update C3dMarkers
Browse files Browse the repository at this point in the history
  • Loading branch information
XMDS committed Jun 13, 2024
1 parent 7657ce6 commit 739e06e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
22 changes: 18 additions & 4 deletions plugin_vc/game_vc/C3dMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions plugin_vc/game_vc/C3dMarkers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ PLUGIN_SOURCE_FILE

C3dMarker *C3dMarkers::m_aMarkerArray = reinterpret_cast<C3dMarker *>(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<C3dMarker*, 0x570340, 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);
}
8 changes: 7 additions & 1 deletion plugin_vc/game_vc/C3dMarkers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

1 change: 1 addition & 0 deletions plugin_vc/game_vc/RenderWare.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 739e06e

Please sign in to comment.