- fixed: Sector_SetWind and Sector_SetCurrent were not usable in scripts called from a line.

- added Gez's A_Mushroom extension.


SVN r2144 (trunk)
This commit is contained in:
Christoph Oelckers 2010-01-30 14:35:52 +00:00
parent 24a12a04b4
commit a5e1fe6906
6 changed files with 33 additions and 19 deletions

View File

@ -118,7 +118,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3)
// Original idea: Linguica // Original idea: Linguica
// //
AActor * P_OldSpawnMissile(AActor * source, AActor * dest, const PClass *type); AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const PClass *type);
enum
{
MSF_Standard = 0,
MSF_Classic = 1,
MSF_DontHurt = 2,
};
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
{ {
@ -134,11 +141,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
if (n == 0) n = self->Damage; // GetMissileDamage (0, 1); if (n == 0) n = self->Damage; // GetMissileDamage (0, 1);
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot"); if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true); P_RadiusAttack (self, self->target, 128, 128, self->DamageType, !(flags & MSF_DontHurt));
P_CheckSplash(self, 128<<FRACBITS); P_CheckSplash(self, 128<<FRACBITS);
// Now launch mushroom cloud // Now launch mushroom cloud
AActor *target = Spawn("Mapspot", 0, 0, 0, NO_REPLACE); // We need something to aim at. AActor *target = Spawn("Mapspot", 0, 0, 0, NO_REPLACE); // We need something to aim at.
AActor *master = (flags & MSF_DontHurt) ? self->target : self;
target->height = self->height; target->height = self->height;
for (i = -n; i <= n; i += 8) for (i = -n; i <= n; i += 8)
{ {
@ -148,13 +156,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
target->x = self->x + (i << FRACBITS); // Aim in many directions from source target->x = self->x + (i << FRACBITS); // Aim in many directions from source
target->y = self->y + (j << FRACBITS); target->y = self->y + (j << FRACBITS);
target->z = self->z + (P_AproxDistance(i,j) * vrange); // Aim up fairly high target->z = self->z + (P_AproxDistance(i,j) * vrange); // Aim up fairly high
if (flags == 0 && (!(self->state->DefineFlags & SDF_DEHACKED) || !(i_compatflags & COMPATF_MUSHROOM))) if ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options
{ (flags == 0 && (self->state->DefineFlags & SDF_DEHACKED) && (i_compatflags & COMPATF_MUSHROOM)))
mo = P_SpawnMissile (self, target, spawntype); // Launch fireball { // Use old function for MBF compatibility
mo = P_OldSpawnMissile (self, master, target, spawntype);
} }
else else // Use normal function
{ {
mo = P_OldSpawnMissile (self, target, spawntype); // Launch fireball mo = P_SpawnMissile(self, target, spawntype, master);
} }
if (mo != NULL) if (mo != NULL)
{ // Slow it down a bit { // Slow it down a bit

View File

@ -1853,7 +1853,7 @@ void AdjustPusher (int tag, int magnitude, int angle, DPusher::EPusher type)
FUNC(LS_Sector_SetWind) FUNC(LS_Sector_SetWind)
// Sector_SetWind (tag, amount, angle) // Sector_SetWind (tag, amount, angle)
{ {
if (ln || arg3) if (arg3)
return false; return false;
AdjustPusher (arg0, arg1, arg2, DPusher::p_wind); AdjustPusher (arg0, arg1, arg2, DPusher::p_wind);
@ -1863,7 +1863,7 @@ FUNC(LS_Sector_SetWind)
FUNC(LS_Sector_SetCurrent) FUNC(LS_Sector_SetCurrent)
// Sector_SetCurrent (tag, amount, angle) // Sector_SetCurrent (tag, amount, angle)
{ {
if (ln || arg3) if (arg3)
return false; return false;
AdjustPusher (arg0, arg1, arg2, DPusher::p_current); AdjustPusher (arg0, arg1, arg2, DPusher::p_current);

View File

@ -111,9 +111,9 @@ void P_RipperBlood (AActor *mo, AActor *bleeder);
int P_GetThingFloorType (AActor *thing); int P_GetThingFloorType (AActor *thing);
void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target); void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target);
AActor *P_SpawnMissile (AActor* source, AActor* dest, const PClass *type); AActor *P_SpawnMissile (AActor* source, AActor* dest, const PClass *type, AActor* owner = NULL);
AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const PClass *type); AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const PClass *type);
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, const PClass *type, bool checkspawn = true); AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, const PClass *type, bool checkspawn = true, AActor *owner = NULL);
AActor *P_SpawnMissileAngle (AActor *source, const PClass *type, angle_t angle, fixed_t velz); AActor *P_SpawnMissileAngle (AActor *source, const PClass *type, angle_t angle, fixed_t velz);
AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type, angle_t angle, fixed_t velz, fixed_t speed); AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type, angle_t angle, fixed_t velz, fixed_t speed);
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, const PClass *type, angle_t angle, fixed_t velz); AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, const PClass *type, angle_t angle, fixed_t velz);

