* Updated to ZDoom r3455:

- Fixed: Teleports that were not initiated by walking would not trigger sector actions.
- Make CheckActorFloorTexture and CheckActorCeilingTexture aware of 3D-floors.
- When morphing, transfer the score to the new actor, and when unmorphing, transfer the morphed actor's score back to the old actor.
- Fixed: D_WriteUserInfoStrings() mixed the colorset with the color for the verbose form.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1317 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2012-03-18 14:43:42 +00:00
parent 07bf0c470d
commit ab529ac7f7
8 changed files with 135 additions and 49 deletions

View file

@ -330,6 +330,7 @@ enum
MF6_DONTCORPSE = 0x02000000, // [RC] Don't autoset MF_CORPSE upon death and don't force Crash state change.
MF6_POISONALWAYS = 0x04000000, // Always apply poison, even when target can't take the damage.
MF6_DOHARMSPECIES = 0x08000000, // Do hurt one's own species with projectiles.
MF6_INTRYMOVE = 0x10000000, // Executing P_TryMove
// --- mobj.renderflags ---
@ -775,6 +776,8 @@ public:
const char *GetTag(const char *def = NULL) const;
void SetTag(const char *def);
// Triggers SECSPAC_Exit/SECSPAC_Enter and related events if oldsec != current sector
void CheckSectorTransition(sector_t *oldsec);
// info for drawing
// NOTE: The first member variable *must* be x.

View file

@ -598,8 +598,8 @@ void D_WriteUserInfoStrings (int i, BYTE **stream, bool compact)
,
D_EscapeUserInfo(info->netname).GetChars(),
(double)info->aimdist / (float)ANGLE_1,
info->colorset,
RPART(info->color), GPART(info->color), BPART(info->color),
info->colorset,
D_EscapeUserInfo(skins[info->skin].name).GetChars(),
info->team,
info->gender == GENDER_FEMALE ? "female" :

View file

