47 static void DoGravity(
C4Object *cobj)
79 for (int32_t cnt=0; cnt+2+fAlternate<rShape.
VtxNum; cnt++)
81 rShape.
VtxX[cnt+2+fAlternate],rShape.
VtxY[cnt+2+fAlternate]))
98 if (val==target)
return;
99 if (
Abs(val-target)<=step) { val=target;
return; }
100 if (val<target) val+=step;
else val-=step;
184 if (Act != LastAction)
202 if (Act != LastAction)
235 if (Act != LastAction)
250 if (
Def != pOldDef || !
Status)
return true;
260 if (pLastTarget && !pLastTarget->
Status) pLastTarget =
nullptr;
261 if (pLastTarget2 && !pLastTarget2->
Status) pLastTarget2 =
nullptr;
264 if (
Def != pOldDef || !
Status)
return true;
276 if (
Def != pOldDef || !
Status)
return true;
282 if (
Def != pOldDef || !
Status)
return true;
308 int32_t iCalls,
bool fForce)
313 return SetAction(
nullptr,
nullptr,
nullptr,iCalls,fForce);
317 if (!
Action.getPropList())
return false;
323 int32_t iCalls,
bool fForce)
336 if (!pActionDef)
return;
355 if (!pActionDef)
return false;
365 if (!pActionDef)
return -1;
410 if (!pActionDef)
return;
419 if (
ydir < 0)
return;
624 int32_t iPushRange,iPushDistance;
627 int32_t iPhaseAdvance=1;
643 pActionDef =
nullptr;
658 if (
Mobile) DoGravity(
this);
865 int32_t smpx =
GetX(), smpy =
GetY();
866 bool fAttachOK =
false;
923 iPhaseAdvance=
fixtoi(limit*10);
939 iTXDir=0; fStraighten=
false;
943 case COMD_UpLeft: fStraighten=
true; iTXDir=-limit;
break;
945 case COMD_UpRight: fStraighten=
true; iTXDir=+limit;
break;
946 case COMD_Up: fStraighten=
true;
break;
955 iPushDistance = std::max(
Shape.
Wdt/2-8,0);
956 iPushRange = iPushDistance + 10;
957 int32_t sax,say,sawdt,sahgt;
960 if (!
Inside(
GetX()-sax,-iPushRange,sawdt-1+iPushRange)
961 || !
Inside(
GetY()-say,-iPushRange,sahgt-1+iPushRange))
973 if (
GetY()-iPushDistance > say+sahgt && iTXDir) {
if (iTXDir>0) sax+=sawdt/2; sawdt/=2; }
975 iTargetX=
Clamp(
GetX(),sax-iPushDistance,sax+sawdt-1+iPushDistance);
976 if (
GetX()==iTargetX)
984 else if (
GetX()>iTargetX)
1004 int32_t iPullDistance;
1023 iTXDir = fMove + fWalk * Clamp<int32_t>(iPullX-
Action.
Target->
GetX(),-10,+10) / 10;
1041 iPushDistance = std::max(
Shape.
Wdt/2-8,0);
1042 iPushRange = iPushDistance + 20;
1045 if (!
Inside(
GetX()-sax,-iPushRange,sawdt-1+iPushRange)
1046 || !
Inside(
GetY()-say,-iPushRange,sahgt-1+iPushRange))
1061 xdir = fMove + fWalk * Clamp<int32_t>(iTargetX-
GetX(),-10,+10) / 10;
1077 lftspeed=
itofix(2); tydir=0;
1080 case COMD_Up: tydir=-lftspeed;
break;
1197 bool fLineChange =
false;
1213 lineAttach = lineAttachV.
getArray();
1214 int32_t iConnectX1, iConnectY1;
1238 lineAttach = lineAttachV.
getArray();
1239 int32_t iConnectX2, iConnectY2;
const uint32_t OCF_HitSpeed4
const uint32_t OCF_HitSpeed3
const uint32_t OCF_FullCon
const int32_t C4D_StaticBack
#define PSF_OnActionChanged
#define PSF_AttachTargetLost
bool PathFree(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
bool GBackLiquid(int32_t x, int32_t y)
bool GBackSemiSolid(int32_t x, int32_t y)
void GrabLost(C4Object *cObj, C4Object *prev_target)
void Towards(C4Real &val, C4Real target, C4Real step)
bool ReduceLineSegments(C4Shape &rShape, bool fAlternate)
void StopActionDelayCommand(C4Object *cobj)
void ObjectComStopDig(C4Object *cObj)
bool ObjectActionScale(C4Object *cObj, int32_t dir)
bool ObjectActionWalk(C4Object *cObj)
bool ObjectActionFlat(C4Object *cObj, int32_t dir)
bool ObjectActionJump(C4Object *cObj, C4Real xdir, C4Real ydir, bool fByCom)
bool ObjectActionHangle(C4Object *cObj)
bool ObjectActionKneel(C4Object *cObj)
bool ObjectActionTumble(C4Object *cObj, int32_t dir, C4Real xdir, C4Real ydir)
bool ComDirLike(int32_t iComDir, int32_t iSample)
bool ObjectComStop(C4Object *cObj)
bool ObjectActionStand(C4Object *cObj)
bool ObjectActionCornerScale(C4Object *cObj)
const C4Real FloatFriction
C4Fixed itofix(int32_t x)
int fixtoi(const C4Fixed &x)
void StopSoundEffect(const char *szSndName, C4Object *pObj)
C4SoundInstance * StartSoundEffect(const char *szSndName, bool fLoop, int32_t iVolume, C4Object *pObj, int32_t iCustomFalloffDistance, int32_t iPitch, C4SoundModifier *modifier)
C4Value C4VPropList(C4PropList *p)
T Clamp(T bval, T lbound, T rbound)
bool Inside(T ival, U lbound, V rbound)
StdMeshInstanceAnimationNode * Animation
int32_t IncompleteActivity
void Set(C4Surface &rSfc)
void UpdateSolidMask(bool fRestoreAttachedObjects)
bool Enter(C4Object *pTarget, bool fCalls=true, bool fCopyMotion=true, bool *pfRejectCollect=nullptr)
void ClearCommand(C4Command *pUntil)
BYTE GetArea(int32_t &aX, int32_t &aY, int32_t &aWdt, int32_t &aHgt) const
C4PropList * GetAction() const
bool AddCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, int32_t iUpdateInterval=0, C4Object *pTarget2=nullptr, bool fInitEvaluation=true, C4Value iData=C4VNull, bool fAppend=false, int32_t iRetries=0, C4String *szText=nullptr, int32_t iBaseMode=0)
void UpdateFace(bool bUpdateShape, bool fTemp=false)
void SetCommand(int32_t iCommand, C4Object *pTarget, C4Value iTx, int32_t iTy=0, C4Object *pTarget2=nullptr, bool fControl=false, C4Value iData=C4VNull, int32_t iRetries=0, C4String *szText=nullptr)
bool AdjustWalkRotation(int32_t iRangeX, int32_t iRangeY, int32_t iSpeed)
bool SetActionByName(C4String *ActName, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls=SAC_StartCall|SAC_AbortCall, bool fForce=false)
int32_t GetProcedure() const
C4DrawTransform * pDrawTransform
void SetDir(int32_t tdir)
bool Push(C4Real txdir, C4Real dforce, bool fStraighten)
void ForcePosition(C4Real target_x, C4Real target_y)
StdMeshInstance * pMeshInstance
bool Lift(C4Real tydir, C4Real dforce)
int32_t LastEnergyLossCausePlayer
void AssignRemoval(bool exit_contents=false)
void MovePosition(int32_t dx, int32_t dy)
bool Exit(int32_t iX=0, int32_t iY=0, int32_t iR=0, C4Real iXDir=Fix0, C4Real iYDir=Fix0, C4Real iRDir=Fix0, bool fCalls=true)
void UpdateShape(bool bUpdateVertices=true)
bool SetPhase(int32_t iPhase)
bool SetAction(C4PropList *Act, C4Object *pTarget=nullptr, C4Object *pTarget2=nullptr, int32_t iCalls=SAC_StartCall|SAC_AbortCall, bool fForce=false)
C4DefGraphics * GetGraphics() const
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
virtual const char * GetName() const
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
C4PropertyName GetPropertyP(C4PropertyName k) const
C4String * GetPropertyStr(C4PropertyName k) const
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
bool GetProperty(C4PropertyName k, C4Value *pResult) const
void SetProperty(C4PropertyName k, const C4Value &to)
bool RemoveVertex(int32_t iPos)
bool CheckScaleToWalk(int x, int y)
int32_t VtxY[C4D_MaxVertex]
bool Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
int32_t VtxX[C4D_MaxVertex]
bool LineConnect(int32_t tx, int32_t ty, int32_t cvtx, int32_t ld, int32_t oldx, int32_t oldy)
StdStrBuf GetData() const
const char * GetCStr() const
C4String * RegString(StdStrBuf String)
const C4Value & GetItem(int32_t iElem) const
C4ValueArray * getArray() const
C4PropList * getPropList() const
AnimationNode * PlayAnimation(const StdStrBuf &animation_name, int slot, AnimationNode *sibling, ValueProvider *position, ValueProvider *weight, bool stop_previous_animation)
void StopAnimation(AnimationNode *node)