Skip to content

Commit e77220b

Browse files
Unify names between games, format
1 parent 39b256d commit e77220b

17 files changed

Lines changed: 575 additions & 473 deletions

File tree

plugin_III/game_III/CPtrList.h

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,36 @@
55
Do not delete this comment block. Respect others' work!
66
*/
77
#pragma once
8-
98
#include "PluginBase.h"
10-
11-
class CPtrNode {
12-
public:
13-
void *m_ptr; // usually a ptr to CEntity
14-
CPtrNode *m_pPrev;
15-
CPtrNode* m_pNext;
16-
17-
CPtrNode() {}
18-
19-
inline CPtrNode(void *Ptr) : m_ptr(Ptr) {}
20-
21-
static void operator delete(void* data);
22-
static void* operator new(unsigned int size);
23-
};
24-
25-
VALIDATE_SIZE(CPtrNode, 0xC);
9+
#include "CPtrNode.h"
2610

2711
class CPtrList {
28-
public:
29-
CPtrNode *m_pLast;
12+
protected:
13+
CPtrNode *m_pHead;
3014

15+
public:
3116
void Flush();
3217

3318
inline void Add(CPtrNode *node) {
3419
node->m_pNext = nullptr;
35-
node->m_pPrev = m_pLast;
36-
if (m_pLast)
37-
m_pLast->m_pNext = node;
38-
m_pLast = node;
20+
node->m_pPrev = m_pHead;
21+
if (m_pHead)
22+
m_pHead->m_pNext = node;
23+
m_pHead = node;
3924
}
4025

4126
inline void Remove(CPtrNode *node) {
42-
if (m_pLast == node)
43-
m_pLast = node->m_pPrev;
27+
if (m_pHead == node)
28+
m_pHead = node->m_pPrev;
4429
if (node->m_pNext)
4530
node->m_pNext->m_pPrev = node->m_pPrev;
4631
if (node->m_pPrev)
4732
node->m_pPrev->m_pNext = node->m_pNext;
4833
}
34+
35+
inline CPtrNode* GetNode() {
36+
return m_pHead;
37+
}
4938
};
5039

5140
VALIDATE_SIZE(CPtrList, 0x4);

plugin_III/game_III/CPtrNode.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Plugin-SDK (Grand Theft Auto 3) 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+
10+
class CPtrNode {
11+
public:
12+
void* m_pVoid; // usually a ptr to CEntity
13+
CPtrNode* m_pPrev;
14+
CPtrNode* m_pNext;
15+
16+
CPtrNode() {}
17+
18+
inline CPtrNode(void* item) : m_pVoid(item) {}
19+
20+
static void operator delete(void* data);
21+
static void* operator new(unsigned int size);
22+
};
23+
24+
VALIDATE_SIZE(CPtrNode, 0xC);

plugin_III/game_III/CWorld.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X)
2121
#define WORLD_MAX_Y (WORLD_MIN_Y + WORLD_SIZE_Y)
2222

23+
#define MAP_Z_LOW_LIMIT -100.0f
24+
2325
#include "PluginBase.h"
2426
#include "CEntity.h"
2527
#include "CStoredCollPoly.h"
@@ -119,22 +121,22 @@ class CWorld {
119121
}
120122
}
121123