View File

@ -5042,10 +5042,10 @@ static fixed_t GetDefaultSpeed(const PClass *type)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type) AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type, AActor *owner)
{ {
return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT, return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT,
source, dest, type); source, dest, type, true, owner);
} }
AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass *type) AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass *type)
@ -5054,7 +5054,7 @@ AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass *
} }
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, const PClass *type, bool checkspawn) AActor *source, AActor *dest, const PClass *type, bool checkspawn, AActor *owner)
{ {
if (dest == NULL) if (dest == NULL)
{ {
@ -5071,7 +5071,10 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE); AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE);
P_PlaySpawnSound(th, source); P_PlaySpawnSound(th, source);
th->target = source; // record missile's originator
// record missile's originator
if (owner) th->target = owner;
else th->target = source;
float speed = (float)(th->Speed); float speed = (float)(th->Speed);
@ -5114,14 +5117,14 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
return (!checkspawn || P_CheckMissileSpawn (th)) ? th : NULL; return (!checkspawn || P_CheckMissileSpawn (th)) ? th : NULL;
} }
AActor * P_OldSpawnMissile(AActor * source, AActor * dest, const PClass *type) AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const PClass *type)
{ {
angle_t an; angle_t an;
fixed_t dist; fixed_t dist;
AActor *th = Spawn (type, source->x, source->y, source->z + 4*8*FRACUNIT, ALLOW_REPLACE); AActor *th = Spawn (type, source->x, source->y, source->z + 4*8*FRACUNIT, ALLOW_REPLACE);
P_PlaySpawnSound(th, source); P_PlaySpawnSound(th, source);
th->target = source; // record missile's originator th->target = owner; // record missile's originator
th->angle = an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y); th->angle = an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y);
an >>= ANGLETOFINESHIFT; an >>= ANGLETOFINESHIFT;
@ -5250,8 +5253,6 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
AActor *linetarget; AActor *linetarget;
int vrange = nofreeaim? ANGLE_1*35 : 0; int vrange = nofreeaim? ANGLE_1*35 : 0;
// Note: NOAUTOAIM is implemented only here, and not in the hitscan or rail attack functions.
// That is because it is only justified for projectiles affected by gravity, not for other attacks.
if (source && source->player && source->player->ReadyWeapon && (source->player->ReadyWeapon->WeaponFlags & WIF_NOAUTOAIM)) if (source && source->player && source->player->ReadyWeapon && (source->player->ReadyWeapon->WeaponFlags & WIF_NOAUTOAIM))
{ {
// Keep exactly the same angle and pitch as the player's own aim // Keep exactly the same angle and pitch as the player's own aim

View File

@ -2059,11 +2059,13 @@ static void P_SpawnPushers ()
case Sector_SetWind: // wind case Sector_SetWind: // wind
for (s = -1; (s = P_FindSectorFromTag (l->args[0],s)) >= 0 ; ) for (s = -1; (s = P_FindSectorFromTag (l->args[0],s)) >= 0 ; )
new DPusher (DPusher::p_wind, l->args[3] ? l : NULL, l->args[1], l->args[2], NULL, s); new DPusher (DPusher::p_wind, l->args[3] ? l : NULL, l->args[1], l->args[2], NULL, s);
l->special = 0;
break; break;
case Sector_SetCurrent: // current case Sector_SetCurrent: // current
for (s = -1; (s = P_FindSectorFromTag (l->args[0],s)) >= 0 ; ) for (s = -1; (s = P_FindSectorFromTag (l->args[0],s)) >= 0 ; )
new DPusher (DPusher::p_current, l->args[3] ? l : NULL, l->args[1], l->args[2], NULL, s); new DPusher (DPusher::p_current, l->args[3] ? l : NULL, l->args[1], l->args[2], NULL, s);
l->special = 0;
break; break;
case PointPush_SetForce: // push/pull case PointPush_SetForce: // push/pull
@ -2092,6 +2094,7 @@ static void P_SpawnPushers ()
} }
} }
} }
l->special = 0;
break; break;
} }
} }

View File

@ -70,6 +70,7 @@ const int RGF_NOPIERCING = 2;
// Flags for A_Mushroom // Flags for A_Mushroom
const int MSF_Standard = 0; const int MSF_Standard = 0;
const int MSF_Classic = 1; const int MSF_Classic = 1;
const int MSF_DontHurt = 2;
// Flags for A_Blast // Flags for A_Blast
const int BF_USEAMMO = 1; const int BF_USEAMMO = 1;