- Remove FloatBobOffsets[], since it's just a mini-finesine[] table multiplied by 8.

SVN r3753 (trunk)
This commit is contained in:
Randy Heit 2012-07-11 02:50:13 +00:00
parent 26e65b26a1
commit ba00e3a185
12 changed files with 36 additions and 63 deletions

View file

@ -84,6 +84,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
}
// Handle Z movement
self->z = self->target->z + 2*FloatBobOffsets[self->args[0]];
self->z = self->target->z + 16*finesine[self->args[0] << BOBTOFINESHIFT];
self->args[0] = (self->args[0]+3)&63;
}

View file

@ -155,9 +155,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{
self->z -= FloatBobOffsets[self->special2] >> 1;
self->z -= finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->special2 = (self->special2 + 4) & 63;
self->z += FloatBobOffsets[self->special2] >> 1;
self->z += finesine[self->special2 << BOBTOFINESHIFT] * 4;
}
//============================================================================

View file

@ -144,17 +144,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
switch (j)
{ // float bob index
case 0:
mo->special2 = pr_holyatk2()&7; // upper-left
mo->special2 = pr_holyatk2(8 << BOBTOFINESHIFT); // upper-left
break;
case 1:
mo->special2 = 32+(pr_holyatk2()&7); // upper-right
mo->special2 = FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT); // upper-right
break;
case 2:
mo->special2 = (32+(pr_holyatk2()&7))<<16; // lower-left
mo->special2 = (FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT)) << 16; // lower-left
break;
case 3:
i = pr_holyatk2();
mo->special2 = ((32+(i&7))<<16)+32+(pr_holyatk2()&7);
i = pr_holyatk2(8 << BOBTOFINESHIFT);
mo->special2 = ((FINEANGLES/2 + i) << 16) + FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT);
break;
}
mo->z = self->z;
@ -448,23 +448,19 @@ void CHolyWeave (AActor *actor, FRandom &pr_random)
int weaveXY, weaveZ;
int angle;
weaveXY = actor->special2>>16;
weaveZ = actor->special2&0xFFFF;
angle = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
newX = actor->x-FixedMul(finecosine[angle],
FloatBobOffsets[weaveXY]<<2);
newY = actor->y-FixedMul(finesine[angle],
FloatBobOffsets[weaveXY]<<2);
weaveXY = (weaveXY+(pr_random()%5))&63;
newX += FixedMul(finecosine[angle],
FloatBobOffsets[weaveXY]<<2);
newY += FixedMul(finesine[angle],
FloatBobOffsets[weaveXY]<<2);
weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & FINEMASK;
angle = (actor->angle + ANG90) >> ANGLETOFINESHIFT;
newX = actor->x - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->y - FixedMul(finesine[angle], finesine[weaveXY] * 32);
weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newX += FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY += FixedMul(finesine[angle], finesine[weaveXY] * 32);
P_TryMove(actor, newX, newY, true);
actor->z -= FloatBobOffsets[weaveZ]<<1;
weaveZ = (weaveZ+(pr_random()%5))&63;
actor->z += FloatBobOffsets[weaveZ]<<1;
actor->special2 = weaveZ+(weaveXY<<16);
actor->z -= finesine[weaveZ] * 16;
weaveZ = (weaveZ + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
actor->z += finesine[weaveZ] * 16;
actor->special2 = weaveZ + (weaveXY << 16);
}
//============================================================================

View file

@ -134,8 +134,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
if (self->threshold) self->threshold--;
// Float up and down
self->z += FloatBobOffsets[weaveindex];
self->special1 = (weaveindex+2)&63;
self->z += finesine[weaveindex << BOBTOFINESHIFT] * 8;
self->special1 = (weaveindex + 2) & 63;
// Ensure it stays above certain height
if (self->z < self->floorz + (64*FRACUNIT))

View file

@ -422,8 +422,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, true);
bobIndex = self->special2;
self->z += FloatBobOffsets[bobIndex]>>4;
self->special2 = (bobIndex+1)&63;
self->z += finesine[bobIndex << BOBTOFINESHIFT] >> 1;
self->special2 = (bobIndex + 1) & 63;
}
//===========================================================================

View file

@ -80,8 +80,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
if ((self->args[3] % 4) == 0)
{
weaveindex = self->special2;
self->z += FloatBobOffsets[weaveindex]>>1;
self->special2 = (weaveindex+1)&63;
self->z += finesine[weaveindex << BOBTOFINESHIFT] * 4;
self->special2 = (weaveindex + 1) & 63;
}
angle = self->angle>>ANGLETOFINESHIFT;

