From 48d88810650de5c66a81a07353a2707bf4c3bb38 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Apr 2008 00:55:55 +0000 Subject: [PATCH] - Fixed: FBlockThingsIterator didn't set the current block coordinates if they were outside the blockmap. This could cause extreme delays if an iteration started outside the valid boundaries. - added nextmap and nextsecret CCMDs. SVN r924 (trunk) --- docs/rh-log.txt | 5 +++ src/c_cmds.cpp | 42 ++++++++++++++++++++++++ src/p_map.cpp | 83 ++++++++++++++++++++++++------------------------ src/p_maputl.cpp | 4 +-- src/version.h | 2 +- 5 files changed, 92 insertions(+), 44 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a2cb23cc3d..5198686835 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +April 18, 2008 (Changes by Graf Zahl) +- Fixed: FBlockThingsIterator didn't set the current block coordinates if + they were outside the blockmap. This could cause extreme delays if an + iteration started outside the valid boundaries. + April 17, 2008 - Fixed: The music stream needs to zero the FMOD_REVERB_CHANNELPROPERTIES before sending it to Channel::getReverbProperties(). diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 80510ed43f..1a739b38e5 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -841,3 +841,45 @@ CCMD(thaw) Net_WriteByte (DEM_GENERICCHEAT); Net_WriteByte (CHT_CLEARFROZENPROPS); } + +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- +CCMD(nextmap) +{ + char * next=NULL; + + if (*level.nextmap) next = level.nextmap; + + if (next != NULL && strncmp(next, "enDSeQ", 6)) + { + G_InitNew(next, false); + } + else + { + Printf("no next map!\n"); + } +} + +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- +CCMD(nextsecret) +{ + char * next=NULL; + + if (*level.secretmap) next = level.secretmap; + + if (next != NULL && strncmp(next, "enDSeQ", 6)) + { + G_InitNew(next, false); + } + else + { + Printf("no next secret map!\n"); + } +} diff --git a/src/p_map.cpp b/src/p_map.cpp index cbba7a5dc9..f1b18e2644 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1008,8 +1008,6 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm) tm.x = x; tm.y = y; - FBoundingBox box(x, y, thing->radius); - newsec = P_PointInSector (x,y); tm.ceilingline = thing->BlockingLine = NULL; @@ -1047,51 +1045,54 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm) } tm.stepthing = NULL; + FBoundingBox box(x, y, thing->radius); - FBlockThingsIterator it2(FBoundingBox(x, y, thing->radius)); - AActor *th; - while ((th = it2.Next())) { - if (!PIT_CheckThing(th, tm)) - { // [RH] If a thing can be stepped up on, we need to continue checking - // other things in the blocks and see if we hit something that is - // definitely blocking. Otherwise, we need to check the lines, or we - // could end up stuck inside a wall. - AActor *BlockingMobj = thing->BlockingMobj; + FBlockThingsIterator it2(box); + AActor *th; + while ((th = it2.Next())) + { + if (!PIT_CheckThing(th, tm)) + { // [RH] If a thing can be stepped up on, we need to continue checking + // other things in the blocks and see if we hit something that is + // definitely blocking. Otherwise, we need to check the lines, or we + // could end up stuck inside a wall. + AActor *BlockingMobj = thing->BlockingMobj; - if (BlockingMobj == NULL || (i_compatflags & COMPATF_NO_PASSMOBJ)) - { // Thing slammed into something; don't let it move now. - thing->height = realheight; - return false; - } - else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT|MF_MISSILE|MF_SKULLFLY)) && - BlockingMobj->z+BlockingMobj->height-thing->z <= thing->MaxStepHeight) - { - if (thingblocker == NULL || - BlockingMobj->z > thingblocker->z) - { - thingblocker = BlockingMobj; - } - thing->BlockingMobj = NULL; - } - else if (thing->player && - thing->z + thing->height - BlockingMobj->z <= thing->MaxStepHeight) - { - if (thingblocker) - { // There is something to step up on. Return this thing as - // the blocker so that we don't step up. + if (BlockingMobj == NULL || (i_compatflags & COMPATF_NO_PASSMOBJ)) + { // Thing slammed into something; don't let it move now. + thing->height = realheight; + return false; + } + else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT|MF_MISSILE|MF_SKULLFLY)) && + BlockingMobj->z+BlockingMobj->height-thing->z <= thing->MaxStepHeight) + { + if (thingblocker == NULL || + BlockingMobj->z > thingblocker->z) + { + thingblocker = BlockingMobj; + } + thing->BlockingMobj = NULL; + } + else if (thing->player && + thing->z + thing->height - BlockingMobj->z <= thing->MaxStepHeight) + { + if (thingblocker) + { // There is something to step up on. Return this thing as + // the blocker so that we don't step up. + thing->height = realheight; + return false; + } + // Nothing is blocking us, but this actor potentially could + // if there is something else to step on. + fakedblocker = BlockingMobj; + thing->BlockingMobj = NULL; + } + else + { // Definitely blocking thing->height = realheight; return false; } - // Nothing is blocking us, but this actor potentially could - // if there is something else to step on. - fakedblocker = BlockingMobj; - thing->BlockingMobj = NULL; - } - else - { // Definitely blocking - thing->height = realheight; - return false; } } } diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 87a151a949..48e40e6bbd 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -804,10 +804,10 @@ FBlockThingsIterator::~FBlockThingsIterator() void FBlockThingsIterator::StartBlock(int x, int y) { + curx = x; + cury = y; if (x >= 0 && y >= 0 && x < bmapwidth && y