122-
static float GetSectorX(float f) {
124+
static inline float GetSectorX(float f) {
123125
return ((f - WORLD_MIN_X) / SECTOR_SIZE_X);
124126
}
125-
static float GetSectorY(float f) {
127+
static inline float GetSectorY(float f) {
126128
return ((f - WORLD_MIN_Y) / SECTOR_SIZE_Y);
127129
}
128-
static int32_t GetSectorIndexX(float f) {
130+
static inline int32_t GetSectorIndexX(float f) {
129131
return (int)GetSectorX(f);
130132
}
131-
static int32_t GetSectorIndexY(float f) {
133+
static inline int32_t GetSectorIndexY(float f) {
132134
return (int)GetSectorY(f);
133135
}
134-
static float GetWorldX(int x) {
136+
static inline float GetWorldX(int x) {
135137
return x * SECTOR_SIZE_X + WORLD_MIN_X;
136138
}
137-
static float GetWorldY(int y) {
139+
static inline float GetWorldY(int y) {
138140
return y * SECTOR_SIZE_Y + WORLD_MIN_Y;
139141
}
140142
};

plugin_sa/game_sa/CEntity.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ void CEntity::DeleteRwObject()
4848
((void (__thiscall *)(CEntity *))(*(void ***)this)[8])(this);
4949
}
5050

51-
CRect* CEntity::GetBoundRect(CRect* rect)
51+
CRect CEntity::GetBoundRect()
5252
{
53-
return ((CRect* (__thiscall *)(CEntity *, CRect*))(*(void ***)this)[9])(this, rect);
53+
CRect out;
54+
((CRect* (__thiscall *)(CEntity *, CRect*))(*(void ***)this)[9])(this, &out);
55+
return out;
5456
}
5557

5658
void CEntity::ProcessControl()

plugin_sa/game_sa/CEntity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class PLUGIN_API CEntity : public CPlaceable {
8787
void SetModelIndexNoCreate(unsigned int index);
8888
void CreateRwObject();
8989
void DeleteRwObject();
90-
CRect* GetBoundRect(CRect* rect);
90+
CRect GetBoundRect();
9191
void ProcessControl();
9292
void ProcessCollision();
9393
void ProcessShift();

plugin_sa/game_sa/CPtrList.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010

1111
class PLUGIN_API CPtrList {
1212
protected:
13-
CPtrNode *pNode;
13+
CPtrNode *m_pHead;
14+
1415
public:
1516
inline CPtrNode *GetNode() {
16-
return pNode;
17+
return m_pHead;
1718
}
1819

1920
inline CPtrList() {
20-
pNode = nullptr;
21+
m_pHead = nullptr;
2122
}
2223

2324
// get elements count

plugin_sa/game_sa/CPtrListDoubleLink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class PLUGIN_API CPtrListDoubleLink : public CPtrList {
1313
public:
1414
inline CPtrNodeDoubleLink *GetNode() {
15-
return reinterpret_cast<CPtrNodeDoubleLink *>(pNode);
15+
return reinterpret_cast<CPtrNodeDoubleLink *>(this->m_pHead);
1616
}
1717

1818
inline ~CPtrListDoubleLink() {

plugin_sa/game_sa/CPtrListSingleLink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class PLUGIN_API CPtrListSingleLink : public CPtrList {
1313
public:
1414
inline CPtrNodeSingleLink *GetNode() {
15-
return reinterpret_cast<CPtrNodeSingleLink *>(pNode);
15+
return reinterpret_cast<CPtrNodeSingleLink *>(this->m_pHead);
1616
}
1717

1818
inline ~CPtrListSingleLink() {

plugin_sa/game_sa/CPtrNode.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
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!
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!
66
*/
77
#pragma once
88
#include "PluginBase.h"
99

1010
class PLUGIN_API CPtrNode {
1111
public:
12-
void *pItem;
13-
CPtrNode *pNext;
12+
void* m_pVoid;
13+
CPtrNode* m_pNext;
1414

15-
inline CPtrNode(void *item) : pItem(item) {}
15+
inline CPtrNode(void* item) : m_pVoid(item) {}
1616
};
1717

1818
VALIDATE_SIZE(CPtrNode, 8);

plugin_sa/game_sa/CSector.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
*/
77
#pragma once
88
#include "PluginBase.h"
9+
#include "CPtrListSingleLink.h"
910
#include "CPtrListDoubleLink.h"
1011

1112
class PLUGIN_API CSector {
1213
public:
13-
CPtrListDoubleLink m_buildings;
14-
CPtrListDoubleLink m_dummies;
14+
CPtrListSingleLink m_buildingList;
15+
CPtrListDoubleLink m_dummyList;
1516
};
1617

1718
VALIDATE_SIZE(CSector, 8);

0 commit comments

Comments
 (0)