- Fixed: The minimum parameter count for ACS_Execute and ACS_ExecuteAlways for

DECORATE was wrong (2 instead of 1.)
- Changed: Hexen set every cluster to be a hub if it hadn't been defined before
  a level using this cluster. Now it will only do that if HexenHack is true, 
  i.e. when original Hexen format MAPINFOs are parsed. For ZDoom format 
  MAPINFOs it will now be the same as for the other games which means that 
  'hub' has to be declared explicitly.
- Added an Idle state that is entered in place of the spawn state if a monster
  has to return to its inactive state if it can't find any more targets.
- Added MF5_NOINTERACTION flag which completely disables all physics related
  code for any actor with this flag. Mostly useful for particle effects where
  the actors just move a certain distance and then disappear.
- Removed the last remains of the antialias precalculation code from
  am_map.cpp because it was no longer used.
- Fixed: Two-sided lines bordering a secret sector were not drawn in the
  proper color
- Fixed: The automap didn't check ACS_LockedExecuteDoor for its lock color.


SVN r876 (trunk)
This commit is contained in:
Christoph Oelckers 2008-04-03 10:49:54 +00:00
parent 799a4ea1bb
commit d780c2e3a4
11 changed files with 455 additions and 455 deletions

View file

@ -1,3 +1,24 @@
April 3, 2008 (Changes by Graf Zahl)
- Fixed: The minimum parameter count for ACS_Execute and ACS_ExecuteAlways for
DECORATE was wrong (2 instead of 1.)
April 2, 2008 (Changes by Graf Zahl)
- Changed: Hexen set every cluster to be a hub if it hadn't been defined before
a level using this cluster. Now it will only do that if HexenHack is true,
i.e. when original Hexen format MAPINFOs are parsed. For ZDoom format
MAPINFOs it will now be the same as for the other games which means that
'hub' has to be declared explicitly.
- Added an Idle state that is entered in place of the spawn state if a monster
has to return to its inactive state if it can't find any more targets.
- Added MF5_NOINTERACTION flag which completely disables all physics related
code for any actor with this flag. Mostly useful for particle effects where
the actors just move a certain distance and then disappear.
- Removed the last remains of the antialias precalculation code from
am_map.cpp because it was no longer used.
- Fixed: Two-sided lines bordering a secret sector were not drawn in the
proper color
- Fixed: The automap didn't check ACS_LockedExecuteDoor for its lock color.
April 2, 2008
- Switched sounds local to the listener from head-relative 3D sounds to 2D
sounds so stereo sounds have full separation. I tried using set3DSpread,

View file

@ -72,7 +72,7 @@ DEFINE_SPECIAL(TeleportOther, 76, 3, 3)
DEFINE_SPECIAL(TeleportGroup, 77, 5, 5)
DEFINE_SPECIAL(TeleportInSector, 78, 4, 5)
DEFINE_SPECIAL(ACS_Execute, 80, 2, 5)
DEFINE_SPECIAL(ACS_Execute, 80, 1, 5)
DEFINE_SPECIAL(ACS_Suspend, 81, 2, 2)
DEFINE_SPECIAL(ACS_Terminate, 82, 2, 2)
DEFINE_SPECIAL(ACS_LockedExecute, 83, 5, 5)
@ -197,7 +197,7 @@ DEFINE_SPECIAL(Scroll_Texture_Model, 222, -1, -1)
DEFINE_SPECIAL(Scroll_Floor, 223, 4, 4)
DEFINE_SPECIAL(Scroll_Ceiling, 224, 4, 4)
DEFINE_SPECIAL(Scroll_Texture_Offsets, 225, -1, -1)
DEFINE_SPECIAL(ACS_ExecuteAlways, 226, 2, 5)
DEFINE_SPECIAL(ACS_ExecuteAlways, 226, 1, 5)
DEFINE_SPECIAL(PointPush_SetForce, 227, -1, -1)
DEFINE_SPECIAL(Plat_RaiseAndStayTx0, 228, 2, 2)
DEFINE_SPECIAL(Thing_SetGoal, 229, 3, 4)

View file

@ -298,6 +298,7 @@ enum
MF5_NEVERRESPAWN = 0x00040000, // never respawns, regardless of skill setting
MF5_DONTRIP = 0x00080000, // Ripping projectiles explode when hittin this actor
MF5_NOINFIGHTING = 0x00100000, // This actor doesn't switch target when it's hurt
MF5_NOINTERACTION = 0x00200000, // Thing is completely excluded from any gameplay related checks
// --- mobj.renderflags ---
@ -758,6 +759,7 @@ public:
bool SetStateNF (FState *newstate);
virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true);
bool isFast();
void SetIdle();
FState *FindState (FName label) const;
FState *FindState (FName label, FName sublabel, bool exact = false) const;

