diff --git a/docs/rh-log.txt b/docs/rh-log.txt index fb95f3f9c5..7171bd8ca9 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ June 30, 2009 +- Added A_WeaponBob. - Dropped the Hexen player classes' JumpZ down to 9, since the original value now works as it originally did. - MF2_NODMGTHRUST now works with players, too. (Previously, it was only for diff --git a/src/d_player.h b/src/d_player.h index 245279dbb2..36881d58ba 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -194,6 +194,7 @@ typedef enum 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_INFINITEAMMO = 1 << 23, // Player owns an infinite ammo artifact + CF_WEAPONBOBBING = 1 << 24, // [HW] Bob weapon while the player is moving } cheat_t; #define WPIECE1 1 diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index de9094c532..b69bb42955 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -208,7 +208,7 @@ void DBaseDecal::SetShade (int r, int g, int b) } // 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 DBaseDecal *next, **prev; @@ -431,7 +431,7 @@ static side_t *NextWall (const side_t *wall) 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; @@ -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; fixed_t x, y, ldx, ldy; @@ -535,7 +535,7 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t x, fix SpreadZ = z; // Try spreading left first - SpreadLeft (rorg - DecalLeft, v1, wall, ffloor); + SpreadLeft (rorg - DecalLeft, v1, wall, ffloor); SpreadStack.Clear (); // Then try spreading right diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 6afebfef50..11752234e3 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -51,8 +51,8 @@ protected: void CalcFracPos (side_t *wall, fixed_t x, fixed_t y); void Remove (); - 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 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); }; class DImpactDecal : public DBaseDecal diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 5ce3f17ffd..d7219465a5 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -67,8 +67,8 @@ void P_SetPsprite (player_t *player, int position, FState *state) if (position == ps_weapon) { - // A_WeaponReady will re-set this as needed - player->cheats &= ~CF_WEAPONREADY; + // A_WeaponReady will re-set these as needed + player->cheats &= ~(CF_WEAPONREADY | CF_WEAPONBOBBING); } 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. // 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. - bobtarget = (player->cheats & CF_WEAPONREADY) ? player->bob : 0; + bobtarget = (player->cheats & CF_WEAPONBOBBING) ? player->bob : 0; if (curbob != bobtarget) { 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 @@ -387,7 +410,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_WeaponReady) } // 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].sy = WEAPONTOP; } diff --git a/wadsrc/static/actors/doom/doomweapons.txt b/wadsrc/static/actors/doom/doomweapons.txt index be3fa9e322..d3997545f9 100644 --- a/wadsrc/static/actors/doom/doomweapons.txt +++ b/wadsrc/static/actors/doom/doomweapons.txt @@ -47,7 +47,7 @@ ACTOR Fist : Weapon // -------------------------------------------------------------------------- // -// Fist +// Pistol // // -------------------------------------------------------------------------- diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 95deef2a9e..c226a71810 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -16,6 +16,7 @@ ACTOR Inventory native action native A_Light2(); action native A_LightInverse(); action native A_WeaponReady(); + action native A_WeaponBob(); action native A_Lower(); action native A_Raise(); action native A_FirePistol();