mirror of
https://github.com/halpz/re3.git
synced 2025-07-22 13:29:47 +00:00
CWeaponModelInfo
This commit is contained in:
@ -9,6 +9,7 @@ CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE];
|
||||
|
||||
CStore<CSimpleModelInfo, SIMPLEMODELSIZE> CModelInfo::ms_simpleModelStore;
|
||||
CStore<CTimeModelInfo, TIMEMODELSIZE> CModelInfo::ms_timeModelStore;
|
||||
CStore<CWeaponModelInfo, WEAPONMODELSIZE> CModelInfo::ms_weaponModelStore;
|
||||
CStore<CClumpModelInfo, CLUMPMODELSIZE> CModelInfo::ms_clumpModelStore;
|
||||
CStore<CPedModelInfo, PEDMODELSIZE> CModelInfo::ms_pedModelStore;
|
||||
CStore<CVehicleModelInfo, VEHICLEMODELSIZE> CModelInfo::ms_vehicleModelStore;
|
||||
@ -25,6 +26,7 @@ CModelInfo::Initialise(void)
|
||||
ms_2dEffectStore.clear();
|
||||
ms_simpleModelStore.clear();
|
||||
ms_timeModelStore.clear();
|
||||
ms_weaponModelStore.clear();
|
||||
ms_clumpModelStore.clear();
|
||||
ms_pedModelStore.clear();
|
||||
ms_vehicleModelStore.clear();
|
||||
@ -86,6 +88,8 @@ CModelInfo::ShutDown(void)
|
||||
ms_simpleModelStore.store[i].Shutdown();
|
||||
for(i = 0; i < ms_timeModelStore.allocPtr; i++)
|
||||
ms_timeModelStore.store[i].Shutdown();
|
||||
for(i = 0; i < ms_weaponModelStore.allocPtr; i++)
|
||||
ms_weaponModelStore.store[i].Shutdown();
|
||||
for(i = 0; i < ms_clumpModelStore.allocPtr; i++)
|
||||
ms_clumpModelStore.store[i].Shutdown();
|
||||
for(i = 0; i < ms_vehicleModelStore.allocPtr; i++)
|
||||
@ -98,6 +102,7 @@ CModelInfo::ShutDown(void)
|
||||
ms_2dEffectStore.clear();
|
||||
ms_simpleModelStore.clear();
|
||||
ms_timeModelStore.clear();
|
||||
ms_weaponModelStore.clear();
|
||||
ms_pedModelStore.clear();
|
||||
ms_clumpModelStore.clear();
|
||||
ms_vehicleModelStore.clear();
|
||||
@ -123,6 +128,16 @@ CModelInfo::AddTimeModel(int id)
|
||||
return modelinfo;
|
||||
}
|
||||
|
||||
CWeaponModelInfo*
|
||||
CModelInfo::AddWeaponModel(int id)
|
||||
{
|
||||
CWeaponModelInfo *modelinfo;
|
||||
modelinfo = CModelInfo::ms_weaponModelStore.alloc();
|
||||
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
|
||||
modelinfo->Init();
|
||||
return modelinfo;
|
||||
}
|
||||
|
||||
CClumpModelInfo*
|
||||
CModelInfo::AddClumpModel(int id)
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "BaseModelInfo.h"
|
||||
#include "SimpleModelInfo.h"
|
||||
#include "TimeModelInfo.h"
|
||||
#include "WeaponModelInfo.h"
|
||||
#include "ClumpModelInfo.h"
|
||||
#include "PedModelInfo.h"
|
||||
#include "VehicleModelInfo.h"
|
||||
@ -14,6 +15,7 @@ class CModelInfo
|
||||
static CBaseModelInfo *ms_modelInfoPtrs[MODELINFOSIZE];
|
||||
static CStore<CSimpleModelInfo, SIMPLEMODELSIZE> ms_simpleModelStore;
|
||||
static CStore<CTimeModelInfo, TIMEMODELSIZE> ms_timeModelStore;
|
||||
static CStore<CWeaponModelInfo, WEAPONMODELSIZE> ms_weaponModelStore;
|
||||
static CStore<CClumpModelInfo, CLUMPMODELSIZE> ms_clumpModelStore;
|
||||
static CStore<CPedModelInfo, PEDMODELSIZE> ms_pedModelStore;
|
||||
static CStore<CVehicleModelInfo, VEHICLEMODELSIZE> ms_vehicleModelStore;
|
||||
@ -25,6 +27,7 @@ public:
|
||||
|
||||
static CSimpleModelInfo *AddSimpleModel(int id);
|
||||
static CTimeModelInfo *AddTimeModel(int id);
|
||||
static CWeaponModelInfo *AddWeaponModel(int id);
|
||||
static CClumpModelInfo *AddClumpModel(int id);
|
||||
static CPedModelInfo *AddPedModel(int id);
|
||||
static CVehicleModelInfo *AddVehicleModel(int id);
|
||||
|
53
src/modelinfo/WeaponModelInfo.cpp
Normal file
53
src/modelinfo/WeaponModelInfo.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "ModelInfo.h"
|
||||
#include "AnimManager.h"
|
||||
#include "VisibilityPlugins.h"
|
||||
|
||||
void
|
||||
CWeaponModelInfo::SetAnimFile(const char *file)
|
||||
{
|
||||
if(strcasecmp(file, "null") == 0)
|
||||
return;
|
||||
|
||||
m_animFileName = new char[strlen(file)+1];
|
||||
strcpy(m_animFileName, file);
|
||||
}
|
||||
|
||||
void
|
||||
CWeaponModelInfo::ConvertAnimFileIndex(void)
|
||||
{
|
||||
if(m_animFileIndex != -1){
|
||||
// we have a string pointer in that union
|
||||
int32 index = CAnimManager::GetAnimationBlockIndex(m_animFileName);
|
||||
delete[] m_animFileName;
|
||||
m_animFileIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CWeaponModelInfo::Init(void)
|
||||
{
|
||||
CSimpleModelInfo::Init();
|
||||
SetWeaponInfo(0);
|
||||
}
|
||||
|
||||
void
|
||||
CWeaponModelInfo::SetWeaponInfo(int32 weaponId)
|
||||
{
|
||||
m_atomics[2] = (RpAtomic*)weaponId;
|
||||
}
|
||||
|
||||
int32
|
||||
CWeaponModelInfo::GetWeaponInfo(void)
|
||||
{
|
||||
return (int32)(uintptr)m_atomics[2];
|
||||
}
|
||||
|
||||
void
|
||||
CWeaponModelInfo::SetAtomic(int n, RpAtomic *atomic)
|
||||
{
|
||||
CSimpleModelInfo::SetAtomic(n, atomic);
|
||||
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderWeaponCB);
|
||||
}
|
||||
|
22
src/modelinfo/WeaponModelInfo.h
Normal file
22
src/modelinfo/WeaponModelInfo.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "SimpleModelInfo.h"
|
||||
|
||||
class CWeaponModelInfo : public CSimpleModelInfo
|
||||
{
|
||||
union {
|
||||
int32 m_animFileIndex;
|
||||
char *m_animFileName;
|
||||
};
|
||||
public:
|
||||
CWeaponModelInfo(void) : CSimpleModelInfo(MITYPE_WEAPON) { m_animFileIndex = -1; }
|
||||
|
||||
virtual void SetAnimFile(const char *file);
|
||||
virtual void ConvertAnimFileIndex(void);
|
||||
virtual int GetAnimFileIndex(void) { return m_animFileIndex; }
|
||||
|
||||
void Init(void);
|
||||
void SetWeaponInfo(int32 weaponId);
|
||||
int32 GetWeaponInfo(void);
|
||||
void SetAtomic(int n, RpAtomic *atomic);
|
||||
};
|
Reference in New Issue
Block a user