mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- Added A_WeaponBob.
SVN r1698 (trunk)
This commit is contained in:
parent
98e3b2f5fc
commit
8554ccf2a3
7 changed files with 37 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ ACTOR Fist : Weapon
|
|||
|
||||
// --------------------------------------------------------------------------
|
||||
//
|
||||
// Fist
|
||||
// Pistol
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue