mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- added a P_PointInSector function and replaced all calls to retrieve an
actor's sector in the game engine code with it. This way there's a clear distinction between renderer-specific and game-specific calls. SVN r638 (trunk)
This commit is contained in:
parent
2e11d31bb5
commit
faa9cc4302
11 changed files with 47 additions and 30 deletions
|
@ -1,4 +1,7 @@
|
|||
December 25, 2007 (Changes by Graf Zahl)
|
||||
- added a P_PointInSector function and replaced all calls to retrieve an
|
||||
actor's sector in the game engine code with it. This way there's a clear
|
||||
distinction between renderer-specific and game-specific calls.
|
||||
- added UseInventory/UseActorInventory ACS functions.
|
||||
|
||||
December 24, 2007 (Changes by Graf Zahl)
|
||||
|
|
|
@ -1247,7 +1247,7 @@ bool G_CheckSpot (int playernum, mapthing2_t *mthing)
|
|||
y = mthing->y << FRACBITS;
|
||||
z = mthing->z << FRACBITS;
|
||||
|
||||
z += R_PointInSubsector (x, y)->sector->floorplane.ZatPoint (x, y);
|
||||
z += P_PointInSector (x, y)->floorplane.ZatPoint (x, y);
|
||||
|
||||
if (!players[playernum].mo)
|
||||
{ // first spawn of level, before corpses
|
||||
|
|
|
@ -330,6 +330,18 @@ bool Check_Sides(AActor *, int, int); // phares
|
|||
// [RH]
|
||||
bool P_CheckSlopeWalk (AActor *actor, fixed_t &xmove, fixed_t &ymove);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//
|
||||
// Added so that in the source there's a clear distinction between
|
||||
// game engine and renderer specific calls.
|
||||
// (For ZDoom itself this doesn't make any difference here but for GZDoom it does.)
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
inline sector_t *P_PointInSector(fixed_t x, fixed_t y)
|
||||
{
|
||||
return R_PointInSubsector(x,y)->sector;
|
||||
}
|
||||
|
||||
//
|
||||
// P_SETUP
|
||||
//
|
||||
|
|
|
@ -229,7 +229,7 @@ void P_FindFloorCeiling (AActor *actor)
|
|||
tmfbbox[BOXRIGHT] = x + actor->radius;
|
||||
tmfbbox[BOXLEFT] = x - actor->radius;
|
||||
|
||||
sec = R_PointInSubsector (x, y)->sector;
|
||||
sec = P_PointInSector (x, y);
|
||||
tmffloorz = tmfdropoffz = sec->floorplane.ZatPoint (x, y);
|
||||
tmfceilingz = sec->ceilingplane.ZatPoint (x, y);
|
||||
tmffloorpic = sec->floorpic;
|
||||
|
@ -322,7 +322,7 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
|
|||
int bx;
|
||||
int by;
|
||||
|
||||
subsector_t* newsubsec;
|
||||
sector_t* newsec;
|
||||
|
||||
// kill anything occupying the position
|
||||
tmthing = thing;
|
||||
|
@ -337,17 +337,17 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
|
|||
tmfbbox[BOXRIGHT] = tmbbox[BOXRIGHT] = x + tmthing->radius;
|
||||
tmfbbox[BOXLEFT] = tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
newsubsec = R_PointInSubsector (x,y);
|
||||
newsec = P_PointInSector (x,y);
|
||||
ceilingline = NULL;
|
||||
|
||||
// The base floor/ceiling is from the subsector that contains the point.
|
||||
// Any contacted lines the step closer together will adjust them.
|
||||
tmffloorz = tmfdropoffz = newsubsec->sector->floorplane.ZatPoint (x, y);
|
||||
tmfceilingz = newsubsec->sector->ceilingplane.ZatPoint (x, y);
|
||||
tmffloorpic = newsubsec->sector->floorpic;
|
||||
tmffloorsector = newsubsec->sector;
|
||||
tmfceilingpic = newsubsec->sector->ceilingpic;
|
||||
tmfceilingsector = newsubsec->sector;
|
||||
tmffloorz = tmfdropoffz = newsec->floorplane.ZatPoint (x, y);
|
||||
tmfceilingz = newsec->ceilingplane.ZatPoint (x, y);
|
||||
tmffloorpic = newsec->floorpic;
|
||||
tmffloorsector = newsec;
|
||||
tmfceilingpic = newsec->ceilingpic;
|
||||
tmfceilingsector = newsec;
|
||||
tmfthing = tmthing;
|
||||
|
||||
validcount++;
|
||||
|
@ -1263,7 +1263,7 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y)
|
|||
int xl, xh;
|
||||
int yl, yh;
|
||||
int bx, by;
|
||||
subsector_t *newsubsec;
|
||||
sector_t *newsec;
|
||||
AActor *thingblocker;
|
||||
AActor *fakedblocker;
|
||||
fixed_t realheight = thing->height;
|
||||
|
@ -1279,20 +1279,21 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y)
|
|||
tmbbox[BOXRIGHT] = x + thing->radius;
|
||||
tmbbox[BOXLEFT] = x - thing->radius;
|
||||
|
||||
newsubsec = R_PointInSubsector (x,y);
|
||||
newsec = P_PointInSector (x,y);
|
||||
ceilingline = BlockingLine = NULL;
|
||||
|
||||
// The base floor / ceiling is from the subsector that contains the point.
|
||||
// Any contacted lines the step closer together will adjust them.
|
||||
tmfloorz = tmdropoffz = newsubsec->sector->floorplane.ZatPoint (x, y);
|
||||
tmceilingz = newsubsec->sector->ceilingplane.ZatPoint (x, y);
|
||||
tmfloorpic = newsubsec->sector->floorpic;
|
||||
tmfloorsector = newsubsec->sector;
|
||||
tmceilingpic = newsubsec->sector->ceilingpic;
|
||||
tmceilingsector = newsubsec->sector;
|
||||
tmfloorz = tmdropoffz = newsec->floorplane.ZatPoint (x, y);
|
||||
tmceilingz = newsec->ceilingplane.ZatPoint (x, y);
|
||||
tmfloorpic = newsec->floorpic;
|
||||
tmfloorsector = newsec;
|
||||
tmceilingpic = newsec->ceilingpic;
|
||||
tmceilingsector = newsec;
|
||||
|
||||
//Added by MC: Fill the tmsector.
|
||||
tmsector = newsubsec->sector;
|
||||
tmsector = newsec;
|
||||
|
||||
|
||||
validcount++;
|
||||
spechit.Clear ();
|
||||
|
|
|
@ -336,7 +336,7 @@ void AActor::LinkToWorld (bool buggy)
|
|||
|
||||
if (!buggy || numnodes == 0)
|
||||
{
|
||||
sec = R_PointInSubsector (x, y)->sector;
|
||||
sec = P_PointInSector (x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -582,8 +582,7 @@ sector_t *AActor::LinkToWorldForMapThing ()
|
|||
distance = radius - distance;
|
||||
x += FixedMul(distance, finecosine[finean]);
|
||||
y += FixedMul(distance, finesine[finean]);
|
||||
ssec = R_PointInSubsector (x, y);
|
||||
break;
|
||||
return P_PointInSector (x, y);
|
||||
}
|
||||
#else
|
||||
if (DMulScale32 (y - ldef->v1->y, ldef->dx, ldef->v1->x - x, ldef->dy) == 0)
|
||||
|
|
|
@ -3779,8 +3779,8 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
|
|||
// [RH] sound sequence overriders
|
||||
if (mthing->type >= 1400 && mthing->type < 1410)
|
||||
{
|
||||
R_PointInSubsector (mthing->x<<FRACBITS,
|
||||
mthing->y<<FRACBITS)->sector->seqType = mthing->type - 1400;
|
||||
P_PointInSector (mthing->x<<FRACBITS,
|
||||
mthing->y<<FRACBITS)->seqType = mthing->type - 1400;
|
||||
return;
|
||||
}
|
||||
else if (mthing->type == 1411)
|
||||
|
@ -3798,8 +3798,8 @@ void P_SpawnMapThing (mapthing2_t *mthing, int position)
|
|||
}
|
||||
else
|
||||
{
|
||||
R_PointInSubsector (mthing->x << FRACBITS,
|
||||
mthing->y << FRACBITS)->sector->seqType = type;
|
||||
P_PointInSector (mthing->x << FRACBITS,
|
||||
mthing->y << FRACBITS)->seqType = type;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1344,7 +1344,7 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
|
|||
|
||||
static void P_CopyPlane (int tag, fixed_t x, fixed_t y, bool copyCeil)
|
||||
{
|
||||
sector_t *dest = R_PointInSubsector (x, y)->sector;
|
||||
sector_t *dest = P_PointInSector (x, y);
|
||||
sector_t *source;
|
||||
int secnum;
|
||||
size_t planeofs;
|
||||
|
@ -1506,7 +1506,7 @@ static void P_SpawnSlopeMakers (mapthing2_t *firstmt, mapthing2_t *lastmt)
|
|||
|
||||
x = mt->x << FRACBITS;
|
||||
y = mt->y << FRACBITS;
|
||||
sec = R_PointInSubsector (x, y)->sector;
|
||||
sec = P_PointInSector (x, y);
|
||||
if (mt->type & 1)
|
||||
{
|
||||
refplane = &sec->ceilingplane;
|
||||
|
|
|
@ -223,7 +223,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
|
|||
oldy = thing->y;
|
||||
oldz = thing->z;
|
||||
aboveFloor = thing->z - thing->floorz;
|
||||
destsect = R_PointInSubsector (x, y)->sector;
|
||||
destsect = P_PointInSector (x, y);
|
||||
// killough 5/12/98: exclude voodoo dolls:
|
||||
player = thing->player;
|
||||
if (player && player->mo != thing)
|
||||
|
|
|
@ -2204,6 +2204,7 @@ void R_FindParticleSubsectors ()
|
|||
{
|
||||
subsector_t *ssec = R_PointInSubsector (Particles[i].x, Particles[i].y);
|
||||
int ssnum = ssec-subsectors;
|
||||
Particles[i].subsector = ssec;
|
||||
Particles[i].snext = ParticlesInSubsec[ssnum];
|
||||
ParticlesInSubsec[ssnum] = i;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ struct particle_t
|
|||
int color;
|
||||
WORD tnext;
|
||||
WORD snext;
|
||||
subsector_t * subsector;
|
||||
};
|
||||
|
||||
extern WORD NumParticles;
|
||||
|
|
|
@ -2024,7 +2024,7 @@ void A_Respawn (AActor *actor)
|
|||
sector_t *sec;
|
||||
|
||||
actor->flags |= MF_SOLID;
|
||||
sec = R_PointInSubsector (x, y)->sector;
|
||||
sec = P_PointInSector (x, y);
|
||||
actor->SetOrigin (x, y, sec->floorplane.ZatPoint (x, y));
|
||||
actor->height = actor->GetDefault()->height;
|
||||
if (P_TestMobjLocation (actor))
|
||||
|
|
Loading…
Reference in a new issue