- made the initial weave index for A_BishopMissileWeave and A_CStaffMissileSlither

a configurable actor property.
- added a menu item for snd_channels.



SVN r2036 (trunk)
This commit is contained in:
Christoph Oelckers 2009-12-23 11:41:24 +00:00
parent cc3b7967a1
commit b0b80f6996
8 changed files with 39 additions and 9 deletions

View file

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

View file

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

View file

@ -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);
}
//============================================================================

View file

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

View file

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

View file

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

View file

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

View file

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