mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-17 17:11:19 +00:00
Allow psprite layers to be manipulated directly from the player's own body
This commit is contained in:
parent
eeff17c550
commit
afa708c138
5 changed files with 20 additions and 19 deletions
|
@ -110,7 +110,7 @@ END_POINTERS
|
||||||
//
|
//
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
DPSprite::DPSprite(player_t *owner, AInventory *caller, int id)
|
DPSprite::DPSprite(player_t *owner, AActor *caller, int id)
|
||||||
: processPending(true),
|
: processPending(true),
|
||||||
firstTic(true),
|
firstTic(true),
|
||||||
x(.0), y(.0),
|
x(.0), y(.0),
|
||||||
|
@ -142,7 +142,7 @@ DPSprite::DPSprite(player_t *owner, AInventory *caller, int id)
|
||||||
if (Next && Next->ID == ID && ID != 0)
|
if (Next && Next->ID == ID && ID != 0)
|
||||||
Next->Destroy(); // Replace it.
|
Next->Destroy(); // Replace it.
|
||||||
|
|
||||||
if (Caller->IsKindOf(RUNTIME_CLASS(AWeapon)))
|
if (Caller->IsKindOf(RUNTIME_CLASS(AWeapon)) || Caller->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
||||||
Flags = (PSPF_ADDWEAPON|PSPF_ADDBOB|PSPF_POWDOUBLE|PSPF_CVARFAST);
|
Flags = (PSPF_ADDWEAPON|PSPF_ADDBOB|PSPF_POWDOUBLE|PSPF_CVARFAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +177,8 @@ DPSprite *player_t::FindPSprite(int layer)
|
||||||
|
|
||||||
DPSprite *player_t::GetPSprite(PSPLayers layer)
|
DPSprite *player_t::GetPSprite(PSPLayers layer)
|
||||||
{
|
{
|
||||||
AInventory *oldcaller = nullptr;
|
AActor *oldcaller = nullptr;
|
||||||
AInventory *newcaller = nullptr;
|
AActor *newcaller = nullptr;
|
||||||
|
|
||||||
if (layer >= PSP_TARGETCENTER)
|
if (layer >= PSP_TARGETCENTER)
|
||||||
{
|
{
|
||||||
|
@ -972,7 +972,7 @@ void A_OverlayOffset(AActor *self, int layer, double wx, double wy, int flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AInventory, A_OverlayOffset)
|
DEFINE_ACTION_FUNCTION(AActor, A_OverlayOffset)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
PARAM_INT_OPT(layer) { layer = PSP_WEAPON; }
|
PARAM_INT_OPT(layer) { layer = PSP_WEAPON; }
|
||||||
|
@ -983,7 +983,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_OverlayOffset)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AInventory, A_WeaponOffset)
|
DEFINE_ACTION_FUNCTION(AActor, A_WeaponOffset)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
PARAM_FLOAT_OPT(wx) { wx = 0.; }
|
PARAM_FLOAT_OPT(wx) { wx = 0.; }
|
||||||
|
@ -999,7 +999,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_WeaponOffset)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AInventory, A_OverlayFlags)
|
DEFINE_ACTION_FUNCTION(AActor, A_OverlayFlags)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
PARAM_INT(layer);
|
PARAM_INT(layer);
|
||||||
|
@ -1118,7 +1118,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Overlay)
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay)
|
||||||
{
|
{
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
PARAM_INT (layer);
|
PARAM_INT (layer);
|
||||||
|
@ -1130,7 +1130,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Overlay)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DPSprite *pspr;
|
DPSprite *pspr;
|
||||||
pspr = new DPSprite(player, reinterpret_cast<AInventory *>(stateowner), layer);
|
pspr = new DPSprite(player, stateowner, layer);
|
||||||
pspr->SetState(state);
|
pspr->SetState(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1312,7 @@ void player_t::TickPSprites()
|
||||||
// Destroy the psprite if it's from a weapon that isn't currently selected by the player
|
// Destroy the psprite if it's from a weapon that isn't currently selected by the player
|
||||||
// or if it's from an inventory item that the player no longer owns.
|
// or if it's from an inventory item that the player no longer owns.
|
||||||
if ((pspr->Caller == nullptr ||
|
if ((pspr->Caller == nullptr ||
|
||||||
(pspr->Caller->Owner != pspr->Owner->mo) ||
|
(pspr->Caller->IsKindOf(RUNTIME_CLASS(AInventory)) && barrier_cast<AInventory *>(pspr->Caller)->Owner != pspr->Owner->mo) ||
|
||||||
(pspr->Caller->IsKindOf(RUNTIME_CLASS(AWeapon)) && pspr->Caller != pspr->Owner->ReadyWeapon)))
|
(pspr->Caller->IsKindOf(RUNTIME_CLASS(AWeapon)) && pspr->Caller != pspr->Owner->ReadyWeapon)))
|
||||||
{
|
{
|
||||||
pspr->Destroy();
|
pspr->Destroy();
|
||||||
|
|
|
@ -64,7 +64,7 @@ class DPSprite : public DObject
|
||||||
DECLARE_CLASS (DPSprite, DObject)
|
DECLARE_CLASS (DPSprite, DObject)
|
||||||
HAS_OBJECT_POINTERS
|
HAS_OBJECT_POINTERS
|
||||||
public:
|
public:
|
||||||
DPSprite(player_t *owner, AInventory *caller, int id);
|
DPSprite(player_t *owner, AActor *caller, int id);
|
||||||
|
|
||||||
static void NewTick();
|
static void NewTick();
|
||||||
void SetState(FState *newstate, bool pending = false);
|
void SetState(FState *newstate, bool pending = false);
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
int GetFrame() const { return Frame; }
|
int GetFrame() const { return Frame; }
|
||||||
FState* GetState() const { return State; }
|
FState* GetState() const { return State; }
|
||||||
DPSprite* GetNext() { return Next; }
|
DPSprite* GetNext() { return Next; }
|
||||||
AInventory* GetCaller() { return Caller; }
|
AActor* GetCaller() { return Caller; }
|
||||||
|
|
||||||
double x, y;
|
double x, y;
|
||||||
double oldx, oldy;
|
double oldx, oldy;
|
||||||
|
@ -89,7 +89,7 @@ private:
|
||||||
void Tick();
|
void Tick();
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
TObjPtr<AInventory> Caller;
|
TObjPtr<AActor> Caller;
|
||||||
TObjPtr<DPSprite> Next;
|
TObjPtr<DPSprite> Next;
|
||||||
player_t *Owner;
|
player_t *Owner;
|
||||||
FState *State;
|
FState *State;
|
||||||
|
|
|
@ -5706,7 +5706,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics)
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
PARAM_INT(tics_to_set);
|
PARAM_INT(tics_to_set);
|
||||||
|
|
||||||
if (stateowner != self && self->player != nullptr && stateowner->IsKindOf(RUNTIME_CLASS(AInventory)))
|
if (self->player != nullptr)
|
||||||
{ // Need to check psp states for a match, then. Blah.
|
{ // Need to check psp states for a match, then. Blah.
|
||||||
DPSprite *pspr = self->player->psprites;
|
DPSprite *pspr = self->player->psprites;
|
||||||
while (pspr)
|
while (pspr)
|
||||||
|
|
|
@ -331,6 +331,11 @@ ACTOR Actor native //: Thinker
|
||||||
native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);
|
native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);
|
||||||
action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER);
|
action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER);
|
||||||
|
|
||||||
|
action native A_Overlay(int layer, state start = "");
|
||||||
|
action native A_WeaponOffset(float wx = 0, float wy = 32, int flags = 0);
|
||||||
|
action native A_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0);
|
||||||
|
action native A_OverlayFlags(int layer, int flags, bool set);
|
||||||
|
|
||||||
native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0);
|
native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0);
|
||||||
native int ACS_NamedSuspend(name script, int mapnum=0);
|
native int ACS_NamedSuspend(name script, int mapnum=0);
|
||||||
native int ACS_NamedTerminate(name script, int mapnum=0);
|
native int ACS_NamedTerminate(name script, int mapnum=0);
|
||||||
|
|
|
@ -40,7 +40,6 @@ ACTOR Inventory native
|
||||||
action native A_ReFire(state flash = "");
|
action native A_ReFire(state flash = "");
|
||||||
action native A_ClearReFire();
|
action native A_ClearReFire();
|
||||||
action native A_CheckReload();
|
action native A_CheckReload();
|
||||||
action native A_Overlay(int layer, state start = "");
|
|
||||||
action native A_GunFlash(state flash = "", int flags = 0);
|
action native A_GunFlash(state flash = "", int flags = 0);
|
||||||
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff", int flags = 0, float range = 0, float/*angle*/ spread_xy = 2.8125, float/*angle*/ spread_z = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus");
|
action native A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff", int flags = 0, float range = 0, float/*angle*/ spread_xy = 2.8125, float/*angle*/ spread_z = 0, float lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus");
|
||||||
action native state A_CheckForReload(int counter, state label, bool dontincrement = false);
|
action native state A_CheckForReload(int counter, state label, bool dontincrement = false);
|
||||||
|
@ -49,10 +48,7 @@ ACTOR Inventory native
|
||||||
action native A_RestoreSpecialDoomThing();
|
action native A_RestoreSpecialDoomThing();
|
||||||
action native A_RestoreSpecialThing1();
|
action native A_RestoreSpecialThing1();
|
||||||
action native A_RestoreSpecialThing2();
|
action native A_RestoreSpecialThing2();
|
||||||
action native A_WeaponOffset(float wx = 0, float wy = 32, int flags = 0);
|
|
||||||
action native A_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0);
|
|
||||||
action native A_OverlayFlags(int layer, int flags, bool set);
|
|
||||||
|
|
||||||
States
|
States
|
||||||
{
|
{
|
||||||
HideDoomish:
|
HideDoomish:
|
||||||
|
|
Loading…
Reference in a new issue