2019-05-15 16:52:37 +02:00
|
|
|
#include "common.h"
|
2020-04-17 15:31:11 +02:00
|
|
|
|
2019-05-15 16:52:37 +02:00
|
|
|
#include "templates.h"
|
|
|
|
#include "TxdStore.h"
|
|
|
|
#include "2dEffect.h"
|
|
|
|
#include "BaseModelInfo.h"
|
2020-05-07 21:55:54 +02:00
|
|
|
#include "ModelInfo.h"
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-05-07 21:55:54 +02:00
|
|
|
//--MIAMI: file done
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-05-05 13:02:42 +02:00
|
|
|
CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
|
2019-05-15 16:52:37 +02:00
|
|
|
{
|
|
|
|
m_colModel = nil;
|
2020-05-07 21:55:54 +02:00
|
|
|
m_2dEffectsID = -1;
|
2019-05-15 16:52:37 +02:00
|
|
|
m_objectId = -1;
|
|
|
|
m_refCount = 0;
|
|
|
|
m_txdSlot = -1;
|
|
|
|
m_type = type;
|
|
|
|
m_num2dEffects = 0;
|
2020-05-05 13:02:42 +02:00
|
|
|
m_bOwnsColModel = false;
|
2019-05-15 16:52:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::Shutdown(void)
|
|
|
|
{
|
|
|
|
DeleteCollisionModel();
|
|
|
|
DeleteRwObject();
|
2020-05-07 21:55:54 +02:00
|
|
|
m_2dEffectsID = -1;
|
2019-05-15 16:52:37 +02:00
|
|
|
m_num2dEffects = 0;
|
|
|
|
m_txdSlot = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::DeleteCollisionModel(void)
|
|
|
|
{
|
2020-05-05 13:02:42 +02:00
|
|
|
if(m_colModel && m_bOwnsColModel){
|
2019-05-15 16:52:37 +02:00
|
|
|
if(m_colModel)
|
|
|
|
delete m_colModel;
|
|
|
|
m_colModel = nil;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::AddRef(void)
|
|
|
|
{
|
|
|
|
m_refCount++;
|
|
|
|
AddTexDictionaryRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::RemoveRef(void)
|
|
|
|
{
|
|
|
|
m_refCount--;
|
|
|
|
RemoveTexDictionaryRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::SetTexDictionary(const char *name)
|
|
|
|
{
|
|
|
|
int slot = CTxdStore::FindTxdSlot(name);
|
|
|
|
if(slot < 0)
|
|
|
|
slot = CTxdStore::AddTxdSlot(name);
|
|
|
|
m_txdSlot = slot;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::AddTexDictionaryRef(void)
|
|
|
|
{
|
|
|
|
CTxdStore::AddRef(m_txdSlot);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::RemoveTexDictionaryRef(void)
|
|
|
|
{
|
|
|
|
CTxdStore::RemoveRef(m_txdSlot);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::Init2dEffects(void)
|
|
|
|
{
|
2020-05-07 21:55:54 +02:00
|
|
|
m_2dEffectsID = -1;
|
2019-05-15 16:52:37 +02:00
|
|
|
m_num2dEffects = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CBaseModelInfo::Add2dEffect(C2dEffect *fx)
|
|
|
|
{
|
2020-05-07 21:55:54 +02:00
|
|
|
if(m_2dEffectsID >= 0)
|
2019-05-15 16:52:37 +02:00
|
|
|
m_num2dEffects++;
|
|
|
|
else{
|
2020-12-18 13:50:26 +01:00
|
|
|
m_2dEffectsID = CModelInfo::Get2dEffectStore().GetIndex(fx);
|
2019-05-15 16:52:37 +02:00
|
|
|
m_num2dEffects = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
C2dEffect*
|
|
|
|
CBaseModelInfo::Get2dEffect(int n)
|
|
|
|
{
|
2020-05-07 21:55:54 +02:00
|
|
|
if(m_2dEffectsID >= 0)
|
2020-12-18 13:50:26 +01:00
|
|
|
return CModelInfo::Get2dEffectStore().GetItem(m_2dEffectsID+n);
|
2019-05-15 16:52:37 +02:00
|
|
|
else
|
|
|
|
return nil;
|
|
|
|
}
|