Actions default to COMD_Stop, Decel for float and swim procedures

With this change everything should behave as normal, still not a fan of these numerous float hacks.
Maikel de Vries 2011-07-06 19:11:12 +02:00
parent d550f7c7da
commit e2db1bc85a
21 changed files with 63 additions and 20 deletions

View File

@ -10,6 +10,7 @@ protected func Initialize()
ry=40;
rx=0;
SetAction("Moving");
SetComDir(COMD_None);
SetPosition(ox,oy);
size=4;
AddEffect("MovingAround",this,100,1,this,this->GetID());

View File

@ -10,6 +10,7 @@ protected func Initialize()
ry=40;
rx=0;
SetAction("Moving");
SetComDir(COMD_None);
SetPosition(ox,oy);
size=4;
AddEffect("MovingAround",this,100,1,this,this->GetID());

View File

@ -10,6 +10,7 @@ protected func Initialize()
ry=40;
rx=0;
SetAction("Moving");
SetComDir(COMD_None);
SetPosition(ox,oy);
size=4;
AddEffect("MovingAround",this,100,1,this,this->GetID());

View File

@ -11,6 +11,7 @@ protected func Initialize()
{
ysin = 0;
SetAction("Float");
SetComDir(COMD_None);
AddEffect("Float",this,1,1,this);
}

View File

@ -47,7 +47,10 @@ protected func FxFlightTimer(object pTarget, effect, int iEffectTime)
}
if(GetAction() != "Fly")
{
SetAction("Fly");
SetComDir(COMD_None);
}
fuel--;
}

View File

@ -44,7 +44,10 @@ protected func FxFlightTimer(object pTarget, effect, int iEffectTime)
}
if(GetAction() != "Fly")
{
SetAction("Fly");
SetComDir(COMD_None);
}
fuel--;
}
@ -90,6 +93,7 @@ func Launch(int angle)
SetProperty("Collectible",0);
SetCategory(C4D_Vehicle);
SetAction("Fly");
SetComDir(COMD_None);
Exit();
AddEffect("Flight",this,150,1,this,this);

View File

