allow throw during jump/dive; add container speed for throw

stable-5.2
Sven Eberhardt 2010-01-04 00:36:55 +01:00
parent ff0c0a6c96
commit a00b741611
4 changed files with 9 additions and 10 deletions

View File

@ -28,6 +28,8 @@ func ControlUse(object clonk, int x, int y)
clonk->SetYDir(0);
last_x = BoundBy(x,-0,0)+GetX(); last_y = clonk->GetDefBottom()+3;
last_frame = begin_frame = FrameCounter();
return true;
}
func HoldingEnabled() { return true; }

View File

@ -713,13 +713,10 @@ private func DoThrow(object obj, int angle)
if (iYDir < 0) iYDir = iYDir * 13/10;
if (iYDir > 0) iYDir = iYDir * 8/10;
// is riding? add it's velocity
var proc = GetProcedure();
if (GetActionTarget() && (proc == "PUSH" || proc == "ATTACH"))
{
iXDir += GetActionTarget()->GetXDir() / 10;
iYDir += GetActionTarget()->GetYDir() / 10;
}
// add own velocity
iXDir += GetXDir(1000);
iYDir += GetYDir(1000)/2;
// throw
obj->Exit(iX, iY, iR, 0, 0, iRDir);
obj->SetXDir(iXDir,1000);
@ -738,7 +735,7 @@ public func ControlThrow(object target, int x, int y)
var throwAngle = Angle(0,0,x,y);
// walking (later with animation: flight, scale, hangle?)
if (GetProcedure() == "WALK")
if (GetProcedure() == "WALK" || GetAction() == "Jump" || GetAction() == "Dive")
{
if (throwAngle < 180) SetDir(DIR_Right);
else SetDir(DIR_Left);

View File

@ -4038,7 +4038,7 @@ void C4Object::ExecAction()
break;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case DFA_THROW:
ydir=0; xdir=0;
//ydir=0; xdir=0;
Action.t_attach|=CNAT_Bottom;
Mobile=1;
break;

View File

@ -145,7 +145,7 @@ bool ObjectActionThrow(C4Object *cObj, C4Object *pThing)
pThing->Exit(cObj->GetX(),
cObj->GetY()+cObj->Shape.y-1,
Random(360),
pthrow*iDir,-pthrow,pthrow*iDir);
pthrow*iDir+cObj->xdir,-pthrow+cObj->ydir,pthrow*iDir);
// Success
return true;
}