summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-08-20 12:53:17 +0200
committeraap <aap@papnet.eu>2020-08-20 12:53:17 +0200
commit764af8735c00a7f40a51f605fed3c73ce6413337 (patch)
tree3009c3e5da4a39e7e64446e654ee3689b8e91632 /src/core
parenttransmission done (diff)
downloadre3-764af8735c00a7f40a51f605fed3c73ce6413337.tar
re3-764af8735c00a7f40a51f605fed3c73ce6413337.tar.gz
re3-764af8735c00a7f40a51f605fed3c73ce6413337.tar.bz2
re3-764af8735c00a7f40a51f605fed3c73ce6413337.tar.lz
re3-764af8735c00a7f40a51f605fed3c73ce6413337.tar.xz
re3-764af8735c00a7f40a51f605fed3c73ce6413337.tar.zst
re3-764af8735c00a7f40a51f605fed3c73ce6413337.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Collision.cpp12
-rw-r--r--src/core/Collision.h3
-rw-r--r--src/core/Pools.cpp24
-rw-r--r--src/core/Pools.h3
-rw-r--r--src/core/config.h10
-rw-r--r--src/core/main.cpp6
-rw-r--r--src/core/main.h3
-rw-r--r--src/core/templates.h4
8 files changed, 47 insertions, 18 deletions
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index c2037dc5..91e7bba7 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -3049,6 +3049,18 @@ CColModel::GetTrianglePoint(CVector &v, int i) const
v = vertices[i].Get();
}
+void*
+CColModel::operator new(size_t){
+ CColModel *node = CPools::GetColModelPool()->New();
+ assert(node);
+ return node;
+}
+
+void
+CColModel::operator delete(void *p, size_t){
+ CPools::GetColModelPool()->Delete((CColModel*)p);
+}
+
CColModel&
CColModel::operator=(const CColModel &other)
{
diff --git a/src/core/Collision.h b/src/core/Collision.h
index fd079028..93959a72 100644
--- a/src/core/Collision.h
+++ b/src/core/Collision.h
@@ -181,7 +181,6 @@ struct CStoredCollPoly
bool valid;
};
-//--MIAMI: done struct
struct CColModel
{
CSphere boundingSphere;
@@ -208,6 +207,8 @@ struct CColModel
void SetLinkPtr(CLink<CColModel*>*);
void GetTrianglePoint(CVector &v, int i) const;
+ void *operator new(size_t);
+ void operator delete(void *p, size_t);
CColModel& operator=(const CColModel& other);
};
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 6e3799f4..fe2cf7ad 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -22,21 +22,25 @@ CTreadablePool *CPools::ms_pTreadablePool;
CObjectPool *CPools::ms_pObjectPool;
CDummyPool *CPools::ms_pDummyPool;
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
+CColModelPool *CPools::ms_pColModelPool;
+//--MIAMI: done
void
CPools::Initialise(void)
{
- ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES);
- ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS);
- ms_pPedPool = new CPedPool(NUMPEDS);
- ms_pVehiclePool = new CVehiclePool(NUMVEHICLES);
- ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS);
- ms_pTreadablePool = new CTreadablePool(NUMTREADABLES);
- ms_pObjectPool = new CObjectPool(NUMOBJECTS);
- ms_pDummyPool = new CDummyPool(NUMDUMMIES);
- ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS);
+ ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES, "PtrNode");
+ ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS, "EntryInfoNode");
+ ms_pPedPool = new CPedPool(NUMPEDS, "Peds");
+ ms_pVehiclePool = new CVehiclePool(NUMVEHICLES, "Vehicles");
+ ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS, "Buildings");
+ ms_pTreadablePool = new CTreadablePool(NUMTREADABLES, "Treadables");
+ ms_pObjectPool = new CObjectPool(NUMOBJECTS, "Objects");
+ ms_pDummyPool = new CDummyPool(NUMDUMMIES, "Dummys");
+ ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS, "AudioScriptObj");
+ ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
}
+//--MIAMI: done
void
CPools::ShutDown(void)
{
@@ -49,6 +53,7 @@ CPools::ShutDown(void)
debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces());
debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces());
debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces());
+ debug("ColModels left %d\n", ms_pColModelPool->GetNoOfUsedSpaces());
printf("Shutdown pool started\n");
delete ms_pPtrNodePool;
@@ -60,6 +65,7 @@ CPools::ShutDown(void)
delete ms_pObjectPool;
delete ms_pDummyPool;
delete ms_pAudioScriptObjectPool;
+ delete ms_pColModelPool;
printf("Shutdown pool done\n");
}
diff --git a/src/core/Pools.h b/src/core/Pools.h
index 2f0537ff..afef1b85 100644
--- a/src/core/Pools.h
+++ b/src/core/Pools.h
@@ -19,6 +19,7 @@ typedef CPool<CTreadable> CTreadablePool;
typedef CPool<CObject, CCutsceneObject> CObjectPool;
typedef CPool<CDummy, CDummyPed> CDummyPool;
typedef CPool<cAudioScriptObject> CAudioScriptObjectPool;
+typedef CPool<CColModel> CColModelPool;
class CPools
{
@@ -31,6 +32,7 @@ class CPools
static CObjectPool *ms_pObjectPool;
static CDummyPool *ms_pDummyPool;
static CAudioScriptObjectPool *ms_pAudioScriptObjectPool;
+ static CColModelPool *ms_pColModelPool;
public:
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
@@ -41,6 +43,7 @@ public:
static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; }
static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; }
static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; }
+ static CColModelPool *GetColModelPool(void) { return ms_pColModelPool; }
static void Initialise(void);
static void ShutDown(void);
diff --git a/src/core/config.h b/src/core/config.h
index efdb5c8c..1cd9ca6c 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -27,16 +27,16 @@ enum Config {
// Pool sizes
NUMPTRNODES = 50000,
- NUMENTRYINFOS = 5400, // only 3200 in VC???
+ NUMENTRYINFOS = 3200,
NUMPEDS = 140,
NUMVEHICLES = 110,
NUMBUILDINGS = 7000,
- NUMTREADABLES = 1214, // 1 in VC
+ NUMTREADABLES = 1,
NUMOBJECTS = 460,
- NUMDUMMIES = 2802, // 2340 in VC
- NUMAUDIOSCRIPTOBJECTS = 256, // 192 in VC
+ NUMDUMMIES = 2340,
+ NUMAUDIOSCRIPTOBJECTS = 192,
+ NUMCOLMODELS = 4400,
NUMCUTSCENEOBJECTS = 50, // does not exist in VC
- // TODO(MIAMI): colmodel pool
NUMANIMBLOCKS = 35,
NUMANIMATIONS = 450,
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 27f6abd9..7a25daac 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -3,6 +3,9 @@
#include "rphanim.h"
#include "rpskin.h"
#include "rtbmp.h"
+#ifndef LIBRW
+#include "rpanisot.h"
+#endif
#include "main.h"
#include "CdStream.h"
@@ -384,6 +387,9 @@ PluginAttach(void)
return FALSE;
}
+#ifndef LIBRW
+ RpAnisotPluginAttach();
+#endif
#ifdef EXTENDED_PIPELINES
CustomPipes::CustomPipeRegister();
#endif
diff --git a/src/core/main.h b/src/core/main.h
index 9ad4ed1c..96fbef05 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -20,6 +20,9 @@ extern bool gbShowTimebars;
class CSprite2d;
+bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
+void DoRWStuffEndOfFrame(void);
void InitialiseGame(void);
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
void LoadingIslandScreen(const char *levelName);
diff --git a/src/core/templates.h b/src/core/templates.h
index 465e3bef..9f5bd5ea 100644
--- a/src/core/templates.h
+++ b/src/core/templates.h
@@ -45,7 +45,7 @@ class CPool
public:
// TODO(MIAMI): remove ctor without name argument
- CPool(int size){
+ CPool(int size, const char *name){
// TODO: use new here
m_entries = (U*)malloc(sizeof(U)*size);
m_flags = (Flags*)malloc(sizeof(Flags)*size);
@@ -56,8 +56,6 @@ public:
m_flags[i].free = 1;
}
}
- CPool(int size, const char *name)
- : CPool(size) {}
~CPool() {
Flush();
}