Skip to content

Commit c7bba2a

Browse files
Revert "Improvements to death and cheat handling"
This reverts commit 3033faf. Revert "Improved ZScript interface for morphing" This reverts commit 6c64a44. Revert "Further morphing clean up" This reverts commit 12dc5c1. Revert "Fixed inconsistencies between player and monster morphing" This reverts commit 3073064. Revert "Reworked Morphing" This reverts commit 2c09a44. - fix compile
1 parent 5346ec8 commit c7bba2a

25 files changed

+744
-873
lines changed

src/g_level.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ int FLevelLocals::FinishTravel ()
17111711
pawn->flags2 &= ~MF2_BLASTED;
17121712
if (oldpawn != nullptr)
17131713
{
1714-
PlayerPointerSubstitution (oldpawn, pawn, true);
1714+
StaticPointerSubstitution (oldpawn, pawn);
17151715
oldpawn->Destroy();
17161716
}
17171717
if (pawndup != NULL)

src/g_statusbar/sbar_mugshot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ FGameTexture *FMugShot::GetFace(player_t *player, const char *default_face, int
479479
if (CurrentState != NULL)
480480
{
481481
int skin = player->userinfo.GetSkin();
482-
const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->mo->alternative != nullptr ? (GetDefaultByType(player->MorphedPlayerClass))->NameVar(NAME_Face).GetChars() : Skins[skin].Face.GetChars());
482+
const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? (GetDefaultByType(player->MorphedPlayerClass))->NameVar(NAME_Face).GetChars() : Skins[skin].Face.GetChars());
483483
return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle);
484484
}
485485
return NULL;

src/m_cheat.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,10 @@ class DSuicider : public DThinker
626626
double plyrdmgfact = Pawn->DamageFactor;
627627
Pawn->DamageFactor = 1.;
628628
P_DamageMobj (Pawn, Pawn, Pawn, TELEFRAG_DAMAGE, NAME_Suicide);
629-
if (Pawn != nullptr)
629+
Pawn->DamageFactor = plyrdmgfact;
630+
if (Pawn->health <= 0)
630631
{
631-
Pawn->DamageFactor = plyrdmgfact;
632-
if (Pawn->health <= 0)
633-
{
634-
Pawn->flags &= ~MF_SHOOTABLE;
635-
}
632+
Pawn->flags &= ~MF_SHOOTABLE;
636633
}
637634
Destroy();
638635
}

