diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c1ad26588..34d5eea63 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,14 @@ +December 9, 2006 (Changes by Graf Zahl) +- Fixed: P_LookForTid should abort its search when it discovers that it has + cycled through the entire list of actors. +- Reverted AActor::FindState to its R407 version because the change in R408 + doesn't compile properly with VC++. +- Changed FIXMAPTHINGPOS further so that it also affects objects that are + not directly on a wall but closer than its radius. +- Changed FIXEDMAPTHINGPOS to move objects completely out of the wall and + adjusted the radii of all affected objects to actually represent half + the sprite's width. + December 8, 2006 (Changes by Graf Zahl) - Fixed: The Acolyte's obituary wasn't printed. - Fixed: The fighter player's attack state used the Cleric's sprite. diff --git a/src/actor.h b/src/actor.h index 5dd44c914..137804052 100644 --- a/src/actor.h +++ b/src/actor.h @@ -749,7 +749,7 @@ public: bool UpdateWaterLevel (fixed_t oldz); FState *FindState (FName label) const; - FState *FindState (int numnames, ...) const; + FState *FindState (int numnames, int first, ...) const; FState *FindState (int numnames, va_list arglist) const; bool HasSpecialDeathStates () const; diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 309013f64..f0379c420 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -578,6 +578,7 @@ IMPLEMENT_ACTOR (AKlaxonWarningLight, Strife, 24, 0) PROP_SpawnState (0) PROP_SeeState (1) PROP_ReactionTime (60) + PROP_RadiusFixed(5) PROP_Flags (MF_NOBLOCKMAP|MF_AMBUSH|MF_SPAWNCEILING|MF_NOGRAVITY) PROP_Flags4 (MF4_FIXMAPTHINGPOS|MF4_NOSPLASHALERT|MF4_SYNCHRONIZED) PROP_StrifeType (121) diff --git a/src/info.cpp b/src/info.cpp index 12e27f1ad..01c732940 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -509,7 +509,10 @@ bool AActor::HasSpecialDeathStates () const // //=========================================================================== -FState *AActor::FindState (int numnames, ...) const +FState *AActor::FindState (int numnames, int first, ...) const // The 'first' parameter is only here to + // disambiguate from the single parameter version + // Please note that this code does *NOT* compile + // properly with VC++ when 'first' is removed! { va_list arglist; va_start (arglist, numnames); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 08e202329..e96344622 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1123,6 +1123,7 @@ AActor *LookForTIDinBlock (AActor *lookee, int index) bool P_LookForTID (AActor *actor, INTBOOL allaround) { AActor *other; + bool reachedend = false; other = P_BlockmapSearch (actor, 0, LookForTIDinBlock); @@ -1150,7 +1151,17 @@ bool P_LookForTID (AActor *actor, INTBOOL allaround) while ((other = iterator.Next()) != actor->LastLook.Actor) { if (other == NULL) + { + if (reachedend) + { + // we have cycled through the entire list at least once + // so let's abort because even if we continue nothing can + // be found. + break; + } + reachedend = true; continue; + } if (!(other->flags & MF_SHOOTABLE)) continue; // not shootable (observer or dead) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 3239485e1..04b81af01 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -38,6 +38,7 @@ // State. #include "r_state.h" #include "templates.h" +#include "vectors.h" static AActor *RoughBlockCheck (AActor *mo, int index); @@ -539,6 +540,51 @@ sector_t *AActor::LinkToWorldForMapThing () } } +#if 1 + // Not inside the line's bounding box + if (x + radius <= ldef->bbox[BOXLEFT] + || x - radius >= ldef->bbox[BOXRIGHT] + || y + radius <= ldef->bbox[BOXBOTTOM] + || y - radius >= ldef->bbox[BOXTOP] ) + continue; + + // Get the exact distance to the line + divline_t dll, dlv; + fixed_t linelen = (fixed_t)sqrt((double)ldef->dx*ldef->dx + (double)ldef->dy*ldef->dy); + + P_MakeDivline (ldef, &dll); + + dlv.x = x; + dlv.y = y; + dlv.dx = FixedDiv(dll.dy, linelen); + dlv.dy = -FixedDiv(dll.dx, linelen); + + fixed_t distance = abs(P_InterceptVector(&dlv, &dll)); + + if (distance < radius) + { + DPrintf ("%s at (%d,%d) lies on %s line %d, distance = %f\n", + this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS, + ldef->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal", + ldef-lines, FIXED2FLOAT(distance)); + angle_t finean = R_PointToAngle2 (0, 0, ldef->dx, ldef->dy); + if (ldef->backsector != NULL && ldef->backsector == ssec->sector) + { + finean += ANGLE_90; + } + else + { + finean -= ANGLE_90; + } + finean >>= ANGLETOFINESHIFT; + + // Get the distance we have to move the object away from the wall + distance = radius - distance; + x += FixedMul(distance, finecosine[finean]); + y += FixedMul(distance, finesine[finean]); + break; + } +#else if (DMulScale32 (y - ldef->v1->y, ldef->dx, ldef->v1->x - x, ldef->dy) == 0) { // It touches the infinite line; now make sure it touches the linedef @@ -550,8 +596,10 @@ sector_t *AActor::LinkToWorldForMapThing () num = (SQWORD)(x-ldef->v1->x)*ldef->dx+(SQWORD)(y-ldef->v1->y)*ldef->dy; if (num >= 0 && num <= den) { - DPrintf ("%s at (%d,%d) lies directly on line %d\n", - this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS, ldef-lines); + DPrintf ("%s at (%d,%d) lies directly on %s line %d\n", + this->GetClass()->TypeName.GetChars(), x>>FRACBITS, y>>FRACBITS, + ldef->dx == 0? "vertical" : ldef->dy == 0? "horizontal" : "diagonal", + ldef-lines); angle_t finean = R_PointToAngle2 (0, 0, ldef->dx, ldef->dy); if (ldef->backsector != NULL && ldef->backsector == ssec->sector) { @@ -562,12 +610,13 @@ sector_t *AActor::LinkToWorldForMapThing () finean -= ANGLE_90; } finean >>= ANGLETOFINESHIFT; - x += finecosine[finean] >> 2; - y += finesine[finean] >> 2; + x += finecosine[finean]) >> 2; + y += finesine[finean]) >> 2; break; } } } +#endif } } } diff --git a/wadsrc/decorate/heretic/hereticdecorations.txt b/wadsrc/decorate/heretic/hereticdecorations.txt index c68e22739..cb090d0ea 100644 --- a/wadsrc/decorate/heretic/hereticdecorations.txt +++ b/wadsrc/decorate/heretic/hereticdecorations.txt @@ -236,7 +236,7 @@ ACTOR Moss2 49 ACTOR WallTorch 50 { Game Heretic - Radius 20 + Radius 6 Height 16 +NOGRAVITY +FIXMAPTHINGPOS diff --git a/wadsrc/decorate/hexen/hexenspecialdecs.txt b/wadsrc/decorate/hexen/hexenspecialdecs.txt index 2072c3800..40b10171a 100644 --- a/wadsrc/decorate/hexen/hexenspecialdecs.txt +++ b/wadsrc/decorate/hexen/hexenspecialdecs.txt @@ -115,6 +115,7 @@ ACTOR ZWallTorch : SwitchableDecoration 54 +NOBLOCKMAP +NOGRAVITY +FIXMAPTHINGPOS + Radius 6.5 States { Active: diff --git a/wadsrc/decorate/strife/strifestuff.txt b/wadsrc/decorate/strife/strifestuff.txt index 57e36c453..c2e2cec49 100644 --- a/wadsrc/decorate/strife/strifestuff.txt +++ b/wadsrc/decorate/strife/strifestuff.txt @@ -201,7 +201,7 @@ ACTOR ExplosiveBarrel2 : ExplosiveBarrel 94 ACTOR LightSilverFluorescent 95 { Game Strife - Radius 4 + Radius 2.5 Height 16 +NOBLOCKMAP +FIXMAPTHINGPOS @@ -219,7 +219,7 @@ ACTOR LightSilverFluorescent 95 ACTOR LightBrownFluorescent 96 { Game Strife - Radius 4 + Radius 2.5 Height 16 +NOBLOCKMAP +FIXMAPTHINGPOS @@ -237,7 +237,7 @@ ACTOR LightBrownFluorescent 96 ACTOR LightGoldFluorescent 97 { Game Strife - Radius 4 + Radius 2.5 Height 16 +NOBLOCKMAP +FIXMAPTHINGPOS @@ -772,7 +772,7 @@ ACTOR BurningBrazier 106 ACTOR SmallTorchLit 107 { Game Strife - Radius 0.00007 + Radius 2.5 Height 16 +NOBLOCKMAP +FIXMAPTHINGPOS @@ -793,7 +793,7 @@ ACTOR SmallTorchLit 107 ACTOR SmallTorchUnlit 108 { Game Strife - Radius 0.00007 + Radius 2.5 Height 16 +NOBLOCKMAP +FIXMAPTHINGPOS