- Added submission for ACS CheckPlayerCamera ACS function.

- Removed FRadiusThingsIterator after discovering that VC++ misoptimized
  it in P_CheckPosition. Now FBlockThingsIterator is used with the distance
  check being done manually. 

SVN r914 (trunk)
This commit is contained in:
Christoph Oelckers 2008-04-15 10:04:41 +00:00
parent adc9f090ef
commit 99b2fab410
9 changed files with 71 additions and 53 deletions

View file

@ -1,3 +1,9 @@
April 15, 2008 (Changes by Graf Zahl)
- Added submission for ACS CheckPlayerCamera ACS function.
- Removed FRadiusThingsIterator after discovering that VC++ misoptimized
it in P_CheckPosition. Now FBlockThingsIterator is used with the distance
check being done manually.
April 14, 2008 (Changes by Graf Zahl)
- Added rotation 90° angles only) and mirroring to the Multipatch texture
composition code.

View file

@ -603,6 +603,12 @@ public:
return (flags & MF_COUNTKILL) && !(flags & MF_FRIENDLY);
}
bool intersects(AActor *other) const
{
fixed_t blockdist = radius + other->radius;
return ( abs(x - other->x) < blockdist && abs(y - other->y) < blockdist);
}
// Calculate amount of missile damage
virtual int GetMissileDamage(int mask, int add);

View file

@ -145,9 +145,9 @@ public:
player_t *oldplayer = CPlayer;
DBaseStatusBar::AttachToPlayer (player);
if (oldplayer != CPlayer)
if (oldplayer != CPlayer || savegamerestore/*added for morphing*/)
{
SetFace (&skins[CPlayer->userinfo.skin]);
SetFace (&skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin]);
}
if (multiplayer)
{

View file

@ -5,6 +5,7 @@
#include "p_local.h"
#include "a_sharedglobal.h"
#include "s_sound.h"
#include "m_bbox.h"
static FRandom pr_thrustraise ("ThrustRaise");
@ -262,9 +263,14 @@ void A_ThrustBlock (AActor *actor)
void A_ThrustImpale (AActor *actor)
{
AActor *thing;
FRadiusThingsIterator it(actor->x, actor->y, actor->radius);
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
{
continue;
}
if (!(thing->flags & MF_SHOOTABLE) )
continue;

View file

@ -5339,7 +5339,24 @@ int DLevelScript::RunScript ()
static_cast<DSBarInfo*>(StatusBar)->SetMugShotState(FBehavior::StaticLookupString(STACK(1)));
}
break;
case PCD_CHECKPLAYERCAMERA:
{
AActor *actor = SingleActorFromTID(STACK(1), activator);
if(actor != NULL && actor->player != NULL)
{
if(actor->player->camera != actor->player->mo)
{
STACK(1) = actor->player->camera->tid;
}
else
{
STACK(1) = 0;
}
}
else STACK(1) = 0;
}
}
}

View file

@ -550,6 +550,7 @@ public:
PCD_SETMUGSHOTSTATE,
PCD_THINGCOUNTSECTOR,
PCD_THINGCOUNTNAMESECTOR,
PCD_CHECKPLAYERCAMERA, // [TN]
PCODE_COMMAND_COUNT
};

View file

