JMW
Aspiring Addon Developer
Is there anything here that's not 2010 compatible and going to make it "hang"
I can't figure it, but something here is not working with 2010 (from 2006)
(Thanks for the code Computerex)
Code:
VOBJ * BOOMMANAGER::ReadAndAssign(char * ini, VESSEL * v)
{
char cbuf[255], str[255];
VOBJ * vbj = new VOBJ();
std::vector<PVISUAL*> visuals;
int pCount = 0;
g_FR.LoadInt(ini,"SETTINGS","pcount",pCount);
PVISUAL *vis;
PARTICLESTREAMSPEC *ps;
VECTOR3 pos;
for (int i = 0; i < pCount; i++)
{
ps = new PARTICLESTREAMSPEC();
sprintf(cbuf,"P_%d_srcsize",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->srcsize);
sprintf(cbuf,"P_%d_srcrate",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->srcrate);
sprintf(cbuf,"P_%d_v0",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->v0);
sprintf(cbuf,"P_%d_srcspread",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->srcspread);
sprintf(cbuf,"P_%d_lifetime",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->lifetime);
sprintf(cbuf,"P_%d_growthrate",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->growthrate);
sprintf(cbuf,"P_%d_atmslowdown",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->atmslowdown);
sprintf(cbuf,"P_%d_lmin",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->lmin);
sprintf(cbuf,"P_%d_lmax",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->lmax);
sprintf(cbuf,"P_%d_amin",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->amin);
sprintf(cbuf,"P_%d_amax",i+1);
g_FR.LoadDouble(ini,"SETTINGS",cbuf,ps->amax);
sprintf(cbuf,"P_%d_pos",i+1);
g_FR.LoadVector(ini,"SETTINGS",cbuf,pos);
sprintf(str,"P_%d_LTYPE",i+1);
g_FR.LoadString(ini,"SETTINGS",str,cbuf);
if (!strcmp(cbuf,"EMISSIVE"))
ps->ltype=PARTICLESTREAMSPEC::EMISSIVE;
else if (!strcmp(cbuf,"DIFFUSE"))
ps->ltype=PARTICLESTREAMSPEC::DIFFUSE;
else
ps->ltype=PARTICLESTREAMSPEC::DIFFUSE;
sprintf(str,"P_%d_LEVELMAP",i+1);
g_FR.LoadString(ini,"SETTINGS",str,cbuf);
if (!strcmp(cbuf,"LVL_FLAT"))
ps->levelmap=PARTICLESTREAMSPEC::LVL_FLAT;
else if(!strcmp(cbuf,"LVL_LIN"))
ps->levelmap=PARTICLESTREAMSPEC::LVL_LIN;
else if(!strcmp(cbuf,"LVL_SQRT"))
ps->levelmap=PARTICLESTREAMSPEC::LVL_SQRT;
else if(!strcmp(cbuf,"LVL_PLIN"))
ps->levelmap=PARTICLESTREAMSPEC::LVL_PLIN;
else if (!strcmp(cbuf,"LVL_PSQRT"))
ps->levelmap=PARTICLESTREAMSPEC::LVL_PSQRT;
else
ps->levelmap=PARTICLESTREAMSPEC::LVL_SQRT;
sprintf(str,"P_%d_ATMSMAP",i+1);
g_FR.LoadString(ini,"SETTINGS",str,cbuf);
if (!strcmp(cbuf,"ATM_FLAT"))
ps->atmsmap=PARTICLESTREAMSPEC::ATM_FLAT;
else if (!strcmp(cbuf,"ATM_PLIN"))
ps->atmsmap=PARTICLESTREAMSPEC::ATM_PLIN;
else if (!strcmp(cbuf,"ATM_PLOG"))
ps->atmsmap=PARTICLESTREAMSPEC::ATM_PLOG;
else
ps->atmsmap=PARTICLESTREAMSPEC::ATM_PLOG;
sprintf(str,"P_%d_tex",i+1);
g_FR.LoadString(ini,"SETTINGS",str,cbuf);
if (strcmp(cbuf,"none"))
{
SURFHANDLE texture = oapiRegisterExhaustTexture(cbuf);
ps->tex=texture;
}
vis = new PVISUAL(ps,pos);
visuals.push_back(vis);
}
g_FR.LoadString(ini,"SETTINGS","sound",cbuf);
if (!strcmp("default",cbuf))
sprintf(vbj->sound,"Sound/Vessel/sonicbang.wav");
else
sprintf(vbj->sound,"%s",cbuf);
g_FR.LoadDouble(ini,"SETTINGS","duration",vbj->duration);
vbj->hook=v->GetHandle();
vbj->streams=visuals;
CreateResourceAndStreams(vbj);
return vbj;
}
(Thanks for the code Computerex)