- Converted all action functions be directly callable by the VM (though they are not yet
usable). SVN r2154 (scripting)
This commit is contained in:
parent
7ea11cd169
commit
739e684549
108 changed files with 2827 additions and 1295 deletions
|
|
@ -424,13 +424,16 @@ enum EWRF_Options
|
|||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_WeaponReady)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_INT(paramflags, 0);
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_INT_OPT(flags) { flags = 0; }
|
||||
|
||||
if (!(paramflags & WRF_NoSwitch)) DoReadyWeaponToSwitch(self);
|
||||
if ((paramflags & WRF_NoFire) != WRF_NoFire) DoReadyWeaponToFire(self,
|
||||
(!(paramflags & WRF_NoPrimary)), (!(paramflags & WRF_NoSecondary)));
|
||||
if (!(paramflags & WRF_NoBob)) DoReadyWeaponToBob(self);
|
||||
if (!(flags & WRF_NoSwitch))
|
||||
DoReadyWeaponToSwitch(self);
|
||||
if ((flags & WRF_NoFire) != WRF_NoFire)
|
||||
DoReadyWeaponToFire(self, !(flags & WRF_NoPrimary), !(flags & WRF_NoSecondary));
|
||||
if (!(flags & WRF_NoBob))
|
||||
DoReadyWeaponToBob(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -509,11 +512,13 @@ void P_CheckWeaponSwitch (player_t *player)
|
|||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_ReFire)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
player_t *player = self->player;
|
||||
|
||||
if (NULL == player)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if ((player->cmd.ucmd.buttons&BT_ATTACK)
|
||||
&& !player->ReadyWeapon->bAltFire
|
||||
|
|
@ -535,16 +540,19 @@ DEFINE_ACTION_FUNCTION(AInventory, A_ReFire)
|
|||
player->ReadyWeapon->CheckAmmo (player->ReadyWeapon->bAltFire
|
||||
? AWeapon::AltFire : AWeapon::PrimaryFire, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_ClearReFire)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
player_t *player = self->player;
|
||||
|
||||
if (NULL != player)
|
||||
{
|
||||
player->refire = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -559,12 +567,15 @@ DEFINE_ACTION_FUNCTION(AInventory, A_ClearReFire)
|
|||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_CheckReload)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
self->player->ReadyWeapon->CheckAmmo (
|
||||
self->player->ReadyWeapon->bAltFire ? AWeapon::AltFire
|
||||
: AWeapon::PrimaryFire, true);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -575,12 +586,14 @@ DEFINE_ACTION_FUNCTION(AInventory, A_CheckReload)
|
|||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
player_t *player = self->player;
|
||||
pspdef_t *psp;
|
||||
|
||||
if (NULL == player)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
psp = &player->psprites[ps_weapon];
|
||||
if (player->morphTics || player->cheats & CF_INSTANTWEAPSWITCH)
|
||||
|
|
@ -593,17 +606,17 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
|||
}
|
||||
if (psp->sy < WEAPONBOTTOM)
|
||||
{ // Not lowered all the way yet
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{ // Player is dead, so don't bring up a pending weapon
|
||||
psp->sy = WEAPONBOTTOM;
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (player->health <= 0)
|
||||
{ // Player is dead, so keep the weapon off screen
|
||||
P_SetPsprite (player, ps_weapon, NULL);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
/* if (player->PendingWeapon != WP_NOCHANGE)
|
||||
{ // [RH] Make sure we're actually changing weapons.
|
||||
|
|
@ -612,6 +625,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
|||
// [RH] Clear the flash state. Only needed for Strife.
|
||||
P_SetPsprite (player, ps_flash, NULL);
|
||||
P_BringUpWeapon (player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
@ -622,27 +636,29 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
|||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
if (self == NULL)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
player_t *player = self->player;
|
||||
pspdef_t *psp;
|
||||
|
||||
if (NULL == player)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (player->PendingWeapon != WP_NOCHANGE)
|
||||
{
|
||||
P_SetPsprite (player, ps_weapon, player->ReadyWeapon->GetDownState());
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
psp = &player->psprites[ps_weapon];
|
||||
psp->sy -= RAISESPEED;
|
||||
if (psp->sy > WEAPONTOP)
|
||||
{ // Not raised all the way yet
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
psp->sy = WEAPONTOP;
|
||||
if (player->ReadyWeapon != NULL)
|
||||
|
|
@ -653,6 +669,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
|
|||
{
|
||||
player->psprites[ps_weapon].state = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -663,11 +680,12 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
|
|||
//
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_GunFlash)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
player_t *player = self->player;
|
||||
|
||||
if (NULL == player)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
player->mo->PlayAttacking2 ();
|
||||
|
||||
|
|
@ -675,6 +693,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_GunFlash)
|
|||
if (player->ReadyWeapon->bAltFire) flash = player->ReadyWeapon->FindState(NAME_AltFlash);
|
||||
if (flash == NULL) flash = player->ReadyWeapon->FindState(NAME_Flash);
|
||||
P_SetPsprite (player, ps_flash, flash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -740,37 +759,47 @@ void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch
|
|||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_Light0)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
self->player->extralight = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_Light1)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
self->player->extralight = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AInventory, A_Light2)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
self->player->extralight = 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Light)
|
||||
{
|
||||
ACTION_PARAM_START(1);
|
||||
ACTION_PARAM_INT(light, 0);
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_INT(light);
|
||||
|
||||
if (self->player != NULL)
|
||||
{
|
||||
self->player->extralight = clamp<int>(light, 0, 20);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue