mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- change teleport freeze handling to a player property plus virtual override on PlayerPawn for increased configurability.
This commit is contained in:
parent
337750b874
commit
b6d0d5008e
4 changed files with 28 additions and 54 deletions
|
@ -200,55 +200,6 @@ bool AInventory::Grind(bool items)
|
||||||
return Super::Grind(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
|
// AInventory :: Use
|
||||||
|
|
|
@ -83,7 +83,6 @@ public:
|
||||||
void DepleteOrDestroy (); // virtual on the script side.
|
void DepleteOrDestroy (); // virtual on the script side.
|
||||||
bool CallUse(bool pickup); // virtual on the script side.
|
bool CallUse(bool pickup); // virtual on the script side.
|
||||||
PalEntry CallGetBlend(); // 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 GetNoTeleportFreeze(); // virtual on the script side.
|
||||||
|
|
||||||
bool DoRespawn();
|
bool DoRespawn();
|
||||||
|
|
|
@ -203,9 +203,14 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
|
||||||
// [BC] && bHaltVelocity.
|
// [BC] && bHaltVelocity.
|
||||||
if (thing->player && ((flags & TELF_DESTFOG) || !(flags & TELF_KEEPORIENTATION)) && !(flags & TELF_KEEPVELOCITY))
|
if (thing->player && ((flags & TELF_DESTFOG) || !(flags & TELF_KEEPORIENTATION)) && !(flags & TELF_KEEPVELOCITY))
|
||||||
{
|
{
|
||||||
// Freeze player for about .5 sec
|
int time = 18;
|
||||||
if (thing->Inventory == NULL || !thing->Inventory->GetNoTeleportFreeze())
|
IFVIRTUALPTR(thing, APlayerPawn, GetTeleportFreezeTime)
|
||||||
thing->reactiontime = 18;
|
{
|
||||||
|
VMValue param = thing;
|
||||||
|
VMReturn ret(&time);
|
||||||
|
VMCall(func, ¶m, 1, &ret, 1);
|
||||||
|
}
|
||||||
|
thing->reactiontime = time;
|
||||||
}
|
}
|
||||||
if (thing->flags & MF_MISSILE)
|
if (thing->flags & MF_MISSILE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ class PlayerPawn : Actor native
|
||||||
|
|
||||||
meta Name HealingRadiusType;
|
meta Name HealingRadiusType;
|
||||||
meta Name InvulMode;
|
meta Name InvulMode;
|
||||||
|
meta int TeleportFreezeTime;
|
||||||
|
|
||||||
property prefix: Player;
|
property prefix: Player;
|
||||||
property HealRadiusType: HealingradiusType;
|
property HealRadiusType: HealingradiusType;
|
||||||
|
@ -69,6 +70,7 @@ class PlayerPawn : Actor native
|
||||||
property MorphWeapon: MorphWeapon;
|
property MorphWeapon: MorphWeapon;
|
||||||
property FlechetteType: FlechetteType;
|
property FlechetteType: FlechetteType;
|
||||||
property Portrait: Portrait;
|
property Portrait: Portrait;
|
||||||
|
property TeleportFreezeTime: TeleportFreezeTime;
|
||||||
|
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
|
@ -106,6 +108,7 @@ class PlayerPawn : Actor native
|
||||||
Player.FlechetteType "ArtiPoisonBag3";
|
Player.FlechetteType "ArtiPoisonBag3";
|
||||||
Player.AirCapacity 1;
|
Player.AirCapacity 1;
|
||||||
Player.ViewBob 1;
|
Player.ViewBob 1;
|
||||||
|
Player.TeleportFreezeTime 18;
|
||||||
Obituary "$OB_MPDEFAULT";
|
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;
|
return (mo.ViewHeight + crouchviewdelta - viewheight) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlayerClass native
|
struct PlayerClass native
|
||||||
|
|
Loading…
Reference in a new issue