View file

@ -115,8 +115,6 @@ inline fixed_t MTOF(fixed_t x)
return MulScale24 (x, scale_mtof);
}
//static int WeightingScale;
CVAR (Int, am_rotate, 0, CVAR_ARCHIVE);
CVAR (Int, am_overlay, 0, CVAR_ARCHIVE);
CVAR (Bool, am_showsecrets, true, CVAR_ARCHIVE);
@ -347,16 +345,6 @@ static fixed_t mapxstart=0; //x-value for the bitmap.
static bool stopped = true;
/*
#define NUMALIASES 3
#define WALLCOLORS -1
#define FDWALLCOLORS -2
#define CDWALLCOLORS -3
static BYTE antialias[NUMALIASES][NUMWEIGHTS];
*/
void AM_rotatePoint (fixed_t *x, fixed_t *y);
void AM_rotate (fixed_t *x, fixed_t *y, angle_t an);
void AM_doFollowPlayer ();
@ -733,57 +721,6 @@ static void AM_initColors (bool overlayed)
NotSeenColor = DoomColors[10];
}
#if 0
// Due to a bug (marked below) precalculated antialiasing was never working properly.
// Also, tests show it provides no measurable performance improvement.
// And since it only complicates matters it's disabled for now.
// initialize the anti-aliased lines
static struct
{
int *color;
int prevcolor;
int falseColor;
} aliasedLines[3] = {
{ &WallColor, -1, WALLCOLORS },
{ &FDWallColor, -1, FDWALLCOLORS },
{ &CDWallColor, -1, CDWALLCOLORS }
};
float backRed, backGreen, backBlue;
GetComponents (Background, palette, backRed, backGreen, backBlue);
for (int alias = 0; alias < NUMALIASES; alias++)
{
if (aliasedLines[alias].prevcolor != *(aliasedLines[alias].color) ||
lastpal != palette || lastback != Background)
{
float foreRed, foreGreen, foreBlue;
aliasedLines[alias].prevcolor = *(aliasedLines[alias].color);
GetComponents (*(aliasedLines[alias].color), palette, foreRed, foreGreen, foreBlue);
for (int i = 0; i < NUMWEIGHTS; i++)
{
float step = (float)i;
float fore = (NUMWEIGHTS-1 - step) / (NUMWEIGHTS-1);
float back = step / (NUMWEIGHTS-1);
int red = (int)(backRed * back + foreRed * fore);
int green = (int)(backGreen * back + foreGreen * fore);
int blue = (int)(backGreen * back + foreBlue * fore);
// [RH] What was I thinking here?
// if (palette)
antialias[alias][i] = ColorMatcher.Pick (red, green, blue);
// else
// antialias[alias][i] = MAKERGB(red, green, blue);
}
}
// This line was inside the 'if' block rendering the whole
// precalculation inoperable.
*(aliasedLines[alias].color) = aliasedLines[alias].falseColor;
}
lastback = Background;
#endif
lastpal = palette;
}
@ -1357,6 +1294,22 @@ void AM_drawGrid (const AMColor &color)
}
}
static bool AM_CheckSecret(line_t *line)
{
if (line->frontsector != NULL)
{
if (line->frontsector->oldspecial &&
(am_map_secrets==2 || (am_map_secrets==1 && !(line->frontsector->special&SECRET_MASK))))
return true;
}
if (line->backsector != NULL)
{
if (line->backsector->oldspecial &&
(am_map_secrets==2 || (am_map_secrets==1 && !(line->backsector->special&SECRET_MASK))))
return true;
}
return false;
}
//
// Determines visible lines, draws them.
// This is LineDef based, not LineSeg based.
@ -1384,18 +1337,14 @@ void AM_drawWalls (bool allmap)
if ((lines[i].flags & ML_DONTDRAW) && am_cheat == 0)
continue;
if (!lines[i].backsector)
if (AM_CheckSecret(&lines[i]))
{
if (lines[i].frontsector->oldspecial &&
(am_map_secrets==2 || (am_map_secrets==1 && !(lines[i].frontsector->special&SECRET_MASK))))
{
// map secret sectors like Boom
AM_drawMline(&l, SecretSectorColor);
}
else
{
AM_drawMline(&l, WallColor);
}
// map secret sectors like Boom
AM_drawMline(&l, SecretSectorColor);
}
else if (!lines[i].backsector)
{
AM_drawMline(&l, WallColor);
}
else
{
@ -1424,6 +1373,7 @@ void AM_drawWalls (bool allmap)
}
else if (lines[i].special == Door_LockedRaise ||
lines[i].special == ACS_LockedExecute ||
lines[i].special == ACS_LockedExecuteDoor ||
(lines[i].special == Generic_Door && lines[i].args[4]!=0))
{
if (am_usecustomcolors)
@ -1805,7 +1755,6 @@ void AM_Drawer ()
f_w = screen->GetWidth ();
f_h = ST_Y;
f_p = screen->GetPitch ();
//WeightingScale = 0;
AM_clearFB(Background);
}
@ -1816,13 +1765,6 @@ void AM_Drawer ()
f_w = realviewwidth;
f_h = realviewheight;
f_p = screen->GetPitch ();
/*
WeightingScale = (int)(am_ovtrans * 256.f);
if (WeightingScale < 0 || WeightingScale >= 256)
{
WeightingScale = 0;
}
*/
}
AM_activateNewScale();

