This commit is contained in:
commit
8a198591f4
30 changed files with 749 additions and 776 deletions
|
|
@ -1753,7 +1753,7 @@ void C_MidPrintBold (FFont *font, const char *msg)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DObject, C_MidPrint)
|
||||
DEFINE_ACTION_FUNCTION(_Console, MidPrint)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(font);
|
||||
|
|
|
|||
|
|
@ -2109,6 +2109,11 @@ static int RemoveClass(const PClass *cls)
|
|||
player = true;
|
||||
continue;
|
||||
}
|
||||
// [SP] Don't remove owned inventory objects.
|
||||
if (static_cast<AInventory *>(actor)->Owner != NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
removecount++;
|
||||
actor->ClearCounters();
|
||||
actor->Destroy();
|
||||
|
|
|
|||
|
|
@ -249,363 +249,6 @@ void AWeapon::MarkPrecacheSounds() const
|
|||
ReadySound.MarkUsed();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: TryPickup
|
||||
//
|
||||
// If you can't see the weapon when it's active, then you can't pick it up.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::TryPickupRestricted (AActor *&toucher)
|
||||
{
|
||||
// Wrong class, but try to pick up for ammo
|
||||
if (CallShouldStay())
|
||||
{ // Can't pick up weapons for other classes in coop netplay
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gaveSome = (NULL != AddAmmo (toucher, AmmoType1, AmmoGive1));
|
||||
gaveSome |= (NULL != AddAmmo (toucher, AmmoType2, AmmoGive2));
|
||||
if (gaveSome)
|
||||
{
|
||||
GoAwayAndDie ();
|
||||
}
|
||||
return gaveSome;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: TryPickup
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::TryPickup (AActor *&toucher)
|
||||
{
|
||||
FState * ReadyState = FindState(NAME_Ready);
|
||||
if (ReadyState != NULL &&
|
||||
ReadyState->GetFrame() < sprites[ReadyState->sprite].numframes)
|
||||
{
|
||||
return Super::TryPickup (toucher);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: Use
|
||||
//
|
||||
// Make the player switch to this weapon.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::Use (bool pickup)
|
||||
{
|
||||
AWeapon *useweap = this;
|
||||
|
||||
// Powered up weapons cannot be used directly.
|
||||
if (WeaponFlags & WIF_POWERED_UP) return false;
|
||||
|
||||
// If the player is powered-up, use the alternate version of the
|
||||
// weapon, if one exists.
|
||||
if (SisterWeapon != NULL &&
|
||||
SisterWeapon->WeaponFlags & WIF_POWERED_UP &&
|
||||
Owner->FindInventory (PClass::FindActor(NAME_PowerWeaponLevel2), true))
|
||||
{
|
||||
useweap = SisterWeapon;
|
||||
}
|
||||
if (Owner->player != NULL && Owner->player->ReadyWeapon != useweap)
|
||||
{
|
||||
Owner->player->PendingWeapon = useweap;
|
||||
}
|
||||
// Return false so that the weapon is not removed from the inventory.
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: Destroy
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void AWeapon::OnDestroy()
|
||||
{
|
||||
AWeapon *sister = SisterWeapon;
|
||||
|
||||
if (sister != NULL)
|
||||
{
|
||||
// avoid recursion
|
||||
sister->SisterWeapon = NULL;
|
||||
if (sister != this)
|
||||
{ // In case we are our own sister, don't crash.
|
||||
sister->Destroy();
|
||||
}
|
||||
}
|
||||
Super::OnDestroy();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: HandlePickup
|
||||
//
|
||||
// Try to leach ammo from the weapon if you have it already.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::HandlePickup (AInventory *item)
|
||||
{
|
||||
if (item->GetClass() == GetClass())
|
||||
{
|
||||
if (static_cast<AWeapon *>(item)->PickupForAmmo (this))
|
||||
{
|
||||
item->ItemFlags |= IF_PICKUPGOOD;
|
||||
}
|
||||
if (MaxAmount > 1) //[SP] If amount<maxamount do another pickup test of the weapon itself!
|
||||
{
|
||||
return Super::HandlePickup (item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: PickupForAmmo
|
||||
//
|
||||
// The player already has this weapon, so try to pick it up for ammo.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::PickupForAmmo (AWeapon *ownedWeapon)
|
||||
{
|
||||
bool gotstuff = false;
|
||||
|
||||
// Don't take ammo if the weapon sticks around.
|
||||
if (!CallShouldStay ())
|
||||
{
|
||||
int oldamount1 = 0;
|
||||
int oldamount2 = 0;
|
||||
if (ownedWeapon->Ammo1 != NULL) oldamount1 = ownedWeapon->Ammo1->Amount;
|
||||
if (ownedWeapon->Ammo2 != NULL) oldamount2 = ownedWeapon->Ammo2->Amount;
|
||||
|
||||
if (AmmoGive1 > 0) gotstuff = AddExistingAmmo (ownedWeapon->Ammo1, AmmoGive1);
|
||||
if (AmmoGive2 > 0) gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2);
|
||||
|
||||
AActor *Owner = ownedWeapon->Owner;
|
||||
if (gotstuff && Owner != NULL && Owner->player != NULL)
|
||||
{
|
||||
if (ownedWeapon->Ammo1 != NULL && oldamount1 == 0)
|
||||
{
|
||||
static_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(ownedWeapon->Ammo1->GetClass());
|
||||
}
|
||||
else if (ownedWeapon->Ammo2 != NULL && oldamount2 == 0)
|
||||
{
|
||||
static_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(ownedWeapon->Ammo2->GetClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
return gotstuff;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: CreateCopy
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
AInventory *AWeapon::CreateCopy (AActor *other)
|
||||
{
|
||||
AWeapon *copy = static_cast<AWeapon*>(Super::CreateCopy (other));
|
||||
if (copy != this)
|
||||
{
|
||||
copy->AmmoGive1 = AmmoGive1;
|
||||
copy->AmmoGive2 = AmmoGive2;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: CreateTossable
|
||||
//
|
||||
// A weapon that's tossed out should contain no ammo, so you can't cheat
|
||||
// by dropping it and then picking it back up.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
AInventory *AWeapon::CreateTossable ()
|
||||
{
|
||||
// Only drop the weapon that is meant to be placed in a level. That is,
|
||||
// only drop the weapon that normally gives you ammo.
|
||||
if (SisterWeapon != NULL &&
|
||||
((AWeapon*)GetDefault())->AmmoGive1 == 0 &&
|
||||
((AWeapon*)GetDefault())->AmmoGive2 == 0 &&
|
||||
(((AWeapon*)SisterWeapon->GetDefault())->AmmoGive1 > 0 ||
|
||||
((AWeapon*)SisterWeapon->GetDefault())->AmmoGive2 > 0))
|
||||
{
|
||||
return SisterWeapon->CallCreateTossable ();
|
||||
}
|
||||
AWeapon *copy = static_cast<AWeapon *> (Super::CreateTossable ());
|
||||
|
||||
if (copy != NULL)
|
||||
{
|
||||
// If this weapon has a sister, remove it from the inventory too.
|
||||
if (SisterWeapon != NULL)
|
||||
{
|
||||
SisterWeapon->SisterWeapon = NULL;
|
||||
SisterWeapon->Destroy ();
|
||||
}
|
||||
// To avoid exploits, the tossed weapon must not have any ammo.
|
||||
copy->AmmoGive1 = 0;
|
||||
copy->AmmoGive2 = 0;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: AttachToOwner
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void AWeapon::AttachToOwner (AActor *other)
|
||||
{
|
||||
Super::AttachToOwner (other);
|
||||
|
||||
Ammo1 = AddAmmo (Owner, AmmoType1, AmmoGive1);
|
||||
Ammo2 = AddAmmo (Owner, AmmoType2, AmmoGive2);
|
||||
SisterWeapon = AddWeapon (SisterWeaponType);
|
||||
if (Owner->player != NULL)
|
||||
{
|
||||
if (!Owner->player->userinfo.GetNeverSwitch() && !(WeaponFlags & WIF_NO_AUTO_SWITCH))
|
||||
{
|
||||
Owner->player->PendingWeapon = this;
|
||||
}
|
||||
if (Owner->player->mo == players[consoleplayer].camera)
|
||||
{
|
||||
StatusBar->ReceivedWeapon (this);
|
||||
}
|
||||
}
|
||||
GivenAsMorphWeapon = false; // will be set explicitly by morphing code
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: AddAmmo
|
||||
//
|
||||
// Give some ammo to the owner, even if it's just 0.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
AInventory *AWeapon::AddAmmo (AActor *other, PClassActor *ammotype, int amount)
|
||||
{
|
||||
AInventory *ammo;
|
||||
|
||||
if (ammotype == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// [BC] This behavior is from the original Doom. Give 5/2 times as much ammo when
|
||||
// we pick up a weapon in deathmatch.
|
||||
if (( deathmatch ) && ( gameinfo.gametype & GAME_DoomChex ))
|
||||
amount = amount * 5 / 2;
|
||||
|
||||
// extra ammo in baby mode and nightmare mode
|
||||
if (!(this->ItemFlags&IF_IGNORESKILL))
|
||||
{
|
||||
amount = int(amount * G_SkillProperty(SKILLP_AmmoFactor));
|
||||
}
|
||||
ammo = other->FindInventory (ammotype);
|
||||
if (ammo == NULL)
|
||||
{
|
||||
ammo = static_cast<AInventory *>(Spawn (ammotype));
|
||||
ammo->Amount = MIN (amount, ammo->MaxAmount);
|
||||
ammo->AttachToOwner (other);
|
||||
}
|
||||
else if (ammo->Amount < ammo->MaxAmount)
|
||||
{
|
||||
ammo->Amount += amount;
|
||||
if (ammo->Amount > ammo->MaxAmount)
|
||||
{
|
||||
ammo->Amount = ammo->MaxAmount;
|
||||
}
|
||||
}
|
||||
return ammo;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: AddExistingAmmo
|
||||
//
|
||||
// Give the owner some more ammo he already has.
|
||||
//
|
||||
//===========================================================================
|
||||
EXTERN_CVAR(Bool, sv_unlimited_pickup)
|
||||
|
||||
bool AWeapon::AddExistingAmmo (AInventory *ammo, int amount)
|
||||
{
|
||||
if (ammo != NULL && (ammo->Amount < ammo->MaxAmount || sv_unlimited_pickup))
|
||||
{
|
||||
// extra ammo in baby mode and nightmare mode
|
||||
if (!(ItemFlags&IF_IGNORESKILL))
|
||||
{
|
||||
amount = int(amount * G_SkillProperty(SKILLP_AmmoFactor));
|
||||
}
|
||||
ammo->Amount += amount;
|
||||
if (ammo->Amount > ammo->MaxAmount && !sv_unlimited_pickup)
|
||||
{
|
||||
ammo->Amount = ammo->MaxAmount;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: AddWeapon
|
||||
//
|
||||
// Give the owner a weapon if they don't have it already.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
AWeapon *AWeapon::AddWeapon (PClassWeapon *weapontype)
|
||||
{
|
||||
AWeapon *weap;
|
||||
|
||||
if (weapontype == NULL || !weapontype->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
weap = static_cast<AWeapon *>(Owner->FindInventory (weapontype));
|
||||
if (weap == NULL)
|
||||
{
|
||||
weap = static_cast<AWeapon *>(Spawn (weapontype));
|
||||
weap->AttachToOwner (Owner);
|
||||
}
|
||||
return weap;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: ShouldStay
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::ShouldStay ()
|
||||
{
|
||||
if (((multiplayer &&
|
||||
(!deathmatch && !alwaysapplydmflags)) || (dmflags & DF_WEAPONS_STAY)) &&
|
||||
!(flags & MF_DROPPED))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: CheckAmmo
|
||||
|
|
@ -781,49 +424,6 @@ void AWeapon::PostMorphWeapon ()
|
|||
pspr->SetState(GetUpState());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: EndPowerUp
|
||||
//
|
||||
// The Tome of Power just expired.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void AWeapon::EndPowerup ()
|
||||
{
|
||||
if (SisterWeapon != NULL && WeaponFlags&WIF_POWERED_UP)
|
||||
{
|
||||
if (GetReadyState() != SisterWeapon->GetReadyState())
|
||||
{
|
||||
if (Owner->player->PendingWeapon == NULL ||
|
||||
Owner->player->PendingWeapon == WP_NOCHANGE)
|
||||
Owner->player->PendingWeapon = SisterWeapon;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPSprite *psp = Owner->player->FindPSprite(PSP_WEAPON);
|
||||
if (psp != nullptr && psp->GetCaller() == Owner->player->ReadyWeapon)
|
||||
{
|
||||
// If the weapon changes but the state does not, we have to manually change the PSprite's caller here.
|
||||
psp->SetCaller(SisterWeapon);
|
||||
Owner->player->ReadyWeapon = SisterWeapon;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something went wrong. Initiate a regular weapon change.
|
||||
Owner->player->PendingWeapon = SisterWeapon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AWeapon, EndPowerup)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AWeapon);
|
||||
self->EndPowerup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: GetUpState
|
||||
|
|
@ -936,65 +536,6 @@ FState *AWeapon::GetStateForButtonName (FName button)
|
|||
}
|
||||
|
||||
|
||||
/* Weapon giver ***********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(AWeaponGiver, false, false)
|
||||
|
||||
DEFINE_FIELD(AWeaponGiver, DropAmmoFactor);
|
||||
|
||||
void AWeaponGiver::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
auto def = (AWeaponGiver *)GetDefault();
|
||||
arc("dropammofactor", DropAmmoFactor, def->DropAmmoFactor);
|
||||
}
|
||||
|
||||
bool AWeaponGiver::TryPickup(AActor *&toucher)
|
||||
{
|
||||
DDropItem *di = GetDropItems();
|
||||
AWeapon *weap;
|
||||
|
||||
if (di != NULL)
|
||||
{
|
||||
PClassWeapon *ti = dyn_cast<PClassWeapon>(PClass::FindClass(di->Name));
|
||||
if (ti != NULL)
|
||||
{
|
||||
if (master == NULL)
|
||||
{
|
||||
master = weap = static_cast<AWeapon*>(Spawn(di->Name));
|
||||
if (weap != NULL)
|
||||
{
|
||||
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.
|
||||
weap->flags = (weap->flags & ~MF_DROPPED) | (this->flags & MF_DROPPED);
|
||||
|
||||
// If our ammo gives are non-negative, transfer them to the real weapon.
|
||||
if (AmmoGive1 >= 0) weap->AmmoGive1 = AmmoGive1;
|
||||
if (AmmoGive2 >= 0) weap->AmmoGive2 = AmmoGive2;
|
||||
|
||||
// If DropAmmoFactor is non-negative, modify the given ammo amounts.
|
||||
if (DropAmmoFactor > 0)
|
||||
{
|
||||
weap->AmmoGive1 = int(weap->AmmoGive1 * DropAmmoFactor);
|
||||
weap->AmmoGive2 = int(weap->AmmoGive2 * DropAmmoFactor);
|
||||
}
|
||||
weap->BecomeItem();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
weap = barrier_cast<AWeapon*>(master);
|
||||
bool res = weap->CallTryPickup(toucher);
|
||||
if (res)
|
||||
{
|
||||
GoAwayAndDie();
|
||||
master = NULL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Weapon slots ***********************************************************/
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -2079,48 +1620,3 @@ PClassWeapon *Net_ReadWeapon(BYTE **stream)
|
|||
return Weapons_ntoh[index];
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_ZoomFactor
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AWeapon, A_ZoomFactor)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AActor);
|
||||
PARAM_FLOAT_DEF(zoom);
|
||||
PARAM_INT_DEF(flags);
|
||||
|
||||
if (self->player != NULL && self->player->ReadyWeapon != NULL)
|
||||
{
|
||||
zoom = 1 / clamp(zoom, 0.1, 50.0);
|
||||
if (flags & 1)
|
||||
{ // Make the zoom instant.
|
||||
self->player->FOV = float(self->player->DesiredFOV * zoom);
|
||||
}
|
||||
if (flags & 2)
|
||||
{ // Disable pitch/yaw scaling.
|
||||
zoom = -zoom;
|
||||
}
|
||||
self->player->ReadyWeapon->FOVScale = float(zoom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SetCrosshair
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AWeapon, A_SetCrosshair)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AActor);
|
||||
PARAM_INT(xhair);
|
||||
|
||||
if (self->player != NULL && self->player->ReadyWeapon != NULL)
|
||||
{
|
||||
self->player->ReadyWeapon->Crosshair = xhair;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,17 +136,7 @@ public:
|
|||
virtual void MarkPrecacheSounds() const;
|
||||
|
||||
virtual void Serialize(FSerializer &arc) override;
|
||||
virtual bool ShouldStay () override;
|
||||
virtual void AttachToOwner (AActor *other) override;
|
||||
virtual bool HandlePickup (AInventory *item) override;
|
||||
virtual AInventory *CreateCopy (AActor *other) override;
|
||||
virtual AInventory *CreateTossable () override;
|
||||
virtual bool TryPickup (AActor *&toucher) override;
|
||||
virtual bool TryPickupRestricted (AActor *&toucher) override;
|
||||
virtual bool Use (bool pickup) override;
|
||||
virtual void OnDestroy() override;
|
||||
|
||||
bool PickupForAmmo(AWeapon *ownedWeapon);
|
||||
void PostMorphWeapon();
|
||||
|
||||
// scripted virtuals.
|
||||
|
|
@ -158,9 +148,6 @@ public:
|
|||
|
||||
FState *GetStateForButtonName (FName button);
|
||||
|
||||
|
||||
virtual void EndPowerup ();
|
||||
|
||||
enum
|
||||
{
|
||||
PrimaryFire,
|
||||
|
|
@ -180,10 +167,6 @@ public:
|
|||
BobInverseSmooth
|
||||
};
|
||||
|
||||
protected:
|
||||
AInventory *AddAmmo (AActor *other, PClassActor *ammotype, int amount);
|
||||
bool AddExistingAmmo (AInventory *ammo, int amount);
|
||||
AWeapon *AddWeapon (PClassWeapon *weapon);
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
@ -217,14 +200,3 @@ enum
|
|||
WIF_BOT_BFG = 1<<28, // this is a BFG
|
||||
};
|
||||
|
||||
class AWeaponGiver : public AWeapon
|
||||
{
|
||||
DECLARE_CLASS (AWeaponGiver, AWeapon)
|
||||
|
||||
public:
|
||||
virtual bool TryPickup(AActor *&toucher) override;
|
||||
virtual void Serialize(FSerializer &arc) override;
|
||||
|
||||
double DropAmmoFactor;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1673,6 +1673,15 @@ void DBaseStatusBar::ReceivedWeapon (AWeapon *weapon)
|
|||
{
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_StatusBar, ReceivedWeapon)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_POINTER(w, AWeapon);
|
||||
StatusBar->ReceivedWeapon(w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void DBaseStatusBar::SerializeMessages(FSerializer &arc)
|
||||
{
|
||||
arc.Array("hudmessages", Messages, 3, true);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, backpacktype)
|
|||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, Armor2Percent)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon1)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, ArmorIcon2)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gametype)
|
||||
|
||||
|
||||
const char *GameNames[17] =
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ void ADynamicLight::Activate(AActor *activator)
|
|||
m_cycler.SetCycleType(CYCLE_Sin);
|
||||
m_currentRadius = m_cycler.GetVal();
|
||||
}
|
||||
assert(m_currentRadius > 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public:
|
|||
void SetHalo(bool halo) { m_halo = halo; }
|
||||
protected:
|
||||
FName m_Name;
|
||||
unsigned char m_Args[5];
|
||||
int m_Args[5];
|
||||
double m_Param;
|
||||
DVector3 m_Pos;
|
||||
ELightType m_type;
|
||||
|
|
@ -159,7 +159,7 @@ FLightDefaults::FLightDefaults(FName name, ELightType type)
|
|||
m_type = type;
|
||||
|
||||
m_Pos.Zero();
|
||||
memset(m_Args, 0, 5);
|
||||
memset(m_Args, 0, sizeof(m_Args));
|
||||
m_Param = 0;
|
||||
|
||||
m_subtractive = false;
|
||||
|
|
@ -1195,8 +1195,8 @@ void gl_SetActorLights(AActor *actor)
|
|||
|
||||
for(;count<actor->dynamiclights.Size();count++)
|
||||
{
|
||||
actor->dynamiclights[count]->flags2|=MF2_DORMANT;
|
||||
memset(actor->dynamiclights[count]->args, 0, sizeof(actor->args));
|
||||
actor->dynamiclights[count]->flags2 |= MF2_DORMANT;
|
||||
memset(actor->dynamiclights[count]->args, 0, 3*sizeof(actor->args[0]));
|
||||
}
|
||||
All.Unclock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ xx(PuzzleItemNumber)
|
|||
xx(HealthPickup)
|
||||
xx(autousemode)
|
||||
xx(Ammo)
|
||||
xx(WeaponGiver)
|
||||
xx(PowerTargeter)
|
||||
xx(PowerInvulnerable)
|
||||
xx(PowerStrength)
|
||||
|
|
|
|||
|
|
@ -3248,9 +3248,9 @@ void ModifyDropAmount(AInventory *inv, int dropamount)
|
|||
inv->Amount = amount;
|
||||
inv->ItemFlags |= flagmask;
|
||||
}
|
||||
else if (inv->IsKindOf (RUNTIME_CLASS(AWeaponGiver)))
|
||||
else if (inv->IsKindOf (PClass::FindActor(NAME_WeaponGiver)))
|
||||
{
|
||||
static_cast<AWeaponGiver *>(inv)->DropAmmoFactor = dropammofactor;
|
||||
inv->FloatVar("AmmoFactor") = dropammofactor;
|
||||
inv->ItemFlags |= flagmask;
|
||||
}
|
||||
else if (inv->IsKindOf (RUNTIME_CLASS(AWeapon)))
|
||||
|
|
|
|||
192
src/p_pspr.cpp
192
src/p_pspr.cpp
|
|
@ -36,7 +36,6 @@
|
|||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
#define LOWERSPEED 6.
|
||||
#define RAISESPEED 6.
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
|
|
@ -511,6 +510,13 @@ void P_BringUpWeapon (player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_PlayerInfo, BringUpWeapon)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(player_t);
|
||||
P_BringUpWeapon(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC P_FireWeapon
|
||||
|
|
@ -607,6 +613,12 @@ void P_DropWeapon (player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_PlayerInfo, DropWeapon)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(player_t);
|
||||
P_DropWeapon(self);
|
||||
return 0;
|
||||
}
|
||||
//============================================================================
|
||||
//
|
||||
// P_BobWeapon
|
||||
|
|
@ -1003,40 +1015,6 @@ void A_ReFire(AActor *self, FState *state)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AStateProvider, A_ClearReFire)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AStateProvider);
|
||||
player_t *player = self->player;
|
||||
|
||||
if (NULL != player)
|
||||
{
|
||||
player->refire = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_CheckReload
|
||||
//
|
||||
// Present in Doom, but unused. Also present in Strife, and actually used.
|
||||
// This and what I call A_XBowReFire are actually the same thing in Strife,
|
||||
// not two separate functions as I have them here.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AStateProvider, A_CheckReload)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AStateProvider);
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
self->player->ReadyWeapon->CheckAmmo (
|
||||
self->player->ReadyWeapon->bAltFire ? AWeapon::AltFire
|
||||
: AWeapon::PrimaryFire, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
|
@ -1272,95 +1250,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayRenderStyle)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_Lower
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AStateProvider, A_Lower)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AStateProvider);
|
||||
|
||||
player_t *player = self->player;
|
||||
DPSprite *psp;
|
||||
|
||||
if (nullptr == player)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (nullptr == player->ReadyWeapon)
|
||||
{
|
||||
P_BringUpWeapon(player);
|
||||
return 0;
|
||||
}
|
||||
psp = player->GetPSprite(PSP_WEAPON);
|
||||
if (player->morphTics || player->cheats & CF_INSTANTWEAPSWITCH)
|
||||
{
|
||||
psp->y = WEAPONBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
psp->y += LOWERSPEED;
|
||||
}
|
||||
if (psp->y < WEAPONBOTTOM)
|
||||
{ // Not lowered all the way yet
|
||||
return 0;
|
||||
}
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{ // Player is dead, so don't bring up a pending weapon
|
||||
// Player is dead, so keep the weapon off screen
|
||||
P_SetPsprite(player, PSP_FLASH, nullptr);
|
||||
psp->SetState(player->ReadyWeapon->FindState(NAME_DeadLowered));
|
||||
return 0;
|
||||
}
|
||||
// [RH] Clear the flash state. Only needed for Strife.
|
||||
P_SetPsprite(player, PSP_FLASH, nullptr);
|
||||
P_BringUpWeapon (player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_Raise
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AStateProvider, A_Raise)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AStateProvider);
|
||||
|
||||
if (self == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
player_t *player = self->player;
|
||||
DPSprite *psp;
|
||||
|
||||
if (nullptr == player)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (player->PendingWeapon != WP_NOCHANGE)
|
||||
{
|
||||
P_DropWeapon(player);
|
||||
return 0;
|
||||
}
|
||||
if (player->ReadyWeapon == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
psp = player->GetPSprite(PSP_WEAPON);
|
||||
psp->y -= RAISESPEED;
|
||||
if (psp->y > WEAPONTOP)
|
||||
{ // Not raised all the way yet
|
||||
return 0;
|
||||
}
|
||||
psp->y = WEAPONTOP;
|
||||
psp->SetState(player->ReadyWeapon->GetReadyState());
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC A_Overlay
|
||||
|
|
@ -1430,47 +1319,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearOverlays)
|
|||
ACTION_RETURN_INT(count);
|
||||
}
|
||||
|
||||
//
|
||||
// A_GunFlash
|
||||
//
|
||||
enum GF_Flags
|
||||
{
|
||||
GFF_NOEXTCHANGE = 1,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AStateProvider, A_GunFlash)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE(AStateProvider);
|
||||
PARAM_STATE_ACTION_DEF(flash);
|
||||
PARAM_INT_DEF(flags);
|
||||
|
||||
player_t *player = self->player;
|
||||
|
||||
if (nullptr == player)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (!(flags & GFF_NOEXTCHANGE))
|
||||
{
|
||||
player->mo->PlayAttacking2 ();
|
||||
}
|
||||
if (flash == nullptr)
|
||||
{
|
||||
if (player->ReadyWeapon->bAltFire)
|
||||
{
|
||||
flash = player->ReadyWeapon->FindState(NAME_AltFlash);
|
||||
}
|
||||
if (flash == nullptr)
|
||||
{
|
||||
flash = player->ReadyWeapon->FindState(NAME_Flash);
|
||||
}
|
||||
}
|
||||
P_SetPsprite(player, PSP_FLASH, flash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// WEAPON ATTACKS
|
||||
//
|
||||
|
|
@ -1516,20 +1364,6 @@ DEFINE_ACTION_FUNCTION(AActor, BulletSlope)
|
|||
ACTION_RETURN_FLOAT(P_BulletSlope(self, t, aimflags).Degrees);
|
||||
}
|
||||
|
||||
|
||||
AActor *P_AimTarget(AActor *mo)
|
||||
{
|
||||
FTranslatedLineTarget t;
|
||||
P_BulletSlope(mo, &t, ALF_PORTALRESTRICT);
|
||||
return t.linetarget;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, AimTarget)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
ACTION_RETURN_OBJECT(P_AimTarget(self));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
//
|
||||
// PROC P_SetupPsprites
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "v_text.h"
|
||||
#include "thingdef.h"
|
||||
#include "r_state.h"
|
||||
|
||||
|
||||
// stores indices for symbolic state labels for some old-style DECORATE functions.
|
||||
FStateLabelStorage StateLabels;
|
||||
|
|
@ -1092,3 +1094,9 @@ DEFINE_ACTION_FUNCTION(FState, DistanceTo)
|
|||
}
|
||||
ACTION_RETURN_INT(retv);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FState, ValidateSpriteFrame)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FState);
|
||||
ACTION_RETURN_BOOL(self->Frame < sprites[self->sprite].numframes);
|
||||
}
|
||||
|
|
@ -643,6 +643,11 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetUserName)
|
|||
ACTION_RETURN_STRING(self->userinfo.GetName());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetNeverSwitch)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(player_t);
|
||||
ACTION_RETURN_BOOL(self->userinfo.GetNeverSwitch());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -2359,7 +2359,6 @@ FxExpression *FxAssign::Resolve(FCompileContext &ctx)
|
|||
ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
static const BYTE loadops[] = { OP_LK, OP_LKF, OP_LKS, OP_LKP };
|
||||
assert(ValueType == Base->ValueType);
|
||||
assert(ValueType->GetRegType() == Right->ValueType->GetRegType());
|
||||
|
||||
ExpEmit pointer = Base->Emit(build);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue