- Added pointers for A_CustomMissile and A_CustomBulletAttack.

This commit is contained in:
MajorCooke 2014-12-21 12:29:19 -06:00
parent 9446edc068
commit 91bfe4cceb
3 changed files with 22 additions and 9 deletions

View file

@ -73,6 +73,8 @@ DECLARE_ACTION(A_BossDeath)
void A_Chase(AActor *self); void A_Chase(AActor *self);
void A_FaceTarget (AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270); void A_FaceTarget (AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270);
void A_FaceMaster(AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270);
void A_FaceTracer(AActor *actor, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270);
bool A_RaiseMobj (AActor *, fixed_t speed); bool A_RaiseMobj (AActor *, fixed_t speed);
bool A_SinkMobj (AActor *, fixed_t speed); bool A_SinkMobj (AActor *, fixed_t speed);

View file

@ -907,20 +907,23 @@ enum CM_Flags
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
{ {
ACTION_PARAM_START(6); ACTION_PARAM_START(7);
ACTION_PARAM_CLASS(ti, 0); ACTION_PARAM_CLASS(ti, 0);
ACTION_PARAM_FIXED(SpawnHeight, 1); ACTION_PARAM_FIXED(SpawnHeight, 1);
ACTION_PARAM_INT(Spawnofs_XY, 2); ACTION_PARAM_INT(Spawnofs_XY, 2);
ACTION_PARAM_ANGLE(Angle, 3); ACTION_PARAM_ANGLE(Angle, 3);
ACTION_PARAM_INT(flags, 4); ACTION_PARAM_INT(flags, 4);
ACTION_PARAM_ANGLE(pitch, 5); ACTION_PARAM_ANGLE(pitch, 5);
ACTION_PARAM_INT(ptr, 6);
AActor *ref = COPY_AAPTR(self, ptr);
int aimmode = flags & CMF_AIMMODE; int aimmode = flags & CMF_AIMMODE;
AActor * targ; AActor * targ;
AActor * missile; AActor * missile;
if (self->target != NULL || aimmode==2) if (ref != NULL || aimmode==2)
{ {
if (ti) if (ti)
{ {
@ -937,14 +940,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile)
self->x += x; self->x += x;
self->y += y; self->y += y;
self->z += z; self->z += z;
missile = P_SpawnMissileXYZ(self->x, self->y, self->z + 32*FRACUNIT, self, self->target, ti, false); missile = P_SpawnMissileXYZ(self->x, self->y, self->z + 32*FRACUNIT, self, ref, ti, false);
self->x -= x; self->x -= x;
self->y -= y; self->y -= y;
self->z -= z; self->z -= z;
break; break;
case 1: case 1:
missile = P_SpawnMissileXYZ(self->x+x, self->y+y, self->z + self->GetBobOffset() + SpawnHeight, self, self->target, ti, false); missile = P_SpawnMissileXYZ(self->x+x, self->y+y, self->z + self->GetBobOffset() + SpawnHeight, self, ref, ti, false);
break; break;
case 2: case 2:
@ -1056,7 +1059,7 @@ enum CBA_Flags
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
{ {
ACTION_PARAM_START(7); ACTION_PARAM_START(8);
ACTION_PARAM_ANGLE(Spread_XY, 0); ACTION_PARAM_ANGLE(Spread_XY, 0);
ACTION_PARAM_ANGLE(Spread_Z, 1); ACTION_PARAM_ANGLE(Spread_Z, 1);
ACTION_PARAM_INT(NumBullets, 2); ACTION_PARAM_INT(NumBullets, 2);
@ -1064,6 +1067,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
ACTION_PARAM_CLASS(pufftype, 4); ACTION_PARAM_CLASS(pufftype, 4);
ACTION_PARAM_FIXED(Range, 5); ACTION_PARAM_FIXED(Range, 5);
ACTION_PARAM_INT(Flags, 6); ACTION_PARAM_INT(Flags, 6);
ACTION_PARAM_INT(ptr, 7);
AActor *ref = COPY_AAPTR(self, ptr);
if(Range==0) Range=MISSILERANGE; if(Range==0) Range=MISSILERANGE;
@ -1072,9 +1078,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
int bslope = 0; int bslope = 0;
int laflags = (Flags & CBAF_NORANDOMPUFFZ)? LAF_NORANDOMPUFFZ : 0; int laflags = (Flags & CBAF_NORANDOMPUFFZ)? LAF_NORANDOMPUFFZ : 0;
if (self->target || (Flags & CBAF_AIMFACING)) if (ref || (Flags & CBAF_AIMFACING))
{ {
if (!(Flags & CBAF_AIMFACING)) A_FaceTarget (self); if (!(Flags & CBAF_AIMFACING))
{
if (ref == self->target) A_FaceTarget(self);
else if (ref == self->master) A_FaceMaster(self);
else if (ref == self->tracer) A_FaceTracer(self);
}
bangle = self->angle; bangle = self->angle;
if (!pufftype) pufftype = PClass::FindClass(NAME_BulletPuff); if (!pufftype) pufftype = PClass::FindClass(NAME_BulletPuff);

View file

@ -204,8 +204,8 @@ ACTOR Actor native //: Thinker
action native A_StopSoundEx(coerce name slot); action native A_StopSoundEx(coerce name slot);
action native A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); 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_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_CustomMissile(class<Actor> missiletype, float spawnheight = 32, int spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET);
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_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET);
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, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 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", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none", float spawnofs_z = 0);
action native A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); action native A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT);
action native A_JumpIfCloser(float distance, state label); action native A_JumpIfCloser(float distance, state label);