mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- added DavidPH's randomization patch for hitscan attacks.
SVN r2318 (trunk)
This commit is contained in:
parent
6a57a43277
commit
b61b761e28
4 changed files with 42 additions and 10 deletions
|
@ -803,6 +803,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
|
|||
// An even more customizable hitscan attack
|
||||
//
|
||||
//==========================================================================
|
||||
enum CBA_Flags
|
||||
{
|
||||
CBAF_AIMFACING = 1,
|
||||
CBAF_NORANDOM = 2,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
||||
{
|
||||
ACTION_PARAM_START(7);
|
||||
|
@ -812,7 +818,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
|||
ACTION_PARAM_INT(DamagePerBullet, 3);
|
||||
ACTION_PARAM_CLASS(pufftype, 4);
|
||||
ACTION_PARAM_FIXED(Range, 5);
|
||||
ACTION_PARAM_BOOL(AimFacing, 6);
|
||||
ACTION_PARAM_INT(Flags, 6);
|
||||
|
||||
if(Range==0) Range=MISSILERANGE;
|
||||
|
||||
|
@ -820,9 +826,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
|||
int bangle;
|
||||
int bslope;
|
||||
|
||||
if (self->target || AimFacing)
|
||||
if (self->target || (Flags & CBAF_AIMFACING))
|
||||
{
|
||||
if (!AimFacing) A_FaceTarget (self);
|
||||
if (!(Flags & CBAF_AIMFACING)) A_FaceTarget (self);
|
||||
bangle = self->angle;
|
||||
|
||||
if (!pufftype) pufftype = PClass::FindClass(NAME_BulletPuff);
|
||||
|
@ -834,7 +840,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
|
|||
{
|
||||
int angle = bangle + pr_cabullet.Random2() * (Spread_XY / 255);
|
||||
int slope = bslope + pr_cabullet.Random2() * (Spread_Z / 255);
|
||||
int damage = ((pr_cabullet()%3)+1) * DamagePerBullet;
|
||||
int damage = DamagePerBullet;
|
||||
|
||||
if (!(Flags & CBAF_NORANDOM))
|
||||
damage *= ((pr_cabullet()%3)+1);
|
||||
|
||||
P_LineAttack(self, angle, Range, slope, damage, NAME_None, pufftype);
|
||||
}
|
||||
}
|
||||
|
@ -948,6 +958,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfNoAmmo)
|
|||
// An even more customizable hitscan attack
|
||||
//
|
||||
//==========================================================================
|
||||
enum FB_Flags
|
||||
{
|
||||
FBF_USEAMMO = 1,
|
||||
FBF_NORANDOM = 2,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
||||
{
|
||||
ACTION_PARAM_START(7);
|
||||
|
@ -956,7 +972,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
|||
ACTION_PARAM_INT(NumberOfBullets, 2);
|
||||
ACTION_PARAM_INT(DamagePerBullet, 3);
|
||||
ACTION_PARAM_CLASS(PuffType, 4);
|
||||
ACTION_PARAM_BOOL(UseAmmo, 5);
|
||||
ACTION_PARAM_INT(Flags, 5);
|
||||
ACTION_PARAM_FIXED(Range, 6);
|
||||
|
||||
if (!self->player) return;
|
||||
|
@ -968,7 +984,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
|||
int bangle;
|
||||
int bslope;
|
||||
|
||||
if (UseAmmo && weapon)
|
||||
if ((Flags & FBF_USEAMMO) && weapon)
|
||||
{
|
||||
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
|
||||
}
|
||||
|
@ -986,7 +1002,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
|||
|
||||
if ((NumberOfBullets==1 && !player->refire) || NumberOfBullets==0)
|
||||
{
|
||||
int damage = ((pr_cwbullet()%3)+1)*DamagePerBullet;
|
||||
int damage = DamagePerBullet;
|
||||
|
||||
if (!(Flags & FBF_NORANDOM))
|
||||
damage *= ((pr_cwbullet()%3)+1);
|
||||
|
||||
P_LineAttack(self, bangle, Range, bslope, damage, NAME_None, PuffType);
|
||||
}
|
||||
else
|
||||
|
@ -996,7 +1016,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
|||
{
|
||||
int angle = bangle + pr_cwbullet.Random2() * (Spread_XY / 255);
|
||||
int slope = bslope + pr_cwbullet.Random2() * (Spread_Z / 255);
|
||||
int damage = ((pr_cwbullet()%3)+1) * DamagePerBullet;
|
||||
int damage = DamagePerBullet;
|
||||
|
||||
if (!(Flags & FBF_NORANDOM))
|
||||
damage *= ((pr_cwbullet()%3)+1);
|
||||
|
||||
P_LineAttack(self, angle, Range, slope, damage, NAME_None, PuffType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10);
|
||||
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, bool aimfacing = false);
|
||||
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_JumpIfHealthLower(int health, state label);
|
||||
action native A_JumpIfCloser(float distance, state label);
|
||||
|
|
|
@ -5,6 +5,14 @@ const int CMF_AIMDIRECTION = 2;
|
|||
const int CMF_TRACKOWNER = 4;
|
||||
const int CMF_CHECKTARGETDEAD = 8;
|
||||
|
||||
// Flags for A_CustomBulletAttack
|
||||
const int CBAF_AIMFACING = 1;
|
||||
const int CBAF_NORANDOM = 2;
|
||||
|
||||
// Flags for A_FireBullets
|
||||
const int FBF_USEAMMO = 1;
|
||||
const int FBF_NORANDOM = 2;
|
||||
|
||||
// Flags for A_SpawnItemEx
|
||||
const int SXF_TRANSFERTRANSLATION=1;
|
||||
const int SXF_ABSOLUTEPOSITION=2;
|
||||
|
|
|
@ -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, float lifesteal = 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_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_Light(int extralight);
|
||||
|
|
Loading…
Reference in a new issue