View file

@ -174,7 +174,7 @@ void KSpiritInit (AActor *spirit, AActor *korax)
spirit->health = KORAX_SPIRIT_LIFETIME;
spirit->tracer = korax; // Swarm around korax
spirit->special2 = 32+(pr_kspiritinit()&7); // Float bob index
spirit->special2 = FINEANGLES/2 + pr_kspiritinit(8 << BOBTOFINESHIFT); // Float bob index
spirit->args[0] = 10; // initial turn value
spirit->args[1] = 0; // initial look angle

View file

@ -226,8 +226,8 @@ void A_WraithFX4 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
{
int weaveindex = self->special1;
self->z += FloatBobOffsets[weaveindex];
self->special1 = (weaveindex+2)&63;
self->z += finesine[weaveindex << BOBTOFINESHIFT] * 8;
self->special1 = (weaveindex + 2) & 63;
// if (self->floorclip > 0)
// {
// P_SetMobjState(self, S_WRAITH_RAISE2);

View file

@ -114,8 +114,6 @@ void P_UnPredictPlayer ();
#define ONCEILINGZ FIXED_MAX
#define FLOATRANDZ (FIXED_MAX-1)
extern fixed_t FloatBobOffsets[64];
APlayerPawn *P_SpawnPlayer (struct FPlayerStart *mthing, int playernum, bool tempplayer=false);
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);

View file

@ -119,27 +119,6 @@ CUSTOM_CVAR (Float, sv_gravity, 800.f, CVAR_SERVERINFO|CVAR_NOSAVE)
CVAR (Bool, cl_missiledecals, true, CVAR_ARCHIVE)
CVAR (Bool, addrocketexplosion, false, CVAR_ARCHIVE)
fixed_t FloatBobOffsets[64] =
{
0, 51389, 102283, 152192,
200636, 247147, 291278, 332604,
370727, 405280, 435929, 462380,
484378, 501712, 514213, 521763,
524287, 521763, 514213, 501712,
484378, 462380, 435929, 405280,
370727, 332604, 291278, 247147,
200636, 152192, 102283, 51389,
-1, -51390, -102284, -152193,
-200637, -247148, -291279, -332605,
-370728, -405281, -435930, -462381,
-484380, -501713, -514215, -521764,
-524288, -521764, -514214, -501713,
-484379, -462381, -435930, -405280,
-370728, -332605, -291279, -247148,
-200637, -152193, -102284, -51389
};
CVAR (Int, cl_pufftype, 0, CVAR_ARCHIVE);
CVAR (Int, cl_bloodtype, 0, CVAR_ARCHIVE);

View file

@ -44,14 +44,15 @@
#endif
#define FINEANGLEBITS 13
#define FINEANGLES 8192
#define FINEMASK (FINEANGLES-1)
// 0x100000000 to 0x2000
#define ANGLETOFINESHIFT 19
#define BOBTOFINESHIFT (FINEANGLEBITS - 6)
// Effective size is 10240.
extern fixed_t finesine[5*FINEANGLES/4];

View file

@ -3831,11 +3831,11 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, fixed_t xydist, fixed_t zdis
if (xydist != 0 && xyspeed != 0)
{
dist = FixedMul(FloatBobOffsets[weaveXY], xydist);
dist = MulScale13(finesine[weaveXY << BOBTOFINESHIFT], xydist);
newX = self->x - FixedMul (finecosine[angle], dist);
newY = self->y - FixedMul (finesine[angle], dist);
weaveXY = (weaveXY + xyspeed) & 63;
dist = FixedMul(FloatBobOffsets[weaveXY], xydist);
dist = MulScale13(finesine[weaveXY << BOBTOFINESHIFT], xydist);
newX += FixedMul (finecosine[angle], dist);
newY += FixedMul (finesine[angle], dist);
if (!(self->flags5 & MF5_NOINTERACTION))
@ -3852,12 +3852,11 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, fixed_t xydist, fixed_t zdis
}
self->WeaveIndexXY = weaveXY;
}
if (zdist != 0 && zspeed != 0)
{
self->z -= FixedMul(FloatBobOffsets[weaveZ], zdist);
self->z -= MulScale13(finesine[weaveZ << BOBTOFINESHIFT], zdist);
weaveZ = (weaveZ + zspeed) & 63;
self->z += FixedMul(FloatBobOffsets[weaveZ], zdist);
self->z += MulScale13(finesine[weaveZ << BOBTOFINESHIFT], zdist);
self->WeaveIndexZ = weaveZ;
}
}