From 3d8d176087d9975824ed6fbbca182ca8b8e93e1c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 3 Oct 2009 17:07:11 +0000 Subject: [PATCH] - Added Gez's MageWandMissile customization patch but moved the new functionality into the FastProjectile base class and removed the native MageWandMissile class, using the generic functionality instead. - Fixed: GetReplacement and GetReplacee always checked the skill definitions, even if they weren't supposed to be used. It was also missing a range check for 'gameskill'. SVN r1894 (trunk) --- docs/rh-log.txt | 8 ++++ src/g_hexen/a_magelightning.cpp | 6 +-- src/g_hexen/a_magewand.cpp | 26 ------------- src/g_shared/a_fastprojectile.cpp | 15 ++++++++ src/info.cpp | 50 +++++++++++++++---------- src/namedef.h | 3 ++ wadsrc/static/actors/hexen/magewand.txt | 3 +- 7 files changed, 60 insertions(+), 51 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a381476193..ab1d13ce06 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,11 @@ +October 3, 2009 (Changes by Graf Zahl) +- Added Gez's MageWandMissile customization patch but moved the new functionality + into the FastProjectile base class and removed the native MageWandMissile + class, using the generic functionality instead. +- Fixed: GetReplacement and GetReplacee always checked the skill definitions, + even if they weren't supposed to be used. It was also missing a range check + for 'gameskill'. + October 2, 2009 (Changes by Graf Zahl) - fixed: Savegames stored the global fixed light levels when saving a player. diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 7231514b9f..9953cf1d04 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -208,8 +208,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip) DEFINE_ACTION_FUNCTION(AActor, A_LightningZap) { - const PClass *lightning=PClass::FindClass((ENamedName) self->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None)); - if (lightning == NULL) lightning = PClass::FindClass("LightningZap"); + const PClass *lightning=PClass::FindClass((ENamedName) self->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_LightningZap)); AActor *mo; fixed_t deltaZ; @@ -326,8 +325,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ZapMimic) DEFINE_ACTION_FUNCTION(AActor, A_LastZap) { - const PClass *lightning=PClass::FindClass((ENamedName) self->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None)); - if (lightning == NULL) lightning = PClass::FindClass("LightningZap"); + const PClass *lightning=PClass::FindClass((ENamedName) self->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_LightningZap)); AActor *mo; diff --git a/src/g_hexen/a_magewand.cpp b/src/g_hexen/a_magewand.cpp index b5d2aaa0f5..ab58f7ff8f 100644 --- a/src/g_hexen/a_magewand.cpp +++ b/src/g_hexen/a_magewand.cpp @@ -17,32 +17,6 @@ static FRandom pr_smoke ("MWandSmoke"); void A_MWandAttack (AActor *actor); -// Wand Missile ------------------------------------------------------------- - -class AMageWandMissile : public AFastProjectile -{ - DECLARE_CLASS(AMageWandMissile, AFastProjectile) -public: - void Effect (); -}; - -IMPLEMENT_CLASS (AMageWandMissile) - -void AMageWandMissile::Effect () -{ - fixed_t hitz; - - //if (pr_smoke() < 128) // [RH] I think it looks better if it's consistent - { - hitz = z-8*FRACUNIT; - if (hitz < floorz) - { - hitz = floorz; - } - Spawn ("MageWandSmoke", x, y, hitz, ALLOW_REPLACE); - } -} - //============================================================================ // // A_MWandAttack diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index 0127ed0d74..d3924a17e1 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -113,5 +113,20 @@ void AFastProjectile::Tick () void AFastProjectile::Effect() { + //if (pr_smoke() < 128) // [RH] I think it looks better if it's consistent + { + FName name = (ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None); + if (name != NAME_None) + { + fixed_t hitz = z-8*FRACUNIT; + if (hitz < floorz) + { + hitz = floorz; + } + + const PClass *trail = PClass::FindClass(name); + Spawn (trail, x, y, hitz, ALLOW_REPLACE); + } + } } diff --git a/src/info.cpp b/src/info.cpp index aeb89e8c92..116d4e603f 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -168,17 +168,22 @@ void FActorInfo::RegisterIDs () FActorInfo *FActorInfo::GetReplacement (bool lookskill) { - FName skillrepname = AllSkills[gameskill].GetReplacement(this->Class->TypeName); - if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL) + FName skillrepname; + + if (lookskill && AllSkills.Size() > (unsigned)gameskill) { - Printf("Warning: incorrect actor name in definition of skill %s: \n\ - class %s is replaced by inexistent class %s\n\ - Skill replacement will be ignored for this actor.\n", - AllSkills[gameskill].Name.GetChars(), - this->Class->TypeName.GetChars(), skillrepname.GetChars()); - AllSkills[gameskill].SetReplacement(this->Class->TypeName, NAME_None); - AllSkills[gameskill].SetReplacedBy(skillrepname, NAME_None); - lookskill = false; skillrepname = NAME_None; + skillrepname = AllSkills[gameskill].GetReplacement(this->Class->TypeName); + if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL) + { + Printf("Warning: incorrect actor name in definition of skill %s: \n" + "class %s is replaced by non-existent class %s\n" + "Skill replacement will be ignored for this actor.\n", + AllSkills[gameskill].Name.GetChars(), + this->Class->TypeName.GetChars(), skillrepname.GetChars()); + AllSkills[gameskill].SetReplacement(this->Class->TypeName, NAME_None); + AllSkills[gameskill].SetReplacedBy(skillrepname, NAME_None); + lookskill = false; skillrepname = NAME_None; + } } if (Replacement == NULL && (!lookskill || skillrepname == NAME_None)) { @@ -211,17 +216,22 @@ FActorInfo *FActorInfo::GetReplacement (bool lookskill) FActorInfo *FActorInfo::GetReplacee (bool lookskill) { - FName skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName); - if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL) + FName skillrepname; + + if (lookskill && AllSkills.Size() > (unsigned)gameskill) { - Printf("Warning: incorrect actor name in definition of skill %s: \ - inexistent class %s is replaced by class %s\n\ - Skill replacement will be ignored for this actor.\n", - AllSkills[gameskill].Name.GetChars(), - skillrepname.GetChars(), this->Class->TypeName.GetChars()); - AllSkills[gameskill].SetReplacedBy(this->Class->TypeName, NAME_None); - AllSkills[gameskill].SetReplacement(skillrepname, NAME_None); - lookskill = false; + FName skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName); + if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL) + { + Printf("Warning: incorrect actor name in definition of skill %s: \n" + "non-existent class %s is replaced by class %s\n" + "Skill replacement will be ignored for this actor.\n", + AllSkills[gameskill].Name.GetChars(), + skillrepname.GetChars(), this->Class->TypeName.GetChars()); + AllSkills[gameskill].SetReplacedBy(this->Class->TypeName, NAME_None); + AllSkills[gameskill].SetReplacement(skillrepname, NAME_None); + lookskill = false; + } } if (Replacee == NULL && (!lookskill || skillrepname == NAME_None)) { diff --git a/src/namedef.h b/src/namedef.h index 8510cd95b8..a00ca93f5d 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -129,6 +129,9 @@ xx(FWeapQuietus) xx(CWeapWraithverge) xx(MWeapBloodscourge) +// Misc Hexen classes +xx(LightningZap) + // Ammo and weapon names for the Strife status bar xx(ClipOfBullets) xx(PoisonBolts) diff --git a/wadsrc/static/actors/hexen/magewand.txt b/wadsrc/static/actors/hexen/magewand.txt index c3608b5d23..ebb8e2ca12 100644 --- a/wadsrc/static/actors/hexen/magewand.txt +++ b/wadsrc/static/actors/hexen/magewand.txt @@ -46,7 +46,7 @@ ACTOR MageWandSmoke // Wand Missile ------------------------------------------------------------- -ACTOR MageWandMissile : FastProjectile native +ACTOR MageWandMissile : FastProjectile { Speed 184 Radius 12 @@ -54,6 +54,7 @@ ACTOR MageWandMissile : FastProjectile native Damage 2 +RIPPER +CANNOTPUSH +NODAMAGETHRUST +SPAWNSOUNDSOURCE + MissileType "MageWandSmoke" SeeSound "MageWandFire" States {