summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-07 21:55:54 +0200
committeraap <aap@papnet.eu>2020-05-07 21:55:54 +0200
commitc715569d1d52ebc2a99544a98bedbfdabf8fd3a7 (patch)
tree3040a6d3af78f844c430bcb10309d59da00f80bc
parentlittle script change (diff)
downloadre3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.tar
re3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.tar.gz
re3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.tar.bz2
re3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.tar.lz
re3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.tar.xz
re3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.tar.zst
re3-c715569d1d52ebc2a99544a98bedbfdabf8fd3a7.zip
-rw-r--r--src/core/Zones.cpp1
-rw-r--r--src/core/config.h6
-rw-r--r--src/core/templates.h10
-rw-r--r--src/modelinfo/BaseModelInfo.cpp16
-rw-r--r--src/modelinfo/BaseModelInfo.h17
-rw-r--r--src/modelinfo/ClumpModelInfo.h2
-rw-r--r--src/modelinfo/SimpleModelInfo.h2
-rw-r--r--src/modelinfo/TimeModelInfo.h2
-rw-r--r--src/render/2dEffect.h2
9 files changed, 36 insertions, 22 deletions
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 589ca2e3..f511bfc8 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -47,7 +47,6 @@ CTheZones::Init(void)
for(i = 0; i < NUMINFOZONES; i++)
memset(&InfoZoneArray[i], 0, sizeof(CZone));
- CZoneInfo *zonei;
int x = 1000/9;
for(i = 0; i < 2*NUMINFOZONES; i++){
// Cars
diff --git a/src/core/config.h b/src/core/config.h
index f4cc8b05..940d06db 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -13,13 +13,13 @@ enum Config {
EXTRADIRSIZE = 256,
CUTSCENEDIRSIZE = 512,
- SIMPLEMODELSIZE = 5000, // only 3885 in VC???
+ SIMPLEMODELSIZE = 3885,
TIMEMODELSIZE = 385,
CLUMPMODELSIZE = 5,
WEAPONMODELSIZE = 37,
PEDMODELSIZE = 130,
- VEHICLEMODELSIZE = 120, // only 110 in VC???
- TWODFXSIZE = 2000, // only 1210 in VC???
+ VEHICLEMODELSIZE = 110,
+ TWODFXSIZE = 1210,
MAXVEHICLESLOADED = 50, // 70 on mobile
diff --git a/src/core/templates.h b/src/core/templates.h
index 44ab566b..aa71fe5d 100644
--- a/src/core/templates.h
+++ b/src/core/templates.h
@@ -17,6 +17,16 @@ public:
void clear(void){
this->allocPtr = 0;
}
+ int getIndex(T *item){
+ assert(item >= &this->store[0]);
+ assert(item < &this->store[n]);
+ return item - this->store;
+ }
+ T *getItem(int index){
+ assert(index >= 0);
+ assert(index < n);
+ return &this->store[index];
+ }
};
template<typename T, typename U = T>
diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp
index a2779107..31bb2500 100644
--- a/src/modelinfo/BaseModelInfo.cpp
+++ b/src/modelinfo/BaseModelInfo.cpp
@@ -4,12 +4,14 @@
#include "TxdStore.h"
#include "2dEffect.h"
#include "BaseModelInfo.h"
+#include "ModelInfo.h"
+//--MIAMI: file done
CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
{
m_colModel = nil;
- m_twodEffects = nil;
+ m_2dEffectsID = -1;
m_objectId = -1;
m_refCount = 0;
m_txdSlot = -1;
@@ -23,7 +25,7 @@ CBaseModelInfo::Shutdown(void)
{
DeleteCollisionModel();
DeleteRwObject();
- m_twodEffects = nil;
+ m_2dEffectsID = -1;
m_num2dEffects = 0;
m_txdSlot = -1;
}
@@ -76,17 +78,17 @@ CBaseModelInfo::RemoveTexDictionaryRef(void)
void
CBaseModelInfo::Init2dEffects(void)
{
- m_twodEffects = nil;
+ m_2dEffectsID = -1;
m_num2dEffects = 0;
}
void
CBaseModelInfo::Add2dEffect(C2dEffect *fx)
{
- if(m_twodEffects)
+ if(m_2dEffectsID >= 0)
m_num2dEffects++;
else{
- m_twodEffects = fx;
+ m_2dEffectsID = CModelInfo::Get2dEffectStore().getIndex(fx);
m_num2dEffects = 1;
}
}
@@ -94,8 +96,8 @@ CBaseModelInfo::Add2dEffect(C2dEffect *fx)
C2dEffect*
CBaseModelInfo::Get2dEffect(int n)
{
- if(m_twodEffects)
- return &m_twodEffects[n];
+ if(m_2dEffectsID >= 0)
+ return CModelInfo::Get2dEffectStore().getItem(m_2dEffectsID+n);
else
return nil;
}
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index 4b880758..c196aa5a 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -2,7 +2,7 @@
#include "Collision.h"
-#define MAX_MODEL_NAME (24)
+#define MAX_MODEL_NAME (21)
enum ModelInfoType : uint8
{
@@ -25,14 +25,14 @@ class CBaseModelInfo
{
protected:
char m_name[MAX_MODEL_NAME];
+ ModelInfoType m_type;
+ uint8 m_num2dEffects;
+ bool m_bOwnsColModel;
CColModel *m_colModel;
- C2dEffect *m_twodEffects;
+ int16 m_2dEffectsID;
int16 m_objectId;
uint16 m_refCount;
int16 m_txdSlot;
- ModelInfoType m_type;
- uint8 m_num2dEffects;
- bool m_bOwnsColModel;
public:
CBaseModelInfo(ModelInfoType type);
@@ -42,6 +42,9 @@ public:
virtual RwObject *CreateInstance(RwMatrix *) = 0;
virtual RwObject *CreateInstance(void) = 0;
virtual RwObject *GetRwObject(void) = 0;
+ virtual void SetAnimFile(const char *file) {}
+ virtual void ConvertAnimFileIndex(void) {}
+ virtual int GetAnimFileIndex(void) { return -1; }
// one day it becomes virtual
ModelInfoType GetModelType() const { return m_type; }
@@ -49,7 +52,7 @@ public:
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME || m_type == MITYPE_WEAPON; }
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; }
char *GetName(void) { return m_name; }
- void SetName(const char *name) { strncpy(m_name, name, 24); }
+ void SetName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; }
@@ -70,5 +73,3 @@ public:
uint8 GetNum2dEffects() const { return m_num2dEffects; }
uint16 GetNumRefs() const { return m_refCount; }
};
-
-static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
diff --git a/src/modelinfo/ClumpModelInfo.h b/src/modelinfo/ClumpModelInfo.h
index c37a468a..bf756e67 100644
--- a/src/modelinfo/ClumpModelInfo.h
+++ b/src/modelinfo/ClumpModelInfo.h
@@ -50,4 +50,4 @@ public:
static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data);
static RwFrame *GetFrameFromId(RpClump *clump, int32 id);
};
-static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error");
+//static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error");
diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h
index b2e59bb2..2ebe9284 100644
--- a/src/modelinfo/SimpleModelInfo.h
+++ b/src/modelinfo/SimpleModelInfo.h
@@ -57,4 +57,4 @@ public:
void SetRelatedModel(CSimpleModelInfo *m){
m_atomics[2] = (RpAtomic*)m; }
};
-static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");
+//static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");
diff --git a/src/modelinfo/TimeModelInfo.h b/src/modelinfo/TimeModelInfo.h
index f8b7c8ff..6e3c64fb 100644
--- a/src/modelinfo/TimeModelInfo.h
+++ b/src/modelinfo/TimeModelInfo.h
@@ -17,4 +17,4 @@ public:
void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; }
CTimeModelInfo *FindOtherTimeModel(void);
};
-static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
+//static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
diff --git a/src/render/2dEffect.h b/src/render/2dEffect.h
index b0615e4d..a24a3f4f 100644
--- a/src/render/2dEffect.h
+++ b/src/render/2dEffect.h
@@ -1,3 +1,5 @@
+#pragma once
+
enum {
EFFECT_LIGHT,
EFFECT_PARTICLE,