summaryrefslogtreecommitdiffstats
path: root/src/render/ParticleMgr.cpp
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2021-01-12 22:07:24 +0100
committerFire-Head <Fire-Head@users.noreply.github.com>2021-01-12 22:07:24 +0100
commit3648ef4687967c7363c9c61f4610679484dc478e (patch)
tree29e9018c263edde8792a5e4a6917bfc9007f721c /src/render/ParticleMgr.cpp
parentSector sizes (diff)
downloadre3-3648ef4687967c7363c9c61f4610679484dc478e.tar
re3-3648ef4687967c7363c9c61f4610679484dc478e.tar.gz
re3-3648ef4687967c7363c9c61f4610679484dc478e.tar.bz2
re3-3648ef4687967c7363c9c61f4610679484dc478e.tar.lz
re3-3648ef4687967c7363c9c61f4610679484dc478e.tar.xz
re3-3648ef4687967c7363c9c61f4610679484dc478e.tar.zst
re3-3648ef4687967c7363c9c61f4610679484dc478e.zip
Diffstat (limited to 'src/render/ParticleMgr.cpp')
-rw-r--r--src/render/ParticleMgr.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp
index f6919435..c802067d 100644
--- a/src/render/ParticleMgr.cpp
+++ b/src/render/ParticleMgr.cpp
@@ -4,18 +4,31 @@
#include "FileMgr.h"
#include "ParticleMgr.h"
+// --LCS: File done
+
cParticleSystemMgr mod_ParticleSystemManager;
const char *ParticleFilename = "PARTICLE.CFG";
cParticleSystemMgr::cParticleSystemMgr()
{
- memset(this, 0, sizeof(*this));
+#ifdef FIX_BUGS
+ m_aParticles = nil;
+#endif
+}
+
+cParticleSystemMgr::~cParticleSystemMgr()
+{
+#ifdef FIX_BUGS
+ if ( m_aParticles )
+ delete [] m_aParticles;
+#endif
}
void cParticleSystemMgr::Initialise()
{
- LoadParticleData();
+ if ( gMakeResources )
+ LoadParticleData();
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
m_aParticles[i].m_pParticles = nil;
@@ -23,20 +36,31 @@ void cParticleSystemMgr::Initialise()
void cParticleSystemMgr::LoadParticleData()
{
- CFileMgr::SetDir("DATA");
- CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
+#ifdef FIX_BUGS
+ if ( m_aParticles )
+ delete [] m_aParticles;
+#endif
+ m_aParticles = new tParticleSystemData[MAX_PARTICLES];
+
+ memset(m_aParticles, 0, sizeof(tParticleSystemData)*MAX_PARTICLES);
+
+ CFileMgr::SetDir("Data");
+ ssize_t len = CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
CFileMgr::SetDir("");
+ ASSERT(!(len <= 0));
+
tParticleSystemData *entry = nil;
int32 type = PARTICLE_FIRST;
+ char *buffEnd = (char *)&work_buff[len];
char *lineStart = (char *)work_buff;
char *lineEnd = lineStart + 1;
char line[500];
char delims[4];
- while ( true )
+ while ( lineStart < buffEnd )
{
ASSERT(lineStart != nil);
ASSERT(lineEnd != nil);