- Fixed: The global WeaponSection string was never freed. It has been replaced

with an FString now.
- Fixed: The music strings in the default level info were never freed and
  caused memory leaks when used repeatedly.
- Fixed: The intermusic string in the level info was never freed.
- Fixed: The default fire obituary should only be printed if the damage
  came from the environment. If it comes from a monster the monster specific
  obituary should be used instead.
- Added custom damage types from the floating point test release.
- Changed Pain Elemental's massacre check. Now A_PainDie checks for the damage 
  type and doesn't spawn anything if it is NAME_Massacre. A_PainDie can also 
  be used by other actors so a more generalized approach is needed than hard
  coding it into the Pain Elemental.
- Converted a few of Doom's monsters to DECORATE because I couldn't test the
  first version of the custom state code with the corpses inheriting from them.
- Added custom states from last year's floating point test release and fixed
  some bugs I found in that code. Unfortunately it wasn't all salvageable
  and it was easier to recreate some parts from scratch.



SVN r368 (trunk)
This commit is contained in:
Christoph Oelckers 2006-10-31 14:53:21 +00:00
commit 063c85b157
118 changed files with 2103 additions and 1818 deletions

View file

@ -60,7 +60,7 @@ IMPLEMENT_ACTOR (AIceChunkHead, Any, -1, 0)
PROP_RadiusFixed (3)
PROP_HeightFixed (4)
PROP_Mass(5)
PROP_DamageType (MOD_ICE)
PROP_DamageType (NAME_Ice)
PROP_Flags (MF_DROPOFF)
PROP_Flags2 (MF2_LOGRAV|MF2_CANNOTPUSH)
@ -214,11 +214,11 @@ void A_IceSetTics (AActor *actor)
actor->tics = 70+(pr_icesettics()&63);
floor = P_GetThingFloorType (actor);
if (Terrains[floor].DamageMOD == MOD_FIRE)
if (Terrains[floor].DamageMOD == NAME_Fire)
{
actor->tics >>= 2;
}
else if (Terrains[floor].DamageMOD == MOD_ICE)
else if (Terrains[floor].DamageMOD == NAME_Ice)
{
actor->tics <<= 1;
}

View file

