forked from Mirrors/openclonk
Move Game.Particles to ::Particles
parent
fb48b275be
commit
a05e53c1bc
|
@ -109,7 +109,6 @@ class C4Game
|
|||
C4ComponentHost GameText;
|
||||
C4GameScriptHost Script;
|
||||
C4LangStringTable MainSysLangStringTable, ScenarioLangStringTable, ScenarioSysLangStringTable;
|
||||
C4ParticleSystem Particles;
|
||||
C4PlayerList Players;
|
||||
StdStrBuf PlayerNames;
|
||||
C4GameControl Control;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// thus, more complex partivle behaviour should be solved via
|
||||
// objects
|
||||
// note: this particle system will always assume the owning def
|
||||
// object to be a static class named Game.Particles!
|
||||
// object to be a static class named ::Particles!
|
||||
|
||||
#ifndef INC_C4Particles
|
||||
#define INC_C4Particles
|
||||
|
@ -50,7 +50,7 @@ typedef C4ParticleProc C4ParticleExecProc; // particle execution proc - returns
|
|||
typedef C4ParticleProc C4ParticleCollisionProc; // particle collision proc - returns whether particle died
|
||||
typedef void (*C4ParticleDrawProc)(C4Particle *, C4TargetFacet &, C4Object *); // particle drawing code
|
||||
|
||||
#define ParticleSystem Game.Particles
|
||||
#define ParticleSystem ::Particles
|
||||
|
||||
// core for particle defs
|
||||
class C4ParticleDefCore
|
||||
|
@ -224,6 +224,8 @@ class C4ParticleSystem
|
|||
friend class C4ParticleChunk;
|
||||
};
|
||||
|
||||
extern C4ParticleSystem Particles;
|
||||
|
||||
// default particle execution/drawing functions
|
||||
bool fxStdInit(C4Particle *pPrt, C4Object *pTarget);
|
||||
bool fxStdExec(C4Particle *pPrt, C4Object *pTarget);
|
||||
|
|
|
@ -644,7 +644,7 @@ int32_t FnFxFireTimer(C4AulContext *ctx, C4Object *pObj, int32_t iNumber, int32_
|
|||
pObj->ExecFire(iNumber, iCausedByPlr);
|
||||
|
||||
// special effects only if loaded
|
||||
if (!Game.Particles.IsFireParticleLoaded()) return C4Fx_OK;
|
||||
if (!::Particles.IsFireParticleLoaded()) return C4Fx_OK;
|
||||
|
||||
// get effect: May be NULL after object fire execution, in which case the fire has been extinguished
|
||||
if (!pObj->GetOnFire()) return C4Fx_Execute_Kill;
|
||||
|
@ -720,12 +720,12 @@ int32_t FnFxFireTimer(C4AulContext *ctx, C4Object *pObj, int32_t iNumber, int32_
|
|||
if (i<iCount/2)
|
||||
{
|
||||
dwClr = 0x32004000 + ((SafeRandom(59) + 196) << 16);
|
||||
pPartDef = Game.Particles.pFire1;
|
||||
pPartDef = ::Particles.pFire1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwClr = 0xffffff;
|
||||
pPartDef = Game.Particles.pFire2;
|
||||
pPartDef = ::Particles.pFire2;
|
||||
}
|
||||
if (iFireMode == C4Fx_FireMode_Object) dwClr += 0x62000000;
|
||||
|
||||
|
@ -752,7 +752,7 @@ int32_t FnFxFireTimer(C4AulContext *ctx, C4Object *pObj, int32_t iNumber, int32_
|
|||
}
|
||||
|
||||
// OK; create it!
|
||||
Game.Particles.Create(pPartDef, float(iX)+fRot[0]*iPx+fRot[1]*iPy, float(iY)+fRot[2]*iPx+fRot[3]*iPy, (float) iXDir/10.0f, (float) iYDir/10.0f, (float) iSize/10.0f, dwClr, pParticleList,pObj);
|
||||
::Particles.Create(pPartDef, float(iX)+fRot[0]*iPx+fRot[1]*iPy, float(iY)+fRot[2]*iPx+fRot[3]*iPy, (float) iXDir/10.0f, (float) iYDir/10.0f, (float) iSize/10.0f, dwClr, pParticleList,pObj);
|
||||
}
|
||||
|
||||
return C4Fx_OK;
|
||||
|
@ -834,9 +834,9 @@ void BubbleOut(int32_t tx, int32_t ty)
|
|||
|
||||
void Smoke(int32_t tx, int32_t ty, int32_t level, DWORD dwClr)
|
||||
{
|
||||
if (Game.Particles.pSmoke)
|
||||
if (::Particles.pSmoke)
|
||||
{
|
||||
Game.Particles.Create(Game.Particles.pSmoke, float(tx), float(ty)-level/2, 0.0f, 0.0f, float(level), dwClr);
|
||||
::Particles.Create(::Particles.pSmoke, float(tx), float(ty)-level/2, 0.0f, 0.0f, float(level), dwClr);
|
||||
return;
|
||||
}
|
||||
// User-defined smoke level
|
||||
|
@ -869,20 +869,20 @@ void Explosion(int32_t tx, int32_t ty, int32_t level, C4Object *inobj, int32_t i
|
|||
::Landscape.Incinerate(tx+5,ty-5);
|
||||
// Create blast object or particle
|
||||
C4Object *pBlast;
|
||||
C4ParticleDef *pPrtDef = Game.Particles.pBlast;
|
||||
C4ParticleDef *pPrtDef = ::Particles.pBlast;
|
||||
// particle override
|
||||
if (szEffect)
|
||||
{
|
||||
C4ParticleDef *pPrtDef2 = Game.Particles.GetDef(szEffect);
|
||||
C4ParticleDef *pPrtDef2 = ::Particles.GetDef(szEffect);
|
||||
if (pPrtDef2) pPrtDef = pPrtDef2;
|
||||
}
|
||||
else if (idEffect) pPrtDef = NULL;
|
||||
// create particle
|
||||
if (pPrtDef)
|
||||
{
|
||||
Game.Particles.Create(pPrtDef, (float) tx, (float) ty, 0.0f, 0.0f, (float) level, 0);
|
||||
::Particles.Create(pPrtDef, (float) tx, (float) ty, 0.0f, 0.0f, (float) level, 0);
|
||||
if (SEqual2(pPrtDef->Name.getData(), "Blast"))
|
||||
Game.Particles.Cast(Game.Particles.pFSpark, level/5+1, (float) tx, (float) ty, level, level/2+1.0f, 0x00ef0000, level+1.0f, 0xffff1010);
|
||||
::Particles.Cast(::Particles.pFSpark, level/5+1, (float) tx, (float) ty, level, level/2+1.0f, 0x00ef0000, level+1.0f, 0xffff1010);
|
||||
}
|
||||
else
|
||||
if (pBlast = Game.CreateObjectConstruction(idEffect ? idEffect : C4Id("FXB1"),pByObj,iCausedBy,tx,ty+level,FullCon*level/20))
|
||||
|
|
|
@ -2358,7 +2358,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode)
|
|||
}
|
||||
|
||||
// Fire facet - always draw, even if particles are drawn as well
|
||||
if (OnFire /*&& !Game.Particles.IsFireParticleLoaded()*/) if (eDrawMode!=ODM_BaseOnly)
|
||||
if (OnFire /*&& !::Particles.IsFireParticleLoaded()*/) if (eDrawMode!=ODM_BaseOnly)
|
||||
{
|
||||
C4Facet fgo;
|
||||
// Straight: Full Shape.Rect on fire
|
||||
|
|
|
@ -265,7 +265,7 @@ void C4ParticleList::Exec(C4Object *pObj)
|
|||
{
|
||||
// sorry, life is over for you :P
|
||||
--pPrt->pDef->Count;
|
||||
pPrt->MoveList(*this, Game.Particles.FreeParticles);
|
||||
pPrt->MoveList(*this, ::Particles.FreeParticles);
|
||||
}
|
||||
}
|
||||
// done
|
||||
|
@ -289,7 +289,7 @@ void C4ParticleList::Clear()
|
|||
pPrtNext=pPrt->pNext;
|
||||
// sorry, life is over for you :P
|
||||
--pPrt->pDef->Count;
|
||||
pPrt->MoveList(*this, Game.Particles.FreeParticles);
|
||||
pPrt->MoveList(*this, ::Particles.FreeParticles);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ int32_t C4ParticleList::Remove(C4ParticleDef *pOfDef)
|
|||
{
|
||||
// sorry, life is over for you :P
|
||||
--pPrt->pDef->Count;
|
||||
pPrt->MoveList(*this, Game.Particles.FreeParticles);
|
||||
pPrt->MoveList(*this, ::Particles.FreeParticles);
|
||||
}
|
||||
}
|
||||
// done
|
||||
|
@ -446,7 +446,7 @@ C4Particle *C4ParticleSystem::Create(C4ParticleDef *pOfDef,
|
|||
// count particle
|
||||
++pOfDef->Count;
|
||||
// more to desired list
|
||||
pPrt->MoveList(Game.Particles.FreeParticles, *pPxList);
|
||||
pPrt->MoveList(::Particles.FreeParticles, *pPxList);
|
||||
// return newly created particle
|
||||
return pPrt;
|
||||
}
|
||||
|
@ -840,3 +840,5 @@ C4ParticleDrawProcRec C4ParticleDrawProcMap[] = {
|
|||
{ "Smoke", fxSmokeDraw },
|
||||
{ "Std", fxStdDraw },
|
||||
{ "", 0 } };
|
||||
|
||||
C4ParticleSystem Particles;
|
||||
|
|
|
@ -5137,10 +5137,10 @@ static bool FnCreateParticle(C4AulContext *cthr, C4String *szName, long iX, long
|
|||
iY+=cthr->Obj->GetY();
|
||||
}
|
||||
// get particle
|
||||
C4ParticleDef *pDef=Game.Particles.GetDef(FnStringPar(szName));
|
||||
C4ParticleDef *pDef=::Particles.GetDef(FnStringPar(szName));
|
||||
if (!pDef) return FALSE;
|
||||
// create
|
||||
Game.Particles.Create(pDef, (float) iX, (float) iY, (float) iXDir/10.0f, (float) iYDir/10.0f, (float) a/10.0f, b, pObj ? (fBack ? &pObj->BackParticles : &pObj->FrontParticles) : NULL, pObj);
|
||||
::Particles.Create(pDef, (float) iX, (float) iY, (float) iXDir/10.0f, (float) iYDir/10.0f, (float) a/10.0f, b, pObj ? (fBack ? &pObj->BackParticles : &pObj->FrontParticles) : NULL, pObj);
|
||||
// success, even if not created
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -5156,10 +5156,10 @@ static bool FnCastAParticles(C4AulContext *cthr, C4String *szName, long iAmount,
|
|||
iY+=cthr->Obj->GetY();
|
||||
}
|
||||
// get particle
|
||||
C4ParticleDef *pDef=Game.Particles.GetDef(FnStringPar(szName));
|
||||
C4ParticleDef *pDef=::Particles.GetDef(FnStringPar(szName));
|
||||
if (!pDef) return FALSE;
|
||||
// cast
|
||||
Game.Particles.Cast(pDef, iAmount, (float) iX, (float) iY, iLevel, (float) a0/10.0f, b0, (float) a1/10.0f, b1, pObj ? (fBack ? &pObj->BackParticles : &pObj->FrontParticles) : NULL, pObj);
|
||||
::Particles.Cast(pDef, iAmount, (float) iX, (float) iY, iLevel, (float) a0/10.0f, b0, (float) a1/10.0f, b1, pObj ? (fBack ? &pObj->BackParticles : &pObj->FrontParticles) : NULL, pObj);
|
||||
// success, even if not created
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -5180,11 +5180,11 @@ static bool FnPushParticles(C4AulContext *cthr, C4String *szName, long iAX, long
|
|||
C4ParticleDef *pDef=NULL;
|
||||
if (szName)
|
||||
{
|
||||
pDef=Game.Particles.GetDef(FnStringPar(szName));
|
||||
pDef=::Particles.GetDef(FnStringPar(szName));
|
||||
if (!pDef) return FALSE;
|
||||
}
|
||||
// push them
|
||||
Game.Particles.Push(pDef, (float) iAX/10.0f, (float)iAY/10.0f);
|
||||
::Particles.Push(pDef, (float) iAX/10.0f, (float)iAY/10.0f);
|
||||
// success
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -5195,7 +5195,7 @@ static bool FnClearParticles(C4AulContext *cthr, C4String *szName, C4Object *pOb
|
|||
C4ParticleDef *pDef=NULL;
|
||||
if (szName)
|
||||
{
|
||||
pDef=Game.Particles.GetDef(FnStringPar(szName));
|
||||
pDef=::Particles.GetDef(FnStringPar(szName));
|
||||
if (!pDef) return FALSE;
|
||||
}
|
||||
// delete them
|
||||
|
@ -5205,7 +5205,7 @@ static bool FnClearParticles(C4AulContext *cthr, C4String *szName, C4Object *pOb
|
|||
pObj->BackParticles.Remove(pDef);
|
||||
}
|
||||
else
|
||||
Game.Particles.GlobalParticles.Remove(pDef);
|
||||
::Particles.GlobalParticles.Remove(pDef);
|
||||
// success
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1086,7 +1086,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay)
|
|||
|
||||
// draw global particles
|
||||
C4ST_STARTNEW(PartStat, "C4Viewport::Draw: Particles")
|
||||
Game.Particles.GlobalParticles.Draw(cgo,NULL);
|
||||
::Particles.GlobalParticles.Draw(cgo,NULL);
|
||||
C4ST_STOP(PartStat)
|
||||
|
||||
// draw foreground objects
|
||||
|
|
Loading…
Reference in New Issue