View file

@ -1060,7 +1060,7 @@ static void ParseMapInfoLower (FScanner &sc,
clusterinfo = &wadclusterinfos[clusterindex];
memset (clusterinfo, 0, sizeof(cluster_info_t));
clusterinfo->cluster = sc.Number;
if (gameinfo.gametype == GAME_Hexen)
if (HexenHack)
{
clusterinfo->flags |= CLUSTER_HUB;
}

View file

@ -543,7 +543,7 @@ void A_KlaxonBlare (AActor *self)
A_TurretLook (self);
if (self->target == NULL)
{
self->SetState (self->SpawnState);
self->SetIdle();
}
else
{

View file

@ -140,6 +140,7 @@ xx(Crush)
xx(Yes)
xx(No)
xx(Greetings)
xx(Idle)
// Compatible death names for the decorate parser.
xx(XDeath)

View file

@ -1884,7 +1884,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
}
else
{
actor->SetState (actor->SpawnState);
actor->SetIdle();
actor->flags &= ~MF_INCHASE;
return;
}
@ -1945,7 +1945,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
if (newgoal != NULL && delay != 0)
{
actor->flags4 |= MF4_INCOMBAT;
actor->SetState (actor->SpawnState);
actor->SetIdle();
}
actor->flags &= ~MF_INCHASE;
actor->goal = newgoal;

View file

@ -1432,11 +1432,12 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
mo->momx = mo->momy = mo->momz = 0;
if (!(mo->flags2 & MF2_DORMANT))
{
mo->SetState (mo->SeeState != NULL ? mo->SeeState : mo->SpawnState);
if (mo->SeeState != NULL) mo->SetState (mo->SeeState);
else mo->SetIdle();
}
else
{
mo->SetState (mo->SpawnState);
mo->SetIdle();
mo->tics = -1;
}
}
@ -2398,11 +2399,12 @@ bool AActor::Slam (AActor *thing)
int dam = GetMissileDamage (7, 1);
P_DamageMobj (thing, this, this, dam, NAME_Melee);
P_TraceBleed (dam, thing, this);
SetState (SeeState != NULL ? SeeState : SpawnState);
if (SeeState != NULL) SetState (SeeState);
else SetIdle();
}
else
{
SetState (SpawnState);
SetIdle();
tics = -1;
}
}
@ -2542,403 +2544,417 @@ void AActor::Tick ()
PrevY = y;
PrevZ = z;
AInventory * item = Inventory;
// Handle powerup effects here so that the order is controlled
// by the order in the inventory, not the order in the thinker table
while (item != NULL && item->Owner == this)
if (flags5 & MF5_NOINTERACTION)
{
item->DoEffect();
item = item->Inventory;
// only do the minimally necessary things here to save time.
UnlinkFromWorld ();
flags |= MF_NOBLOCKMAP;
x += momx;
y += momy;
z += momz;
LinkToWorld ();
}
if (flags & MF_UNMORPHED)
else
{
return;
}
//Added by MC: Freeze mode.
if (bglobal.freeze && !(player && !player->isbot))
{
return;
}
AInventory * item = Inventory;
// Apply freeze mode.
if (( level.flags & LEVEL_FROZEN ) && ( player == NULL || !( player->cheats & CF_TIMEFREEZE )))
{
return;
}
fixed_t oldz = z;
// [RH] Give the pain elemental vertical friction
// This used to be in APainElemental::Tick but in order to use
// A_PainAttack with other monsters it has to be here!
if (flags4 & MF4_VFRICTION)
{
if (health >0)
// Handle powerup effects here so that the order is controlled
// by the order in the inventory, not the order in the thinker table
while (item != NULL && item->Owner == this)
{
if (abs (momz) < FRACUNIT/4)
{
momz = 0;
flags4 &= ~MF4_VFRICTION;
}
else
{
momz = FixedMul (momz, 0xe800);
}
item->DoEffect();
item = item->Inventory;
}
}
// [RH] Pulse in and out of visibility
if (effects & FX_VISIBILITYPULSE)
{
if (visdir > 0)
if (flags & MF_UNMORPHED)
{
alpha += 0x800;
if (alpha >= OPAQUE)
{
alpha = OPAQUE;
visdir = -1;
}
return;
}
else
{
alpha -= 0x800;
if (alpha <= TRANSLUC25)
{
alpha = TRANSLUC25;
visdir = 1;
}
}
}
else if (flags & MF_STEALTH)
{
// [RH] Fade a stealth monster in and out of visibility
RenderStyle.Flags &= ~STYLEF_Alpha1;
if (visdir > 0)
{
alpha += 2*FRACUNIT/TICRATE;
if (alpha > OPAQUE)
{
alpha = OPAQUE;
visdir = 0;
}
}
else if (visdir < 0)
{
alpha -= 3*FRACUNIT/TICRATE/2;
if (alpha < 0)
{
alpha = 0;
visdir = 0;
}
}
}
if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback &&
(flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER))
{
clock (BotSupportCycles);
bglobal.m_Thinking = true;
for (i = 0; i < MAXPLAYERS; i++)
//Added by MC: Freeze mode.
if (bglobal.freeze && !(player && !player->isbot))
{
if (!playeringame[i] || !players[i].isbot)
continue;
return;
}
if (flags3 & MF3_ISMONSTER)
// Apply freeze mode.
if (( level.flags & LEVEL_FROZEN ) && ( player == NULL || !( player->cheats & CF_TIMEFREEZE )))
{
return;
}
fixed_t oldz = z;
// [RH] Give the pain elemental vertical friction
// This used to be in APainElemental::Tick but in order to use
// A_PainAttack with other monsters it has to be here!
if (flags4 & MF4_VFRICTION)
{
if (health >0)
{
if (health > 0
&& !players[i].enemy
&& player ? !IsTeammate (players[i].mo) : true
&& P_AproxDistance (players[i].mo->x-x, players[i].mo->y-y) < MAX_MONSTER_TARGET_DIST
&& P_CheckSight (players[i].mo, this, 2))
{ //Probably a monster, so go kill it.
players[i].enemy = this;
if (abs (momz) < FRACUNIT/4)
{
momz = 0;
flags4 &= ~MF4_VFRICTION;
}
}
else if (flags & MF_SPECIAL)
{ //Item pickup time
//clock (BotWTG);
bglobal.WhatToGet (players[i].mo, this);
//unclock (BotWTG);
BotWTG++;
}
else if (flags & MF_MISSILE)
{
if (!players[i].missile && (flags3 & MF3_WARNBOT))
{ //warn for incoming missiles.
if (target != players[i].mo && bglobal.Check_LOS (players[i].mo, this, ANGLE_90))
players[i].missile = this;
else
{
momz = FixedMul (momz, 0xe800);
}
}
}
bglobal.m_Thinking = false;
unclock (BotSupportCycles);
}
//End of MC
// [RH] Consider carrying sectors here
fixed_t cummx = 0, cummy = 0;
if ((level.Scrolls != NULL || player != NULL) && !(flags & MF_NOCLIP) && !(flags & MF_NOSECTOR))
{
fixed_t height, waterheight; // killough 4/4/98: add waterheight
const msecnode_t *node;
int countx, county;
// killough 3/7/98: Carry things on floor
// killough 3/20/98: use new sector list which reflects true members
// killough 3/27/98: fix carrier bug
// killough 4/4/98: Underwater, carry things even w/o gravity
// Move objects only if on floor or underwater,
// non-floating, and clipped.
countx = county = 0;
for (node = touching_sectorlist; node; node = node->m_tnext)
// [RH] Pulse in and out of visibility
if (effects & FX_VISIBILITYPULSE)
{
const sector_t *sec = node->m_sector;
fixed_t scrollx, scrolly;
if (level.Scrolls != NULL)
if (visdir > 0)
{
const FSectorScrollValues *scroll = &level.Scrolls[sec - sectors];
scrollx = scroll->ScrollX;
scrolly = scroll->ScrollY;
alpha += 0x800;
if (alpha >= OPAQUE)
{
alpha = OPAQUE;
visdir = -1;
}
}
else
{
scrollx = scrolly = 0;
alpha -= 0x800;
if (alpha <= TRANSLUC25)
{
alpha = TRANSLUC25;
visdir = 1;
}
}
if (player != NULL)
}
else if (flags & MF_STEALTH)
{
// [RH] Fade a stealth monster in and out of visibility
RenderStyle.Flags &= ~STYLEF_Alpha1;
if (visdir > 0)
{
int scrolltype = sec->special & 0xff;
alpha += 2*FRACUNIT/TICRATE;
if (alpha > OPAQUE)
{
alpha = OPAQUE;
visdir = 0;
}
}
else if (visdir < 0)
{
alpha -= 3*FRACUNIT/TICRATE/2;
if (alpha < 0)
{
alpha = 0;
visdir = 0;
}
}
}
if (scrolltype >= Scroll_North_Slow &&
scrolltype <= Scroll_SouthWest_Fast)
{ // Hexen scroll special
scrolltype -= Scroll_North_Slow;
if (i_compatflags&COMPATF_RAVENSCROLL)
{
angle_t fineangle = HexenScrollDirs[scrolltype / 3] * 32;
fixed_t carryspeed = DivScale32 (HexenSpeedMuls[scrolltype % 3], 32*CARRYFACTOR);
if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback &&
(flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER))
{
clock (BotSupportCycles);
bglobal.m_Thinking = true;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || !players[i].isbot)
continue;
if (flags3 & MF3_ISMONSTER)
{
if (health > 0
&& !players[i].enemy
&& player ? !IsTeammate (players[i].mo) : true
&& P_AproxDistance (players[i].mo->x-x, players[i].mo->y-y) < MAX_MONSTER_TARGET_DIST
&& P_CheckSight (players[i].mo, this, 2))
{ //Probably a monster, so go kill it.
players[i].enemy = this;
}
}
else if (flags & MF_SPECIAL)
{ //Item pickup time
//clock (BotWTG);
bglobal.WhatToGet (players[i].mo, this);
//unclock (BotWTG);
BotWTG++;
}
else if (flags & MF_MISSILE)
{
if (!players[i].missile && (flags3 & MF3_WARNBOT))
{ //warn for incoming missiles.
if (target != players[i].mo && bglobal.Check_LOS (players[i].mo, this, ANGLE_90))
players[i].missile = this;
}
}
}
bglobal.m_Thinking = false;
unclock (BotSupportCycles);
}
//End of MC
// [RH] Consider carrying sectors here
fixed_t cummx = 0, cummy = 0;
if ((level.Scrolls != NULL || player != NULL) && !(flags & MF_NOCLIP) && !(flags & MF_NOSECTOR))
{
fixed_t height, waterheight; // killough 4/4/98: add waterheight
const msecnode_t *node;
int countx, county;
// killough 3/7/98: Carry things on floor
// killough 3/20/98: use new sector list which reflects true members
// killough 3/27/98: fix carrier bug
// killough 4/4/98: Underwater, carry things even w/o gravity
// Move objects only if on floor or underwater,
// non-floating, and clipped.
countx = county = 0;
for (node = touching_sectorlist; node; node = node->m_tnext)
{
const sector_t *sec = node->m_sector;
fixed_t scrollx, scrolly;
if (level.Scrolls != NULL)
{
const FSectorScrollValues *scroll = &level.Scrolls[sec - sectors];
scrollx = scroll->ScrollX;
scrolly = scroll->ScrollY;
}
else
{
scrollx = scrolly = 0;
}
if (player != NULL)
{
int scrolltype = sec->special & 0xff;
if (scrolltype >= Scroll_North_Slow &&
scrolltype <= Scroll_SouthWest_Fast)
{ // Hexen scroll special
scrolltype -= Scroll_North_Slow;
if (i_compatflags&COMPATF_RAVENSCROLL)
{
angle_t fineangle = HexenScrollDirs[scrolltype / 3] * 32;
fixed_t carryspeed = DivScale32 (HexenSpeedMuls[scrolltype % 3], 32*CARRYFACTOR);
scrollx += FixedMul (carryspeed, finecosine[fineangle]);
scrolly += FixedMul (carryspeed, finesine[fineangle]);
}
else
{
// Use speeds that actually match the scrolling textures!
scrollx -= HexenScrollies[scrolltype][0] << (FRACBITS-1);
scrolly += HexenScrollies[scrolltype][1] << (FRACBITS-1);
}
}
else if (scrolltype >= Carry_East5 &&
scrolltype <= Carry_West35)
{ // Heretic scroll special
scrolltype -= Carry_East5;
BYTE dir = HereticScrollDirs[scrolltype / 5];
fixed_t carryspeed = DivScale32 (HereticSpeedMuls[scrolltype % 5], 32*CARRYFACTOR);
if (scrolltype<=Carry_East35 && !(i_compatflags&COMPATF_RAVENSCROLL))
{
// Use speeds that actually match the scrolling textures!
carryspeed = (1 << ((scrolltype%5) + FRACBITS-1));
}
scrollx += carryspeed * ((dir & 3) - 1);
scrolly += carryspeed * (((dir & 12) >> 2) - 1);
}
else if (scrolltype == dScroll_EastLavaDamage)
{ // Special Heretic scroll special
if (i_compatflags&COMPATF_RAVENSCROLL)
{
scrollx += DivScale32 (28, 32*CARRYFACTOR);
}
else
{
// Use a speed that actually matches the scrolling texture!
scrollx += DivScale32 (12, 32*CARRYFACTOR);
}
}
else if (scrolltype == Scroll_StrifeCurrent)
{ // Strife scroll special
int anglespeed = sec->tag - 100;
fixed_t carryspeed = DivScale32 (anglespeed % 10, 16*CARRYFACTOR);
angle_t fineangle = (anglespeed / 10) << (32-3);
fineangle >>= ANGLETOFINESHIFT;
scrollx += FixedMul (carryspeed, finecosine[fineangle]);
scrolly += FixedMul (carryspeed, finesine[fineangle]);
}
else
{
// Use speeds that actually match the scrolling textures!
scrollx -= HexenScrollies[scrolltype][0] << (FRACBITS-1);
scrolly += HexenScrollies[scrolltype][1] << (FRACBITS-1);
}
}
else if (scrolltype >= Carry_East5 &&
scrolltype <= Carry_West35)
{ // Heretic scroll special
scrolltype -= Carry_East5;
BYTE dir = HereticScrollDirs[scrolltype / 5];
fixed_t carryspeed = DivScale32 (HereticSpeedMuls[scrolltype % 5], 32*CARRYFACTOR);
if (scrolltype<=Carry_East35 && !(i_compatflags&COMPATF_RAVENSCROLL))
{
// Use speeds that actually match the scrolling textures!
carryspeed = (1 << ((scrolltype%5) + FRACBITS-1));
}
scrollx += carryspeed * ((dir & 3) - 1);
scrolly += carryspeed * (((dir & 12) >> 2) - 1);
}
else if (scrolltype == dScroll_EastLavaDamage)
{ // Special Heretic scroll special
if (i_compatflags&COMPATF_RAVENSCROLL)
{
scrollx += DivScale32 (28, 32*CARRYFACTOR);
}
else
{
// Use a speed that actually matches the scrolling texture!
scrollx += DivScale32 (12, 32*CARRYFACTOR);
}
}
else if (scrolltype == Scroll_StrifeCurrent)
{ // Strife scroll special
int anglespeed = sec->tag - 100;
fixed_t carryspeed = DivScale32 (anglespeed % 10, 16*CARRYFACTOR);
angle_t fineangle = (anglespeed / 10) << (32-3);
fineangle >>= ANGLETOFINESHIFT;
scrollx += FixedMul (carryspeed, finecosine[fineangle]);
scrolly += FixedMul (carryspeed, finesine[fineangle]);
}
}
if ((scrollx | scrolly) == 0)
{
continue;
}
if (flags & MF_NOGRAVITY &&
(sec->heightsec == NULL || (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)))
{
continue;
}
height = sec->floorplane.ZatPoint (x, y);
if (z > height)
{
if (sec->heightsec == NULL || (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
if ((scrollx | scrolly) == 0)
{
continue;
}
waterheight = sec->heightsec->floorplane.ZatPoint (x, y);
if (waterheight > height && z >= waterheight)
if (flags & MF_NOGRAVITY &&
(sec->heightsec == NULL || (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)))
{
continue;
}
}
cummx += scrollx;
cummy += scrolly;
if (scrollx) countx++;
if (scrolly) county++;
}
// Some levels designed with Boom in mind actually want things to accelerate
// at neighboring scrolling sector boundaries. But it is only important for
// non-player objects.
if (player != NULL || !(i_compatflags & COMPATF_BOOMSCROLL))
{
if (countx > 1)
{
cummx /= countx;
}
if (county > 1)
{
cummy /= county;
}
}
}
// [RH] If standing on a steep slope, fall down it
if ((flags & MF_SOLID) && !(flags & (MF_NOCLIP|MF_NOGRAVITY)) &&
!(flags & MF_NOBLOCKMAP) &&
momz <= 0 &&
floorz == z)
{
const secplane_t * floorplane = &floorsector->floorplane;
if (floorplane->c < STEEPSLOPE &&
floorplane->ZatPoint (x, y) <= floorz)
{
const msecnode_t *node;
bool dopush = true;
if (floorplane->c > STEEPSLOPE*2/3)
{
for (node = touching_sectorlist; node; node = node->m_tnext)
height = sec->floorplane.ZatPoint (x, y);
if (z > height)
{
const sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE)
if (sec->heightsec == NULL || (sec->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
{
if (floorplane->ZatPoint (x, y) >= z - MaxStepHeight)
continue;
}
waterheight = sec->heightsec->floorplane.ZatPoint (x, y);
if (waterheight > height && z >= waterheight)
{
continue;
}
}
cummx += scrollx;
cummy += scrolly;
if (scrollx) countx++;
if (scrolly) county++;
}
// Some levels designed with Boom in mind actually want things to accelerate
// at neighboring scrolling sector boundaries. But it is only important for
// non-player objects.
if (player != NULL || !(i_compatflags & COMPATF_BOOMSCROLL))
{
if (countx > 1)
{
cummx /= countx;
}
if (county > 1)
{
cummy /= county;
}
}
}
// [RH] If standing on a steep slope, fall down it
if ((flags & MF_SOLID) && !(flags & (MF_NOCLIP|MF_NOGRAVITY)) &&
!(flags & MF_NOBLOCKMAP) &&
momz <= 0 &&
floorz == z)
{
const secplane_t * floorplane = &floorsector->floorplane;
if (floorplane->c < STEEPSLOPE &&
floorplane->ZatPoint (x, y) <= floorz)
{
const msecnode_t *node;
bool dopush = true;
if (floorplane->c > STEEPSLOPE*2/3)
{
for (node = touching_sectorlist; node; node = node->m_tnext)
{
const sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE)
{
dopush = false;
break;
if (floorplane->ZatPoint (x, y) >= z - MaxStepHeight)
{
dopush = false;
break;
}
}
}
}
}
if (dopush)
{
momx += floorplane->a;
momy += floorplane->b;
if (dopush)
{
momx += floorplane->a;
momy += floorplane->b;
}
}
}
}
// [RH] Missiles moving perfectly vertical need some X/Y movement, or they
// won't hurt anything. Don't do this if damage is 0! That way, you can
// still have missiles that go straight up and down through actors without
// damaging anything.
if ((flags & MF_MISSILE) && (momx|momy) == 0 && Damage != 0)
{
momx = 1;
}
// Handle X and Y momemtums
BlockingMobj = NULL;
P_XYMovement (this, cummx, cummy);
if (ObjectFlags & OF_EuthanizeMe)
{ // actor was destroyed
return;
}
if ((momx | momy) == 0 && (flags2 & MF2_BLASTED))
{ // Reset to not blasted when momentums are gone
flags2 &= ~MF2_BLASTED;
}
if (flags2 & MF2_FLOATBOB)
{ // Floating item bobbing motion
z += FloatBobDiffs[(FloatBobPhase + level.maptime) & 63];
}
if (momz || BlockingMobj ||
(z != floorz && (!(flags2 & MF2_FLOATBOB) ||
(z - FloatBobOffsets[(FloatBobPhase + level.maptime) & 63] != floorz)
)))
{ // Handle Z momentum and gravity
if (((flags2 & MF2_PASSMOBJ) || (flags & MF_SPECIAL)) && !(i_compatflags & COMPATF_NO_PASSMOBJ))
// [RH] Missiles moving perfectly vertical need some X/Y movement, or they
// won't hurt anything. Don't do this if damage is 0! That way, you can
// still have missiles that go straight up and down through actors without
// damaging anything.
if ((flags & MF_MISSILE) && (momx|momy) == 0 && Damage != 0)
{
if (!(onmo = P_CheckOnmobj (this)))
momx = 1;
}
// Handle X and Y momemtums
BlockingMobj = NULL;
P_XYMovement (this, cummx, cummy);
if (ObjectFlags & OF_EuthanizeMe)
{ // actor was destroyed
return;
}
if ((momx | momy) == 0 && (flags2 & MF2_BLASTED))
{ // Reset to not blasted when momentums are gone
flags2 &= ~MF2_BLASTED;
}
if (flags2 & MF2_FLOATBOB)
{ // Floating item bobbing motion
z += FloatBobDiffs[(FloatBobPhase + level.maptime) & 63];
}
if (momz || BlockingMobj ||
(z != floorz && (!(flags2 & MF2_FLOATBOB) ||
(z - FloatBobOffsets[(FloatBobPhase + level.maptime) & 63] != floorz)
)))
{ // Handle Z momentum and gravity
if (((flags2 & MF2_PASSMOBJ) || (flags & MF_SPECIAL)) && !(i_compatflags & COMPATF_NO_PASSMOBJ))
{
P_ZMovement (this);
flags2 &= ~MF2_ONMOBJ;
if (!(onmo = P_CheckOnmobj (this)))
{
P_ZMovement (this);
flags2 &= ~MF2_ONMOBJ;
}
else
{
if (player)
{
if (momz < (fixed_t)(level.gravity * Sector->gravity * -655.36f)
&& !(flags&MF_NOGRAVITY))
{
PlayerLandedOnThing (this, onmo);
}
}
if (onmo->z + onmo->height - z <= MaxStepHeight)
{
if (player && player->mo == this)
{
player->viewheight -= onmo->z + onmo->height - z;
fixed_t deltaview = player->GetDeltaViewHeight();
if (deltaview > player->deltaviewheight)
{
player->deltaviewheight = deltaview;
}
}
z = onmo->z + onmo->height;
}
flags2 |= MF2_ONMOBJ;
momz = 0;
Crash();
}
}
else
{
if (player)
{
if (momz < (fixed_t)(level.gravity * Sector->gravity * -655.36f)
&& !(flags&MF_NOGRAVITY))
{
PlayerLandedOnThing (this, onmo);
}
}
if (onmo->z + onmo->height - z <= MaxStepHeight)
{
if (player && player->mo == this)
{
player->viewheight -= onmo->z + onmo->height - z;
fixed_t deltaview = player->GetDeltaViewHeight();
if (deltaview > player->deltaviewheight)
{
player->deltaviewheight = deltaview;
}
}
z = onmo->z + onmo->height;
}
flags2 |= MF2_ONMOBJ;
momz = 0;
Crash();
P_ZMovement (this);
}
if (ObjectFlags & OF_EuthanizeMe)
return; // actor was destroyed
}
else
else if (z <= floorz)
{
P_ZMovement (this);
Crash();
}
if (ObjectFlags & OF_EuthanizeMe)
return; // actor was destroyed
}
else if (z <= floorz)
{
Crash();
}
UpdateWaterLevel (oldz);
UpdateWaterLevel (oldz);
// [RH] Don't advance if predicting a player
if (player && (player->cheats & CF_PREDICTING))
{
return;
// [RH] Don't advance if predicting a player
if (player && (player->cheats & CF_PREDICTING))
{
return;
}
}
// cycle through states, calling action functions at transitions
@ -3195,7 +3211,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
actor->ceilingsector = actor->Sector;
actor->ceilingpic = actor->ceilingsector->ceilingpic;
}
else
else if (!(actor->flags5 & MF5_NOINTERACTION))
{
P_FindFloorCeiling (actor);
actor->floorz = tmffloorz;
@ -3206,6 +3222,16 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
actor->ceilingpic = tmfceilingpic;
actor->ceilingsector = tmfceilingsector;
}
else
{
actor->floorz = FIXED_MIN;
actor->dropoffz = FIXED_MIN;
actor->ceilingz = FIXED_MAX;
actor->floorpic = 0;
actor->floorsector = actor->Sector;
actor->ceilingpic = 0;
actor->ceilingsector = actor->Sector;
}
actor->SpawnPoint[0] = ix >> FRACBITS;
actor->SpawnPoint[1] = iy >> FRACBITS;
@ -4922,6 +4948,13 @@ void AActor::Crash()
}
}
void AActor::SetIdle()
{
FState *idle = FindState (NAME_Idle);
if (idle == NULL) idle = SpawnState;
SetState(idle);
}
FArchive &operator<< (FArchive &arc, FSoundIndex &snd)
{
if (arc.IsStoring ())

View file

@ -235,6 +235,7 @@ static flagdef ActorFlags[]=
DEFINE_FLAG(MF5, NEVERRESPAWN, AActor, flags5),
DEFINE_FLAG(MF5, DONTRIP, AActor, flags5),
DEFINE_FLAG(MF5, NOINFIGHTING, AActor, flags5),
DEFINE_FLAG(MF5, NOINTERACTION, AActor, flags5),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),