- make weapon sprite offsets floats.

This commit is contained in:
Christoph Oelckers 2016-03-21 01:16:34 +01:00
parent 1ff4bb419c
commit 2d2eeb49f0
9 changed files with 23 additions and 25 deletions

View file

@ -125,8 +125,7 @@ void P_UpdateBeak (AActor *self)
{
if (self->player != NULL)
{
self->player->psprites[ps_weapon].sy = WEAPONTOP +
(self->player->chickenPeck << (FRACBITS-1));
self->player->psprites[ps_weapon].sy = WEAPONTOP + self->player->chickenPeck / 2;
}
}

View file

@ -272,8 +272,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT;
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2);
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3);
Angle = self->Angles.Yaw;
if (power)
{
@ -441,8 +441,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1)
if (!weapon->DepleteAmmo(weapon->bAltFire))
return 0;
}
player->psprites[ps_weapon].sx = ((pr_maceatk() & 3) - 2)*FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_maceatk() & 3)*FRACUNIT;
player->psprites[ps_weapon].sx = ((pr_maceatk() & 3) - 2);
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_maceatk() & 3);
ball = P_SpawnPlayerMissile(self, PClass::FindActor("MaceFX1"), self->Angles.Yaw + (((pr_maceatk() & 7) - 4) * (360. / 256)));
if (ball)
{
@ -1065,7 +1065,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
return 0;
}
if (self->bouncecount >= 0 && (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size())
pos.Z = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPointF(mo);// - 40 * FRACUNIT;
pos.Z = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPointF(mo);
else
pos.Z = self->Sector->ceilingplane.ZatPointF(mo);
int moceiling = P_Find3DFloor(NULL, pos, false, false, pos.Z);

View file

@ -73,7 +73,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
int randAttack;
static const int atkResolve1[] = { 50, 150 };
static const int atkResolve2[] = { 150, 200 };
int dist;
// Ice ball (close 20% : far 60%)
// Fire column (close 40% : far 20%)
@ -93,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
P_TraceBleed (newdam > 0 ? newdam : damage, target, self);
return 0;
}
dist = self->AproxDistance (target) > 8*64*FRACUNIT;
int dist = self->Distance2D(target) > 8 * 64;
randAttack = pr_atk ();
if (randAttack < atkResolve1[dist])
{ // Ice ball

View file

@ -1316,10 +1316,10 @@ void APowerTargeter::InitEffect ()
P_SetPsprite (player, ps_targetright, state + 2);
}
player->psprites[ps_targetcenter].sx = (160-3)*FRACUNIT;
player->psprites[ps_targetcenter].sx = (160-3);
player->psprites[ps_targetcenter].sy =
player->psprites[ps_targetleft].sy =
player->psprites[ps_targetright].sy = (100-3)*FRACUNIT;
player->psprites[ps_targetright].sy = (100-3);
PositionAccuracy ();
}
@ -1382,8 +1382,8 @@ void APowerTargeter::PositionAccuracy ()
if (player != NULL)
{
player->psprites[ps_targetleft].sx = (160-3)*FRACUNIT - ((100 - player->mo->accuracy) << FRACBITS);
player->psprites[ps_targetright].sx = (160-3)*FRACUNIT + ((100 - player->mo->accuracy) << FRACBITS);
player->psprites[ps_targetleft].sx = (160-3) - ((100 - player->mo->accuracy));
player->psprites[ps_targetright].sx = (160-3)+ ((100 - player->mo->accuracy));
}
}

View file

@ -741,7 +741,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_HandLower)
if (self->player != NULL)
{
pspdef_t *psp = &self->player->psprites[ps_weapon];
psp->sy += FRACUNIT*9;
psp->sy += 9;
if (psp->sy > WEAPONBOTTOM*2)
{
P_SetPsprite (self->player, ps_weapon, NULL);

View file

@ -500,8 +500,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2Pre)
if (self->player != NULL)
{
self->player->psprites[ps_weapon].sx += pr_mauler2.Random2() << 10;
self->player->psprites[ps_weapon].sy += pr_mauler2.Random2() << 10;
self->player->psprites[ps_weapon].sx += pr_mauler2.Random2() / 64.;
self->player->psprites[ps_weapon].sy += pr_mauler2.Random2() / 64.;
}
return 0;
}

View file

@ -33,8 +33,8 @@
// MACROS ------------------------------------------------------------------
#define LOWERSPEED FRACUNIT*6
#define RAISESPEED FRACUNIT*6
#define LOWERSPEED 6.
#define RAISESPEED 6.
// TYPES -------------------------------------------------------------------
@ -169,11 +169,11 @@ void P_SetPsprite (player_t *player, int position, FState *state, bool nofunctio
if (state->GetMisc1())
{ // Set coordinates.
psp->sx = state->GetMisc1()<<FRACBITS;
psp->sx = state->GetMisc1();
}
if (state->GetMisc2())
{
psp->sy = state->GetMisc2()<<FRACBITS;
psp->sy = state->GetMisc2();
}
if (!nofunction && player->mo != NULL)

View file

@ -28,12 +28,12 @@
#include "tables.h"
#include "thingdef/thingdef.h"
#define WEAPONBOTTOM 128*FRACUNIT
#define WEAPONBOTTOM 128.
// [RH] +0x6000 helps it meet the screen bottom
// at higher resolutions while still being in
// the right spot at 320x200.
#define WEAPONTOP (32*FRACUNIT+0x6000)
#define WEAPONTOP (32+6./16)
//
@ -66,8 +66,8 @@ struct pspdef_t
{
FState* state; // a NULL state means not active
int tics;
fixed_t sx;
fixed_t sy;
double sx;
double sy;
int sprite;
int frame;
bool processPending; // true: waiting for periodic processing on this tick

View file

@ -1590,7 +1590,7 @@ void R_DrawPlayerSprites ()
// [RH] Don't draw the targeter's crosshair if the player already has a crosshair set.
if (psp->state && (i != ps_targetcenter || CrosshairImage == NULL))
{
R_DrawPSprite (psp, i, camera, psp->sx + ofsx, psp->sy + ofsy);
R_DrawPSprite (psp, i, camera, FLOAT2FIXED(psp->sx) + ofsx, FLOAT2FIXED(psp->sy) + ofsy);
}
// [RH] Don't bob the targeter.
if (i == ps_flash)