OpenClonk
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

◆ AdjustMoveToTarget()

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

Definition at line 142 of file C4Command.cpp.

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

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

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

Here is the call graph for this function:
Here is the caller graph for this function: