Add proper CRandom16 vars to factories

This commit is contained in:
Phillip Stephens 2016-02-15 00:23:50 -08:00
parent 0260ebcd64
commit 1c5a86dcbf
6 changed files with 21 additions and 5 deletions

View File

@ -24,6 +24,7 @@ struct Application : boo::IApplicationCallback
int appMain(boo::IApplication* app)
{
Zeus::detectCPU();
pshag::CElementGen::Initialize();
m_viewManager.init(app);
while (m_running)

View File

@ -2,6 +2,7 @@
#include "CToken.hpp"
#include "CSimplePool.hpp"
#include "CGenDescription.hpp"
#include "CRandom16.hpp"
namespace pshag
{
@ -849,6 +850,8 @@ CGenDescription* CParticleDataFactory::CreateGeneratorDescription(CInputStream&
bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
std::vector<TResId>& tracker, CSimplePool* resPool)
{
CRandom16 rand{99};
CGlobalRandom gr(rand);
FourCC clsId = GetClassID(in);
while (clsId != SBIG('_END'))
{

View File

@ -31,11 +31,12 @@ CElectricDescription* CParticleElectricDataFactory::CreateElectricDescription(CI
bool CParticleElectricDataFactory::CreateELSM(CElectricDescription *desc, CInputStream &in, CSimplePool *resPool)
{
CRandom16 rand;
CRandom16 rand{99};
CGlobalRandom gr{rand};
FourCC clsId = CPF::GetClassID(in);
while (clsId != SBIG('_END'))
{
CGlobalRandom gr(rand);
switch(clsId)
{
case SBIG('LIFE'):
@ -118,6 +119,16 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription *desc, CInput
return true;
}
void CParticleElectricDataFactory::LoadELSMTokens(CElectricDescription* desc)
{
if (desc->x40_SSWH.m_found)
desc->x40_SSWH.m_swoosh = desc->x40_SSWH.m_token.GetObj();
if (desc->x50_GPSM.m_found)
desc->x50_GPSM.m_gen = desc->x50_GPSM.m_token.GetObj();
if (desc->x60_EPSM.m_found)
desc->x60_EPSM.m_gen = desc->x60_EPSM.m_token.GetObj();
}
std::unique_ptr<pshag::IObj> FParticleElecrticFactory(const pshag::SObjectTag &tag, pshag::CInputStream &in, const pshag::CVParamTransfer &vparms)
{
CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());

View File

@ -14,7 +14,7 @@ class CParticleElectricDataFactory
{
static CElectricDescription* CreateElectricDescription(CInputStream& in, CSimplePool* resPool);
static bool CreateELSM(CElectricDescription* desc, CInputStream& in, CSimplePool* resPool);
static bool LoadELSMTokens(CElectricDescription* desc);
static void LoadELSMTokens(CElectricDescription* desc);
public:
static CElectricDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
};

View File

@ -28,7 +28,7 @@ CSwooshDescription*CParticleSwooshDataFactory::CreateGeneratorDescription(CInput
bool CParticleSwooshDataFactory::CreateWPSM(CSwooshDescription* desc, CInputStream& in, CSimplePool* resPool)
{
CRandom16 rand;
CRandom16 rand{99};
FourCC clsId = CPF::GetClassID(in);
while (clsId != SBIG('_END'))
{

View File

@ -29,7 +29,8 @@ CWeaponDescription* CProjectileWeaponDataFactory::CreateGeneratorDescription(CIn
bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputStream& in, CSimplePool* resPool)
{
CRandom16 rand;
CRandom16 rand{99};
CGlobalRandom gr{rand};
FourCC clsId = CPF::GetClassID(in);
while(clsId != SBIG('_END'))