diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index 2ed78aef3..33c33413d 100644 --- a/src/g_inventory/a_pickups.cpp +++ b/src/g_inventory/a_pickups.cpp @@ -200,55 +200,6 @@ bool AInventory::Grind(bool items) return Super::Grind(items); } -//=========================================================================== -// -// AInventory :: GetSpeedFactor -// -//=========================================================================== - -double AInventory::GetSpeedFactor() -{ - double factor = 1.; - auto self = this; - while (self != nullptr) - { - IFVIRTUALPTR(self, AInventory, GetSpeedFactor) - { - VMValue params[1] = { (DObject*)self }; - double retval; - VMReturn ret(&retval); - VMCall(func, params, 1, &ret, 1); - factor *= retval; - } - self = self->Inventory; - } - return factor; -} - -//=========================================================================== -// -// AInventory :: GetNoTeleportFreeze -// -//=========================================================================== - -bool AInventory::GetNoTeleportFreeze () -{ - auto self = this; - while (self != nullptr) - { - IFVIRTUALPTR(self, AInventory, GetNoTeleportFreeze) - { - VMValue params[1] = { (DObject*)self }; - int retval; - VMReturn ret(&retval); - VMCall(func, params, 1, &ret, 1); - if (retval) return true; - } - self = self->Inventory; - } - return false; -} - //=========================================================================== // // AInventory :: Use diff --git a/src/g_inventory/a_pickups.h b/src/g_inventory/a_pickups.h index d831bb3de..97f94bff0 100644 --- a/src/g_inventory/a_pickups.h +++ b/src/g_inventory/a_pickups.h @@ -83,7 +83,6 @@ public: void DepleteOrDestroy (); // virtual on the script side. bool CallUse(bool pickup); // virtual on the script side. PalEntry CallGetBlend(); // virtual on the script side. - double GetSpeedFactor(); // virtual on the script side. bool GetNoTeleportFreeze(); // virtual on the script side. bool DoRespawn(); diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 78f21b741..7618b6165 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -203,9 +203,14 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags) // [BC] && bHaltVelocity. if (thing->player && ((flags & TELF_DESTFOG) || !(flags & TELF_KEEPORIENTATION)) && !(flags & TELF_KEEPVELOCITY)) { - // Freeze player for about .5 sec - if (thing->Inventory == NULL || !thing->Inventory->GetNoTeleportFreeze()) - thing->reactiontime = 18; + int time = 18; + IFVIRTUALPTR(thing, APlayerPawn, GetTeleportFreezeTime) + { + VMValue param = thing; + VMReturn ret(&time); + VMCall(func, ¶m, 1, &ret, 1); + } + thing->reactiontime = time; } if (thing->flags & MF_MISSILE) { diff --git a/wadsrc/static/zscript/shared/player.txt b/wadsrc/static/zscript/shared/player.txt index 041d1e49d..478d3e813 100644 --- a/wadsrc/static/zscript/shared/player.txt +++ b/wadsrc/static/zscript/shared/player.txt @@ -52,6 +52,7 @@ class PlayerPawn : Actor native meta Name HealingRadiusType; meta Name InvulMode; + meta int TeleportFreezeTime; property prefix: Player; property HealRadiusType: HealingradiusType; @@ -69,6 +70,7 @@ class PlayerPawn : Actor native property MorphWeapon: MorphWeapon; property FlechetteType: FlechetteType; property Portrait: Portrait; + property TeleportFreezeTime: TeleportFreezeTime; Default { @@ -106,6 +108,7 @@ class PlayerPawn : Actor native Player.FlechetteType "ArtiPoisonBag3"; Player.AirCapacity 1; Player.ViewBob 1; + Player.TeleportFreezeTime 18; Obituary "$OB_MPDEFAULT"; } @@ -1700,6 +1703,23 @@ class PlayerPawn : Actor native } } + //=========================================================================== + // + // + // + //=========================================================================== + + virtual int GetTeleportFreezeTime() + { + if (TeleportFreezeTime <= 0) return 0; + let item = inv; + while (item != null) + { + if (item.GetNoTeleportFreeze()) return 0; + item = item.inv; + } + return TeleportFreezeTime; + } //---------------------------------------------------------------------------- // @@ -2009,7 +2029,6 @@ struct PlayerInfo native play // self is what internally is known as player_t return (mo.ViewHeight + crouchviewdelta - viewheight) / 8; } - } struct PlayerClass native