1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-05 11:35:54 +00:00

CBaseModelInfo done

This commit is contained in:
aap 2020-05-07 21:55:54 +02:00
parent f80474f590
commit c715569d1d
9 changed files with 37 additions and 23 deletions

View file

@ -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

View file

@ -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

View file

@ -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>

View file

@ -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;
}

View file

@ -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];
CColModel *m_colModel;
C2dEffect *m_twodEffects;
int16 m_objectId;
uint16 m_refCount;
int16 m_txdSlot;
ModelInfoType m_type;
uint8 m_num2dEffects;
bool m_bOwnsColModel;
CColModel *m_colModel;
int16 m_2dEffectsID;
int16 m_objectId;
uint16 m_refCount;
int16 m_txdSlot;
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");

View file

@ -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");

View file

@ -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");

View file

@ -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");

View file

@ -1,3 +1,5 @@
#pragma once
enum {
EFFECT_LIGHT,
EFFECT_PARTICLE,