- Added Gez's submissions for A_M_Saw customization, area damage and

pitch for A_FireCustomMissile.


SVN r1685 (trunk)
This commit is contained in:
Christoph Oelckers 2009-06-27 19:37:53 +00:00
parent a687a61c76
commit 43a71eba31
9 changed files with 54 additions and 27 deletions

View file

@ -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.

View file

@ -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 ---

View file

@ -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);
}

View file

@ -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

View file

@ -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<int>(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<<FRACBITS));
@ -3936,11 +3938,13 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
// a much needed option: monsters that fire explosive projectiles cannot
// be hurt by projectiles fired by a monster of the same type.
// Controlled by the DONTHURTSPECIES flag.
if (bombsource &&
thing->GetClass() == bombsource->GetClass() &&
!thing->player &&
bombsource->flags4 & MF4_DONTHURTSPECIES
// 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
@ -3992,6 +3996,7 @@ void P_RadiusAttack (AActor *bombspot, AActor *bombsource, int bombdamage, int b
len = 0.f;
}
len /= FRACUNIT;
len = clamp<float>(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<int>(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,

View file

@ -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<<FRACBITS))
{
P_HitFloor (self);
@ -978,13 +979,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
{
ACTION_PARAM_START(6);
ACTION_PARAM_START(7);
ACTION_PARAM_CLASS(ti, 0);
ACTION_PARAM_ANGLE(Angle, 1);
ACTION_PARAM_BOOL(UseAmmo, 2);
ACTION_PARAM_INT(SpawnOfs_XY, 3);
ACTION_PARAM_FIXED(SpawnHeight, 4);
ACTION_PARAM_BOOL(AimAtAngle, 5);
ACTION_PARAM_ANGLE(pitch, 6);
if (!self->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)
{

View file

@ -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),

View file

@ -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<Actor> pufftype = "BulletPuff");
action native A_ScreamAndUnblock();
action native A_ActiveAndUnblock();
@ -212,7 +212,7 @@ ACTOR Actor native //: Thinker
action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
action native A_Burst(class<Actor> 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();

View file

@ -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<Actor> pufftype = "BulletPuff", float range = 0);
action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", bool useammo = true, float range = 0);
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, bool aimatangle = false);
action native A_FireCustomMissile(class<Actor> 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<Actor> pufftype = "BulletPuff");
action native A_Light(int extralight);
action native A_Light0();