mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-05-31 17:31:09 +00:00
* Updated to ZDoom r2456:
- Added DavidPH's code submission: explicit angle for A_CustomBulletAttack function, A_Saw extension, A_RailAttack extension, and A_JumpIfTargetInLOS extension. - added PinkSilver's APROP_MasterTid submission. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@850 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
80539d2297
commit
0a35f861ce
9 changed files with 334 additions and 71 deletions
|
@ -100,52 +100,88 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
|
|||
//
|
||||
// A_Saw
|
||||
//
|
||||
enum SAW_Flags
|
||||
{
|
||||
SF_NORANDOM = 1,
|
||||
SF_RANDOMLIGHTMISS = 2,
|
||||
SF_RANDOMLIGHTHIT = 4,
|
||||
SF_NOUSEAMMOMISS = 8,
|
||||
SF_NOUSEAMMO = 16,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
|
||||
{
|
||||
angle_t angle;
|
||||
angle_t slope;
|
||||
player_t *player;
|
||||
AActor *linetarget;
|
||||
|
||||
ACTION_PARAM_START(4);
|
||||
ACTION_PARAM_START(9);
|
||||
ACTION_PARAM_SOUND(fullsound, 0);
|
||||
ACTION_PARAM_SOUND(hitsound, 1);
|
||||
ACTION_PARAM_INT(damage, 2);
|
||||
ACTION_PARAM_CLASS(pufftype, 3);
|
||||
ACTION_PARAM_FIXED(Range, 4)
|
||||
ACTION_PARAM_FIXED(LifeSteal, 5);
|
||||
ACTION_PARAM_INT(Flags, 4);
|
||||
ACTION_PARAM_FIXED(Range, 5);
|
||||
ACTION_PARAM_ANGLE(Spread_XY, 6);
|
||||
ACTION_PARAM_ANGLE(Spread_Z, 7);
|
||||
ACTION_PARAM_FIXED(LifeSteal, 8);
|
||||
|
||||
if (NULL == (player = self->player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (pufftype == NULL) pufftype = PClass::FindClass(NAME_BulletPuff);
|
||||
if (damage == 0) damage = 2;
|
||||
|
||||
if (!(Flags & SF_NORANDOM))
|
||||
damage *= (pr_saw()%10+1);
|
||||
|
||||
// use meleerange + 1 so the puff doesn't skip the flash (i.e. plays all states)
|
||||
if (Range == 0) Range = MELEERANGE+1;
|
||||
|
||||
angle = self->angle + (pr_saw.Random2() * (Spread_XY / 255));
|
||||
slope = P_AimLineAttack (self, angle, Range, &linetarget) + (pr_saw.Random2() * (Spread_Z / 255));
|
||||
|
||||
P_LineAttack (self, angle, Range,
|
||||
slope, damage,
|
||||
NAME_None, pufftype);
|
||||
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL)
|
||||
if ((weapon != NULL) && !(Flags & SF_NOUSEAMMO) && !(!linetarget && (Flags & SF_NOUSEAMMOMISS)))
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return;
|
||||
}
|
||||
|
||||
if (pufftype == NULL) pufftype = PClass::FindClass(NAME_BulletPuff);
|
||||
if (damage == 0) damage = 2;
|
||||
|
||||
damage *= (pr_saw()%10+1);
|
||||
angle = self->angle;
|
||||
angle += pr_saw.Random2() << 18;
|
||||
|
||||
// use meleerange + 1 so the puff doesn't skip the flash (i.e. plays all states)
|
||||
if (Range == 0) Range = MELEERANGE+1;
|
||||
|
||||
P_LineAttack (self, angle, Range,
|
||||
P_AimLineAttack (self, angle, Range, &linetarget), damage,
|
||||
NAME_None, pufftype);
|
||||
|
||||
if (!linetarget)
|
||||
{
|
||||
if ((Flags & SF_RANDOMLIGHTMISS) && (pr_saw() > 64))
|
||||
{
|
||||
player->extralight = !player->extralight;
|
||||
}
|
||||
S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Flags & SF_RANDOMLIGHTHIT)
|
||||
{
|
||||
int randVal = pr_saw();
|
||||
if (randVal < 64)
|
||||
{
|
||||
player->extralight = 0;
|
||||
}
|
||||
else if (randVal < 160)
|
||||
{
|
||||
player->extralight = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->extralight = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (LifeSteal)
|
||||
P_GiveBody (self, (damage * LifeSteal) >> FRACBITS);
|
||||
|
||||
|
|
109
src/p_acs.cpp
109
src/p_acs.cpp
|
@ -2431,6 +2431,93 @@ void DLevelScript::DoSetFont (int fontnum)
|
|||
}
|
||||
}
|
||||
|
||||
int DoSetMaster (AActor *self, AActor *master)
|
||||
{
|
||||
AActor *defs;
|
||||
if (self->flags3&MF3_ISMONSTER)
|
||||
{
|
||||
if (master)
|
||||
{
|
||||
if (master->flags3&MF3_ISMONSTER)
|
||||
{
|
||||
self->FriendPlayer = 0;
|
||||
self->master = master;
|
||||
level.total_monsters -= self->CountsAsKill();
|
||||
self->flags = (self->flags & ~MF_FRIENDLY) | (master->flags & MF_FRIENDLY);
|
||||
level.total_monsters += self->CountsAsKill();
|
||||
// Don't attack your new master
|
||||
if (self->target == self->master) self->target = NULL;
|
||||
if (self->lastenemy == self->master) self->lastenemy = NULL;
|
||||
if (self->LastHeard == self->master) self->LastHeard = NULL;
|
||||
return 1;
|
||||
}
|
||||
else if (master->player)
|
||||
{
|
||||
// [KS] Be friendly to this player
|
||||
self->master = NULL;
|
||||
level.total_monsters -= self->CountsAsKill();
|
||||
self->flags|=MF_FRIENDLY;
|
||||
self->FriendPlayer = int(master->player-players+1);
|
||||
|
||||
AActor * attacker=master->player->attacker;
|
||||
if (attacker)
|
||||
{
|
||||
if (!(attacker->flags&MF_FRIENDLY) ||
|
||||
(deathmatch && attacker->FriendPlayer!=0 && attacker->FriendPlayer!=self->FriendPlayer))
|
||||
{
|
||||
self->LastHeard = self->target = attacker;
|
||||
}
|
||||
}
|
||||
// And stop attacking him if necessary.
|
||||
if (self->target == master) self->target = NULL;
|
||||
if (self->lastenemy == master) self->lastenemy = NULL;
|
||||
if (self->LastHeard == master) self->LastHeard = NULL;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self->master = NULL;
|
||||
self->FriendPlayer = 0;
|
||||
// Go back to whatever friendliness we usually have...
|
||||
defs = self->GetDefault();
|
||||
level.total_monsters -= self->CountsAsKill();
|
||||
self->flags = (self->flags & ~MF_FRIENDLY) | (defs->flags & MF_FRIENDLY);
|
||||
level.total_monsters += self->CountsAsKill();
|
||||
// ...And re-side with our friends.
|
||||
if (self->target && !self->IsHostile (self->target)) self->target = NULL;
|
||||
if (self->lastenemy && !self->IsHostile (self->lastenemy)) self->lastenemy = NULL;
|
||||
if (self->LastHeard && !self->IsHostile (self->LastHeard)) self->LastHeard = NULL;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DoGetMasterTID (AActor *self)
|
||||
{
|
||||
if (self->master) return self->master->tid;
|
||||
else if (self->FriendPlayer)
|
||||
{
|
||||
player_t *player = &players[(self->FriendPlayer)-1];
|
||||
return player->mo->tid;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
static AActor *SingleActorFromTID (int tid, AActor *defactor)
|
||||
{
|
||||
if (tid == 0)
|
||||
{
|
||||
return defactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator (tid);
|
||||
return iterator.Next();
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
APROP_Health = 0,
|
||||
|
@ -2458,6 +2545,7 @@ enum
|
|||
APROP_Score = 22,
|
||||
APROP_Notrigger = 23,
|
||||
APROP_DamageFactor = 24,
|
||||
APROP_MasterTID = 25,
|
||||
};
|
||||
|
||||
// These are needed for ACS's APROP_RenderStyle
|
||||
|
@ -2626,25 +2714,18 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
|
|||
actor->DamageFactor = value;
|
||||
break;
|
||||
|
||||
case APROP_MasterTID:
|
||||
AActor *other;
|
||||
other = SingleActorFromTID (value, NULL);
|
||||
DoSetMaster (actor, other);
|
||||
break;
|
||||
|
||||
default:
|
||||
// do nothing.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static AActor *SingleActorFromTID (int tid, AActor *defactor)
|
||||
{
|
||||
if (tid == 0)
|
||||
{
|
||||
return defactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator (tid);
|
||||
return iterator.Next();
|
||||
}
|
||||
}
|
||||
|
||||
int DLevelScript::GetActorProperty (int tid, int property)
|
||||
{
|
||||
AActor *actor = SingleActorFromTID (tid, activator);
|
||||
|
@ -2696,6 +2777,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
|
|||
return 0;
|
||||
}
|
||||
case APROP_Score: return actor->Score;
|
||||
case APROP_MasterTID: return DoGetMasterTID (actor);
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2726,6 +2808,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
|
|||
case APROP_SpawnHealth:
|
||||
case APROP_JumpZ:
|
||||
case APROP_Score:
|
||||
case APROP_MasterTID:
|
||||
return (GetActorProperty(tid, property) == value);
|
||||
|
||||
// Boolean values need to compare to a binary version of value
|
||||
|
|
|
@ -425,7 +425,7 @@ void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target,
|
|||
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
|
||||
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version
|
||||
void P_TraceBleed (int damage, AActor *target); // random direction version
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, const PClass *puff = NULL, bool pierce = true); // [RH] Shoot a railgun
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, const PClass *puff = NULL, bool pierce = true, angle_t angleoffset = 0, angle_t pitchoffset = 0); // [RH] Shoot a railgun
|
||||
bool P_HitFloor (AActor *thing);
|
||||
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true);
|
||||
void P_CheckSplash(AActor *self, fixed_t distance);
|
||||
|
|
|
@ -3769,7 +3769,7 @@ static bool ProcessNoPierceRailHit (FTraceResults &res)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce)
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce, angle_t angleoffset, angle_t pitchoffset)
|
||||
{
|
||||
fixed_t vx, vy, vz;
|
||||
angle_t angle, pitch;
|
||||
|
@ -3780,8 +3780,8 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
|
||||
if (puffclass == NULL) puffclass = PClass::FindClass(NAME_BulletPuff);
|
||||
|
||||
pitch = (angle_t)(-source->pitch) >> ANGLETOFINESHIFT;
|
||||
angle = source->angle >> ANGLETOFINESHIFT;
|
||||
pitch = ((angle_t)(-source->pitch) + pitchoffset) >> ANGLETOFINESHIFT;
|
||||
angle = (source->angle + angleoffset) >> ANGLETOFINESHIFT;
|
||||
|
||||
vx = FixedMul (finecosine[pitch], finecosine[angle]);
|
||||
vy = FixedMul (finecosine[pitch], finesine[angle]);
|
||||
|
@ -3801,7 +3801,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
shootz += 8*FRACUNIT;
|
||||
}
|
||||
|
||||
angle = (source->angle - ANG90) >> ANGLETOFINESHIFT;
|
||||
angle = ((source->angle + angleoffset) - ANG90) >> ANGLETOFINESHIFT;
|
||||
x1 += offset*finecosine[angle];
|
||||
y1 += offset*finesine[angle];
|
||||
|
||||
|
@ -3857,10 +3857,10 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
else
|
||||
{
|
||||
spawnpuff = (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF);
|
||||
P_SpawnBlood (x, y, z, source->angle - ANG180, damage, RailHits[i].HitActor);
|
||||
P_SpawnBlood (x, y, z, (source->angle + angleoffset) - ANG180, damage, RailHits[i].HitActor);
|
||||
P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, source->angle, pitch);
|
||||
}
|
||||
if (spawnpuff) P_SpawnPuff (source, puffclass, x, y, z, source->angle - ANG90, 1, PF_HITTHING);
|
||||
if (spawnpuff) P_SpawnPuff (source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, PF_HITTHING);
|
||||
|
||||
if (puffDefaults && puffDefaults->PoisonDuration != INT_MIN)
|
||||
P_PoisonMobj(RailHits[i].HitActor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod);
|
||||
|
@ -3874,7 +3874,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
SpawnShootDecal (source, trace);
|
||||
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
|
||||
{
|
||||
P_SpawnPuff (source, puffclass, trace.X, trace.Y, trace.Z, source->angle - ANG90, 1, 0);
|
||||
P_SpawnPuff (source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
// This file was automatically generated by the
|
||||
// updaterevision tool. Do not edit by hand.
|
||||
|
||||
#define ZD_SVN_REVISION_STRING "2451"
|
||||
#define ZD_SVN_REVISION_NUMBER 2451
|
||||
#define ZD_SVN_REVISION_STRING "2456"
|
||||
#define ZD_SVN_REVISION_NUMBER 2456
|
||||
|
|
|
@ -825,6 +825,7 @@ enum CBA_Flags
|
|||
{
|
||||
CBAF_AIMFACING = 1,
|
||||
CBAF_NORANDOM = 2,
|
||||
CBAF_EXPLICITANGLE = 4,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
||||
|
@ -856,8 +857,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
|||
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
|
||||
for (i=0 ; i<NumBullets ; i++)
|
||||
{
|
||||
int angle = bangle + pr_cabullet.Random2() * (Spread_XY / 255);
|
||||
int slope = bslope + pr_cabullet.Random2() * (Spread_Z / 255);
|
||||
int angle = bangle;
|
||||
int slope = bslope;
|
||||
|
||||
if (Flags & CBAF_EXPLICITANGLE)
|
||||
{
|
||||
angle += Spread_XY;
|
||||
slope += Spread_Z;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle += pr_cwbullet.Random2() * (Spread_XY / 255);
|
||||
slope += pr_cwbullet.Random2() * (Spread_Z / 255);
|
||||
}
|
||||
|
||||
int damage = DamagePerBullet;
|
||||
|
||||
if (!(Flags & CBAF_NORANDOM))
|
||||
|
@ -1194,7 +1207,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
|
|||
enum
|
||||
{
|
||||
RAF_SILENT = 1,
|
||||
RAF_NOPIERCE = 2
|
||||
RAF_NOPIERCE = 2,
|
||||
RAF_EXPLICITANGLE = 4,
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1204,7 +1218,7 @@ enum
|
|||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
||||
{
|
||||
ACTION_PARAM_START(8);
|
||||
ACTION_PARAM_START(10);
|
||||
ACTION_PARAM_INT(Damage, 0);
|
||||
ACTION_PARAM_INT(Spawnofs_XY, 1);
|
||||
ACTION_PARAM_BOOL(UseAmmo, 2);
|
||||
|
@ -1213,6 +1227,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
|||
ACTION_PARAM_INT(Flags, 5);
|
||||
ACTION_PARAM_FLOAT(MaxDiff, 6);
|
||||
ACTION_PARAM_CLASS(PuffType, 7);
|
||||
ACTION_PARAM_ANGLE(Spread_XY, 8);
|
||||
ACTION_PARAM_ANGLE(Spread_Z, 9);
|
||||
|
||||
if (!self->player) return;
|
||||
|
||||
|
@ -1224,7 +1240,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
|||
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
|
||||
}
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)));
|
||||
angle_t angle;
|
||||
angle_t slope;
|
||||
|
||||
if (Flags & RAF_EXPLICITANGLE)
|
||||
{
|
||||
angle = Spread_XY;
|
||||
slope = Spread_Z;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = pr_crailgun.Random2() * (Spread_XY / 255);
|
||||
slope = pr_crailgun.Random2() * (Spread_Z / 255);
|
||||
}
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angle, slope);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1236,12 +1266,13 @@ enum
|
|||
{
|
||||
CRF_DONTAIM = 0,
|
||||
CRF_AIMPARALLEL = 1,
|
||||
CRF_AIMDIRECT = 2
|
||||
CRF_AIMDIRECT = 2,
|
||||
CRF_EXPLICITANGLE = 4,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
||||
{
|
||||
ACTION_PARAM_START(8);
|
||||
ACTION_PARAM_START(10);
|
||||
ACTION_PARAM_INT(Damage, 0);
|
||||
ACTION_PARAM_INT(Spawnofs_XY, 1);
|
||||
ACTION_PARAM_COLOR(Color1, 2);
|
||||
|
@ -1250,6 +1281,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
ACTION_PARAM_INT(aim, 5);
|
||||
ACTION_PARAM_FLOAT(MaxDiff, 6);
|
||||
ACTION_PARAM_CLASS(PuffType, 7);
|
||||
ACTION_PARAM_ANGLE(Spread_XY, 8);
|
||||
ACTION_PARAM_ANGLE(Spread_Z, 9);
|
||||
|
||||
AActor *linetarget;
|
||||
|
||||
|
@ -1316,7 +1349,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
|
||||
angle_t angle = (self->angle - ANG90) >> ANGLETOFINESHIFT;
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)));
|
||||
angle_t angleoffset;
|
||||
angle_t slopeoffset;
|
||||
|
||||
if (Flags & CRF_EXPLICITANGLE)
|
||||
{
|
||||
angleoffset = Spread_XY;
|
||||
slopeoffset = Spread_Z;
|
||||
}
|
||||
else
|
||||
{
|
||||
angleoffset = pr_crailgun.Random2() * (Spread_XY / 255);
|
||||
slopeoffset = pr_crailgun.Random2() * (Spread_Z / 255);
|
||||
}
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angleoffset, slopeoffset);
|
||||
|
||||
self->x = saved_x;
|
||||
self->y = saved_y;
|
||||
|
@ -2494,23 +2541,38 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearTarget)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// A_JumpIfTargetInLOS (state label, optional fixed fov, optional bool
|
||||
// projectiletarget)
|
||||
// A_JumpIfTargetInLOS (state label, optional fixed fov, optional int flags,
|
||||
// optional fixed dist_max, optional fixed dist_close)
|
||||
//
|
||||
// Jumps if the actor can see its target, or if the player has a linetarget.
|
||||
// ProjectileTarget affects how projectiles are treated. If set, it will use
|
||||
// the target of the projectile for seekers, and ignore the target for
|
||||
// normal projectiles. If not set, it will use the missile's owner instead
|
||||
// (the default).
|
||||
// (the default). ProjectileTarget is now flag JLOSF_PROJECTILE. dist_max
|
||||
// sets the maximum distance that actor can see, 0 means forever. dist_close
|
||||
// uses special behavior if certain flags are set, 0 means no checks.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
enum JLOS_flags
|
||||
{
|
||||
JLOSF_PROJECTILE=1,
|
||||
JLOSF_NOSIGHT=2,
|
||||
JLOSF_CLOSENOFOV=4,
|
||||
JLOSF_CLOSENOSIGHT=8,
|
||||
JLOSF_CLOSENOJUMP=16,
|
||||
JLOSF_DEADNOJUMP=32,
|
||||
JLOSF_CHECKMASTER=64,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
|
||||
{
|
||||
ACTION_PARAM_START(3);
|
||||
ACTION_PARAM_START(5);
|
||||
ACTION_PARAM_STATE(jump, 0);
|
||||
ACTION_PARAM_ANGLE(fov, 1);
|
||||
ACTION_PARAM_BOOL(projtarg, 2);
|
||||
ACTION_PARAM_INT(flags, 2);
|
||||
ACTION_PARAM_FIXED(dist_max, 3);
|
||||
ACTION_PARAM_FIXED(dist_close, 4);
|
||||
|
||||
angle_t an;
|
||||
AActor *target;
|
||||
|
@ -2519,7 +2581,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
|
|||
|
||||
if (!self->player)
|
||||
{
|
||||
if (self->flags & MF_MISSILE && projtarg)
|
||||
if (flags & JLOSF_CHECKMASTER)
|
||||
{
|
||||
target = self->master;
|
||||
}
|
||||
else if (self->flags & MF_MISSILE && (flags & JLOSF_PROJECTILE))
|
||||
{
|
||||
if (self->flags2 & MF2_SEEKERMISSILE)
|
||||
target = self->tracer;
|
||||
|
@ -2533,7 +2599,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
|
|||
|
||||
if (!target) return; // [KS] Let's not call P_CheckSight unnecessarily in this case.
|
||||
|
||||
if (!P_CheckSight (self, target, SF_IGNOREVISIBILITY))
|
||||
if ((flags & JLOSF_DEADNOJUMP) && (target->health <= 0)) return;
|
||||
|
||||
fixed_t distance = P_AproxDistance(target->x - self->x, target->y - self->y);
|
||||
distance = P_AproxDistance(distance, target->z - self->z);
|
||||
|
||||
if (dist_max && (distance > dist_max)) return;
|
||||
|
||||
bool doCheckSight = !(flags & JLOSF_NOSIGHT);
|
||||
|
||||
if (dist_close && (distance < dist_close))
|
||||
{
|
||||
if (flags & JLOSF_CLOSENOJUMP)
|
||||
return;
|
||||
|
||||
if (flags & JLOSF_CLOSENOFOV)
|
||||
fov = 0;
|
||||
|
||||
if (flags & JLOSF_CLOSENOSIGHT)
|
||||
doCheckSight = false;
|
||||
}
|
||||
|
||||
if (doCheckSight && !P_CheckSight (self, target, SF_IGNOREVISIBILITY))
|
||||
return;
|
||||
|
||||
if (fov && (fov < ANGLE_MAX))
|
||||
|
@ -2555,34 +2642,51 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
|
|||
{
|
||||
// Does the player aim at something that can be shot?
|
||||
P_BulletSlope(self, &target);
|
||||
}
|
||||
|
||||
if (!target) return;
|
||||
|
||||
fixed_t distance = P_AproxDistance(target->x - self->x, target->y - self->y);
|
||||
distance = P_AproxDistance(distance, target->z - self->z);
|
||||
|
||||
if (dist_max && (distance > dist_max)) return;
|
||||
|
||||
if (dist_close && (distance < dist_close))
|
||||
{
|
||||
if (flags & JLOSF_CLOSENOJUMP)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ACTION_JUMP(jump);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// A_JumpIfInTargetLOS (state label, optional fixed fov, optional bool
|
||||
// projectiletarget)
|
||||
// A_JumpIfInTargetLOS (state label, optional fixed fov, optional int flags
|
||||
// optional fixed dist_max, optional fixed dist_close)
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS)
|
||||
{
|
||||
ACTION_PARAM_START(3);
|
||||
ACTION_PARAM_START(5);
|
||||
ACTION_PARAM_STATE(jump, 0);
|
||||
ACTION_PARAM_ANGLE(fov, 1);
|
||||
ACTION_PARAM_BOOL(projtarg, 2);
|
||||
ACTION_PARAM_INT(flags, 2);
|
||||
ACTION_PARAM_FIXED(dist_max, 3);
|
||||
ACTION_PARAM_FIXED(dist_close, 4);
|
||||
|
||||
angle_t an;
|
||||
AActor *target;
|
||||
|
||||
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
|
||||
|
||||
if (self->flags & MF_MISSILE && projtarg)
|
||||
if (flags & JLOSF_CHECKMASTER)
|
||||
{
|
||||
target = self->master;
|
||||
}
|
||||
else if (self->flags & MF_MISSILE && (flags & JLOSF_PROJECTILE))
|
||||
{
|
||||
if (self->flags2 & MF2_SEEKERMISSILE)
|
||||
target = self->tracer;
|
||||
|
@ -2596,7 +2700,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS)
|
|||
|
||||
if (!target) return; // [KS] Let's not call P_CheckSight unnecessarily in this case.
|
||||
|
||||
if (!P_CheckSight (target, self, SF_IGNOREVISIBILITY))
|
||||
if ((flags & JLOSF_DEADNOJUMP) && (target->health <= 0)) return;
|
||||
|
||||
fixed_t distance = P_AproxDistance(target->x - self->x, target->y - self->y);
|
||||
distance = P_AproxDistance(distance, target->z - self->z);
|
||||
|
||||
if (dist_max && (distance > dist_max)) return;
|
||||
|
||||
bool doCheckSight = !(flags & JLOSF_NOSIGHT);
|
||||
|
||||
if (dist_close && (distance < dist_close))
|
||||
{
|
||||
if (flags & JLOSF_CLOSENOJUMP)
|
||||
return;
|
||||
|
||||
if (flags & JLOSF_CLOSENOFOV)
|
||||
fov = 0;
|
||||
|
||||
if (flags & JLOSF_CLOSENOSIGHT)
|
||||
doCheckSight = false;
|
||||
}
|
||||
|
||||
if (doCheckSight && !P_CheckSight (target, self, SF_IGNOREVISIBILITY))
|
||||
return;
|
||||
|
||||
if (fov && (fov < ANGLE_MAX))
|
||||
|
|
|
@ -185,7 +185,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_Jump(int chance = 256, state label, ...);
|
||||
action native A_CustomMissile(class<Actor> missiletype, float spawnheight = 32, int spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0);
|
||||
action native A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", float range = 0, int flags = 0);
|
||||
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff");
|
||||
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0);
|
||||
action native A_JumpIfHealthLower(int health, state label);
|
||||
action native A_JumpIfCloser(float distance, state label);
|
||||
action native A_JumpIfTracerCloser(float distance, state label);
|
||||
|
@ -246,8 +246,8 @@ ACTOR Actor native //: Thinker
|
|||
action native A_DeQueueCorpse();
|
||||
action native A_LookEx(int flags = 0, float minseedist = 0, float maxseedist = 0, float maxheardist = 0, float fov = 0, state label = "");
|
||||
action native A_ClearTarget();
|
||||
action native A_JumpIfTargetInLOS (state label, float fov = 0, bool projectiletarget = false);
|
||||
action native A_JumpIfInTargetLOS (state label, float fov = 0, bool projectiletarget = false);
|
||||
action native A_JumpIfTargetInLOS (state label, float fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0);
|
||||
action native A_JumpIfInTargetLOS (state label, float fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0);
|
||||
action native A_DamageMaster(int amount, name damagetype = "none");
|
||||
action native A_DamageChildren(int amount, name damagetype = "none");
|
||||
action native A_DamageSiblings(int amount, name damagetype = "none");
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
|
||||
// Flags for A_Saw
|
||||
const int SF_NORANDOM = 1;
|
||||
const int SF_RANDOMLIGHTMISS = 2;
|
||||
const int SF_RANDOMLIGHTHIT = 4;
|
||||
const int SF_RANDOMLIGHTBOTH = 6;
|
||||
const int SF_NOUSEAMMOMISS = 8;
|
||||
const int SF_NOUSEAMMO = 16;
|
||||
|
||||
// Flags for A_CustomMissile
|
||||
const int CMF_AIMOFFSET = 1;
|
||||
const int CMF_AIMDIRECTION = 2;
|
||||
|
@ -8,6 +16,7 @@ const int CMF_CHECKTARGETDEAD = 8;
|
|||
// Flags for A_CustomBulletAttack
|
||||
const int CBAF_AIMFACING = 1;
|
||||
const int CBAF_NORANDOM = 2;
|
||||
const int CBAF_EXPLICITANGLE = 4;
|
||||
|
||||
// Flags for A_FireBullets
|
||||
const int FBF_USEAMMO = 1;
|
||||
|
@ -47,6 +56,15 @@ const int RSF_FOG = 1;
|
|||
const int RSF_KEEPTARGET = 2;
|
||||
const int RSF_TELEFRAG = 4;
|
||||
|
||||
// Flags for A_JumpIfTargetInLOS and A_JumpIfInTargetLOS
|
||||
const int JLOSF_PROJECTILE = 1;
|
||||
const int JLOSF_NOSIGHT = 2;
|
||||
const int JLOSF_CLOSENOFOV = 4;
|
||||
const int JLOSF_CLOSENOSIGHT = 8;
|
||||
const int JLOSF_CLOSENOJUMP = 16;
|
||||
const int JLOSF_DEADNOJUMP = 32;
|
||||
const int JLOSF_CHECKMASTER = 64;
|
||||
|
||||
// Flags for A_ChangeVelocity
|
||||
const int CVF_RELATIVE = 1;
|
||||
const int CVF_REPLACE = 2;
|
||||
|
@ -75,6 +93,7 @@ const int MRF_UNDOBYDEATHSAVES = 2048;
|
|||
// Flags for A_RailAttack and A_CustomRailgun
|
||||
const int RGF_SILENT = 1;
|
||||
const int RGF_NOPIERCING = 2;
|
||||
const int RGF_EXPLICITANGLE = 4;
|
||||
|
||||
// Flags for A_Mushroom
|
||||
const int MSF_Standard = 0;
|
||||
|
|
|
@ -10,7 +10,7 @@ ACTOR Inventory native
|
|||
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0);
|
||||
action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, 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, float pitch = 0);
|
||||
action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff");
|
||||
action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0);
|
||||
action native A_Light(int extralight);
|
||||
action native A_Light0();
|
||||
action native A_Light1();
|
||||
|
@ -40,7 +40,7 @@ ACTOR Inventory native
|
|||
action native A_ClearReFire();
|
||||
action native A_CheckReload();
|
||||
action native A_GunFlash(state flash = "");
|
||||
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0);
|
||||
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff", int flags = 0, float range = 0, float spread_xy = 2.8125, float spread_z = 0, float lifesteal = 0);
|
||||
action native A_CheckForReload(int counter, state label, bool dontincrement = false);
|
||||
action native A_ResetReloadCounter();
|
||||
action native A_RestoreSpecialPosition();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue