Merge branch 'master' into gonesolong

Conflicts:
	src/CMakeLists.txt
	src/b_think.cpp
	src/g_doom/a_doomweaps.cpp
	src/g_hexen/a_clericstaff.cpp
	src/g_hexen/a_fighterplayer.cpp
	src/namedef.h
	src/p_enemy.cpp
	src/p_local.h
	src/p_mobj.cpp
	src/p_teleport.cpp
	src/sc_man_tokens.h
	src/thingdef/thingdef_codeptr.cpp
	src/thingdef/thingdef_function.cpp
	src/thingdef/thingdef_parse.cpp
	wadsrc/static/actors/actor.txt
	wadsrc/static/actors/constants.txt
	wadsrc/static/actors/shared/inventory.txt

- Added register reuse to VMFunctionBuilder for FxPick's code emitter.
- Note to self: Need to reimplement IsPointerEqual and CheckClass, which
  were added to thingdef_function.cpp over the past year, as this file no
  longer exists in this branch.
This commit is contained in:
Randy Heit 2014-12-21 20:43:24 -06:00
commit b5e4153c78
182 changed files with 23025 additions and 8730 deletions

View file

@ -84,7 +84,6 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj);
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern cycle_t BotSupportCycles;
extern int BotWTG;
EXTERN_CVAR (Int, cl_rockettrails)
@ -291,6 +290,10 @@ void AActor::Serialize (FArchive &arc)
{
arc << flags7;
}
if (SaveVersion >= 4512)
{
arc << weaponspecial;
}
arc << special1
<< special2
<< health
@ -333,9 +336,13 @@ void AActor::Serialize (FArchive &arc)
<< MinMissileChance
<< SpawnFlags
<< Inventory
<< InventoryID
<< id
<< FloatBobPhase
<< InventoryID;
if (SaveVersion < 4513)
{
SDWORD id;
arc << id;
}
arc << FloatBobPhase
<< Translation
<< SeeSound
<< AttackSound
@ -390,8 +397,16 @@ void AActor::Serialize (FArchive &arc)
}
arc << lastpush << lastbump
<< PainThreshold
<< DamageFactor
<< WeaveIndexXY << WeaveIndexZ
<< DamageFactor;
if (SaveVersion >= 4516)
{
arc << DamageMultiply;
}
else
{
DamageMultiply = FRACUNIT;
}
arc << WeaveIndexXY << WeaveIndexZ
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
<< PoisonDamage << PoisonDuration << PoisonPeriod;
if (SaveVersion >= 3235)
@ -403,7 +418,11 @@ void AActor::Serialize (FArchive &arc)
{
arc << FriendPlayer;
}
if (SaveVersion >= 4517)
{
arc << TeleFogSourceType
<< TeleFogDestType;
}
{
FString tagstr;
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
@ -1254,7 +1273,7 @@ bool AActor::Massacre ()
P_DamageMobj (this, NULL, NULL, TELEFRAG_DAMAGE, NAME_Massacre);
}
while (health != prevhealth && health > 0); //abort if the actor wasn't hurt.
return true;
return health <= 0;
}
return false;
}
@ -1282,17 +1301,14 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
if (target != NULL && ((target->flags & (MF_SHOOTABLE|MF_CORPSE)) || (target->flags6 & MF6_KILLED)) )
{
if (mo->flags7 & MF7_HITTARGET) mo->target = target;
if (mo->flags7 & MF7_HITMASTER) mo->master = target;
if (mo->flags7 & MF7_HITTRACER) mo->tracer = target;
if (target->flags & MF_NOBLOOD) nextstate = mo->FindState(NAME_Crash);
if (nextstate == NULL) nextstate = mo->FindState(NAME_Death, NAME_Extreme);
}
if (nextstate == NULL) nextstate = mo->FindState(NAME_Death);
mo->SetState (nextstate);
if (mo->ObjectFlags & OF_EuthanizeMe)
{
return;
}
if (line != NULL && line->special == Line_Horizon && !(mo->flags3 & MF3_SKYEXPLODE))
{
// [RH] Don't explode missiles on horizon lines.
@ -1367,8 +1383,17 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
}
}
if (nextstate != NULL)
// play the sound before changing the state, so that AActor::Destroy can call S_RelinkSounds on it and the death state can override it.
if (mo->DeathSound)
{
S_Sound (mo, CHAN_VOICE, mo->DeathSound, 1,
(mo->flags3 & MF3_FULLVOLDEATH) ? ATTN_NONE : ATTN_NORM);
}
mo->SetState (nextstate);
if (!(mo->ObjectFlags & OF_EuthanizeMe))
{
// The rest only applies if the missile actor still exists.
// [RH] Change render style of exploding rockets
if (mo->flags5 & MF5_DEHEXPLOSION)
{
@ -1401,11 +1426,6 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
mo->flags &= ~MF_MISSILE;
if (mo->DeathSound)
{
S_Sound (mo, CHAN_VOICE, mo->DeathSound, 1,
(mo->flags3 & MF3_FULLVOLDEATH) ? ATTN_NONE : ATTN_NORM);
}
}
}
@ -1742,6 +1762,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
int steps, step, totalsteps;
fixed_t startx, starty;
fixed_t oldfloorz = mo->floorz;
fixed_t oldz = mo->z;
fixed_t maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) ||
(mo->player && mo->player->crouchoffset<-10*FRACUNIT) ? MAXMOVE : MAXMOVE/4;
@ -2031,20 +2052,53 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
}
if (BlockingMobj && (BlockingMobj->flags2 & MF2_REFLECTIVE))
{
angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y);
// Change angle for deflection/reflection
if (mo->AdjustReflectionAngle (BlockingMobj, angle))
bool seeker = (mo->flags2 & MF2_SEEKERMISSILE) ? true : false;
// Don't change the angle if there's THRUREFLECT on the monster.
if (!(BlockingMobj->flags7 & MF7_THRUREFLECT))
{
goto explode;
}
int dir;
angle_t delta;
if (BlockingMobj->flags7 & MF7_MIRRORREFLECT)
angle = mo->angle + ANG180;
else
angle = R_PointToAngle2(BlockingMobj->x, BlockingMobj->y, mo->x, mo->y);
// Reflect the missile along angle
mo->angle = angle;
angle >>= ANGLETOFINESHIFT;
mo->velx = FixedMul (mo->Speed>>1, finecosine[angle]);
mo->vely = FixedMul (mo->Speed>>1, finesine[angle]);
mo->velz = -mo->velz/2;
// Change angle for deflection/reflection
// AIMREFLECT calls precedence so make sure not to bother with adjusting here if declared.
if (!(BlockingMobj->flags7 & MF7_AIMREFLECT) && (mo->AdjustReflectionAngle(BlockingMobj, angle)))
{
goto explode;
}
// Reflect the missile along angle
if (BlockingMobj->flags7 & MF7_AIMREFLECT)
{
dir = P_FaceMobj(mo, mo->target, &delta);
if (dir)
{ // Turn clockwise
mo->angle += delta;
}
else
{ // Turn counter clockwise
mo->angle -= delta;
}
angle = mo->angle >> ANGLETOFINESHIFT;
mo->velx = FixedMul(mo->Speed, finecosine[angle]);
mo->vely = FixedMul(mo->Speed, finesine[angle]);
mo->velz = -mo->velz;
}
else
{
mo->angle = angle;
angle >>= ANGLETOFINESHIFT;
mo->velx = FixedMul(mo->Speed >> 1, finecosine[angle]);
mo->vely = FixedMul(mo->Speed >> 1, finesine[angle]);
mo->velz = -mo->velz / 2;
}
}
if (mo->flags2 & MF2_SEEKERMISSILE)
{
mo->tracer = mo->target;
@ -2725,18 +2779,10 @@ void P_NightmareRespawn (AActor *mobj)
mo->PrevZ = z; // Do not interpolate Z position if we changed it since spawning.
// spawn a teleport fog at old spot because of removal of the body?
mo = Spawn ("TeleportFog", mobj->x, mobj->y, mobj->z, ALLOW_REPLACE);
if (mo != NULL)
{
mo->z += TELEFOGHEIGHT;
}
P_SpawnTeleportFog(mobj, mobj->x, mobj->y, mobj->z + TELEFOGHEIGHT, true);
// spawn a teleport fog at the new spot
mo = Spawn ("TeleportFog", x, y, z, ALLOW_REPLACE);
if (mo != NULL)
{
mo->z += TELEFOGHEIGHT;
}
P_SpawnTeleportFog(mobj, x, y, z + TELEFOGHEIGHT, false);
// remove the old monster
mobj->Destroy ();
@ -2988,6 +3034,7 @@ int AActor::SpecialMissileHit (AActor *victim)
bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle)
{
if (flags2 & MF2_DONTREFLECT) return true;
if (thing->flags7 & MF7_THRUREFLECT) return false;
// Change angle for reflection
if (thing->flags4&MF4_SHIELDREFLECT)
@ -3216,7 +3263,7 @@ void AActor::Tick ()
special2++;
}
//Added by MC: Freeze mode.
if (bglobal.freeze && !(player && !player->isbot))
if (bglobal.freeze && !(player && player->Bot == NULL))
{
return;
}
@ -3330,40 +3377,40 @@ void AActor::Tick ()
}
}
if (bglobal.botnum && consoleplayer == Net_Arbitrator && !demoplayback &&
if (bglobal.botnum && !demoplayback &&
((flags & (MF_SPECIAL|MF_MISSILE)) || (flags3 & MF3_ISMONSTER)))
{
BotSupportCycles.Clock();
bglobal.m_Thinking = true;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || !players[i].isbot)
if (!playeringame[i] || players[i].Bot == NULL)
continue;
if (flags3 & MF3_ISMONSTER)
{
if (health > 0
&& !players[i].enemy
&& !players[i].Bot->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, SF_SEEPASTBLOCKEVERYTHING))
{ //Probably a monster, so go kill it.
players[i].enemy = this;
players[i].Bot->enemy = this;
}
}
else if (flags & MF_SPECIAL)
{ //Item pickup time
//clock (BotWTG);
bglobal.WhatToGet (players[i].mo, this);
players[i].Bot->WhatToGet (this);
//unclock (BotWTG);
BotWTG++;
}
else if (flags & MF_MISSILE)
{
if (!players[i].missile && (flags3 & MF3_WARNBOT))
if (!players[i].Bot->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;
if (target != players[i].mo && players[i].Bot->Check_LOS (this, ANGLE_90))
players[i].Bot->missile = this;
}
}
}
@ -3967,6 +4014,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
actor->touching_sectorlist = NULL; // NULL head of sector list // phares 3/13/98
if (G_SkillProperty(SKILLP_FastMonsters) && actor->GetClass()->FastSpeed >= 0)
actor->Speed = actor->GetClass()->FastSpeed;
actor->DamageMultiply = FRACUNIT;
// set subsector and/or block links
actor->LinkToWorld (SpawningMapThing);
@ -4350,6 +4398,12 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
if ((unsigned)playernum >= (unsigned)MAXPLAYERS || !playeringame[playernum])
return NULL;
// Old lerp data needs to go
if (playernum == consoleplayer)
{
P_PredictionLerpReset();
}
p = &players[playernum];
if (p->cls == NULL)
@ -4390,12 +4444,15 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
{
spawn_x = p->mo->x;
spawn_y = p->mo->y;
spawn_z = p->mo->z;
spawn_angle = p->mo->angle;
}
else
{
spawn_x = mthing->x;
spawn_y = mthing->y;
// Allow full angular precision but avoid roundoff errors for multiples of 45 degrees.
if (mthing->angle % 45 != 0)
{
@ -4409,14 +4466,14 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
{
spawn_angle += 1 << ANGLETOFINESHIFT;
}
}
if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING)
spawn_z = ONCEILINGZ;
else if (GetDefaultByType(p->cls)->flags2 & MF2_SPAWNFLOAT)
spawn_z = FLOATRANDZ;
else
spawn_z = ONFLOORZ;
if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING)
spawn_z = ONCEILINGZ;
else if (GetDefaultByType(p->cls)->flags2 & MF2_SPAWNFLOAT)
spawn_z = FLOATRANDZ;
else
spawn_z = ONFLOORZ;
}
mobj = static_cast<APlayerPawn *>
(Spawn (p->cls, spawn_x, spawn_y, spawn_z, NO_REPLACE));
@ -4462,9 +4519,6 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
mobj->pitch = mobj->roll = 0;
mobj->health = p->health;
//Added by MC: Identification (number in the players[MAXPLAYERS] array)
mobj->id = playernum;
// [RH] Set player sprite based on skin
if (!(mobj->flags4 & MF4_NOSKIN))
{
@ -4536,7 +4590,8 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
{
APowerup *invul = static_cast<APowerup*>(p->mo->GiveInventoryType (RUNTIME_CLASS(APowerInvulnerable)));
invul->EffectTics = 3*TICRATE;
invul->BlendColor = 0; // don't mess with the view
invul->BlendColor = 0; // don't mess with the view
invul->ItemFlags |= IF_UNDROPPABLE; // Don't drop this
p->mo->effects |= FX_RESPAWNINVUL; // [RH] special effect
}
@ -5118,10 +5173,11 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
cls = static_cast<PClassActor *>(cls->ParentClass);
}
}
statedone:
if (!(bloodtype <= 1)) th->renderflags |= RF_INVISIBLE;
}
statedone:
if (!(bloodtype <= 1)) th->renderflags |= RF_INVISIBLE;
if (bloodtype >= 1)
P_DrawSplash2 (40, x, y, z, dir, 2, bloodcolor);
}
@ -5958,22 +6014,41 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
return NULL;
}
int AActor::GetTeam()
{
if (player)
{
return player->userinfo.GetTeam();
}
int myTeam = DesignatedTeam;
// Check for monsters that belong to a player on the team but aren't part of the team themselves.
if (myTeam == TEAM_NONE && FriendPlayer != 0)
{
myTeam = players[FriendPlayer - 1].userinfo.GetTeam();
}
return myTeam;
}
bool AActor::IsTeammate (AActor *other)
{
if (!other)
{
return false;
}
else if (!deathmatch && player && other->player)
return true;
int myTeam = DesignatedTeam;
int otherTeam = other->DesignatedTeam;
if (player)
myTeam = player->userinfo.GetTeam();
if (other->player)
otherTeam = other->player->userinfo.GetTeam();
if (teamplay && myTeam != TEAM_NONE && myTeam == otherTeam)
{
return true;
}
else if (teamplay)
{
int myTeam = GetTeam();
int otherTeam = other->GetTeam();
return (myTeam != TEAM_NONE && myTeam == otherTeam);
}
return false;
}
@ -6069,7 +6144,7 @@ bool AActor::IsHostile (AActor *other)
int AActor::DoSpecialDamage (AActor *target, int damage, FName damagetype)
{
if (target->player && target->player->mo == target && damage < 1000 &&
(target->player->cheats & CF_GODMODE))
(target->player->cheats & CF_GODMODE || target->player->cheats & CF_GODMODE2))
{
return -1;
}