Fix C4Command::Jump, i.e. jumping as part of pathfinder.

stable-5.3
Sven Eberhardt 2012-12-09 18:42:52 +01:00 committed by Nicolas Hake
parent 486d6a33be
commit 0b6126c384
5 changed files with 14 additions and 2 deletions

View File

@ -2983,6 +2983,14 @@ bool C4Object::SetActionByName(C4String *ActName,
return SetAction(Action.getPropList(),pTarget,pTarget2,iCalls,fForce);
}
C4PropList *C4Object::GetActionByName(C4PropertyName &act_name, C4Value *rval_holder)
{
C4Value ActMap; GetProperty(P_ActMap, &ActMap);
if (!ActMap.getPropList()) return false;
ActMap.getPropList()->GetProperty(act_name, rval_holder);
return rval_holder->getPropList();
}
bool C4Object::SetActionByName(const char * szActName,
C4Object *pTarget, C4Object *pTarget2,
int32_t iCalls, bool fForce)

View File

@ -281,6 +281,7 @@ public:
C4PropList* GetAction() const;
bool SetAction(C4PropList * Act, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
bool SetActionByName(C4String * ActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
C4PropList *GetActionByName(C4PropertyName &act_name, C4Value *rval_holder);
bool SetActionByName(const char * szActName, C4Object *pTarget=NULL, C4Object *pTarget2=NULL, int32_t iCalls = SAC_StartCall | SAC_AbortCall, bool fForce = false);
void SetDir(int32_t tdir);
void SetCategory(int32_t Category) { this->Category = Category; Resort(); SetOCF(); }

View File

@ -255,8 +255,9 @@ bool ObjectComJump(C4Object *cObj) // by ObjectComUp, ExecCMDFMoveTo, FnJump
if (cObj->GetProcedure()!=DFA_WALK) return false;
// Calculate direction & forces
C4Real TXDir=Fix0;
C4Real iPhysicalWalk = itofix(0);//FIXME: ValByPhysical(280, pPhysical->Walk) * itofix(cObj->GetCon(), FullCon);
C4Real iPhysicalJump = itofix(0);//FIXME: ValByPhysical(1000, pPhysical->Jump) * itofix(cObj->GetCon(), FullCon);
C4PropList *pActionWalk = cObj->GetAction();
C4Real iPhysicalWalk = C4REAL100(pActionWalk->GetPropertyInt(P_Speed)) * itofix(cObj->GetCon(), FullCon);
C4Real iPhysicalJump = C4REAL100(cObj->GetPropertyInt(P_JumpSpeed)) * itofix(cObj->GetCon(), FullCon);
if (cObj->Action.ComDir==COMD_Left || cObj->Action.ComDir==COMD_UpLeft) TXDir=-iPhysicalWalk;
else if (cObj->Action.ComDir==COMD_Right || cObj->Action.ComDir==COMD_UpRight) TXDir=+iPhysicalWalk;

View File

@ -149,6 +149,7 @@ C4StringTable::C4StringTable()
P[P_BlastIncinerate] = "BlastIncinerate";
P[P_ContactIncinerate] = "ContactIncinerate";
P[P_Global] = "Global";
P[P_JumpSpeed] = "JumpSpeed";
P[DFA_WALK] = "WALK";
P[DFA_FLIGHT] = "FLIGHT";
P[DFA_KNEEL] = "KNEEL";

View File

@ -341,6 +341,7 @@ enum C4PropertyName
P_BlastIncinerate,
P_ContactIncinerate,
P_Global,
P_JumpSpeed,
// Default Action Procedures
DFA_WALK,
DFA_FLIGHT,