Skip to content

Commit f3cd3cf

Browse files
SA upd breakmgr, plantmgr
1 parent 0252549 commit f3cd3cf

File tree

4 files changed

+238
-0
lines changed

4 files changed

+238
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto San Andreas) source file
3+
Authors: GTA Community. See more here
4+
https://github.com/DK22Pac/plugin-sdk
5+
Do not delete this comment block. Respect others' work!
6+
*/
7+
#include "BreakManager_c.h"
8+
9+
BreakManager_c& g_breakMan = *(BreakManager_c*)0xBB4240;
10+
11+
bool BreakManager_c::Init() {
12+
return plugin::CallMethodAndReturnDynGlobal<bool>(0x59E650, this);
13+
}
14+
15+
void BreakManager_c::Exit() {
16+
plugin::CallMethodDynGlobal(0x59E660, this);
17+
}
18+
19+
void BreakManager_c::Render(bool renderAlphas) {
20+
plugin::CallMethodDynGlobal(0x59E6A0, this, renderAlphas);
21+
}
22+
23+
void BreakManager_c::ResetAll() {
24+
plugin::CallMethodDynGlobal(0x59E720, this);
25+
}
26+
27+
void BreakManager_c::Update(float timeStep) {
28+
plugin::CallMethodDynGlobal(0x59E670, this, timeStep);
29+
}

plugin_sa/game_sa/BreakManager_c.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto San Andreas) header file
3+
Authors: GTA Community. See more here
4+
https://github.com/DK22Pac/plugin-sdk
5+
Do not delete this comment block. Respect others' work!
6+
*/
7+
#pragma once
8+
#include "PluginBase.h"
9+
#include "RenderWare.h"
10+
11+
struct BreakInfo_t {
12+
uint32_t version;
13+
uint16_t numVerts;
14+
float* verts;
15+
float* texCoords;
16+
uint8_t* preLitCols;
17+
uint16_t numTris;
18+
uint16_t* vtxIndices;
19+
uint16_t* groupId;
20+
uint16_t numGroups;
21+
RwTexture** pTexture;
22+
char* texNames[32];
23+
char* texMaskNames[32];
24+
float* matCols;
25+
};
26+
27+
struct BreakTri_t {
28+
RwV3d m_verts[3];
29+
RwTexCoords m_texCoords[3];
30+
RwRGBA m_col[3];
31+
};
32+
33+
struct BreakGroup_t {
34+
RwMatrix m_mat;
35+
RwV3d m_vel;
36+
uint8_t m_atRest;
37+
uint16_t m_numTris;
38+
BreakTri_t* m_tris;
39+
RwTexture* m_pTexture;
40+
uint8_t m_restAxisId;
41+
float m_restHeight;
42+
float m_spinSpeed;
43+
RwV3d m_spinAxis;
44+
int32_t m_timer;
45+
};
46+
47+
struct BreakObject_c {
48+
uint8_t m_smashed;
49+
uint8_t m_active;
50+
uint8_t m_produceSparks;
51+
uint8_t m_drawLast;
52+
int32_t m_numGroups;
53+
BreakGroup_t* m_groups;
54+
int32_t m_age;
55+
float m_groundZ;
56+
RwV3d m_groundNormal;
57+
};
58+
59+
class BreakManager_c {
60+
public:
61+
BreakObject_c m_breakObjects[64];
62+
63+
public:
64+
bool Init();
65+
void Exit();
66+
void Render(bool renderAlphas);
67+
void ResetAll();
68+
void Update(float timeStep);
69+
};
70+
71+
extern BreakManager_c& g_breakMan;

