Cleanup bubble script and create bubbles on splash again

Maikel de Vries 2010-10-25 19:14:30 +02:00
parent aa7069b47c
commit 98c0a1d81f
4 changed files with 41 additions and 44 deletions

View File

@ -1,5 +1,5 @@
[DefCore]
id=Bubble1
id=Fx_Bubble
Version=4,10,0,0
Category=C4D_Vehicle
Width=2

View File

@ -1,70 +1,67 @@
/*-- Bubble --*/
local time;
local alpha;
global func Bubble(int iamount, int x, int y)
global func Bubble(int amount, int x, int y)
{
if(iamount==nil || iamount==0) iamount=3;
if (amount==nil || amount==0)
amount=3;
var i = 0;
while(i<iamount)
{
CreateObject(Bubble1, x, y);
++i;
}
for (var i = 0; i < amount; i++)
CreateObject(Fx_Bubble, x, y, NO_OWNER);
return;
}
protected func Initialize()
{
alpha=255;
DoCon(RandomX(25,100));
AddEffect("Move",this,1,1,this);
DoCon(RandomX(25, 100));
AddEffect("Move", this, 100, 1, this);
return;
}
public func FxMoveTimer(pTarget, iEffectNumber, iEffectTime)
public func FxMoveTimer(object target, int num, int time)
{
if(GBackLiquid(0,-3)==false && !GetEffect("Fade",this) || iEffectTime > 108)
{
AddEffect("Fade",pTarget,1,1,pTarget);
}
if (!GBackLiquid(0, -3) && !GetEffect("Fade", this) || time > 108)
AddEffect("Fade", target, 100, 1, target);
//Bubbles burst into smaller bubles
if(Random(30)==1 && pTarget->GetCon()>100)
// Bubbles burst into smaller bubles
if (!Random(30) && target->GetCon() > 100)
{
var i=3;
while(i>0)
for (var i = 0; i < 3; i++)
{
i=--i;
var bubble=CreateObject(Bubble1);
bubble->SetCon(pTarget->GetCon()/15*10);
bubble->SetYDir(pTarget->GetYDir());
var bubble = CreateObject(Fx_Bubble);
bubble->SetCon(10 * target->GetCon() / 15);
bubble->SetYDir(target->GetYDir());
}
RemoveObject();
return -1;
}
// Jittery movement
SetYDir(GetYDir() - 2 + Random(5));
if (Inside(GetXDir(), -6, 6))
SetXDir(GetXDir() + 2 * Random(2) - 1);
//Jittery movement
var dir;
if(Random(2)==1) dir=-1;
else dir=1;
if(GetXDir()<6 && GetXDir()>-6)
{
SetXDir(GetXDir()+dir);
}
return 1;
}
public func FxFadeTimer(pTarget)
public func FxFadeStart(object target, int num, int temporary)
{
if(alpha<=0)
// Store alpha here
if (temporary == 0)
EffectVar(0, target, num) = 255;
return 1;
}
public func FxFadeTimer(object target, int num)
{
var alpha = EffectVar(0, target, num);
if (alpha <= 0)
{
RemoveEffect("Move",this);
RemoveEffect("Move", this);
RemoveObject();
return -1;
}
SetClrModulation(RGBa(255,255,255,alpha));
alpha=alpha-5;
SetClrModulation(RGBa(255, 255, 255, alpha));
EffectVar(0, target, num) = alpha - 5;
return 1;
}

View File

@ -75,7 +75,7 @@ global func ExplosionEffect(int level, int x, int y)
// Blast particle.
CreateParticle("Blast", x, y, 0, 0, level * 10, RGBa(255, 255, 255, 100));
if(!GBackLiquid(x,y)) CastParticles("Spark", 10, 80 + level, x, y, 35, 40, RGB(255, 200, 0), RGB(255, 255, 150));
if(GBackLiquid(x,y)) CastObjects(Bubble1, level * 7 / 10, level, x, y);
if(GBackLiquid(x,y)) CastObjects(Fx_Bubble, level * 7 / 10, level, x, y);
//CastParticles("FSpark", level/5+1, level, x,y, level*5+10,level*10+10, 0x00ef0000,0xffff1010));
// Smoke trails.

View File

@ -831,9 +831,9 @@ void BubbleOut(int32_t tx, int32_t ty)
// User-defined smoke level
int32_t SmokeLevel = GetSmokeLevel();
// Enough bubbles out there already
if (::Objects.ObjectCount(C4ID("FXU1")) >= SmokeLevel) return;
if (::Objects.ObjectCount(C4ID("Fx_Bubble")) >= SmokeLevel) return;
// Create bubble
Game.CreateObject(C4ID("FXU1"),NULL,NO_OWNER,tx,ty);
Game.CreateObject(C4ID("Fx_Bubble"),NULL,NO_OWNER,tx,ty);
}
void Smoke(int32_t tx, int32_t ty, int32_t level, DWORD dwClr)