- 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.


SVN r409 (trunk)
This commit is contained in:
Christoph Oelckers 2006-12-09 12:50:52 +00:00
parent 41de448add
commit 88812ed0f5
9 changed files with 88 additions and 12 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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
}
}
}

View File

@ -236,7 +236,7 @@ ACTOR Moss2 49
ACTOR WallTorch 50
{
Game Heretic
Radius 20
Radius 6
Height 16
+NOGRAVITY
+FIXMAPTHINGPOS

View File

@ -115,6 +115,7 @@ ACTOR ZWallTorch : SwitchableDecoration 54
+NOBLOCKMAP
+NOGRAVITY
+FIXMAPTHINGPOS
Radius 6.5
States
{
Active:

View File

@ -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