CheckMove
Jump to navigation
Jump to search
Note: This feature is for ZScript only. |
bool CheckMove(Vector2 newpos, int flags, FCheckPosition tm)
Usage
Checks to see if the caller can successfully move to newpos in the map. Unlike TryMove, this function will not actually move the caller if the check passes.
Parameters
- Vector2 newpos
- The xy location to check. Note that this is absolute and not relative to the caller.
- int flags
- Default is 0. Multiple flags can be combined with
|
. The following flags are avaialble:- PCM_DROPOFF — Don't allow moves where the drop off exceeds the caller's MaxDropOffHeight. Actors with FLOAT or DROPOFF will ignore this.
- PCM_NOACTORS — Ignore any actors that may be blocking the move
- PCM_NOLINES — Ignore any lines that may be blocking the move
- FCheckPositon tm
- Default is null. A FCheckPosition struct that will be filled with the relevant information.
Return value
Returns true if the caller could successfully move to newpos.
The function also fills the values of the FCheckPosition struct, which has the following fields:
- Actor thing
- Pointer to the actor whose position is stored in this struct.
- Vector3 pos
- Absolute coordinates of the actor whose position is stored in this struct.
- Sector cursector
- Pointer to the sector at the current position.
- double floorz
- Absolute highest floor height at
pos
. If the caller is stepping on top of another actor then this is the top of that actor.
- double ceilingz
- Absolute lowest ceiling height at
pos
.
- double dropoffz
- Absolute highest floor height at
pos
.
- TextureID floorpic
- A TextureID of the cursector's floor texture.
- int floorterrain
- Terrain data of cursector's floor.
- Sector floorsector
- Pointer to the lowest sector at
pos
, if portals are involved. Otherwise, same ascursector
.
- TextureID ceilingpic
- A TextureID of the cursector's ceiling texture.
- Sector ceilingsector
- Pointer to the highest sector at
pos
, if portals are involved. Otherwise, same ascursector
.
- bool touchmidtex
- True if actor at
pos
is touching a 3D middle texture.
- bool abovemidtex
- True if actor at
pos
is above a 3D middle texture.
- bool floatok
- If true, the caller can freely move up and down if it floats. This is used to signal the position wasn't fully blocked by a line or actor in TryMove.
- bool FromPMove
- This is true if this struct was instantiated by
P_Move()
. If true, handles non-players overlapping inside of each other by trying to unstick them if possible.
- line ceilingline
- The line the actor collided with if it hit an upper line part. This is set in case a lower line part also blocks, allowing both the floor and ceiling lines to be checked.
- Actor stepthing
- Another actor the
thing
stepped up on, if any.
- bool DoRipping
- If true, the caller is treated like a ripping projectile.
- bool portalstep
- True if the line edge at
pos
goes through a ceiling portal by going up a step.
- int portalgroup
- The index of the portal group the move goes to if
portalstep
is true.
- int PushTime
- Sets any pushed actor's
lastPush
field to this value. Used to track which actors were already pushed that move step.
See the FCheckPosition struct page for all details.
Examples
![]() |
Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated. |