@ -551,9 +551,9 @@ END_DEFAULTS
//
//===========================================================================
void APowerIronFeet::AbsorbDamage (int damage, int damageType, int &newdamage)
void APowerIronFeet::AbsorbDamage (int damage, FName damageType, int &newdamage)
{
if (damageType == MOD_WATER)
if (damageType == NAME_Water)
{
newdamage = 0;
if (Owner->player != NULL)
@ -582,9 +582,9 @@ END_DEFAULTS
//
//===========================================================================
void APowerMask::AbsorbDamage (int damage, int damageType, int &newdamage)
void APowerMask::AbsorbDamage (int damage, FName damageType, int &newdamage)
{
if (damageType == MOD_FIRE)
if (damageType == NAME_Fire)
{
newdamage = 0;
}

View file

@ -104,14 +104,14 @@ class APowerIronFeet : public APowerup
{
DECLARE_STATELESS_ACTOR (APowerIronFeet, APowerup)
public:
void AbsorbDamage (int damage, int damageType, int &newdamage);
void AbsorbDamage (int damage, FName damageType, int &newdamage);
};
class APowerMask : public APowerIronFeet
{
DECLARE_STATELESS_ACTOR (APowerMask, APowerIronFeet)
public:
void AbsorbDamage (int damage, int damageType, int &newdamage);
void AbsorbDamage (int damage, FName damageType, int &newdamage);
void DoEffect ();
};

View file

@ -43,7 +43,7 @@ class AHateTarget : public AActor
public:
void BeginPlay ();
angle_t AngleIncrements (void);
int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype);
int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype);
};
FState AHateTarget::States[] =
@ -76,7 +76,7 @@ void AHateTarget::BeginPlay ()
}
}
int AHateTarget::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, int damagetype)
int AHateTarget::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype)
{
if (special2 != 0)
{

View file

@ -764,7 +764,7 @@ void AInventory::BecomePickup ()
//
//===========================================================================
void AInventory::AbsorbDamage (int damage, int damageType, int &newdamage)
void AInventory::AbsorbDamage (int damage, FName damageType, int &newdamage)
{
if (Inventory != NULL)
{
@ -1250,18 +1250,6 @@ void AInventory::DetachFromOwner ()
IMPLEMENT_STATELESS_ACTOR (ACustomInventory, Any, -1, 0)
END_DEFAULTS
//===========================================================================
//
// ACustomInventory :: Serialize
//
//===========================================================================
void ACustomInventory::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << UseState << PickupState << DropState;
}
//===========================================================================
//
// ACustomInventory :: SpecialDropAction
@ -1270,7 +1258,7 @@ void ACustomInventory::Serialize (FArchive &arc)
bool ACustomInventory::SpecialDropAction (AActor *dropper)
{
return CallStateChain (dropper, DropState);
return CallStateChain (dropper, FindState(NAME_Drop));
}
//===========================================================================
@ -1281,7 +1269,7 @@ bool ACustomInventory::SpecialDropAction (AActor *dropper)
bool ACustomInventory::Use (bool pickup)
{
return CallStateChain (Owner, UseState);
return CallStateChain (Owner, FindState(NAME_Use));
}
//===========================================================================
@ -1292,8 +1280,9 @@ bool ACustomInventory::Use (bool pickup)
bool ACustomInventory::TryPickup (AActor *toucher)
{
bool useok = CallStateChain (toucher, PickupState);
if ((useok || PickupState == NULL) && UseState != NULL)
FState *pickupstate = FindState(NAME_Pickup);
bool useok = CallStateChain (toucher, pickupstate);
if ((useok || pickupstate == NULL) && FindState(NAME_Use) != NULL)
{
useok = Super::TryPickup (toucher);
}
@ -1561,9 +1550,9 @@ bool ABasicArmor::HandlePickup (AInventory *item)
//
//===========================================================================
void ABasicArmor::AbsorbDamage (int damage, int damageType, int &newdamage)
void ABasicArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
{
if (damageType != MOD_WATER)
if (damageType != NAME_Water)
{
int saved = FixedMul (damage, SavePercent);
if (Amount < saved)
@ -1725,9 +1714,9 @@ bool AHexenArmor::AddArmorToSlot (AActor *actor, int slot, int amount)
//
//===========================================================================
void AHexenArmor::AbsorbDamage (int damage, int damageType, int &newdamage)
void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
{
if (damageType != MOD_WATER)
if (damageType != NAME_Water)
{
fixed_t savedPercent = Slots[0] + Slots[1] + Slots[2] + Slots[3] + Slots[4];
APlayerPawn *ppawn = Owner->player != NULL ? Owner->player->mo : NULL;

View file

@ -149,7 +149,7 @@ public:
virtual void Travelled ();
virtual void OwnerDied ();
virtual void AbsorbDamage (int damage, int damageType, int &newdamage);
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
virtual void AlterWeaponSprite (vissprite_t *vis);
virtual PalEntry GetBlend ();
@ -167,12 +167,10 @@ class ACustomInventory : public AInventory
{
DECLARE_STATELESS_ACTOR (ACustomInventory, AInventory)
public:
FState *UseState, *PickupState, *DropState;
// This is used when an inventory item's use state sequence is executed.
static bool CallStateChain (AActor *actor, FState *state);
void Serialize (FArchive &arc);
bool TryPickup (AActor *toucher);
bool Use (bool pickup);
bool SpecialDropAction (AActor *dropper);
@ -211,13 +209,6 @@ public:
int SelectionOrder; // Lower-numbered weapons get picked first
fixed_t MoveCombatDist; // Used by bots, but do they *really* need it?
FState *UpState;
FState *DownState;
FState *ReadyState;
FState *AtkState, *HoldAtkState;
FState *AltAtkState, *AltHoldAtkState;
FState *FlashState, *AltFlashState;
// In-inventory instance variables
AAmmo *Ammo1, *Ammo2;
AWeapon *SisterWeapon;
@ -237,8 +228,8 @@ public:
virtual FState *GetUpState ();
virtual FState *GetDownState ();
virtual FState *GetReadyState ();
virtual FState *GetAtkState ();
virtual FState *GetHoldAtkState ();
virtual FState *GetAtkState (bool hold);
virtual FState *GetAltAtkState (bool hold);
virtual void PostMorphWeapon ();
virtual void EndPowerup ();
@ -326,7 +317,7 @@ public:
virtual void Tick ();
virtual AInventory *CreateCopy (AActor *other);
virtual bool HandlePickup (AInventory *item);
virtual void AbsorbDamage (int damage, int damageType, int &newdamage);
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
fixed_t SavePercent;
};
@ -368,7 +359,7 @@ public:
virtual AInventory *CreateCopy (AActor *other);
virtual AInventory *CreateTossable ();
virtual bool HandlePickup (AInventory *item);
virtual void AbsorbDamage (int damage, int damageType, int &newdamage);
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
fixed_t Slots[5];
fixed_t SlotsIncrement[4];

View file

@ -96,7 +96,7 @@ void DEarthquake::Tick ()
{
if (pr_quake() < 50)
{
P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), MOD_UNKNOWN);
P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None);
}
// Thrust player around
angle_t an = victim->angle + ANGLE_1*pr_quake();

View file

@ -52,10 +52,6 @@ void AWeapon::Serialize (FArchive &arc)
<< ProjectileType << AltProjectileType
<< SelectionOrder
<< MoveCombatDist
<< UpState << DownState << ReadyState
<< AtkState << HoldAtkState
<< AltAtkState << AltHoldAtkState
<< FlashState << AltFlashState
<< Ammo1 << Ammo2 << SisterWeapon
<< bAltFire;
}
@ -70,6 +66,7 @@ void AWeapon::Serialize (FArchive &arc)
bool AWeapon::TryPickup (AActor *toucher)
{
FState * ReadyState = FindState(NAME_Ready);
if (ReadyState != NULL &&
ReadyState->GetFrame() < sprites[ReadyState->sprite.index].numframes)
{
@ -394,7 +391,7 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo)
{
enoughmask = 1 << altFire;
}
if (altFire && AltAtkState == NULL)
if (altFire && FindState(NAME_AltFire) == NULL)
{ // If this weapon has no alternate fire, then there is never enough ammo for it
enough &= 1;
}
@ -472,7 +469,7 @@ void AWeapon::PostMorphWeapon ()
Owner->player->PendingWeapon = WP_NOCHANGE;
Owner->player->ReadyWeapon = this;
Owner->player->psprites[ps_weapon].sy = WEAPONBOTTOM;
P_SetPsprite (Owner->player, ps_weapon, UpState);
P_SetPsprite (Owner->player, ps_weapon, GetUpState());
}
//===========================================================================
@ -487,7 +484,7 @@ void AWeapon::EndPowerup ()
{
if (SisterWeapon != NULL && WeaponFlags&WIF_POWERED_UP)
{
if (ReadyState != SisterWeapon->ReadyState)
if (GetReadyState() != SisterWeapon->GetReadyState())
{
Owner->player->PendingWeapon = SisterWeapon;
}
@ -506,7 +503,7 @@ void AWeapon::EndPowerup ()
FState *AWeapon::GetUpState ()
{
return UpState;
return FindState(NAME_Select);
}
//===========================================================================
@ -517,7 +514,7 @@ FState *AWeapon::GetUpState ()
FState *AWeapon::GetDownState ()
{
return DownState;
return FindState(NAME_Deselect);
}
//===========================================================================
@ -528,7 +525,7 @@ FState *AWeapon::GetDownState ()
FState *AWeapon::GetReadyState ()
{
return ReadyState;
return FindState(NAME_Ready);
}
//===========================================================================
@ -537,20 +534,28 @@ FState *AWeapon::GetReadyState ()
//
//===========================================================================
FState *AWeapon::GetAtkState ()
FState *AWeapon::GetAtkState (bool hold)
{
return AtkState;
FState * state=NULL;
if (hold) state = FindState(NAME_Hold);
if (state == NULL) state = FindState(NAME_Fire);
return state;
}
//===========================================================================
//
// AWeapon :: GetHoldAtkState
// AWeapon :: GetAtkState
//
//===========================================================================
FState *AWeapon::GetHoldAtkState ()
FState *AWeapon::GetAltAtkState (bool hold)
{
return HoldAtkState;
FState * state=NULL;
if (hold) state = FindState(NAME_AltHold);
if (state == NULL) state = FindState(NAME_AltFire);
return state;
}
/* Weapon slots ***********************************************************/
@ -792,7 +797,7 @@ CCMD (setslot)
{
int slot, i;
if (ParsingKeyConf && !WeaponSection)
if (ParsingKeyConf && WeaponSection.IsEmpty())
{
Printf ("You need to use weaponsection before using setslot\n");
return;
@ -861,7 +866,7 @@ CCMD (weaponsection)
{
argv[1][32] = 0;
}
ReplaceString (&WeaponSection, argv[1]);
WeaponSection = argv[1];
// If the ini already has definitions for this section, load them
char fullSection[32*3];
@ -888,7 +893,7 @@ CCMD (weaponsection)
tackOn = fullSection + 4;
}
sprintf (tackOn, ".%s.WeaponSlots", WeaponSection);
sprintf (tackOn, ".%s.WeaponSlots", WeaponSection.GetChars());
if (GameConfig->SetSection (fullSection))
{
LocalWeapons.RestoreSlots (*GameConfig);
@ -907,7 +912,7 @@ CCMD (addslotdefault)
return;
}
if (ParsingKeyConf && !WeaponSection)
if (ParsingKeyConf && WeaponSection.IsEmpty())
{
Printf ("You need to use weaponsection before using addslotdefault\n");
return;

View file

@ -1366,7 +1366,7 @@ void FBaseStatusBar::BlendView (float blend[4])
{
AddBlend (0.f, 1.f, 0.f, 0.125f, blend);
}
if (CPlayer->mo->DamageType == MOD_ICE)
if (CPlayer->mo->DamageType == NAME_Ice)
{
AddBlend (0.25f, 0.25f, 0.853f, 0.4f, blend);
}