From 43a71eba319ccaab49e5596785a51348d6ed0aa9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 27 Jun 2009 19:37:53 +0000 Subject: [PATCH] - Added Gez's submissions for A_M_Saw customization, area damage and pitch for A_FireCustomMissile. SVN r1685 (trunk) --- docs/rh-log.txt | 6 +++++- src/actor.h | 3 ++- src/g_doom/a_scriptedmarine.cpp | 22 +++++++++++++------- src/p_local.h | 3 ++- src/p_map.cpp | 25 ++++++++++++++--------- src/thingdef/thingdef_codeptr.cpp | 12 ++++++++--- src/thingdef/thingdef_data.cpp | 4 +++- wadsrc/static/actors/actor.txt | 4 ++-- wadsrc/static/actors/shared/inventory.txt | 2 +- 9 files changed, 54 insertions(+), 27 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 44e0f3baa..a202e6e9c 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ -June 26, 2009 +June 27, 2009 (Changes by Graf Zahl) +- Added Gez's submissions for A_M_Saw customization, area damage and + pitch for A_FireCustomMissile. + +June 26, 2009 - Attaching and detaching joysticks once again updates the joystick menu. - Added joystick axis -> button mapping. diff --git a/src/actor.h b/src/actor.h index 6e6ff0577..065d5c69a 100644 --- a/src/actor.h +++ b/src/actor.h @@ -261,7 +261,7 @@ enum MF4_SYNCHRONIZED = 0x00200000, // For actors spawned at load-time only: Do not randomize tics MF4_NOTARGETSWITCH = 0x00400000, // monster never switches target until current one is dead MF4_VFRICTION = 0x00800000, // Internal flag used by A_PainAttack to push a monster down - MF4_DONTHURTSPECIES = 0x01000000, // Don't hurt one's own kind with explosions (hitscans, too?) + MF4_DONTHARMCLASS = 0x01000000, // Don't hurt one's own kind with explosions (hitscans, too?) MF4_SHIELDREFLECT = 0x02000000, MF4_DEFLECT = 0x04000000, // different projectile reflection styles MF4_ALLOWPARTICLES = 0x08000000, // this puff type can be replaced by particles @@ -310,6 +310,7 @@ enum MF6_FORCEPAIN = 0x00000008, // forces target into painstate (unless it has the NOPAIN flag) MF6_NOFEAR = 0x00000010, // Not scared of frightening players MF6_BUMPSPECIAL = 0x00000020, // Actor executes its special when being collided (as the ST flag) + MF6_DONTHARMSPECIES = 0x00000040, // Don't hurt one's own species with explosions (hitscans, too?) // --- mobj.renderflags --- diff --git a/src/g_doom/a_scriptedmarine.cpp b/src/g_doom/a_scriptedmarine.cpp index 7ee65bad9..fbae607ca 100644 --- a/src/g_doom/a_scriptedmarine.cpp +++ b/src/g_doom/a_scriptedmarine.cpp @@ -247,31 +247,39 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineLook) // //============================================================================ -DEFINE_ACTION_FUNCTION(AActor, A_M_Saw) +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw) { + ACTION_PARAM_START(4); + ACTION_PARAM_SOUND(fullsound, 0); + ACTION_PARAM_SOUND(hitsound, 1); + ACTION_PARAM_INT(damage, 2); + ACTION_PARAM_CLASS(pufftype, 3); + if (self->target == NULL) return; + if (pufftype == NULL) pufftype = PClass::FindClass(NAME_BulletPuff); + if (damage == 0) damage = 2; + A_FaceTarget (self); if (self->CheckMeleeRange ()) { angle_t angle; - int damage; AActor *linetarget; - damage = 2 * (pr_m_saw()%10+1); + damage *= (pr_m_saw()%10+1); angle = self->angle + (pr_m_saw.Random2() << 18); P_LineAttack (self, angle, MELEERANGE+1, P_AimLineAttack (self, angle, MELEERANGE+1, &linetarget), damage, - NAME_Melee, NAME_BulletPuff); + NAME_Melee, pufftype); if (!linetarget) { - S_Sound (self, CHAN_WEAPON, "weapons/sawfull", 1, ATTN_NORM); + S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM); return; } - S_Sound (self, CHAN_WEAPON, "weapons/sawhit", 1, ATTN_NORM); + S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM); // turn to face target angle = R_PointToAngle2 (self->x, self->y, linetarget->x, linetarget->y); @@ -292,7 +300,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_Saw) } else { - S_Sound (self, CHAN_WEAPON, "weapons/sawfull", 1, ATTN_NORM); + S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM); } //A_Chase (self); } diff --git a/src/p_local.h b/src/p_local.h index 31c554e6c..cb9ab4a86 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -407,7 +407,8 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner); void P_AimCamera (AActor *t1, fixed_t &x, fixed_t &y, fixed_t &z, sector_t *&sec); // [RH] Means of death -void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, FName damageType, bool hurtSelf, bool dodamage=true); +void P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, + FName damageType, bool hurtSelf, bool dodamage=true, int fulldamagedistance=0); void P_DelSector_List(); void P_DelSeclist(msecnode_t *); // phares 3/16/98 diff --git a/src/p_map.cpp b/src/p_map.cpp index 689763ba3..df7974eba 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3907,13 +3907,15 @@ CUSTOM_CVAR (Float, splashfactor, 1.f, CVAR_SERVERINFO) // Source is the creature that caused the explosion at spot. // void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int bombdistance, FName bombmod, - bool DamageSource, bool bombdodamage) + bool DamageSource, bool bombdodamage, int fulldamagedistance) { if (bombdistance <= 0) return; + fulldamagedistance = clamp(fulldamagedistance, 0, bombdistance-1); - float bombdistancefloat = 1.f / (float)bombdistance; + float bombdistancefloat = 1.f / (float)(bombdistance - fulldamagedistance); float bombdamagefloat = (float)bombdamage; + FVector3 bombvec(FIXED2FLOAT(bombspot->x), FIXED2FLOAT(bombspot->y), FIXED2FLOAT(bombspot->z)); FBlockThingsIterator it(FBoundingBox(bombspot->x, bombspot->y, bombdistance<GetClass() == bombsource->GetClass() && - !thing->player && - bombsource->flags4 & MF4_DONTHURTSPECIES - ) continue; + // Controlled by the DONTHARMCLASS and DONTHARMSPECIES flags. + if ((bombsource && !thing->player) // code common to both checks + && ( // Class check first + ((bombsource->flags4 & MF4_DONTHARMCLASS) && (thing->GetClass() == bombsource->GetClass())) + || // Nigh-identical species check second + ((bombsource->flags6 & MF6_DONTHARMSPECIES) && (thing->GetSpecies() == bombsource->GetSpecies())) + ) + ) continue; // Barrels always use the original code, since this makes // them far too "active." BossBrains also use the old code @@ -3992,6 +3996,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b len = 0.f; } len /= FRACUNIT; + len = clamp(len - (float)fulldamagedistance, 0, len); points = bombdamagefloat * (1.f - len * bombdistancefloat); if (thing == bombsource) { @@ -4055,7 +4060,8 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b if (P_CheckSight (thing, bombspot, 1)) { // OK to damage; target is in direct path - int damage = Scale (bombdamage, bombdistance-dist, bombdistance); + dist = clamp(dist - fulldamagedistance, 0, dist); + int damage = Scale (bombdamage, bombdistance-dist, bombdistance-fulldamagedistance); damage = (int)((float)damage * splashfactor); damage = Scale(damage, thing->GetClass()->Meta.GetMetaFixed(AMETA_RDFactor, FRACUNIT), FRACUNIT); @@ -4070,7 +4076,6 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b } - // // SECTOR HEIGHT CHANGING // After modifying a sector's floor or ceiling height, diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index af898a697..d30c2c78f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -553,11 +553,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) { - ACTION_PARAM_START(4); + ACTION_PARAM_START(5); ACTION_PARAM_INT(damage, 0); ACTION_PARAM_INT(distance, 1); ACTION_PARAM_BOOL(hurtSource, 2); ACTION_PARAM_BOOL(alert, 3); + ACTION_PARAM_INT(fulldmgdistance, 4); if (damage < 0) // get parameters from metadata { @@ -571,7 +572,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) if (distance <= 0) distance = damage; } - P_RadiusAttack (self, self->target, damage, distance, self->DamageType, hurtSource); + P_RadiusAttack (self, self->target, damage, distance, self->DamageType, hurtSource, true, fulldmgdistance); if (self->z <= self->floorz + (distance<player) return; @@ -1007,7 +1009,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) if (AimAtAngle) shootangle+=Angle; + // Temporarily adjusts the pitch + fixed_t SavedPlayerPitch = self->pitch; + self->pitch -= pitch; AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &linetarget); + self->pitch = SavedPlayerPitch; // automatic handling of seeker missiles if (misl) { diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index cf77825a1..881ff5cc0 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -168,7 +168,8 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF4, NOSPLASHALERT, AActor, flags4), DEFINE_FLAG(MF4, SYNCHRONIZED, AActor, flags4), DEFINE_FLAG(MF4, NOTARGETSWITCH, AActor, flags4), - DEFINE_FLAG(MF4, DONTHURTSPECIES, AActor, flags4), + DEFINE_FLAG(MF4, DONTHARMCLASS, AActor, flags4), + DEFINE_FLAG2(MF4_DONTHARMCLASS, DONTHURTSPECIES, AActor, flags4), // Deprecated name as an alias DEFINE_FLAG(MF4, SHIELDREFLECT, AActor, flags4), DEFINE_FLAG(MF4, DEFLECT, AActor, flags4), DEFINE_FLAG(MF4, ALLOWPARTICLES, AActor, flags4), @@ -215,6 +216,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF6, FORCEPAIN, AActor, flags6), DEFINE_FLAG(MF6, NOFEAR, AActor, flags6), DEFINE_FLAG(MF6, BUMPSPECIAL, AActor, flags6), + DEFINE_FLAG(MF6, DONTHARMSPECIES, AActor, flags6), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 295672d93..8a40a3837 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -122,7 +122,7 @@ ACTOR Actor native //: Thinker action native A_SetFloat(); action native A_UnsetFloat(); - action native A_M_Saw(); + action native A_M_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff"); action native A_ScreamAndUnblock(); action native A_ActiveAndUnblock(); @@ -212,7 +212,7 @@ ACTOR Actor native //: Thinker action native A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); action native A_Burst(class chunktype); action native A_RadiusThrust(int force = 128, int distance = -1, bool affectsource = true); - action native A_Explode(int damage = -1, int distance = -1, bool hurtsource = true, bool alert = false); + action native A_Explode(int damage = -1, int distance = -1, bool hurtsource = true, bool alert = false, int fulldamagedistance = 0); action native A_Stop(); action native A_Respawn(bool fog = true); action native A_BarrelDestroy(); diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index bd084813b..b7fb53461 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -8,7 +8,7 @@ ACTOR Inventory native action native A_JumpIfNoAmmo(state label); action native A_CustomPunch(int damage, bool norandom = false, bool useammo = true, class pufftype = "BulletPuff", float range = 0); action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", bool useammo = true, float range = 0); - action native A_FireCustomMissile(class missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, bool aimatangle = false); + action native A_FireCustomMissile(class missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, bool aimatangle = false, float pitch = 0); action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", bool silent = false, float maxdiff = 0, class pufftype = "BulletPuff"); action native A_Light(int extralight); action native A_Light0();