mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- Split weaveindex into two separate byte-sized properties and moved them into unused space
inside AActor. SVN r2038 (trunk)
This commit is contained in:
parent
611834ea2a
commit
d2a4339816
6 changed files with 47 additions and 19 deletions
|
@ -764,7 +764,6 @@ public:
|
|||
DWORD flags6; // Shit! Where did all the flags go?
|
||||
int special1; // Special info
|
||||
int special2; // Special info
|
||||
int weaveindex; // Separated from special2 because it's used by globally accessible functions.
|
||||
int health;
|
||||
BYTE movedir; // 0-7
|
||||
SBYTE visdir;
|
||||
|
@ -782,6 +781,8 @@ public:
|
|||
TObjPtr<AActor> LastLookActor; // Actor last looked for (if TIDtoHate != 0)
|
||||
fixed_t SpawnPoint[3]; // For nightmare respawn
|
||||
WORD SpawnAngle;
|
||||
BYTE WeaveIndexXY; // Separated from special2 because it's used by globally accessible functions.
|
||||
BYTE WeaveIndexZ;
|
||||
int skillrespawncount;
|
||||
int TIDtoHate; // TID of things to hate (0 if none)
|
||||
FNameNoInit Species; // For monster families
|
||||
|
|
|
@ -76,12 +76,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave)
|
|||
int weaveXY, weaveZ;
|
||||
int angle;
|
||||
|
||||
// for compatibility this needs to set the value itself if it was never done by the projectile itself
|
||||
if (self->weaveindex == -1) self->weaveindex = 16;
|
||||
|
||||
// since these values are now user configurable we have to do a proper range check to avoid array overflows.
|
||||
weaveXY = (self->weaveindex >> 16) & 63;
|
||||
weaveZ = (self->weaveindex & 63);
|
||||
weaveXY = self->WeaveIndexXY & 63;
|
||||
weaveZ = self->WeaveIndexZ & 63;
|
||||
angle = (self->angle + ANG90) >> ANGLETOFINESHIFT;
|
||||
newX = self->x - FixedMul (finecosine[angle], FloatBobOffsets[weaveXY]<<1);
|
||||
newY = self->y - FixedMul (finesine[angle], FloatBobOffsets[weaveXY]<<1);
|
||||
|
@ -92,7 +89,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave)
|
|||
self->z -= FloatBobOffsets[weaveZ];
|
||||
weaveZ = (weaveZ + 2) & 63;
|
||||
self->z += FloatBobOffsets[weaveZ];
|
||||
self->weaveindex = weaveZ + (weaveXY<<16);
|
||||
self->WeaveIndexXY = weaveXY;
|
||||
self->WeaveIndexZ = weaveZ;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -135,12 +135,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffAttack)
|
|||
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle-(ANG45/15));
|
||||
if (mo)
|
||||
{
|
||||
mo->weaveindex = 32;
|
||||
mo->WeaveIndexXY = 32;
|
||||
}
|
||||
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle+(ANG45/15));
|
||||
if (mo)
|
||||
{
|
||||
mo->weaveindex = 0;
|
||||
mo->WeaveIndexXY = 0;
|
||||
}
|
||||
S_Sound (self, CHAN_WEAPON, "ClericCStaffFire", 1, ATTN_NORM);
|
||||
}
|
||||
|
@ -157,10 +157,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffMissileSlither)
|
|||
int weaveXY;
|
||||
int angle;
|
||||
|
||||
if (self->weaveindex == -1) self->weaveindex = 0;
|
||||
|
||||
// since these values are now user configurable we have to do a proper range check to avoid array overflows.
|
||||
weaveXY = self->weaveindex & 63;
|
||||
weaveXY = self->WeaveIndexXY & 63;
|
||||
angle = (self->angle+ANG90)>>ANGLETOFINESHIFT;
|
||||
newX = self->x-FixedMul(finecosine[angle], FloatBobOffsets[weaveXY]);
|
||||
newY = self->y-FixedMul(finesine[angle], FloatBobOffsets[weaveXY]);
|
||||
|
@ -168,7 +166,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffMissileSlither)
|
|||
newX += FixedMul(finecosine[angle], FloatBobOffsets[weaveXY]);
|
||||
newY += FixedMul(finesine[angle], FloatBobOffsets[weaveXY]);
|
||||
P_TryMove (self, newX, newY, true);
|
||||
self->weaveindex = weaveXY;
|
||||
self->WeaveIndexXY = weaveXY;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -312,13 +312,34 @@ void AActor::Serialize (FArchive &arc)
|
|||
{
|
||||
arc << DamageFactor;
|
||||
}
|
||||
if (SaveVersion >= 2036)
|
||||
if (SaveVersion > 2036)
|
||||
{
|
||||
arc << weaveindex;
|
||||
arc << WeaveIndexXY << WeaveIndexZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
weaveindex = special2;
|
||||
int index;
|
||||
|
||||
if (SaveVersion < 2036)
|
||||
{
|
||||
index = special2;
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << index;
|
||||
}
|
||||
// A_BishopMissileWeave and A_CStaffMissileSlither stored the weaveXY
|
||||
// value in different parts of the index.
|
||||
if (this->IsKindOf(PClass::FindClass("BishopFX")))
|
||||
{
|
||||
WeaveIndexXY = index >> 16;
|
||||
WeaveIndexZ = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
WeaveIndexXY = index;
|
||||
WeaveIndexZ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip past uservar array in old savegames
|
||||
|
|
|
@ -905,10 +905,19 @@ DEFINE_PROPERTY(bouncecount, I, Actor)
|
|||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_PROPERTY(weaveindex, I, Actor)
|
||||
DEFINE_PROPERTY(weaveindexXY, I, Actor)
|
||||
{
|
||||
PROP_INT_PARM(id, 0);
|
||||
defaults->weaveindex = id;
|
||||
defaults->WeaveIndexXY = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_PROPERTY(weaveindexZ, I, Actor)
|
||||
{
|
||||
PROP_INT_PARM(id, 0);
|
||||
defaults->WeaveIndexZ = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -19,7 +19,8 @@ ACTOR Actor native //: Thinker
|
|||
Gravity 1
|
||||
DamageFactor 1.0
|
||||
PushFactor 0.25
|
||||
WeaveIndex -1
|
||||
WeaveIndexXY 0
|
||||
WeaveIndexZ 16
|
||||
|
||||
// Variables for the expression evaluator
|
||||
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion
|
||||
|
|
Loading…
Reference in a new issue