@ -78,6 +78,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i
morphed->angle = actor->angle;
morphed->target = actor->target;
morphed->tracer = actor;
morphed->Score = actor->Score;
p->PremorphWeapon = p->ReadyWeapon;
morphed->special2 = actor->flags & ~MF_JUSTHIT;
morphed->player = p;
@ -225,6 +226,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
mo->flags = (mo->flags & ~(MF_SHADOW|MF_NOGRAVITY)) | (pmo->flags & (MF_SHADOW|MF_NOGRAVITY));
mo->flags2 = (mo->flags2 & ~MF2_FLY) | (pmo->flags2 & MF2_FLY);
mo->flags3 = (mo->flags3 & ~MF3_GHOST) | (pmo->flags3 & MF3_GHOST);
mo->Score = pmo->Score;
const PClass *exit_flash = player->MorphExitFlash;
bool correctweapon = !!(player->MorphStyle & MORPH_LOSEACTUALWEAPON);
@ -261,7 +263,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
// taking events, reset up the face, if any;
// this is only needed for old-skool skins
// and for the original DOOM status bar.
if ((player == &players[consoleplayer]))
if (player == &players[consoleplayer])
{
const char *face = pmo->GetClass()->Meta.GetMetaString (APMETA_Face);
if (face != NULL && strcmp(face, "None") != 0)
@ -371,6 +373,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s
morphed->UnmorphedMe = actor;
morphed->alpha = actor->alpha;
morphed->RenderStyle = actor->RenderStyle;
morphed->Score = actor->Score;
morphed->UnmorphTime = level.time + ((duration) ? duration : MORPHTICS) + pr_morphmonst();
morphed->MorphStyle = style;
@ -440,6 +443,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
actor->velz = beast->velz;
actor->tid = beast->tid;
actor->special = beast->special;
actor->Score = beast->Score;
memcpy (actor->args, beast->args, sizeof(actor->args));
actor->AddToHash ();
beast->UnmorphedMe = NULL;

View file

@ -3175,6 +3175,64 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
return (!stricmp(string, FBehavior::StaticLookupString(value)));
}
bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, bool floor)
{
AActor *actor = SingleActorFromTID(tid, activator);
if (actor == NULL)
{
return 0;
}
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string));
if (tex == NULL)
{ // If the texture we want to check against doesn't exist, then
// they're obviously not the same.
return 0;
}
int i, numff;
FTextureID secpic;
sector_t *sec = actor->Sector;
numff = sec->e->XFloor.ffloors.Size();
if (floor)
{
// Looking through planes from top to bottom
for (i = 0; i < numff; ++i)
{
F3DFloor *ff = sec->e->XFloor.ffloors[i];
if (actor->z >= ff->top.plane->ZatPoint(actor->x, actor->y))
{ // This floor is beneath our feet.
secpic = *ff->top.texture;
break;
}
}
if (i == numff)
{ // Use sector's floor
secpic = sec->GetTexture(sector_t::floor);
}
}
else
{
fixed_t z = actor->z + actor->height;
// Looking through planes from bottom to top
for (i = numff-1; i >= 0; --i)
{
F3DFloor *ff = sec->e->XFloor.ffloors[i];
if (z <= ff->bottom.plane->ZatPoint(actor->x, actor->y))
{ // This floor is above our eyes.
secpic = *ff->bottom.texture;
break;
}
}
if (i < 0)
{ // Use sector's ceiling
secpic = sec->GetTexture(sector_t::ceiling);
}
}
return tex == TexMan[secpic];
}
enum
{
// These are the original inputs sent by the player.
@ -6966,30 +7024,14 @@ int DLevelScript::RunScript ()
break;
case PCD_CHECKACTORCEILINGTEXTURE:
{
AActor *actor = SingleActorFromTID(STACK(2), activator);
if (actor != NULL)
{
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(STACK(1)));
STACK(2) = (tex == TexMan[actor->Sector->GetTexture(sector_t::ceiling)]);
}
else STACK(2)=0;
STACK(2) = DoCheckActorTexture(STACK(2), activator, STACK(1), false);
sp--;
break;
}
case PCD_CHECKACTORFLOORTEXTURE:
{
AActor *actor = SingleActorFromTID(STACK(2), activator);
if (actor != NULL)
{
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(STACK(1)));
STACK(2) = (tex == TexMan[actor->Sector->GetTexture(sector_t::floor)]);
}
else STACK(2)=0;
STACK(2) = DoCheckActorTexture(STACK(2), activator, STACK(1), true);
sp--;
break;
}
case PCD_GETACTORLIGHTLEVEL:
{

View file

@ -714,6 +714,7 @@ protected:
static void SetLineTexture (int lineid, int side, int position, int name);
static void ReplaceTextures (int fromname, int toname, int flags);
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force);
static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor);
int DoSpawnSpot (int type, int spot, int tid, int angle, bool forced);
int DoSpawnSpotFacing (int type, int spot, int tid, bool forced);
int DoClassifyActor (int tid);

View file