src/p_saveg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ void FLevelLocals::UnSnapshotLevel(bool hubLoad)
11381138
// If this isn't the unmorphed original copy of a player, destroy it, because it's extra.
11391139
for (i = 0; i < MAXPLAYERS; ++i)
11401140
{
1141-
if (PlayerInGame(i) && Players[i]->mo->alternative == pawn)
1141+
if (PlayerInGame(i) && Players[i]->morphTics && Players[i]->mo->alternative == pawn)
11421142
{
11431143
break;
11441144
}

src/playsim/a_morph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ bool P_MorphActor(AActor *activator, AActor *victim, PClassActor *ptype, PClassA
3737

3838
bool P_UnmorphActor(AActor *activator, AActor *morphed, int flags, bool force)
3939
{
40-
IFVIRTUALPTR(morphed, AActor, Unmorph)
40+
IFVIRTUALPTR(morphed, AActor, UnMorph)
4141
{
4242
VMValue params[] = { morphed, activator, flags, force };
4343
int retval;

src/playsim/a_morph.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ enum
2626
MORPH_UNDOBYTIMEOUT = 0x00001000, // Player unmorphs once countdown expires
2727
MORPH_UNDOALWAYS = 0x00002000, // Powerups must always unmorph, no matter what.
2828
MORPH_TRANSFERTRANSLATION = 0x00004000, // Transfer translation from the original actor to the morphed one
29-
MORPH_KEEPARMOR = 0x00008000, // Don't lose current armor value when morphing.
30-
MORPH_IGNOREINVULN = 0x00010000, // Completely ignore invulnerability status on players.
3129

3230
MORPH_STANDARDUNDOING = MORPH_UNDOBYTOMEOFPOWER | MORPH_UNDOBYCHAOSDEVICE | MORPH_UNDOBYTIMEOUT,
3331
};

src/playsim/actor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,8 +1747,8 @@ struct FTranslatedLineTarget
17471747
bool unlinked; // found by a trace that went through an unlinked portal.
17481748
};
17491749

1750-
void PlayerPointerSubstitution(AActor* oldPlayer, AActor* newPlayer, bool removeOld);
1751-
int MorphPointerSubstitution(AActor* from, AActor* to);
1750+
1751+
void StaticPointerSubstitution(AActor* old, AActor* notOld);
17521752

17531753
#define S_FREETARGMOBJ 1
17541754

src/playsim/p_enemy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3139,7 +3139,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Pain)
31393139
PARAM_SELF_PROLOGUE(AActor);
31403140

31413141
// [RH] Vary player pain sounds depending on health (ala Quake2)
3142-
if (self->player && self->alternative == nullptr)
3142+
if (self->player && self->player->morphTics == 0)
31433143
{
31443144
const char *pain_amount;
31453145
FSoundID sfx_id = NO_SOUND;

src/playsim/p_interaction.cpp

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -313,54 +313,36 @@ EXTERN_CVAR (Int, fraglimit)
313313

314314
void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath)
315315
{
316+
// Handle possible unmorph on death
316317
bool wasgibbed = (health < GetGibHealth());
317318

318-
// Check to see if unmorph Actors need to be killed as well. Originally this was always
319-
// called but that puts an unnecessary burden on the modder to determine whether it's
320-
// a valid call or not.
321-
if (alternative != nullptr && !(flags & MF_UNMORPHED))
322319
{
323320
IFVIRTUAL(AActor, MorphedDeath)
324321
{
325-
// Return values are no longer used to ensure things stay properly managed.
326-
AActor* const realMo = alternative;
327-
int morphStyle = 0;
322+
AActor *realthis = NULL;
323+
int realstyle = 0;
324+
int realhealth = 0;
328325

329326
VMValue params[] = { this };
327+
VMReturn returns[3];
328+
returns[0].PointerAt((void**)&realthis);
329+
returns[1].IntAt(&realstyle);
330+
returns[2].IntAt(&realhealth);
331+
VMCall(func, params, 1, returns, 3);
330332

331-
{
332-
IFVM(Actor, GetMorphStyle)
333-
{
334-
VMReturn ret[] = { &morphStyle };
335-
VMCall(func, params, 1, ret, 1);
336-
}
337-
}
338-
339-
VMCall(func, params, 1, nullptr, 0);
340-
341-
// Kill the dummy Actor if it didn't unmorph, otherwise checking the morph flags. Player pawns need
342-
// to stay, otherwise they won't respawn correctly.
343-
if (realMo != nullptr && !(realMo->flags6 & MF6_KILLED)
344-
&& ((alternative != nullptr && player == nullptr) || (alternative == nullptr && !(morphStyle & MORPH_UNDOBYDEATHSAVES))))
333+
if (realthis && !(realstyle & MORPH_UNDOBYDEATHSAVES))
345334
{
346335
if (wasgibbed)
347336
{
348-
const int realGibHealth = realMo->GetGibHealth();
349-
if (realMo->health >= realGibHealth)
350-
realMo->health = realGibHealth - 1; // If morphed was gibbed, so must original be (where allowed).
351-
}
352-
else if (realMo->health > 0)
353-
{
354-
realMo->health = 0;
337+
int realgibhealth = realthis->GetGibHealth();
338+
if (realthis->health >= realgibhealth)
339+
{
340+
realthis->health = realgibhealth - 1; // if morphed was gibbed, so must original be (where allowed)l
341+
}
355342
}
356-
357-
// Pass appropriate damage information along when it's confirmed to die.
358-
realMo->DamageTypeReceived = DamageTypeReceived;
359-
realMo->DamageType = DamageType;
360-
realMo->special1 = special1;
361-
362-
realMo->CallDie(source, inflictor, dmgflags, MeansOfDeath);
343+
realthis->CallDie(source, inflictor, dmgflags, MeansOfDeath);
363344
}
345+
364346
}
365347
}
366348

@@ -476,7 +458,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOf
476458
++source->player->spreecount;
477459
}
478460

479-
if (source->alternative != nullptr)
461+
if (source->player->morphTics)
480462
{ // Make a super chicken
481463
source->GiveInventoryType (PClass::FindActor(NAME_PowerWeaponLevel2));
482464
}
@@ -1347,7 +1329,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
13471329

13481330
if (damage >= player->health && !telefragDamage
13491331
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
1350-
&& target->alternative == nullptr)
1332+
&& !player->morphTics)
13511333
{ // Try to use some inventory health
13521334
P_AutoUseHealth (player, damage - player->health + 1);
13531335
}
@@ -1481,7 +1463,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
14811463
// check for special fire damage or ice damage deaths
14821464
if (mod == NAME_Fire)
14831465
{
1484-
if (player && target->alternative == nullptr)
1466+
if (player && !player->morphTics)
14851467
{ // Check for flame death
14861468
if (!inflictor ||
14871469
((target->health > -50) && (damage > 25)) ||
@@ -1815,7 +1797,7 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, bool playPain
18151797
}
18161798
if (damage >= player->health
18171799
&& (G_SkillProperty(SKILLP_AutoUseHealth) || deathmatch)
1818-
&& target->alternative == nullptr)
1800+
&& !player->morphTics)
18191801
{ // Try to use some inventory health
18201802
P_AutoUseHealth(player, damage - player->health+1);
18211803
}
@@ -1845,7 +1827,7 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, bool playPain
18451827
else
18461828
{
18471829
target->special1 = damage;
1848-
if (player && target->alternative == nullptr)
1830+
if (player && !player->morphTics)
18491831
{ // Check for flame death
18501832
if ((player->poisontype == NAME_Fire) && (target->health > -50) && (damage > 25))
18511833
{

0 commit comments

Comments
 (0)