mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
849ee50689
6 changed files with 43 additions and 38 deletions
|
@ -283,7 +283,7 @@ enum ActorFlag4
|
|||
enum ActorFlag5
|
||||
{
|
||||
MF5_DONTDRAIN = 0x00000001, // cannot be drained health from.
|
||||
MF5_INSTATECALL = 0x00000002, // This actor is being run through CallStateChain
|
||||
/* FREE SLOT 0x00000002*/
|
||||
MF5_NODROPOFF = 0x00000004, // cannot drop off under any circumstances.
|
||||
MF5_NOFORWARDFALL = 0x00000008, // Does not make any actor fall forward by being damaged by this
|
||||
MF5_COUNTSECRET = 0x00000010, // From Doom 64: actor acts like a secret
|
||||
|
|
|
@ -38,7 +38,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch)
|
|||
if (self->player != NULL)
|
||||
{
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != NULL && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return 0;
|
||||
|
@ -76,7 +76,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
|
|||
if (self->player != nullptr)
|
||||
{
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
return 0;
|
||||
|
@ -160,7 +160,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
|
|||
slope = P_AimLineAttack (self, angle, range, &t) + spread_z * (pr_saw.Random2() / 255.);
|
||||
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if ((weapon != NULL) && !(flags & SF_NOUSEAMMO) && !(!t.linetarget && (flags & SF_NOUSEAMMOMISS)) && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_WEAPON())
|
||||
if ((weapon != NULL) && !(flags & SF_NOUSEAMMO) && !(!t.linetarget && (flags & SF_NOUSEAMMOMISS)) && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return 0;
|
||||
|
@ -269,7 +269,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun)
|
|||
|
||||
S_Sound (self, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM);
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
return 0;
|
||||
|
@ -305,7 +305,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
|
|||
|
||||
S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 2))
|
||||
return 0;
|
||||
|
@ -421,7 +421,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCGun)
|
|||
}
|
||||
|
||||
AWeapon *weapon = player->ReadyWeapon;
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != nullptr && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
return 0;
|
||||
|
@ -465,7 +465,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMissile)
|
|||
return 0;
|
||||
}
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != NULL && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
return 0;
|
||||
|
@ -492,7 +492,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireSTGrenade)
|
|||
return 0;
|
||||
}
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != NULL && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return 0;
|
||||
|
@ -520,7 +520,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePlasma)
|
|||
return 0;
|
||||
}
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != NULL && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
return 0;
|
||||
|
@ -575,21 +575,21 @@ static void FireRailgun(AActor *self, int offset_xy, bool fromweapon)
|
|||
DEFINE_ACTION_FUNCTION(AActor, A_FireRailgun)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
FireRailgun(self, 0, ACTION_CALL_FROM_WEAPON());
|
||||
FireRailgun(self, 0, ACTION_CALL_FROM_PSPRITE());
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunRight)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
FireRailgun(self, 10, ACTION_CALL_FROM_WEAPON());
|
||||
FireRailgun(self, 10, ACTION_CALL_FROM_PSPRITE());
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunLeft)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
FireRailgun(self, -10, ACTION_CALL_FROM_WEAPON());
|
||||
FireRailgun(self, -10, ACTION_CALL_FROM_PSPRITE());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG)
|
|||
}
|
||||
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL && ACTION_CALL_FROM_WEAPON())
|
||||
if (weapon != NULL && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, deh.BFGCells))
|
||||
return 0;
|
||||
|
@ -751,7 +751,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireOldBFG)
|
|||
}
|
||||
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (!ACTION_CALL_FROM_WEAPON()) weapon = NULL;
|
||||
if (!ACTION_CALL_FROM_PSPRITE()) weapon = NULL;
|
||||
if (weapon != NULL)
|
||||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
|
|
|
@ -106,7 +106,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
|
|||
AActor *mo;
|
||||
TThinkerIterator<AActor> iterator;
|
||||
|
||||
if (self->player && (blastflags & BF_USEAMMO) && ACTION_CALL_FROM_WEAPON())
|
||||
if (self->player && (blastflags & BF_USEAMMO) && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
if (weapon != NULL && !weapon->DepleteAmmo(weapon->bAltFire))
|
||||
|
|
|
@ -352,18 +352,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns)
|
|||
|
||||
if (self->player != nullptr && self->player->mo == self)
|
||||
{
|
||||
DPSprite *psp = self->player->GetPSprite(PSP_STRIFEHANDS);
|
||||
if (psp != nullptr)
|
||||
FState *firehands = self->FindState("FireHands");
|
||||
if (firehands != NULL)
|
||||
{
|
||||
psp->SetState(self->FindState("FireHands"));
|
||||
psp->Flags &= PSPF_ADDWEAPON | PSPF_ADDBOB;
|
||||
psp->y = WEAPONTOP;
|
||||
}
|
||||
DPSprite *psp = self->player->GetPSprite(PSP_STRIFEHANDS);
|
||||
if (psp != nullptr)
|
||||
{
|
||||
psp->SetState(firehands);
|
||||
psp->Flags &= PSPF_ADDWEAPON | PSPF_ADDBOB;
|
||||
psp->y = WEAPONTOP;
|
||||
}
|
||||
|
||||
self->player->ReadyWeapon = nullptr;
|
||||
self->player->PendingWeapon = WP_NOCHANGE;
|
||||
self->player->playerstate = PST_LIVE;
|
||||
self->player->extralight = 3;
|
||||
self->player->ReadyWeapon = nullptr;
|
||||
self->player->PendingWeapon = WP_NOCHANGE;
|
||||
self->player->playerstate = PST_LIVE;
|
||||
self->player->extralight = 3;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -388,7 +392,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrispyPlayer)
|
|||
|
||||
DPSprite *psp;
|
||||
psp = self->player->GetPSprite(PSP_STRIFEHANDS);
|
||||
psp->SetState(psp->GetState() + (self->FindState("FireHandsLower") - self->FindState("FireHands")));
|
||||
FState *firehandslower = self->FindState("FireHandsLower");
|
||||
FState *firehands = self->FindState("FireHands");
|
||||
if (firehandslower != NULL && firehands != NULL && firehands < firehandslower)
|
||||
psp->SetState(psp->GetState() + (firehandslower - firehands));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -361,6 +361,6 @@ int MatchString (const char *in, const char **strings);
|
|||
|
||||
// Checks to see what called the current action function
|
||||
#define ACTION_CALL_FROM_ACTOR() (stateinfo == nullptr || stateinfo->mStateType == STATE_Actor)
|
||||
#define ACTION_CALL_FROM_WEAPON() (self->player && stateinfo != nullptr && stateinfo->mStateType == STATE_Psprite)
|
||||
#define ACTION_CALL_FROM_PSPRITE() (self->player && stateinfo != nullptr && stateinfo->mStateType == STATE_Psprite)
|
||||
#define ACTION_CALL_FROM_INVENTORY() (stateinfo != nullptr && stateinfo->mStateType == STATE_StateChain)
|
||||
#endif
|
||||
|
|
|
@ -120,7 +120,6 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
|
|||
ret[0].PointerAt((void **)&nextstate);
|
||||
ret[1].IntAt(&retval);
|
||||
|
||||
this->flags5 |= MF5_INSTATECALL;
|
||||
FState *savedstate = this->state;
|
||||
|
||||
while (state != NULL)
|
||||
|
@ -191,7 +190,6 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
|
|||
}
|
||||
state = nextstate;
|
||||
}
|
||||
this->flags5 &= ~MF5_INSTATECALL;
|
||||
this->state = savedstate;
|
||||
return !!result;
|
||||
}
|
||||
|
@ -1742,7 +1740,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfNoAmmo)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_STATE(jump);
|
||||
|
||||
if (!ACTION_CALL_FROM_WEAPON())
|
||||
if (!ACTION_CALL_FROM_PSPRITE() || self->player->ReadyWeapon == nullptr)
|
||||
{
|
||||
ACTION_RETURN_STATE(NULL);
|
||||
}
|
||||
|
@ -1791,7 +1789,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
|
|||
DAngle bslope = 0.;
|
||||
int laflags = (flags & FBF_NORANDOMPUFFZ)? LAF_NORANDOMPUFFZ : 0;
|
||||
|
||||
if ((flags & FBF_USEAMMO) && weapon && ACTION_CALL_FROM_WEAPON())
|
||||
if ((flags & FBF_USEAMMO) && weapon && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo(weapon->bAltFire, true))
|
||||
return 0; // out of ammo
|
||||
|
@ -1882,7 +1880,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile)
|
|||
FTranslatedLineTarget t;
|
||||
|
||||
// Only use ammo if called from a weapon
|
||||
if (useammo && ACTION_CALL_FROM_WEAPON() && weapon)
|
||||
if (useammo && ACTION_CALL_FROM_PSPRITE() && weapon)
|
||||
{
|
||||
if (!weapon->DepleteAmmo(weapon->bAltFire, true))
|
||||
return 0; // out of ammo
|
||||
|
@ -1974,7 +1972,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
|
|||
pitch = P_AimLineAttack (self, angle, range, &t);
|
||||
|
||||
// only use ammo when actually hitting something!
|
||||
if ((flags & CPF_USEAMMO) && t.linetarget && weapon && ACTION_CALL_FROM_WEAPON())
|
||||
if ((flags & CPF_USEAMMO) && t.linetarget && weapon && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo(weapon->bAltFire, true))
|
||||
return 0; // out of ammo
|
||||
|
@ -2075,7 +2073,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
|||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
|
||||
// only use ammo when actually hitting something!
|
||||
if (useammo && weapon != NULL && ACTION_CALL_FROM_WEAPON())
|
||||
if (useammo && weapon != NULL && ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
if (!weapon->DepleteAmmo(weapon->bAltFire, true))
|
||||
return 0; // out of ammo
|
||||
|
@ -2662,7 +2660,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
|
|||
ACTION_RETURN_BOOL(true);
|
||||
}
|
||||
|
||||
if (ACTION_CALL_FROM_WEAPON())
|
||||
if (ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
// Used from a weapon, so use some ammo
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
|
@ -2787,7 +2785,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
|
|||
{
|
||||
ACTION_RETURN_BOOL(true);
|
||||
}
|
||||
if (ACTION_CALL_FROM_WEAPON())
|
||||
if (ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
// Used from a weapon, so use some ammo
|
||||
AWeapon *weapon = self->player->ReadyWeapon;
|
||||
|
@ -5840,7 +5838,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics)
|
|||
PARAM_ACTION_PROLOGUE;
|
||||
PARAM_INT(tics_to_set);
|
||||
|
||||
if (ACTION_CALL_FROM_WEAPON())
|
||||
if (ACTION_CALL_FROM_PSPRITE())
|
||||
{
|
||||
DPSprite *pspr = self->player->FindPSprite(stateinfo->mPSPIndex);
|
||||
if (pspr != nullptr)
|
||||
|
|
Loading…
Reference in a new issue