From 641f946e3232b1ae11366fb648672b157d0548cf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 2 Aug 2009 10:48:58 +0000 Subject: [PATCH] - Fixed: The big endian version of PalEntry did not add the DWORD d field. - Fixed: TObjPtr did not use a union to map its 2 pointers together. - Added a compatibility mode for A_Mushroom. For DECORATE it is an additional parameter but to force it for Dehacked mods some minor hacks using the Misc1 variable were needed. SVN r1746 (trunk) --- docs/rh-log.txt | 9 ++++++++- src/d_dehacked.cpp | 5 +++++ src/dobject.h | 7 +++++-- src/doomtype.h | 9 ++++++++- src/g_doom/a_fatso.cpp | 14 ++++++++++++-- src/p_mobj.cpp | 24 ++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 2 +- 7 files changed, 63 insertions(+), 7 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c4a996d50..f44355a38 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,11 @@ -August 1, 2009 +August 2, 2009 (Changes by Graf Zahl) +- Fixed: The big endian version of PalEntry did not add the DWORD d field. +- Fixed: TObjPtr did not use a union to map its 2 pointers together. +- Added a compatibility mode for A_Mushroom. For DECORATE it is an additional + parameter but to force it for Dehacked mods some minor hacks using the + Misc1 variable were needed. + +August 1, 2009 - Moved the terget->velz assignment to the end of A_VileAttack to remove the influence of vertical thrust from the radius attack, since ZDoom does explosions in three dimensions, but Doom only did it in two. diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 03edbd6dc..37d18e6da 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1715,6 +1715,11 @@ static int PatchCodePtrs (int dummy) } } SetPointer(state, sym); + // Hack to trigger compatible mode for A_Mushroom when called from Dehacked mods + if (symname.CompareNoCase("A_Mushroom")) + { + state->Misc1 = 1; + } } } } diff --git a/src/dobject.h b/src/dobject.h index e853b7ec0..0176f587c 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -340,8 +340,11 @@ namespace GC template class TObjPtr { - T *p; - DObject *o; // For GC::Mark below to make GCC's strict aliasing happy + union + { + T *p; + DObject *o; + }; public: TObjPtr() throw() { diff --git a/src/doomtype.h b/src/doomtype.h index 6d8ed8011..08f187aeb 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -162,7 +162,14 @@ struct PalEntry #ifdef WORDS_BIGENDIAN PalEntry (BYTE ir, BYTE ig, BYTE ib) : a(0), r(ir), g(ig), b(ib) {} PalEntry (BYTE ia, BYTE ir, BYTE ig, BYTE ib) : a(ia), r(ir), g(ig), b(ib) {} - BYTE a,r,g,b; + union + { + struct + { + BYTE a,r,g,b; + }; + DWORD d; + }; #else PalEntry (BYTE ir, BYTE ig, BYTE ib) : b(ib), g(ig), r(ir), a(0) {} PalEntry (BYTE ia, BYTE ir, BYTE ig, BYTE ib) : b(ib), g(ig), r(ir), a(ia) {} diff --git a/src/g_doom/a_fatso.cpp b/src/g_doom/a_fatso.cpp index 51e0587da..66cd47aac 100644 --- a/src/g_doom/a_fatso.cpp +++ b/src/g_doom/a_fatso.cpp @@ -118,13 +118,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3) // Original idea: Linguica // +AActor * P_OldSpawnMissile(AActor * source, AActor * dest, const PClass *type); + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom) { int i, j; - ACTION_PARAM_START(2); + ACTION_PARAM_START(3); ACTION_PARAM_CLASS(spawntype, 0); ACTION_PARAM_INT(n, 1); + ACTION_PARAM_INT(flags, 2); if (n == 0) n = self->GetMissileDamage (0, 1); if (spawntype == NULL) spawntype = PClass::FindClass("FatShot"); @@ -146,7 +149,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) << (FRACBITS+2)); // Aim up fairly high - mo = P_SpawnMissile (self, target, spawntype); // Launch fireball + if (flags == 0 && self->state->Misc1 == 0) + { + mo = P_SpawnMissile (self, target, spawntype); // Launch fireball + } + else + { + mo = P_OldSpawnMissile (self, target, spawntype); // Launch fireball + } if (mo != NULL) { mo->velx >>= 1; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ed81dbc2d..fc65306f0 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4877,6 +4877,30 @@ 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) +{ + 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->angle = an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y); + an >>= ANGLETOFINESHIFT; + th->velx = FixedMul (th->Speed, finecosine[an]); + th->vely = FixedMul (th->Speed, finesine[an]); + + dist = P_AproxDistance (dest->x - source->x, dest->y - source->y); + if (th->Speed) dist = dist / th->Speed; + + if (dist < 1) + dist = 1; + + th->velz = (dest->z - source->z) / dist; + P_CheckMissileSpawn(th); + return th; +} //--------------------------------------------------------------------------- // // FUNC P_SpawnMissileAngle diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 04334701c..96da00bb3 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -100,7 +100,7 @@ ACTOR Actor native //: Thinker action native A_BrainExplode(); action native A_Die(name damagetype = "none"); action native A_Detonate(); - action native A_Mushroom(class spawntype = "FatShot", int numspawns = 0); + action native A_Mushroom(class spawntype = "FatShot", int numspawns = 0, int flags = 0); action native A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); action native A_SetFloorClip();