@ -307,6 +307,7 @@ void P_FindFloorCeiling (AActor *actor, bool onlyspawnpos)
bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag)
{
FCheckPosition tmf;
sector_t *oldsec = thing->Sector;
// kill anything occupying the position
@ -405,6 +406,13 @@ bool P_TeleportMove (AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefr
thing->PrevY = y;
thing->PrevZ = z;
// If this teleport was caused by a move, P_TryMove() will handle the
// sector transition messages better than we can here.
if (!(thing->flags6 & MF6_INTRYMOVE))
{
thing->CheckSectorTransition(oldsec);
}
return true;
}
@ -1677,6 +1685,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
{
thing->z = onfloor->ZatPoint (x, y);
}
thing->flags6 |= MF6_INTRYMOVE;
if (!P_CheckPosition (thing, x, y, tm))
{
AActor *BlockingMobj = thing->BlockingMobj;
@ -1704,6 +1713,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
if (!(tm.thing->flags2 & MF2_PASSMOBJ) || (i_compatflags & COMPATF_NO_PASSMOBJ))
{
thing->z = oldz;
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
}
@ -1813,6 +1823,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
{ // Can't move over a dropoff unless it's been blasted
// [GZ] Or missile-spawned
thing->z = oldz;
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
}
@ -1821,7 +1832,11 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
// special logic to move a monster off a dropoff
// this intentionally does not check for standing on things.
if (thing->floorz - tm.floorz > thing->MaxDropOffHeight ||
thing->dropoffz - tm.dropoffz > thing->MaxDropOffHeight) return false;
thing->dropoffz - tm.dropoffz > thing->MaxDropOffHeight)
{
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
}
}
if (thing->flags2 & MF2_CANTLEAVEFLOORPIC
@ -1829,6 +1844,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
|| tm.floorz - thing->z != 0))
{ // must stay within a sector of a certain floor type
thing->z = oldz;
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
@ -1843,6 +1859,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
thing->velx = 0;
thing->vely = 0;
thing->z = oldz;
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
}
@ -1869,7 +1886,10 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
if (thing->BounceFlags & BOUNCE_MBF && // killough 8/13/98
!(thing->flags & (MF_MISSILE|MF_NOGRAVITY)) &&
!thing->IsSentient() && tm.floorz - thing->z > 16*FRACUNIT)
return false; // too big a step up for MBF bouncers under gravity
{ // too big a step up for MBF bouncers under gravity
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
}
// the move is ok, so link the thing into its new position
thing->UnlinkFromWorld ();
@ -1896,6 +1916,7 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
// [RH] Don't activate anything if just predicting
if (thing->player && (thing->player->cheats & CF_PREDICTING))
{
thing->flags6 &= ~MF6_INTRYMOVE;
return true;
}
@ -1967,34 +1988,13 @@ bool P_TryMove (AActor *thing, fixed_t x, fixed_t y,
}
// [RH] If changing sectors, trigger transitions
if (oldsec != newsec)
{
if (oldsec->SecActTarget)
{
oldsec->SecActTarget->TriggerAction (thing, SECSPAC_Exit);
}
if (newsec->SecActTarget)
{
int act = SECSPAC_Enter;
if (thing->z <= newsec->floorplane.ZatPoint (thing->x, thing->y))
{
act |= SECSPAC_HitFloor;
}
if (thing->z + thing->height >= newsec->ceilingplane.ZatPoint (thing->x, thing->y))
{
act |= SECSPAC_HitCeiling;
}
if (newsec->heightsec &&
thing->z == newsec->heightsec->floorplane.ZatPoint (thing->x, thing->y))
{
act |= SECSPAC_HitFakeFloor;
}
newsec->SecActTarget->TriggerAction (thing, act);
}
}
thing->CheckSectorTransition(oldsec);
thing->flags6 &= ~MF6_INTRYMOVE;
return true;
pushline:
thing->flags6 &= ~MF6_INTRYMOVE;
// [RH] Don't activate anything if just predicting
if (thing->player && (thing->player->cheats & CF_PREDICTING))
{

View file

@ -3362,6 +3362,42 @@ void AActor::Tick ()
}
}
//==========================================================================
//
// AActor :: CheckSectorTransition
//
// Fire off some sector triggers if the actor has changed sectors.
//
//==========================================================================
void AActor::CheckSectorTransition(sector_t *oldsec)
{
if (oldsec != Sector)
{
if (oldsec->SecActTarget != NULL)
{
oldsec->SecActTarget->TriggerAction(this, SECSPAC_Exit);
}
if (Sector->SecActTarget != NULL)
{
int act = SECSPAC_Enter;
if (z <= Sector->floorplane.ZatPoint(x, y))
{
act |= SECSPAC_HitFloor;
}
if (z + height >= Sector->ceilingplane.ZatPoint(x, y))
{
act |= SECSPAC_HitCeiling;
}
if (Sector->heightsec != NULL && z == Sector->heightsec->floorplane.ZatPoint(x, y))
{
act |= SECSPAC_HitFakeFloor;
}
Sector->SecActTarget->TriggerAction(this, act);
}
}
}
//==========================================================================
//
// AActor::UpdateWaterLevel

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "3450"
#define ZD_SVN_REVISION_NUMBER 3450
#define ZD_SVN_REVISION_STRING "3455"
#define ZD_SVN_REVISION_NUMBER 3455