@ -19,6 +19,7 @@ protected func Initialize()
rotanim = PlayAnimation("Rotate", 5, Anim_Const(1), Anim_Const(1000));
AddEffect("ButterflyTurn", this, 1, 1, this);
SetAction("Fly");
SetComDir(COMD_None);
MoveToTarget();
return 1;
}
@ -53,13 +54,21 @@ func TurnButterfly()
private func FlyingStart()
{
TurnButterfly();
if (!Random(3)) SetAction("Flutter");
if (!Random(3))
{
SetAction("Flutter");
SetComDir(COMD_None);
}
return 1;
}
private func Fluttering()
{
if (!Random(7)) SetAction("Fly");
if (!Random(7))
{
SetAction("Fly");
SetComDir(COMD_None);
}
return 1;
}
@ -112,6 +121,7 @@ Fly = {
Procedure = DFA_FLOAT,
Speed = 200,
Accel = 16,
Decel = 16,
Directions = 2,
FlipDir = 1,
Length = 1,
@ -129,6 +139,7 @@ Flutter = {
Procedure = DFA_FLOAT,
Speed = 200,
Accel = 16,
Decel = 16,
Directions = 2,
FlipDir = 1,
Length = 11,

View File

@ -2155,6 +2155,7 @@ Swim = {
Procedure = DFA_SWIM,
Speed = 96,
Accel = 7,
Decel = 9,
Directions = 2,
Length = 1,
Delay = 0,

View File

@ -3,6 +3,7 @@
func Initialize()
{
SetAction("Fly");
SetComDir(COMD_None);
}
func Show(int clr, int layer, int size,bool diffuse)
@ -45,6 +46,7 @@ Fly = {
Procedure = DFA_FLOAT,
Speed = 1000,
Accel = 16,
Decel = 16,
NextAction = "Hold"
},
};

View File

@ -20,6 +20,7 @@ protected func Initialize()
DoCon(Random(75));
SetAction("Fly");
SetComDir(COMD_None);
SetPhase(RandomX(1,16));
//Push low flying clouds up to proper height
@ -159,6 +160,7 @@ Fly = {
Procedure = DFA_FLOAT,
Speed = 20,
Accel = 16,
Decel = 16,
X = 0,
Y = 0,
Wdt = 512,

View File

@ -66,6 +66,7 @@ func Update()
public func Initialize()
{
SetAction("Float");
SetComDir(COMD_None);
SetSpeed(0, -20);
alpha=255;
return true;

View File

@ -9,6 +9,7 @@ protected func Initialize()
idir = 0;
dir = 0;
SetAction("Inflate");
SetComDir(COMD_None);
AddEffect("Float",this,1,1,this);
//Special Effects
@ -22,7 +23,11 @@ protected func Initialize()
private func Deflate()
{
if(GetAction() != "Deflate") SetAction("Deflate");
if(GetAction() != "Deflate")
{
SetAction("Deflate");
SetComDir(COMD_None);
}
Schedule("Pack()",20); //EndCall doesn't work. >:(
}

View File

@ -121,6 +121,7 @@ Travel = {
Procedure = DFA_FLOAT,
Speed = 100000,
Accel = 16,
Decel = 16,
NextAction = "Travel",
Length = 1,
Delay = 1,

View File

@ -23,6 +23,7 @@ public func Initialize()
color = GetPlayerColor(GetOwner());
SetClrModulation(color|RGBa(0,0,0,fade));
SetAction("Fly");
SetComDir(COMD_None);
return true;
}

View File

@ -32,6 +32,7 @@ public func EngageRail(object pRailpoint)
SetSpeed(0,0);
SetR(0);
SetAction("OnRail");
SetComDir(COMD_None);
pRailTarget = pRailpoint;
rail_direction = 0;
}

View File

@ -3,6 +3,7 @@
protected func Initialize()
{
SetAction("Door");
SetComDir(COMD_None);
return;
}

View File

@ -29,6 +29,7 @@ local turnanim;
protected func Initialize()
{
SetAction("Fly");
SetComDir(COMD_None);
throttle = 0;
xtarget = 0;
ytarget = 0;

View File

@ -8,6 +8,7 @@ protected func Initialize()
{
SetRDir(-2+Random(4));
SetAction("Fall");
SetComDir(COMD_None);
AddEffect("Fade",this,1,1,this);
}

View File

@ -10,6 +10,7 @@ protected func Initialize()
{
ysin = 0;
SetAction("Float");
SetComDir(COMD_None);
AddEffect("Float",this,1,1,this);
}

View File

@ -37,7 +37,7 @@ void C4Action::Default()
//pActionDef = 0;
Dir=DIR_None;
DrawDir=Dir;
ComDir=COMD_None;
ComDir=COMD_Stop;
Time=0;
Data=0;
Target=Target2=NULL;
@ -53,7 +53,7 @@ void C4Action::CompileFunc(StdCompiler *pComp)
// Note: Compiled directly into "Object"-categories, so beware of name clashes (see C4Object::CompileFunc)
// FIXME pComp->Value(mkNamingAdapt( toC4CStr(Name), "Action", "" ));
pComp->Value(mkNamingAdapt( Dir, "Dir", DIR_None ));
pComp->Value(mkNamingAdapt( ComDir, "ComDir", COMD_None ));
pComp->Value(mkNamingAdapt( ComDir, "ComDir", COMD_Stop ));
pComp->Value(mkNamingAdapt( Time, "ActionTime", 0 ));
pComp->Value(mkNamingAdapt( Data, "ActionData", 0 ));
pComp->Value(mkNamingAdapt( Phase, "Phase", 0 ));

View File

@ -3680,12 +3680,12 @@ void C4Object::ExecAction()
case COMD_Left: xdir-=accel; break;
case COMD_UpLeft: ydir-=accel; xdir-=accel; break;
case COMD_Stop:
if (xdir<0) xdir+=accel;
if (xdir>0) xdir-=accel;
if ((xdir>-accel) && (xdir<+accel)) xdir=0;
if (ydir<0) ydir+=accel;
if (ydir>0) ydir-=accel;
if ((ydir>-accel) && (ydir<+accel)) ydir=0;
if (xdir<0) xdir+=decel;
if (xdir>0) xdir-=decel;
if ((xdir>-decel) && (xdir<+decel)) xdir=0;
if (ydir<0) ydir+=decel;
if (ydir>0) ydir-=decel;
if ((ydir>-decel) && (ydir<+decel)) ydir=0;
break;
}
@ -3698,9 +3698,12 @@ void C4Object::ExecAction()
else { ObjectActionWalk(this); return; }
}
// xdir/ydir bounds
if (ydir<-limit) ydir=-limit; if (ydir>+limit) ydir=+limit;
if (xdir>+limit) xdir=+limit; if (xdir<-limit) xdir=-limit;
// xdir/ydir bounds, don't apply if COMD_None
if (Action.ComDir != COMD_None)
{
if (ydir<-limit) ydir=-limit; if (ydir>+limit) ydir=+limit;
if (xdir>+limit) xdir=+limit; if (xdir<-limit) xdir=-limit;
}
// Surface dir bound
if (!GBackLiquid(GetX(),GetY()-1+Def->Float*Con/FullCon-1)) if (ydir<0) ydir=0;
// Dir, Phase, Attach
@ -3902,12 +3905,12 @@ void C4Object::ExecAction()
case COMD_Left: xdir-=accel; break;
case COMD_UpLeft: ydir-=accel; xdir-=accel; break;
case COMD_Stop:
if (xdir<0) xdir+=accel;
if (xdir>0) xdir-=accel;
if ((xdir>-accel) && (xdir<+accel)) xdir=0;
if (ydir<0) ydir+=accel;
if (ydir>0) ydir-=accel;
if ((ydir>-accel) && (ydir<+accel)) ydir=0;
if (xdir<0) xdir+=decel;
if (xdir>0) xdir-=decel;
if ((xdir>-decel) && (xdir<+decel)) xdir=0;
if (ydir<0) ydir+=decel;
if (ydir>0) ydir-=decel;
if ((ydir>-decel) && (ydir<+decel)) ydir=0;
break;
}
// xdir/ydir bounds, don't apply if COMD_None