- Added A_WeaponBob.

SVN r1698 (trunk)
This commit is contained in:
Randy Heit 2009-07-01 00:58:26 +00:00
parent 98e3b2f5fc
commit 8554ccf2a3
7 changed files with 37 additions and 11 deletions

View file

@ -1,4 +1,5 @@
June 30, 2009 June 30, 2009
- Added A_WeaponBob.
- Dropped the Hexen player classes' JumpZ down to 9, since the original value - Dropped the Hexen player classes' JumpZ down to 9, since the original value
now works as it originally did. now works as it originally did.
- MF2_NODMGTHRUST now works with players, too. (Previously, it was only for - MF2_NODMGTHRUST now works with players, too. (Previously, it was only for

View file

@ -194,6 +194,7 @@ typedef enum
CF_DOUBLEFIRINGSPEED= 1 << 21, // Player owns a double firing speed artifact CF_DOUBLEFIRINGSPEED= 1 << 21, // Player owns a double firing speed artifact
CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths. CF_EXTREMELYDEAD = 1 << 22, // [RH] Reliably let the status bar know about extreme deaths.
CF_INFINITEAMMO = 1 << 23, // Player owns an infinite ammo artifact CF_INFINITEAMMO = 1 << 23, // Player owns an infinite ammo artifact
CF_WEAPONBOBBING = 1 << 24, // [HW] Bob weapon while the player is moving
} cheat_t; } cheat_t;
#define WPIECE1 1 #define WPIECE1 1

View file

@ -208,7 +208,7 @@ void DBaseDecal::SetShade (int r, int g, int b)
} }
// Returns the texture the decal stuck to. // Returns the texture the decal stuck to.
FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor * ffloor) FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor *ffloor)
{ {
// Stick the decal at the end of the chain so it appears on top // Stick the decal at the end of the chain so it appears on top
DBaseDecal *next, **prev; DBaseDecal *next, **prev;
@ -431,7 +431,7 @@ static side_t *NextWall (const side_t *wall)
return NULL; return NULL;
} }
void DBaseDecal::SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor * ffloor) void DBaseDecal::SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor *ffloor)
{ {
fixed_t ldx, ldy; fixed_t ldx, ldy;
@ -475,7 +475,7 @@ void DBaseDecal::SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor
} }
} }
void DBaseDecal::SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize, F3DFloor * ffloor) void DBaseDecal::SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize, F3DFloor *ffloor)
{ {
vertex_t *v1; vertex_t *v1;
fixed_t x, y, ldx, ldy; fixed_t x, y, ldx, ldy;

View file

@ -51,8 +51,8 @@ protected:
void CalcFracPos (side_t *wall, fixed_t x, fixed_t y); void CalcFracPos (side_t *wall, fixed_t x, fixed_t y);
void Remove (); void Remove ();
static void SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor * ffloor); static void SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor *ffloor);
static void SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize, F3DFloor * ffloor); static void SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize, F3DFloor *ffloor);
}; };
class DImpactDecal : public DBaseDecal class DImpactDecal : public DBaseDecal

View file

@ -67,8 +67,8 @@ void P_SetPsprite (player_t *player, int position, FState *state)
if (position == ps_weapon) if (position == ps_weapon)
{ {
// A_WeaponReady will re-set this as needed // A_WeaponReady will re-set these as needed
player->cheats &= ~CF_WEAPONREADY; player->cheats &= ~(CF_WEAPONREADY | CF_WEAPONBOBBING);
} }
psp = &player->psprites[position]; psp = &player->psprites[position];
@ -312,7 +312,7 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y)
// [RH] Smooth transitions between bobbing and not-bobbing frames. // [RH] Smooth transitions between bobbing and not-bobbing frames.
// This also fixes the bug where you can "stick" a weapon off-center by // This also fixes the bug where you can "stick" a weapon off-center by
// shooting it when it's at the peak of its swing. // shooting it when it's at the peak of its swing.
bobtarget = (player->cheats & CF_WEAPONREADY) ? player->bob : 0; bobtarget = (player->cheats & CF_WEAPONBOBBING) ? player->bob : 0;
if (curbob != bobtarget) if (curbob != bobtarget)
{ {
if (abs (bobtarget - curbob) <= 1*FRACUNIT) if (abs (bobtarget - curbob) <= 1*FRACUNIT)
@ -345,6 +345,29 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y)
} }
} }
//---------------------------------------------------------------------------
//
// PROC A_WeaponBob
//
// The player's weapon will bob, but they cannot fire it at this time.
//
//---------------------------------------------------------------------------
DEFINE_ACTION_FUNCTION(AInventory, A_WeaponBob)
{
player_t *player = self->player;
if (player == NULL || player->ReadyWeapon == NULL)
{
return;
}
// Prepare for bobbing action.
player->cheats |= CF_WEAPONBOBBING;
player->psprites[ps_weapon].sx = 0;
player->psprites[ps_weapon].sy = WEAPONTOP;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// PROC A_WeaponReady // PROC A_WeaponReady
@ -387,7 +410,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_WeaponReady)
} }
// Prepare for bobbing and firing action. // Prepare for bobbing and firing action.
player->cheats |= CF_WEAPONREADY; player->cheats |= CF_WEAPONREADY | CF_WEAPONBOBBING;
player->psprites[ps_weapon].sx = 0; player->psprites[ps_weapon].sx = 0;
player->psprites[ps_weapon].sy = WEAPONTOP; player->psprites[ps_weapon].sy = WEAPONTOP;
} }

View file

@ -47,7 +47,7 @@ ACTOR Fist : Weapon
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// //
// Fist // Pistol
// //
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View file

@ -16,6 +16,7 @@ ACTOR Inventory native
action native A_Light2(); action native A_Light2();
action native A_LightInverse(); action native A_LightInverse();
action native A_WeaponReady(); action native A_WeaponReady();
action native A_WeaponBob();
action native A_Lower(); action native A_Lower();
action native A_Raise(); action native A_Raise();
action native A_FirePistol(); action native A_FirePistol();