plugin_sa/game_sa/CPlantMgr.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto San Andreas) source file
3+
Authors: GTA Community. See more here
4+
https://github.com/DK22Pac/plugin-sdk
5+
Do not delete this comment block. Respect others' work!
6+
*/
7+
#include "CPlantMgr.h"
8+
9+
void CPlantMgr::UpdateAmbientColor() {
10+
plugin::CallDynGlobal(0x5DB310);
11+
}
12+
13+
float CPlantMgr::CalculateWindBending() {
14+
return plugin::CallAndReturnDynGlobal<float>(0x5DB3D0);
15+
}
16+
17+
void CPlantMgr::SetPlantFriendlyFlagInAtomicMI(CAtomicModelInfo* mi) {
18+
plugin::CallDynGlobal(0x5DB650, mi);
19+
}
20+
21+
void CPlantMgr::Shutdown() {
22+
plugin::CallDynGlobal(0x5DB940);
23+
}
24+
25+
void CPlantMgr::Render() {
26+
plugin::CallDynGlobal(0x5DBAE0);
27+
}
28+
29+
void CPlantMgr::_ProcessEntryCollisionDataSections_RemoveLocTris(CPlantColEntEntry* col, CVector const& camPos, int triProcessSkipMask, int colStartIndex, int colEndIndex) {
30+
plugin::CallDynGlobal(0x5DBF20, col, camPos, triProcessSkipMask, colStartIndex, colEndIndex);
31+
}
32+
33+
void CPlantMgr::_ColEntityCache_Update(CVector const& camPos, uint8_t quickUpdate) {
34+
plugin::CallDynGlobal(0x5DC510, camPos, quickUpdate);
35+
}
36+
37+
void CPlantMgr::_ProcessEntryCollisionDataSections_AddLocTris(CPlantColEntEntry* col, CVector const& camPos, int processSkipMask, int colStartIndex, int colEndIndex) {
38+
plugin::CallDynGlobal(0x5DC8B0, col, camPos, processSkipMask, colStartIndex, colEndIndex);
39+
}
40+
41+
void CPlantMgr::_ProcessEntryCollisionDataSections(CPlantColEntEntry* col, CVector const& camPos, int processSkipMask) {
42+
plugin::CallDynGlobal(0x5DCD80, col, camPos, processSkipMask);
43+
}
44+
45+
void CPlantMgr::_UpdateLocTris(CVector const& camPos, int processSkipMask) {
46+
plugin::CallDynGlobal(0x5DCF00, camPos, processSkipMask);
47+
}
48+
49+
bool CPlantMgr::PreUpdateOnceForNewCameraPos(CVector const& camPos) {
50+
return plugin::CallAndReturnDynGlobal<bool>(0x5DCF30, camPos);
51+
}
52+
53+
void CPlantMgr::Update(CVector const& camPos) {
54+
plugin::CallDynGlobal(0x5DCFA0, camPos);
55+
}
56+
57+
bool CPlantMgr::ReloadConfig() {
58+
return plugin::CallAndReturnDynGlobal<bool>(0x5DD780);
59+
}
60+
61+
bool CPlantMgr::Initialise() {
62+
return plugin::CallAndReturnDynGlobal<bool>(0x5DD910);
63+
}

plugin_sa/game_sa/CPlantMgr.h

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto San Andreas) header file
3+
Authors: GTA Community. See more here
4+
https://github.com/DK22Pac/plugin-sdk
5+
Do not delete this comment block. Respect others' work!
6+
*/
7+
#pragma once
8+
#include "PluginBase.h"
9+
#include "CAtomicModelInfo.h"
10+
#include "CEntity.h"
11+
#include "RenderWare.h"
12+
13+
struct CPlantSurfPropPlantData {
14+
uint16_t m_nModelID;
15+
uint16_t m_nTextureID;
16+
RwRGBA m_rgbaColor;
17+
uint8_t m_nIntensity;
18+
uint8_t m_nIntensityVar;
19+
float m_fScaleXY;
20+
float m_fScaleZ;
21+
float m_fScaleVarXY;
22+
float m_fScaleVarZ;
23+
float m_fDensity;
24+
float m_fWindBendScale;
25+
float m_fWindBendVar;
26+
};
27+
28+
struct CPlantSurfProp {
29+
uint16_t m_nPlantSlotID;
30+
CPlantSurfPropPlantData m_PlantData[3];
31+
};
32+
33+
struct CPlantLocTri {
34+
CVector m_V1;
35+
CVector m_V2;
36+
CVector m_V3;
37+
CVector m_Center;
38+
float m_SphereRadius;
39+
float m_Seed[3];
40+
uint16_t m_nMaxNumPlants[3];
41+
uint8_t m_nSurfaceType;
42+
uint8_t m_nLighting;
43+
uint8_t m_createsPlants : 1;
44+
uint8_t m_createsObjects : 1;
45+
uint8_t m_createdObjects : 1;
46+
uint8_t m_pad : 5;
47+
CPlantLocTri* m_pNextTri;
48+
CPlantLocTri* m_pPrevTri;
49+
};
50+
51+
class CPlantColEntEntry {
52+
CEntity* m_pEntity;
53+
CPlantLocTri** m_LocTriArray;
54+
uint16_t m_nNumTris;
55+
CPlantColEntEntry* m_pNextEntry;
56+
CPlantColEntEntry* m_pPrevEntry;
57+
};
58+
59+
class CPlantMgr {
60+
public:
61+
static void UpdateAmbientColor();
62+
static float CalculateWindBending();
63+
static void SetPlantFriendlyFlagInAtomicMI(CAtomicModelInfo*);
64+
static void Shutdown();
65+
static void Render();
66+
static void _ProcessEntryCollisionDataSections_RemoveLocTris(CPlantColEntEntry*, CVector const&, int, int, int);
67+
static void _ColEntityCache_Update(CVector const&, uint8_t);
68+
static void _ProcessEntryCollisionDataSections_AddLocTris(CPlantColEntEntry*, CVector const&, int, int, int);
69+
static void _ProcessEntryCollisionDataSections(CPlantColEntEntry*, CVector const&, int);
70+
static void _UpdateLocTris(CVector const&, int);
71+
static bool PreUpdateOnceForNewCameraPos(CVector const&);
72+
static void Update(CVector const&);
73+
static bool ReloadConfig();
74+
static bool Initialise();
75+
};

0 commit comments

Comments
 (0)