From abcc6049b9bbcd6e18998cd37268c20caac7433d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Feb 2016 12:04:52 +0100 Subject: [PATCH] - made the z coordinate part of the CheckResults for the MultiBlock iterators and use these for all height checks in the iterator loops. This will later make it easier to support arbitrary portals with height displacements. --- src/basictypes.h | 6 ++++++ src/p_map.cpp | 8 ++++---- src/p_maputl.cpp | 10 +++++++++- src/p_maputl.h | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/basictypes.h b/src/basictypes.h index ea56e9093..3159de428 100644 --- a/src/basictypes.h +++ b/src/basictypes.h @@ -112,6 +112,12 @@ struct fixedvec3 return *this; } + operator fixedvec2() + { + fixedvec2 ret = { x, y }; + return ret; + } + }; inline fixedvec2 operator +(const fixedvec2 &v1, const fixedvec2 &v2) diff --git a/src/p_map.cpp b/src/p_map.cpp index 66c95d495..a7346fa17 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -462,8 +462,8 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra { if (!(th->flags3 & thing->flags3 & MF3_DONTOVERLAP)) { - if (z > th->Top() || // overhead - z + thing->height < th->Z()) // underneath + if (z > cres.position.z + th->height || // overhead + z + thing->height < cres.position.z) // underneath continue; } } @@ -557,9 +557,9 @@ void P_PlayerStartStomp(AActor *actor, bool mononly) if (th->player != NULL && mononly) continue; - if (actor->Z() > th->Top()) + if (actor->Z() > cres.position.z + th->height) continue; // overhead - if (actor->Top() < th->Z()) + if (actor->Top() < cres.position.z) continue; // underneath P_DamageMobj(th, actor, actor, TELEFRAG_DAMAGE, NAME_Telefrag); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 59a7b9b54..722d1a6dd 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -534,6 +534,12 @@ void AActor::SetOrigin (fixed_t ix, fixed_t iy, fixed_t iz, bool moving) P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS); } +//=========================================================================== +// +// FBlockNode - allows to link actors into multiple blocks in the blockmap +// +//=========================================================================== + FBlockNode *FBlockNode::FreeBlocks = NULL; FBlockNode *FBlockNode::Create (AActor *who, int x, int y, int group) @@ -789,7 +795,9 @@ bool FMultiBlockLinesIterator::Next(FMultiBlockLinesIterator::CheckResult *item) if (line != NULL) { item->line = line; - item->position = offset; + item->position.x = offset.x; + item->position.y = offset.y; + item->position.z = checkpoint.z; item->portalflags = portalflags; return true; } diff --git a/src/p_maputl.h b/src/p_maputl.h index 2aacf3dd1..11260bcbf 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -220,7 +220,7 @@ public: struct CheckResult { line_t *line; - fixedvec2 position; + fixedvec3 position; int portalflags; };