mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Added Gez's A_WeaponReady enhancement submission.
SVN r1711 (trunk)
This commit is contained in:
parent
17418316ea
commit
23e4c47b5b
8 changed files with 58 additions and 46 deletions
|
@ -1,4 +1,7 @@
|
|||
July 5, 2009 (Changes by Graf Zahl)
|
||||
July 6, 2009 (Changes by Graf Zahl)
|
||||
- Added Gez's A_WeaponReady enhancement submission.
|
||||
|
||||
July 5, 2009 (Changes by Graf Zahl)
|
||||
- Added Gez's CheckActorProperty submission.
|
||||
|
||||
July 4, 2009 (Changes by Graf Zahl)
|
||||
|
|
|
@ -195,7 +195,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink)
|
|||
}
|
||||
else
|
||||
{
|
||||
CALL_ACTION(A_WeaponReady, self);
|
||||
DoReadyWeaponToFire(self);
|
||||
DoReadyWeaponToBob(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady)
|
|||
}
|
||||
else
|
||||
{
|
||||
CALL_ACTION(A_WeaponReady, self);
|
||||
DoReadyWeaponToFire(self);
|
||||
DoReadyWeaponToBob(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +107,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG)
|
|||
}
|
||||
else
|
||||
{
|
||||
CALL_ACTION(A_WeaponReady, self);
|
||||
DoReadyWeaponToFire(self);
|
||||
DoReadyWeaponToBob(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,8 @@ int ALightningZap::SpecialMissileHit (AActor *thing)
|
|||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_LightningReady)
|
||||
{
|
||||
CALL_ACTION(A_WeaponReady, self);
|
||||
DoReadyWeaponToFire(self);
|
||||
DoReadyWeaponToBob(self);
|
||||
if (pr_lightningready() < 160)
|
||||
{
|
||||
S_Sound (self, CHAN_WEAPON, "MageLightningReady", 1, ATTN_NORM);
|
||||
|
|
|
@ -345,50 +345,21 @@ 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
|
||||
//
|
||||
// The player can fire the weapon or change to another weapon at this time.
|
||||
// Readies a weapon for firing or bobbing with its two ancillary functions,
|
||||
// DoReadyWeaponToFire() and DoReadyWeaponToBob().
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_WeaponReady)
|
||||
void DoReadyWeaponToFire (AActor * self)
|
||||
{
|
||||
player_t *player = self->player;
|
||||
player_t *player;
|
||||
AWeapon *weapon;
|
||||
|
||||
if (NULL == player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
weapon = player->ReadyWeapon;
|
||||
|
||||
if (NULL == weapon)
|
||||
if (!self || !(player = self->player) || !(weapon = player->ReadyWeapon))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -409,12 +380,41 @@ DEFINE_ACTION_FUNCTION(AInventory, A_WeaponReady)
|
|||
}
|
||||
}
|
||||
|
||||
// Prepare for bobbing and firing action.
|
||||
player->cheats |= CF_WEAPONREADY | CF_WEAPONBOBBING;
|
||||
// Prepare for firing action.
|
||||
player->cheats |= CF_WEAPONREADY;
|
||||
return;
|
||||
}
|
||||
|
||||
void DoReadyWeaponToBob (AActor * self)
|
||||
{
|
||||
player_t *player;
|
||||
|
||||
if (!self || !(player = self->player) || !(player->ReadyWeapon))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare for bobbing action.
|
||||
player->cheats |= CF_WEAPONBOBBING;
|
||||
player->psprites[ps_weapon].sx = 0;
|
||||
player->psprites[ps_weapon].sy = WEAPONTOP;
|
||||
}
|
||||
|
||||
enum EWRF_Options
|
||||
{
|
||||
WRF_NoBob = 1,
|
||||
WRF_NoFire = 2,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_WeaponReady)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_INT(paramflags, 0);
|
||||
|
||||
if (!(paramflags & WRF_NoFire)) DoReadyWeaponToFire(self);
|
||||
if (!(paramflags & WRF_NoBob)) DoReadyWeaponToBob(self);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC P_CheckWeaponFire
|
||||
|
|
|
@ -89,7 +89,9 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y);
|
|||
angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget = NULL);
|
||||
void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch);
|
||||
|
||||
DECLARE_ACTION(A_WeaponReady)
|
||||
void DoReadyWeaponToBob(AActor * self);
|
||||
void DoReadyWeaponToFire(AActor * self);
|
||||
|
||||
DECLARE_ACTION(A_Raise)
|
||||
DECLARE_ACTION(A_ReFire)
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ const int LOF_FULLVOLSEESOUND = 16;
|
|||
const int CVF_RELATIVE = 1;
|
||||
const int CVF_REPLACE = 2;
|
||||
|
||||
// Flags for A_WeaponReady
|
||||
const int WRF_NoBob = 1;
|
||||
const int WRF_NoFire = 2;
|
||||
|
||||
// Morph constants
|
||||
const int MRF_ADDSTAMINA = 1;
|
||||
const int MRF_FULLHEALTH = 2;
|
||||
|
|
|
@ -15,8 +15,7 @@ ACTOR Inventory native
|
|||
action native A_Light1();
|
||||
action native A_Light2();
|
||||
action native A_LightInverse();
|
||||
action native A_WeaponReady();
|
||||
action native A_WeaponBob();
|
||||
action native A_WeaponReady(int flags = 0);
|
||||
action native A_Lower();
|
||||
action native A_Raise();
|
||||
action native A_FirePistol();
|
||||
|
|
Loading…
Reference in a new issue