- Added customizable mage lightning patch.

SVN r1574 (trunk)
This commit is contained in:
Randy Heit 2009-05-11 15:24:44 +00:00
parent 1c61ef89eb
commit b224765351
2 changed files with 21 additions and 8 deletions

View file

@ -51,7 +51,7 @@ int ALightning::SpecialMissileHit (AActor *thing)
P_DamageMobj(thing, this, target, 3, NAME_Electric); P_DamageMobj(thing, this, target, 3, NAME_Electric);
if (!(S_IsActorPlayingSomething (this, CHAN_WEAPON, -1))) if (!(S_IsActorPlayingSomething (this, CHAN_WEAPON, -1)))
{ {
S_Sound (this, CHAN_WEAPON, "MageLightningZap", 1, ATTN_NORM); S_Sound (this, CHAN_WEAPON, this->AttackSound, 1, ATTN_NORM);
} }
if (thing->flags3&MF3_ISMONSTER && pr_hit() < 64) if (thing->flags3&MF3_ISMONSTER && pr_hit() < 64)
{ {
@ -207,6 +207,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
DEFINE_ACTION_FUNCTION(AActor, A_LightningZap) 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");
AActor *mo; AActor *mo;
fixed_t deltaZ; fixed_t deltaZ;
@ -226,7 +229,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
{ {
deltaZ = -10*FRACUNIT; deltaZ = -10*FRACUNIT;
} }
mo = Spawn<ALightningZap> (self->x+((pr_zap()-128)*self->radius/256), mo = Spawn(lightning, self->x+((pr_zap()-128)*self->radius/256),
self->y+((pr_zap()-128)*self->radius/256), self->y+((pr_zap()-128)*self->radius/256),
self->z+deltaZ, ALLOW_REPLACE); self->z+deltaZ, ALLOW_REPLACE);
if (mo) if (mo)
@ -246,7 +249,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
} }
if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160) if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160)
{ {
S_Sound (self, CHAN_BODY, "MageLightningContinuous", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, self->ActiveSound, 1, ATTN_NORM);
} }
} }
@ -256,12 +259,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
// //
//============================================================================ //============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_MLightningAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MLightningAttack)
{ {
ACTION_PARAM_START(2);
ACTION_PARAM_CLASS(floor, 0);
ACTION_PARAM_CLASS(ceiling, 1);
AActor *fmo, *cmo; AActor *fmo, *cmo;
fmo = P_SpawnPlayerMissile (self, PClass::FindClass ("LightningFloor")); fmo = P_SpawnPlayerMissile (self, floor);
cmo = P_SpawnPlayerMissile (self, PClass::FindClass ("LightningCeiling")); cmo = P_SpawnPlayerMissile (self, ceiling);
if (fmo) if (fmo)
{ {
fmo->special1 = 0; fmo->special1 = 0;
@ -319,9 +326,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ZapMimic)
DEFINE_ACTION_FUNCTION(AActor, A_LastZap) 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");
AActor *mo; AActor *mo;
mo = Spawn<ALightningZap> (self->x, self->y, self->z, ALLOW_REPLACE); mo = Spawn(lightning, self->x, self->y, self->z, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->SetState (mo->FindState (NAME_Death)); mo->SetState (mo->FindState (NAME_Death));

View file

@ -14,7 +14,7 @@ ACTOR MWeapLightning : MageWeapon 8040
Inventory.PickupMessage "$TXT_WEAPON_M3" Inventory.PickupMessage "$TXT_WEAPON_M3"
action native A_LightningReady(); action native A_LightningReady();
action native A_MLightningAttack(); action native A_MLightningAttack(class<Actor> floor = "LightningFloor", class<Actor> ceiling = "LightningCeiling");
States States
{ {
@ -53,6 +53,9 @@ ACTOR MWeapLightning : MageWeapon 8040
ACTOR Lightning native ACTOR Lightning native
{ {
MissileType "LightningZap"
AttackSound "MageLightningZap"
ActiveSound "MageLightningContinuous"
} }
ACTOR LightningCeiling : Lightning ACTOR LightningCeiling : Lightning