This commit is contained in:
nashmuhandes 2024-10-06 21:29:38 +08:00
commit 58ddcd4806
65 changed files with 1310 additions and 332 deletions

View file

@ -168,6 +168,7 @@ IMPLEMENT_POINTERS_START(AActor)
IMPLEMENT_POINTER(target)
IMPLEMENT_POINTER(lastenemy)
IMPLEMENT_POINTER(tracer)
IMPLEMENT_POINTER(damagesource)
IMPLEMENT_POINTER(goal)
IMPLEMENT_POINTER(LastLookActor)
IMPLEMENT_POINTER(Inventory)
@ -217,6 +218,7 @@ void AActor::Serialize(FSerializer &arc)
A("angles", Angles)
A("frame", frame)
A("scale", Scale)
A("nolocalrender", NoLocalRender) // Note: This will probably be removed later since a better solution is needed
A("renderstyle", RenderStyle)
A("renderflags", renderflags)
A("renderflags2", renderflags2)
@ -289,6 +291,7 @@ void AActor::Serialize(FSerializer &arc)
A("inventoryid", InventoryID)
A("floatbobphase", FloatBobPhase)
A("floatbobstrength", FloatBobStrength)
A("floatbobfactor", FloatBobFactor)
A("translation", Translation)
A("bloodcolor", BloodColor)
A("bloodtranslation", BloodTranslation)
@ -317,6 +320,7 @@ void AActor::Serialize(FSerializer &arc)
A("wallbouncefactor", wallbouncefactor)
A("bouncecount", bouncecount)
A("maxtargetrange", maxtargetrange)
A("missilechancemult", missilechancemult)
A("meleethreshold", meleethreshold)
A("meleerange", meleerange)
A("damagetype", DamageType)
@ -398,7 +402,8 @@ void AActor::Serialize(FSerializer &arc)
("unmorphtime", UnmorphTime)
("morphflags", MorphFlags)
("premorphproperties", PremorphProperties)
("morphexitflash", MorphExitFlash);
("morphexitflash", MorphExitFlash)
("damagesource", damagesource);
SerializeTerrain(arc, "floorterrain", floorterrain, &def->floorterrain);
@ -798,7 +803,7 @@ DEFINE_ACTION_FUNCTION(AActor, GiveInventoryType)
void AActor::CopyFriendliness (AActor *other, bool changeTarget, bool resetHealth)
{
Level->total_monsters -= CountsAsKill();
if (health > 0) Level->total_monsters -= CountsAsKill();
TIDtoHate = other->TIDtoHate;
LastLookActor = other->LastLookActor;
LastLookPlayerNumber = other->LastLookPlayerNumber;
@ -813,7 +818,7 @@ void AActor::CopyFriendliness (AActor *other, bool changeTarget, bool resetHealt
LastHeard = target = other->target;
}
if (resetHealth) health = SpawnHealth();
Level->total_monsters += CountsAsKill();
if (health > 0) Level->total_monsters += CountsAsKill();
}
DEFINE_ACTION_FUNCTION(AActor, CopyFriendliness)
@ -4430,6 +4435,14 @@ void AActor::Tick ()
// must have been removed
if (ObjectFlags & OF_EuthanizeMe) return;
}
//[inkoalawetrust] Genericized level damage handling that makes sector, 3D floor, and TERRAIN flat damage affect monsters and other NPCs too.
if (!(flags9 & MF9_NOSECTORDAMAGE) && (player || (player == nullptr && Sector->MoreFlags & SECMF_HURTMONSTERS)))
{
P_ActorOnSpecial3DFloor(this);
P_ActorInSpecialSector(this,Sector);
if (!isAbove(Sector->floorplane.ZatPoint(this)) || waterlevel) // Actor must be touching the floor for TERRAIN flats.
P_ActorOnSpecialFlat(this, P_GetThingFloorType(this));
}
if (tics != -1)
{
@ -6278,9 +6291,15 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, const DVector3 &pos1
if ( puff && (puff->flags5 & MF5_PUFFGETSOWNER))
puff->target = source;
// [AA] Track the source of the attack unconditionally in a separate field.
puff->damagesource = source;
// Angle is the opposite of the hit direction (i.e. the puff faces the source.)
puff->Angles.Yaw = hitdir + DAngle::fromDeg(180);
// [AA] Mark the spawned actor as a puff with a flag.
puff->flags9 |= MF9_ISPUFF;
// If a puff has a crash state and an actor was not hit,
// it will enter the crash state. This is used by the StrifeSpark
// and BlasterPuff.