- 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)
This commit is contained in:
Christoph Oelckers 2009-08-02 10:48:58 +00:00
parent 8330a69212
commit 641f946e32
7 changed files with 63 additions and 7 deletions

View file

@ -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.

View file

@ -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;
}
}
}
}

View file

@ -339,9 +339,12 @@ namespace GC
// with knowledge of the object that holds the pointer.
template<class T>
class TObjPtr
{
union
{
T *p;
DObject *o; // For GC::Mark below to make GCC's strict aliasing happy
DObject *o;
};
public:
TObjPtr() throw()
{

View file

@ -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) {}
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) {}

View file

@ -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
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;

View file

@ -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

View file

@ -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<Actor> spawntype = "FatShot", int numspawns = 0);
action native A_Mushroom(class<Actor> 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();