diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4f241608b..08d1f117b 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +December 23, 2009 (Changes by Graf Zahl) +- made the initial weave index for A_BishopMissileWeave and A_CStaffMissileSlither + a configurable actor property. +- added a menu item for snd_channels. + December 20, 2009 (Changes by Graf Zahl) - Fixed: The Dehacked parser could read past the end of the file if the last element was improperly defined. diff --git a/src/actor.h b/src/actor.h index b6dab786a..a7f06281a 100644 --- a/src/actor.h +++ b/src/actor.h @@ -764,6 +764,7 @@ 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; diff --git a/src/g_hexen/a_bishop.cpp b/src/g_hexen/a_bishop.cpp index 1e4109748..df998a8ab 100644 --- a/src/g_hexen/a_bishop.cpp +++ b/src/g_hexen/a_bishop.cpp @@ -60,7 +60,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopAttack2) if (mo != NULL) { mo->tracer = self->target; - mo->special2 = 16; // High word == x/y, Low word == z } self->special1--; } @@ -77,10 +76,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave) int weaveXY, weaveZ; int angle; - if (self->special2 == 0) self->special2 = 16; + // 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; - weaveXY = self->special2 >> 16; - weaveZ = self->special2 & 0xFFFF; + // 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); angle = (self->angle + ANG90) >> ANGLETOFINESHIFT; newX = self->x - FixedMul (finecosine[angle], FloatBobOffsets[weaveXY]<<1); newY = self->y - FixedMul (finesine[angle], FloatBobOffsets[weaveXY]<<1); @@ -91,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave) self->z -= FloatBobOffsets[weaveZ]; weaveZ = (weaveZ + 2) & 63; self->z += FloatBobOffsets[weaveZ]; - self->special2 = weaveZ + (weaveXY<<16); + self->weaveindex = weaveZ + (weaveXY<<16); } //============================================================================ diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 38018071c..b2a50487c 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->special2 = 32; + mo->weaveindex = 32; } mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle+(ANG45/15)); if (mo) { - mo->special2 = 0; + mo->weaveindex = 0; } S_Sound (self, CHAN_WEAPON, "ClericCStaffFire", 1, ATTN_NORM); } @@ -157,7 +157,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffMissileSlither) int weaveXY; int angle; - weaveXY = self->special2; + 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; angle = (self->angle+ANG90)>>ANGLETOFINESHIFT; newX = self->x-FixedMul(finecosine[angle], FloatBobOffsets[weaveXY]); newY = self->y-FixedMul(finesine[angle], FloatBobOffsets[weaveXY]); @@ -165,7 +168,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->special2 = weaveXY; + self->weaveindex = weaveXY; } //============================================================================ diff --git a/src/m_options.cpp b/src/m_options.cpp index 313d0d602..e8ffa85c3 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -94,6 +94,7 @@ EXTERN_CVAR(Bool, hud_althud) EXTERN_CVAR(Int, compatmode) EXTERN_CVAR (Bool, vid_vsync) EXTERN_CVAR(Bool, displaynametags) +EXTERN_CVAR (Int, snd_channels) // // defaulted values @@ -1252,6 +1253,7 @@ static menuitem_t SoundItems[] = { discrete, "Underwater reverb", {&snd_waterreverb}, {2.0}, {0.0}, {0.0}, {OnOff} }, { slider, "Underwater cutoff", {&snd_waterlp}, {0.0}, {2000.0},{50.0}, {NULL} }, { discrete, "Randomize pitches", {&snd_pitched}, {2.0}, {0.0}, {0.0}, {OnOff} }, + { slider, "Sound channels", {&snd_channels}, {8.0}, {256.0}, {8.0}, {NULL} }, { redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} }, { more, "Restart sound", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)MakeSoundChanges} }, { redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} }, diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 868941d01..c0f8af6e8 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -312,6 +312,14 @@ void AActor::Serialize (FArchive &arc) { arc << DamageFactor; } + if (SaveVersion >= 2036) + { + arc << weaveindex; + } + else + { + weaveindex = special2; + } // Skip past uservar array in old savegames if (SaveVersion < 1933) diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index ea8407cc0..e8b170880 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -902,6 +902,15 @@ DEFINE_PROPERTY(bouncecount, I, Actor) defaults->bouncecount = id; } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(weaveindex, I, Actor) +{ + PROP_INT_PARM(id, 0); + defaults->weaveindex = id; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 117a29ac8..71c0790db 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -19,6 +19,7 @@ ACTOR Actor native //: Thinker Gravity 1 DamageFactor 1.0 PushFactor 0.25 + WeaveIndex -1 // Variables for the expression evaluator // NOTE: fixed_t and angle_t are only used here to ensure proper conversion