Physical: Walk speed and acceleration is now an Action property

Günther Brammer 2010-12-11 21:10:05 +01:00
parent 8b03b2c149
commit 07025c2613
19 changed files with 61 additions and 55 deletions

View File

@ -33,7 +33,6 @@ ClosedContainer=2
[Physical]
Energy=50000
Breath=50000
Walk=80000
Jump=35000
Dig=40000
Swim=60000

View File

@ -228,6 +228,9 @@ Walk = {
Prototype = Action,
Name = "Walk",
Procedure = DFA_WALK,
Accel = 16,
Decel = 22,
Speed = 224,
Directions = 2,
FlipDir = 1,
Length = 14,
@ -243,6 +246,9 @@ Run = {
Prototype = Action,
Name = "Run",
Procedure = DFA_WALK,
Accel = 16,
Decel = 22,
Speed = 224,
Directions = 2,
FlipDir = 1,
Length = 18,

View File

@ -29,7 +29,6 @@ Oversize=1
[Physical]
Energy=50000
Breath=100000
Walk=70000
Jump=40000
Dig=40000
Swim=60000

View File

@ -721,12 +721,12 @@ func UpdateBackwardsSpeed()
func FxIntWalkBackStart(pTarget, iNumber, fTmp, iValue)
{
if(iValue == nil) iValue = 30000;
pTarget->SetPhysical("Walk", iValue, PHYS_StackTemporary);
pTarget->PushActionSpeed("Walk", iValue);
}
func FxIntWalkBackStop(pTarget, iNumber)
{
pTarget->ResetPhysical("Walk");
pTarget->PopActionSpeed("Walk");
}
/* Walk */
@ -1801,6 +1801,9 @@ Walk = {
Prototype = Action,
Name = "Walk",
Procedure = DFA_WALK,
Accel = 16,
Decel = 22,
Speed = 196,
Directions = 2,
FlipDir = 0,
Length = 1,
@ -2014,6 +2017,7 @@ Push = {
Prototype = Action,
Name = "Push",
Procedure = DFA_PUSH,
Speed = 196,
Directions = 2,
Length = 8,
Delay = 15,

View File

@ -34,8 +34,6 @@ local pWire;
public func ControlUse(object clonk, int x, int y)
{
//if(clonk->GetAction() != "Walk") return true;
var pDyna = aDynamites[iCount-1] = CreateContents(Dynamite);
if(!pDyna->ControlUse(clonk, x, y, 1))
{

View File

@ -31,8 +31,8 @@ func Initialize()
AnimationShoot = nil,
ShootTime = 20,
TurnType = 1,
WalkSpeed = 30000,
WalkBack = 20000,
WalkSpeed = 84,
WalkBack = 56,
AimSpeed = 20, // the speed of aiming
};
OnRopeBreak();

View File

@ -35,8 +35,8 @@ func Initialize()
AnimationShoot = nil,
ShootTime = 20,
TurnType = 1,
WalkSpeed = 30000,
WalkBack = 20000,
WalkSpeed = 84,
WalkBack = 56,
AnimationReplacements = [
["Walk", "BowWalk"],
["Walk_Position", 20],
@ -196,13 +196,13 @@ private func ClonkAimLimit(object clonk, int angle)
func FxIntWalkSlowStart(pTarget, iNumber, fTmp, iValue)
{
if(iValue == nil || iValue == 0) iValue = 30000;
pTarget->SetPhysical("Walk", iValue, PHYS_StackTemporary);
if(iValue == nil || iValue == 0) iValue = 84;
pTarget->PushActionSpeed("Walk", iValue);
}
func FxIntWalkSlowStop(pTarget, iNumber)
{
pTarget->ResetPhysical("Walk");
pTarget->PopActionSpeed("Walk");
}
/* +++++++++++ Various callbacks +++++++++ */

View File

@ -36,8 +36,8 @@ func Initialize()
LoadTime = 100,
AnimationShoot = nil,
ShootTime = 20,
WalkSpeed = 30000,
WalkBack = 20000,
WalkSpeed = 84,
WalkBack = 56,
};
}

View File

@ -174,13 +174,13 @@ func HitByWeapon(by, iDamage)
func FxShieldStopControlStart(object target, int num, temp)
{
target->SetPhysical("Walk", 30000, PHYS_StackTemporary);
target->PushActionSpeed("Walk", 84);
if(temp) return;
}
func FxShieldStopControlStop(object target, int num, iCause, temp)
{
target->ResetPhysical("Walk");
target->PopActionSpeed("Walk");
if(temp) return;
}
@ -268,4 +268,4 @@ func Definition(def) {
def.Collectible = 1;
SetProperty("PictureTransformation",Trans_Mul(Trans_Translate(1000,-500),Trans_Rotate(20,1,1,-1),Trans_Scale(1200)),def);
}
}

View File

@ -217,13 +217,13 @@ func CheckStrike(iTime)
func FxSwordStrikeStopStart(pTarget, iEffectNumber, iTemp)
{
pTarget->SetPhysical("Walk", (pTarget->GetPhysical("Walk", 0) * 1)/100, PHYS_StackTemporary);
pTarget->PushActionSpeed("Walk", (pTarget.ActMap.Walk.Speed)/100);
if(iTemp) return;
}
func FxSwordStrikeStopStop(pTarget, iEffectNumber, iCause, iTemp)
{
pTarget->ResetPhysical("Walk");
pTarget->PopActionSpeed("Walk");
if(iTemp) return;
}
@ -234,12 +234,8 @@ func FxSwordStrikeStopTimer(pTarget, iEffectNumber)
func FxSwordStrikeSpeedUpStart(pTarget, iEffectNumber, iTemp)
{
pTarget->SetPhysical("Walk", pTarget->GetPhysical("Walk", 0) * 3, PHYS_StackTemporary);
if(iTemp) return;
var dir=-1;
if(pTarget->GetDir() == DIR_Right) dir=1;
pTarget->SetXDir(pTarget->GetPhysical("Walk")*dir, 100000);
pTarget->PushActionSpeed("Walk", pTarget.ActMap.Walk.Speed * 3);
pTarget.ActMap.Walk.Accel = 210;
}
func FxSwordStrikeSpeedUpTimer(pTarget, iEffectNumber, iEffectTime)
@ -251,8 +247,7 @@ func FxSwordStrikeSpeedUpTimer(pTarget, iEffectNumber, iEffectTime)
func FxSwordStrikeSpeedUpStop(pTarget, iEffectNumber, iCause, iTemp)
{
pTarget->ResetPhysical("Walk");
//pTarget->SetPhysical("Walk", pTarget->GetPhysical("Walk", 0) / 2, PHYS_Temporary);
pTarget->PopActionSpeed("Walk");
if(iTemp) return;
if(!pTarget->GetAlive()) return;
@ -262,7 +257,7 @@ func FxSwordStrikeSpeedUpStop(pTarget, iEffectNumber, iCause, iTemp)
func FxSwordStrikeSlowStart(pTarget, iEffectNumber, iTemp, iTime)
{
pTarget->SetPhysical("Walk", pTarget->GetPhysical("Walk", 0) / 3, PHYS_StackTemporary);
pTarget->PushActionSpeed("Walk", pTarget.ActMap.Walk.Speed / 3);
if(iTemp) return;
EffectVar(0, pTarget, iEffectNumber) = iTime;
}
@ -274,8 +269,7 @@ func FxSwordStrikeSlowTimer(pTarget, iEffectNumber, iEffectTime)
func FxSwordStrikeSlowStop(pTarget, iEffectNumber, iCause, iTemp)
{
pTarget->ResetPhysical("Walk");
//pTarget->SetPhysical("Walk", pTarget->GetPhysical("Walk", 0) * 2, PHYS_Temporary);
pTarget->PopActionSpeed("Walk");
}
func Definition(def) {

View File

@ -18,8 +18,8 @@
ShootTime = 20, // The duration of shooting
ShootTime2 = 5, // For a callback ShootTime2 frames after StartShoot: DuringShoot
TurnType = 1, // Specify a special turn type (0: turn 120 degrees, 1: turn 180 degrees, 2: turn 220 degrees) see SetTurnType in clonk
WalkSpeed = 30000, // Reduce the walk speed during aiming
WalkBack = 20000, // Reduce the walk speed for walking backwards (speed 0 means no walking backwards at all)
WalkSpeed = 84, // Reduce the walk speed during aiming
WalkBack = 56, // Reduce the walk speed for walking backwards (speed 0 means no walking backwards at all)
AimSpeed = 5, // the speed of aiming default 5° per frame
AnimationReplacements = [ // Replace some animations with others during load/aim/shoot
["Walk", "BowWalk"],
@ -438,10 +438,10 @@ public func ResetHands(bool pause)
func FxIntWalkSlowStart(pTarget, iNumber, fTmp, iValue)
{
if(iValue == nil) iValue = 30000;
pTarget->SetPhysical("Walk", iValue, PHYS_StackTemporary);
pTarget->PushActionSpeed("Walk", iValue);
}
func FxIntWalkSlowStop(pTarget, iNumber)
{
pTarget->ResetPhysical("Walk");
}
pTarget->PopActionSpeed("Walk");
}

View File

@ -33,7 +33,7 @@ const int CornerRange=AttachRange+2;
extern const C4Real FloatAccel;
extern const C4Real HitSpeed1,HitSpeed2,HitSpeed3,HitSpeed4;
extern const C4Real WalkAccel,WalkBreak,SwimAccel;
extern const C4Real SwimAccel;
extern const C4Real FloatFriction;
extern const C4Real RotateAccel;

View File

@ -170,7 +170,6 @@ struct C4PhysInfoNameMap_t { const char *szName; C4PhysicalInfo::Offset off; } C
{
{ "Energy", &C4PhysicalInfo::Energy },
{ "Breath", &C4PhysicalInfo::Breath },
{ "Walk", &C4PhysicalInfo::Walk },
{ "Jump", &C4PhysicalInfo::Jump },
{ "Dig", &C4PhysicalInfo::Dig },
{ "Swim", &C4PhysicalInfo::Swim },

View File

@ -40,7 +40,6 @@ public:
public:
int32_t Energy;
int32_t Breath;
int32_t Walk;
int32_t Jump;
int32_t Dig;
int32_t Swim;

View File

@ -37,8 +37,6 @@ const C4Real FixFullCircle=itofix(360),FixHalfCircle=FixFullCircle/2;
const C4Real FloatFriction=C4REAL100(2);
const C4Real RotateAccel=C4REAL100(20);
const C4Real FloatAccel=C4REAL100(16);
const C4Real WalkAccel=C4REAL100(16);
const C4Real WalkBreak=C4REAL100(22);
const C4Real SwimAccel=C4REAL100(7);
const C4Real HitSpeed1=C4REAL100(150); // Hit Event
const C4Real HitSpeed2=itofix(2); // Cross Check Hit

View File

@ -3906,7 +3906,6 @@ void C4Object::ExecAction()
// Determine ActDef & Physical Info
//C4PropList * pAction = Action.pActionDef;
C4PhysicalInfo *pPhysical=GetPhysical();
C4Real lLimit;
C4Real fWalk,fMove;
int32_t smpx,smpy;
@ -3952,7 +3951,9 @@ void C4Object::ExecAction()
// Handle Default Action Procedure: evaluates Procedure and Action.ComDir
// Update xdir,ydir,Action.Dir,attachment,iPhaseAdvance
int32_t dir = Action.Dir;
C4Real accel = WalkAccel;
C4Real accel = C4REAL100(pActionDef->GetPropertyInt(P_Accel));
C4Real decel = C4REAL100(pActionDef->GetPropertyInt(P_Decel));
C4Real lLimit = C4REAL100(pActionDef->GetPropertyInt(P_Speed));
C4Real xlFloatAccel;
C4Real xrFloatAccel;
@ -3965,23 +3966,27 @@ void C4Object::ExecAction()
{
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case DFA_WALK:
lLimit=ValByPhysical(280, pPhysical->Walk);
switch (Action.ComDir)
{
case COMD_Left: case COMD_UpLeft: case COMD_DownLeft:
// breaaak!!!
if (dir == DIR_Right) accel = WalkBreak;
xdir-=accel; if (xdir<-lLimit) xdir=-lLimit;
if (dir == DIR_Right)
xdir-=decel;
else
xdir-=accel;
if (xdir<-lLimit) xdir=-lLimit;
break;
case COMD_Right: case COMD_UpRight: case COMD_DownRight:
if (dir == DIR_Left) accel = WalkBreak;
xdir+=accel; if (xdir>+lLimit) xdir=+lLimit;
if (dir == DIR_Left)
xdir+=decel;
else
xdir+=accel;
if (xdir>+lLimit) xdir=+lLimit;
break;
case COMD_Stop: case COMD_Up: case COMD_Down:
if (xdir<0) xdir+=WalkBreak;
if (xdir>0) xdir-=WalkBreak;
if ((xdir>-WalkBreak) && (xdir<+WalkBreak)) xdir=0;
if (xdir<0) xdir+=decel;
if (xdir>0) xdir-=decel;
if ((xdir>-decel) && (xdir<+decel)) xdir=0;
break;
}
iPhaseAdvance=0;
@ -4244,7 +4249,6 @@ void C4Object::ExecAction()
// Target pushing force
bool fStraighten;
iTXDir=0; fStraighten=false;
lLimit=ValByPhysical(280, pPhysical->Walk);
switch (Action.ComDir)
{
case COMD_Left: case COMD_DownLeft: iTXDir=-lLimit; break;
@ -4314,7 +4318,7 @@ void C4Object::ExecAction()
if (Action.ComDir==COMD_Right) iPullX = GetX()-iPullDistance;
if (Action.ComDir==COMD_Left) iPullX = GetX()+iPullDistance;
fWalk = ValByPhysical(280, pPhysical->Walk);
fWalk = lLimit;
fMove = 0;
if (Action.ComDir==COMD_Right) fMove = +fWalk;

View File

@ -302,7 +302,7 @@ bool ObjectComJump(C4Object *cObj) // by ObjectComUp, ExecCMDFMoveTo, FnJump
// Calculate direction & forces
C4Real TXDir=Fix0;
C4PhysicalInfo *pPhysical=cObj->GetPhysical();
C4Real iPhysicalWalk = ValByPhysical(280, pPhysical->Walk) * itofix(cObj->GetCon(), FullCon);
C4Real iPhysicalWalk = itofix(0);//FIXME: ValByPhysical(280, pPhysical->Walk) * itofix(cObj->GetCon(), FullCon);
C4Real iPhysicalJump = ValByPhysical(1000, pPhysical->Jump) * itofix(cObj->GetCon(), FullCon);
if (cObj->Action.ComDir==COMD_Left || cObj->Action.ComDir==COMD_UpLeft) TXDir=-iPhysicalWalk;

View File

@ -89,6 +89,9 @@ C4StringTable::C4StringTable()
P[P_Collectible] = "Collectible";
P[P_ActMap] = "ActMap";
P[P_Procedure] = "Procedure";
P[P_Speed] = "Speed";
P[P_Accel] = "Accel";
P[P_Decel] = "Decel";
P[P_Attach] = "Attach";
P[P_Directions] = "Directions";
P[P_FlipDir] = "FlipDir";

View File

@ -184,6 +184,9 @@ enum C4PropertyName
P_PictureTransformation,
P_MeshTransformation,
P_Procedure,
P_Speed,
P_Accel,
P_Decel,
P_Directions,
P_FlipDir,
P_Length,