CBaseModelInfo done
This commit is contained in:
parent
f80474f590
commit
c715569d1d
|
@ -47,7 +47,6 @@ CTheZones::Init(void)
|
||||||
for(i = 0; i < NUMINFOZONES; i++)
|
for(i = 0; i < NUMINFOZONES; i++)
|
||||||
memset(&InfoZoneArray[i], 0, sizeof(CZone));
|
memset(&InfoZoneArray[i], 0, sizeof(CZone));
|
||||||
|
|
||||||
CZoneInfo *zonei;
|
|
||||||
int x = 1000/9;
|
int x = 1000/9;
|
||||||
for(i = 0; i < 2*NUMINFOZONES; i++){
|
for(i = 0; i < 2*NUMINFOZONES; i++){
|
||||||
// Cars
|
// Cars
|
||||||
|
|
|
@ -13,13 +13,13 @@ enum Config {
|
||||||
EXTRADIRSIZE = 256,
|
EXTRADIRSIZE = 256,
|
||||||
CUTSCENEDIRSIZE = 512,
|
CUTSCENEDIRSIZE = 512,
|
||||||
|
|
||||||
SIMPLEMODELSIZE = 5000, // only 3885 in VC???
|
SIMPLEMODELSIZE = 3885,
|
||||||
TIMEMODELSIZE = 385,
|
TIMEMODELSIZE = 385,
|
||||||
CLUMPMODELSIZE = 5,
|
CLUMPMODELSIZE = 5,
|
||||||
WEAPONMODELSIZE = 37,
|
WEAPONMODELSIZE = 37,
|
||||||
PEDMODELSIZE = 130,
|
PEDMODELSIZE = 130,
|
||||||
VEHICLEMODELSIZE = 120, // only 110 in VC???
|
VEHICLEMODELSIZE = 110,
|
||||||
TWODFXSIZE = 2000, // only 1210 in VC???
|
TWODFXSIZE = 1210,
|
||||||
|
|
||||||
MAXVEHICLESLOADED = 50, // 70 on mobile
|
MAXVEHICLESLOADED = 50, // 70 on mobile
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,16 @@ public:
|
||||||
void clear(void){
|
void clear(void){
|
||||||
this->allocPtr = 0;
|
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>
|
template<typename T, typename U = T>
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
#include "TxdStore.h"
|
#include "TxdStore.h"
|
||||||
#include "2dEffect.h"
|
#include "2dEffect.h"
|
||||||
#include "BaseModelInfo.h"
|
#include "BaseModelInfo.h"
|
||||||
|
#include "ModelInfo.h"
|
||||||
|
|
||||||
|
//--MIAMI: file done
|
||||||
|
|
||||||
CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
|
CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
|
||||||
{
|
{
|
||||||
m_colModel = nil;
|
m_colModel = nil;
|
||||||
m_twodEffects = nil;
|
m_2dEffectsID = -1;
|
||||||
m_objectId = -1;
|
m_objectId = -1;
|
||||||
m_refCount = 0;
|
m_refCount = 0;
|
||||||
m_txdSlot = -1;
|
m_txdSlot = -1;
|
||||||
|
@ -23,7 +25,7 @@ CBaseModelInfo::Shutdown(void)
|
||||||
{
|
{
|
||||||
DeleteCollisionModel();
|
DeleteCollisionModel();
|
||||||
DeleteRwObject();
|
DeleteRwObject();
|
||||||
m_twodEffects = nil;
|
m_2dEffectsID = -1;
|
||||||
m_num2dEffects = 0;
|
m_num2dEffects = 0;
|
||||||
m_txdSlot = -1;
|
m_txdSlot = -1;
|
||||||
}
|
}
|
||||||
|
@ -76,17 +78,17 @@ CBaseModelInfo::RemoveTexDictionaryRef(void)
|
||||||
void
|
void
|
||||||
CBaseModelInfo::Init2dEffects(void)
|
CBaseModelInfo::Init2dEffects(void)
|
||||||
{
|
{
|
||||||
m_twodEffects = nil;
|
m_2dEffectsID = -1;
|
||||||
m_num2dEffects = 0;
|
m_num2dEffects = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CBaseModelInfo::Add2dEffect(C2dEffect *fx)
|
CBaseModelInfo::Add2dEffect(C2dEffect *fx)
|
||||||
{
|
{
|
||||||
if(m_twodEffects)
|
if(m_2dEffectsID >= 0)
|
||||||
m_num2dEffects++;
|
m_num2dEffects++;
|
||||||
else{
|
else{
|
||||||
m_twodEffects = fx;
|
m_2dEffectsID = CModelInfo::Get2dEffectStore().getIndex(fx);
|
||||||
m_num2dEffects = 1;
|
m_num2dEffects = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,8 +96,8 @@ CBaseModelInfo::Add2dEffect(C2dEffect *fx)
|
||||||
C2dEffect*
|
C2dEffect*
|
||||||
CBaseModelInfo::Get2dEffect(int n)
|
CBaseModelInfo::Get2dEffect(int n)
|
||||||
{
|
{
|
||||||
if(m_twodEffects)
|
if(m_2dEffectsID >= 0)
|
||||||
return &m_twodEffects[n];
|
return CModelInfo::Get2dEffectStore().getItem(m_2dEffectsID+n);
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "Collision.h"
|
#include "Collision.h"
|
||||||
|
|
||||||
#define MAX_MODEL_NAME (24)
|
#define MAX_MODEL_NAME (21)
|
||||||
|
|
||||||
enum ModelInfoType : uint8
|
enum ModelInfoType : uint8
|
||||||
{
|
{
|
||||||
|
@ -25,14 +25,14 @@ class CBaseModelInfo
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
char m_name[MAX_MODEL_NAME];
|
char m_name[MAX_MODEL_NAME];
|
||||||
CColModel *m_colModel;
|
|
||||||
C2dEffect *m_twodEffects;
|
|
||||||
int16 m_objectId;
|
|
||||||
uint16 m_refCount;
|
|
||||||
int16 m_txdSlot;
|
|
||||||
ModelInfoType m_type;
|
ModelInfoType m_type;
|
||||||
uint8 m_num2dEffects;
|
uint8 m_num2dEffects;
|
||||||
bool m_bOwnsColModel;
|
bool m_bOwnsColModel;
|
||||||
|
CColModel *m_colModel;
|
||||||
|
int16 m_2dEffectsID;
|
||||||
|
int16 m_objectId;
|
||||||
|
uint16 m_refCount;
|
||||||
|
int16 m_txdSlot;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CBaseModelInfo(ModelInfoType type);
|
CBaseModelInfo(ModelInfoType type);
|
||||||
|
@ -42,6 +42,9 @@ public:
|
||||||
virtual RwObject *CreateInstance(RwMatrix *) = 0;
|
virtual RwObject *CreateInstance(RwMatrix *) = 0;
|
||||||
virtual RwObject *CreateInstance(void) = 0;
|
virtual RwObject *CreateInstance(void) = 0;
|
||||||
virtual RwObject *GetRwObject(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
|
// one day it becomes virtual
|
||||||
ModelInfoType GetModelType() const { return m_type; }
|
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 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; }
|
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; }
|
||||||
char *GetName(void) { return m_name; }
|
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){
|
void SetColModel(CColModel *col, bool owns = false){
|
||||||
m_colModel = col; m_bOwnsColModel = owns; }
|
m_colModel = col; m_bOwnsColModel = owns; }
|
||||||
CColModel *GetColModel(void) { return m_colModel; }
|
CColModel *GetColModel(void) { return m_colModel; }
|
||||||
|
@ -70,5 +73,3 @@ public:
|
||||||
uint8 GetNum2dEffects() const { return m_num2dEffects; }
|
uint8 GetNum2dEffects() const { return m_num2dEffects; }
|
||||||
uint16 GetNumRefs() const { return m_refCount; }
|
uint16 GetNumRefs() const { return m_refCount; }
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
|
|
||||||
|
|
|
@ -50,4 +50,4 @@ public:
|
||||||
static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data);
|
static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data);
|
||||||
static RwFrame *GetFrameFromId(RpClump *clump, int32 id);
|
static RwFrame *GetFrameFromId(RpClump *clump, int32 id);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error");
|
//static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error");
|
||||||
|
|
|
@ -57,4 +57,4 @@ public:
|
||||||
void SetRelatedModel(CSimpleModelInfo *m){
|
void SetRelatedModel(CSimpleModelInfo *m){
|
||||||
m_atomics[2] = (RpAtomic*)m; }
|
m_atomics[2] = (RpAtomic*)m; }
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");
|
//static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");
|
||||||
|
|
|
@ -17,4 +17,4 @@ public:
|
||||||
void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; }
|
void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; }
|
||||||
CTimeModelInfo *FindOtherTimeModel(void);
|
CTimeModelInfo *FindOtherTimeModel(void);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
|
//static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
EFFECT_LIGHT,
|
EFFECT_LIGHT,
|
||||||
EFFECT_PARTICLE,
|
EFFECT_PARTICLE,
|
||||||
|
|
Loading…
Reference in New Issue