OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4TransferZone.cpp File Reference
Include dependency graph for C4TransferZone.cpp:

Go to the source code of this file.

Functions

void AdjustMoveToTarget (int32_t &rX, int32_t &rY, bool fFreeMove, int32_t iShapeHgt)
 

Function Documentation

void AdjustMoveToTarget ( int32_t &  rX,
int32_t &  rY,
bool  fFreeMove,
int32_t  iShapeHgt 
)

Definition at line 144 of file C4Command.cpp.

References GBackSemiSolid(), GBackSolid(), C4Landscape::GetHeight(), and Landscape.

Referenced by C4TransferZone::GetEntryPoint(), C4Command::InitEvaluation(), and C4Command::JumpControl().

145 {
146  // Above solid (always)
147  int32_t iY=std::min(rY, ::Landscape.GetHeight());
148  while ((iY>=0) && GBackSolid(rX,iY)) iY--;
149  if (iY>=0) rY=iY;
150  // No-free-move adjustments (i.e. if walking)
151  if (!fFreeMove)
152  {
153  // Drop down to bottom of free space
154  if (!GBackSemiSolid(rX,rY))
155  {
156  for (iY=rY; (iY<::Landscape.GetHeight()) && !GBackSemiSolid(rX,iY+1); iY++) {}
157  if (iY<::Landscape.GetHeight()) rY=iY;
158  }
159  // Vertical shape offset above solid
160  if (GBackSolid(rX,rY+1) || GBackSolid(rX,rY+5))
161  if (!GBackSemiSolid(rX,rY-iShapeHgt/2))
162  rY-=iShapeHgt/2;
163  }
164 
165 }
C4Landscape Landscape
int32_t GetHeight() const
bool GBackSemiSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:237
bool GBackSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:232

Here is the call graph for this function:

Here is the caller graph for this function: