From a5e1fe690662e4d4ad7a572bbc0fdee6abed9673 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Jan 2010 14:35:52 +0000 Subject: [PATCH] - fixed: Sector_SetWind and Sector_SetCurrent were not usable in scripts called from a line. - added Gez's A_Mushroom extension. SVN r2144 (trunk) --- src/g_doom/a_fatso.cpp | 23 ++++++++++++++++------- src/p_lnspec.cpp | 4 ++-- src/p_local.h | 4 ++-- src/p_mobj.cpp | 17 +++++++++-------- src/p_spec.cpp | 3 +++ wadsrc/static/actors/constants.txt | 1 + 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/g_doom/a_fatso.cpp b/src/g_doom/a_fatso.cpp index 484df58ca4..73ae4e2b53 100644 --- a/src/g_doom/a_fatso.cpp +++ b/src/g_doom/a_fatso.cpp @@ -118,7 +118,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3) // 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) { @@ -134,11 +141,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom) if (n == 0) n = self->Damage; // GetMissileDamage (0, 1); 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<target : self; target->height = self->height; 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->y = self->y + (j << FRACBITS); 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))) - { - mo = P_SpawnMissile (self, target, spawntype); // Launch fireball + if ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options + (flags == 0 && (self->state->DefineFlags & SDF_DEHACKED) && (i_compatflags & COMPATF_MUSHROOM))) + { // 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) { // Slow it down a bit diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index bb94ccea1c..818de725a5 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1853,7 +1853,7 @@ void AdjustPusher (int tag, int magnitude, int angle, DPusher::EPusher type) FUNC(LS_Sector_SetWind) // Sector_SetWind (tag, amount, angle) { - if (ln || arg3) + if (arg3) return false; AdjustPusher (arg0, arg1, arg2, DPusher::p_wind); @@ -1863,7 +1863,7 @@ FUNC(LS_Sector_SetWind) FUNC(LS_Sector_SetCurrent) // Sector_SetCurrent (tag, amount, angle) { - if (ln || arg3) + if (arg3) return false; AdjustPusher (arg0, arg1, arg2, DPusher::p_current); diff --git a/src/p_local.h b/src/p_local.h index fe3b84cd30..1707db26ec 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -111,9 +111,9 @@ void P_RipperBlood (AActor *mo, AActor *bleeder); int P_GetThingFloorType (AActor *thing); 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_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_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); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 7db9920197..b589e061ee 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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, - source, dest, type); + source, dest, type, true, owner); } 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 *source, AActor *dest, const PClass *type, bool checkspawn) + AActor *source, AActor *dest, const PClass *type, bool checkspawn, AActor *owner) { 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); 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); @@ -5114,14 +5117,14 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, 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; fixed_t dist; AActor *th = Spawn (type, source->x, source->y, source->z + 4*8*FRACUNIT, ALLOW_REPLACE); 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); an >>= ANGLETOFINESHIFT; @@ -5250,8 +5253,6 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, AActor *linetarget; 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)) { // Keep exactly the same angle and pitch as the player's own aim diff --git a/src/p_spec.cpp b/src/p_spec.cpp index c78e4ebe34..6ac57bb4a2 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -2059,11 +2059,13 @@ static void P_SpawnPushers () case Sector_SetWind: // wind 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); + l->special = 0; break; case Sector_SetCurrent: // current 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); + l->special = 0; break; case PointPush_SetForce: // push/pull @@ -2092,6 +2094,7 @@ static void P_SpawnPushers () } } } + l->special = 0; break; } } diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index fda6fd5a62..0e1f8f903e 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -70,6 +70,7 @@ const int RGF_NOPIERCING = 2; // Flags for A_Mushroom const int MSF_Standard = 0; const int MSF_Classic = 1; +const int MSF_DontHurt = 2; // Flags for A_Blast const int BF_USEAMMO = 1;