diff --git a/src/actor.h b/src/actor.h index a7f06281a..5a8acbfc8 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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 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 diff --git a/src/g_hexen/a_bishop.cpp b/src/g_hexen/a_bishop.cpp index df998a8ab..d4de94f60 100644 --- a/src/g_hexen/a_bishop.cpp +++ b/src/g_hexen/a_bishop.cpp @@ -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; } //============================================================================ diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index b2a50487c..a29d3afd6 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -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; } //============================================================================ diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index c0f8af6e8..496bd7587 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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 diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index e8b170880..cd2537db0 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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; } //========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 71c0790db..8517b12fd 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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