@ -283,14 +283,6 @@ public:
void Reset() { StartBlock(minx, miny); }
};
class FRadiusThingsIterator : public FBlockThingsIterator
{
fixed_t X, Y, Radius;
public:
FRadiusThingsIterator(fixed_t x, fixed_t y, fixed_t radius);
AActor *Next();
};
class FPathTraverse
{
static TArray<intercept_t> intercepts;

View file

@ -253,7 +253,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
FRadiusThingsIterator it2(x, y, thing->radius);
FBlockThingsIterator it2(FBoundingBox(x, y, thing->radius));
AActor *th;
while ((th = it2.Next()))
@ -265,6 +265,10 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
if (th == thing)
continue;
fixed_t blockdist = th->radius + tmf.thing->radius;
if ( abs(th->x - tmf.x) >= blockdist || abs(th->y - tmf.y) >= blockdist)
continue;
// [RH] Z-Check
// But not if not MF2_PASSMOBJ or MF3_DONTOVERLAP are set!
// Otherwise those things would get stuck inside each other.
@ -325,7 +329,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
void P_PlayerStartStomp (AActor *actor)
{
AActor *th;
FRadiusThingsIterator it(actor->x, actor->y, actor->radius);
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
while ((th = it.Next()))
{
@ -336,6 +340,9 @@ void P_PlayerStartStomp (AActor *actor)
if (th == actor || (th->player == actor->player && th->player != NULL))
continue;
if (!th->intersects(actor))
continue;
// only kill monsters and other players
if (th->player == NULL && !(th->flags3 & MF3_ISMONSTER))
continue;
@ -643,7 +650,7 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
fixed_t topz;
bool solid;
int damage;
// don't clip against self
if (thing == tm.thing)
return true;
@ -651,6 +658,10 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_SHOOTABLE)) )
return true; // can't hit thing
fixed_t blockdist = thing->radius + tm.thing->radius;
if ( abs(thing->x - tm.x) >= blockdist || abs(thing->y - tm.y) >= blockdist)
return true;
tm.thing->BlockingMobj = thing;
topz = thing->z + thing->height;
if (!(i_compatflags & COMPATF_NO_PASSMOBJ) && !(tm.thing->flags & (MF_FLOAT|MF_MISSILE|MF_SKULLFLY|MF_NOGRAVITY)) &&
@ -1037,7 +1048,7 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm)
tm.stepthing = NULL;
FRadiusThingsIterator it2(x, y, thing->radius);
FBlockThingsIterator it2(FBoundingBox(x, y, thing->radius));
AActor *th;
while ((th = it2.Next()))
{
@ -1168,11 +1179,15 @@ bool P_TestMobjZ (AActor *actor, bool quick, AActor **pOnmobj)
return true;
}
FRadiusThingsIterator it(actor->x, actor->y, actor->radius);
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
AActor *thing;
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
{
continue;
}
if (!(thing->flags & MF_SOLID))
{ // Can't hit thing
continue;
@ -3392,7 +3407,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
float bombdamagefloat = (float)bombdamage;
FVector3 bombvec(FIXED2FLOAT(bombspot->x), FIXED2FLOAT(bombspot->y), FIXED2FLOAT(bombspot->z));
FRadiusThingsIterator it(bombspot->x, bombspot->y, bombdistance<<FRACBITS);
FBlockThingsIterator it(FBoundingBox(bombspot->x, bombspot->y, bombdistance<<FRACBITS));
AActor *thing;
while ((thing = it.Next()))
@ -3627,9 +3642,13 @@ void P_FindAboveIntersectors (AActor *actor)
return;
AActor *thing;
FRadiusThingsIterator it(actor->x, actor->y, actor->radius);
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
{
continue;
}
if (!(thing->flags & MF_SOLID))
{ // Can't hit thing
continue;
@ -3665,9 +3684,13 @@ void P_FindBelowIntersectors (AActor *actor)
return;
AActor *thing;
FRadiusThingsIterator it(actor->x, actor->y, actor->radius);
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
{
continue;
}
if (!(thing->flags & MF_SOLID))
{ // Can't hit thing
continue;

View file

@ -858,39 +858,6 @@ AActor *FBlockThingsIterator::Next()
}
//===========================================================================
//
// FRadiusThingsIterator :: Next
//
//===========================================================================
FRadiusThingsIterator::FRadiusThingsIterator(fixed_t x, fixed_t y, fixed_t radius)
: FBlockThingsIterator(FBoundingBox(x, y, radius))
{
X = x;
Y = y;
Radius = radius;
}
//===========================================================================
//
// FRadiusThingsIterator :: Next
//
//===========================================================================
AActor *FRadiusThingsIterator::Next()
{
AActor *actor;
while ((actor = FBlockThingsIterator::Next()))
{
fixed_t blockdist = actor->radius + Radius;
if ( abs(actor->x - X) < blockdist && abs(actor->y - Y) < blockdist)
return actor;
}
return NULL;
}
//===========================================================================
//
// FPathTraverse :: Intercepts