- P_UndoPlayerMorph scriptified.
Not tested yet and still missing a new native interface.
This commit is contained in:
parent
192104aea2
commit
78d6832d14
10 changed files with 301 additions and 67 deletions
|
|
@ -105,7 +105,6 @@ public:
|
|||
void GiveDeathmatchInventory ();
|
||||
void FilterCoopRespawnInventory (APlayerPawn *oldplayer);
|
||||
|
||||
void SetupWeaponSlots ();
|
||||
void GiveDefaultInventory ();
|
||||
|
||||
// These are virtual on the script side only.
|
||||
|
|
|
|||
|
|
@ -382,31 +382,6 @@ DEFINE_ACTION_FUNCTION(AWeapon, DepleteAmmo)
|
|||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: PostMorphWeapon
|
||||
//
|
||||
// Bring this weapon up after a player unmorphs.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void AWeapon::PostMorphWeapon ()
|
||||
{
|
||||
DPSprite *pspr;
|
||||
if (Owner == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Owner->player->PendingWeapon = WP_NOCHANGE;
|
||||
Owner->player->ReadyWeapon = this;
|
||||
Owner->player->refire = 0;
|
||||
|
||||
pspr = Owner->player->GetPSprite(PSP_WEAPON);
|
||||
pspr->y = WEAPONBOTTOM;
|
||||
pspr->ResetInterpolation();
|
||||
pspr->SetState(GetUpState());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: GetUpState
|
||||
|
|
@ -1382,6 +1357,49 @@ void P_PlaybackKeyConfWeapons(FWeaponSlots *slots)
|
|||
PlayingKeyConf = nullptr;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APlayerPawn :: SetupWeaponSlots
|
||||
//
|
||||
// Sets up the default weapon slots for this player. If this is also the
|
||||
// local player, determines local modifications and sends those across the
|
||||
// network. Ignores voodoo dolls.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void FWeaponSlots::SetupWeaponSlots(APlayerPawn *pp)
|
||||
{
|
||||
auto player = pp->player;
|
||||
if (player != nullptr && player->mo == pp)
|
||||
{
|
||||
player->weapons.StandardSetup(pp->GetClass());
|
||||
// If we're the local player, then there's a bit more work to do.
|
||||
// This also applies if we're a bot and this is the net arbitrator.
|
||||
if (player - players == consoleplayer ||
|
||||
(player->Bot != nullptr && consoleplayer == Net_Arbitrator))
|
||||
{
|
||||
FWeaponSlots local_slots(player->weapons);
|
||||
if (player->Bot != nullptr)
|
||||
{ // Bots only need weapons from KEYCONF, not INI modifications.
|
||||
P_PlaybackKeyConfWeapons(&local_slots);
|
||||
}
|
||||
else
|
||||
{
|
||||
local_slots.LocalSetup(pp->GetClass());
|
||||
}
|
||||
local_slots.SendDifferences(int(player - players), player->weapons);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FWeaponSlots, SetupWeaponSlots)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(pawn, APlayerPawn);
|
||||
FWeaponSlots::SetupWeaponSlots(pawn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// P_SetupWeapons_ntohton
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "a_pickups.h"
|
||||
class PClassActor;
|
||||
class AWeapon;
|
||||
class APlayerPawn;
|
||||
|
||||
class FWeaponSlot
|
||||
{
|
||||
|
|
@ -71,6 +72,7 @@ struct FWeaponSlots
|
|||
void SendDifferences(int playernum, const FWeaponSlots &other);
|
||||
int RestoreSlots (FConfigFile *config, const char *section);
|
||||
void PrintSettings();
|
||||
static void SetupWeaponSlots(APlayerPawn *pp);
|
||||
|
||||
void AddSlot(int slot, PClassActor *type, bool feedback);
|
||||
void AddSlotDefault(int slot, PClassActor *type, bool feedback);
|
||||
|
|
@ -126,8 +128,6 @@ public:
|
|||
void Finalize(FStateDefinitions &statedef) override;
|
||||
void Serialize(FSerializer &arc) override;
|
||||
|
||||
void PostMorphWeapon();
|
||||
|
||||
// scripted virtuals.
|
||||
FState *GetUpState ();
|
||||
FState *GetDownState ();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,18 @@
|
|||
|
||||
static FRandom pr_morphmonst ("MorphMonster");
|
||||
|
||||
|
||||
bool P_MorphPlayer(player_t *activator, player_t *p, PClassActor *spawntype, int duration, int style, PClassActor *enter_flash, PClassActor *exit_flash)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool P_UndoPlayerMorph(player_t *activator, player_t *player, int unmorphflag, bool force)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void EndAllPowerupEffects(AInventory *item);
|
||||
void InitAllPowerupEffects(AInventory *item);
|
||||
|
||||
|
|
@ -336,7 +348,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
beastweap = player->ReadyWeapon;
|
||||
if (player->PremorphWeapon != nullptr)
|
||||
{
|
||||
player->PremorphWeapon->PostMorphWeapon ();
|
||||
player->PremorphWeapon-> P ostMorphWeapon ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -386,9 +398,11 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, UndoPlayerMorph)
|
|||
PARAM_POINTER_NOT_NULL(player, player_t);
|
||||
PARAM_INT(unmorphflag);
|
||||
PARAM_BOOL(force);
|
||||
ACTION_RETURN_BOOL(P_UndoPlayerMorph(self, player, unmorphflag, force));
|
||||
ACTION_RETURN_BOOL(P_UndoPlayerMorph(player, self, unmorphflag, force));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// FUNC P_MorphMonster
|
||||
|
|
|
|||
|
|
@ -1025,7 +1025,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
{
|
||||
if (playeringame[i] && players[i].mo != NULL)
|
||||
{
|
||||
players[i].mo->SetupWeaponSlots();
|
||||
FWeaponSlots::SetupWeaponSlots(players[i].mo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -916,7 +916,7 @@ void APlayerPawn::Tick()
|
|||
void APlayerPawn::PostBeginPlay()
|
||||
{
|
||||
Super::PostBeginPlay();
|
||||
SetupWeaponSlots();
|
||||
FWeaponSlots::SetupWeaponSlots(this);
|
||||
|
||||
// Voodoo dolls: restore original floorz/ceilingz logic
|
||||
if (player == NULL || player->mo != this)
|
||||
|
|
@ -931,40 +931,6 @@ void APlayerPawn::PostBeginPlay()
|
|||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APlayerPawn :: SetupWeaponSlots
|
||||
//
|
||||
// Sets up the default weapon slots for this player. If this is also the
|
||||
// local player, determines local modifications and sends those across the
|
||||
// network. Ignores voodoo dolls.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APlayerPawn::SetupWeaponSlots()
|
||||
{
|
||||
if (player != NULL && player->mo == this)
|
||||
{
|
||||
player->weapons.StandardSetup(GetClass());
|
||||
// If we're the local player, then there's a bit more work to do.
|
||||
// This also applies if we're a bot and this is the net arbitrator.
|
||||
if (player - players == consoleplayer ||
|
||||
(player->Bot != NULL && consoleplayer == Net_Arbitrator))
|
||||
{
|
||||
FWeaponSlots local_slots(player->weapons);
|
||||
if (player->Bot != NULL)
|
||||
{ // Bots only need weapons from KEYCONF, not INI modifications.
|
||||
P_PlaybackKeyConfWeapons(&local_slots);
|
||||
}
|
||||
else
|
||||
{
|
||||
local_slots.LocalSetup(GetClass());
|
||||
}
|
||||
local_slots.SendDifferences(int(player - players), player->weapons);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APlayerPawn :: AddInventory
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ PFunction *FindClassMemberFunction(PContainerType *selfcls, PContainerType *func
|
|||
auto cls_target = funcsym ? PType::toClass(funcsym->OwningClass) : nullptr;
|
||||
if (funcsym == nullptr)
|
||||
{
|
||||
if (PClass::FindClass(name)) return nullptr; // Special case when a class's member variable hides a global class name. This should still work.
|
||||
sc.Message(MSG_ERROR, "%s is not a member function of %s", name.GetChars(), selfcls->TypeName.GetChars());
|
||||
}
|
||||
else if ((funcsym->Variants[0].Flags & VARF_Private) && symtable != &funccls->Symbols)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue