mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-17 17:11:19 +00:00
Added A_ClearOverlays(int start, int stop, bool safety).
- Clears a set of overlays in ranges [start,stop]. If unspecified, wipes all non-hardcoded layers. Safety determines whether to affect core layers or not (i.e. weapon). Returns the number of layers cleared. Added no override boolean to A_Overlay and a boolean return type. - If true, and a layer already has an active layer, the function returns false. Otherwise, sets the layer and returns true.
This commit is contained in:
parent
2f6c98ead3
commit
dd410876cf
2 changed files with 49 additions and 3 deletions
|
@ -1135,16 +1135,61 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay)
|
||||||
PARAM_ACTION_PROLOGUE;
|
PARAM_ACTION_PROLOGUE;
|
||||||
PARAM_INT (layer);
|
PARAM_INT (layer);
|
||||||
PARAM_STATE_OPT (state) { state = nullptr; }
|
PARAM_STATE_OPT (state) { state = nullptr; }
|
||||||
|
PARAM_BOOL_OPT (dontoverride) { dontoverride = false; }
|
||||||
|
|
||||||
player_t *player = self->player;
|
player_t *player = self->player;
|
||||||
|
|
||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
return 0;
|
ACTION_RETURN_BOOL(false);
|
||||||
|
|
||||||
DPSprite *pspr;
|
DPSprite *pspr;
|
||||||
|
if (dontoverride && (player->FindPSprite(layer) != nullptr))
|
||||||
|
{
|
||||||
|
ACTION_RETURN_BOOL(false);
|
||||||
|
}
|
||||||
pspr = new DPSprite(player, stateowner, layer);
|
pspr = new DPSprite(player, stateowner, layer);
|
||||||
pspr->SetState(state);
|
pspr->SetState(state);
|
||||||
return 0;
|
ACTION_RETURN_BOOL(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays)
|
||||||
|
{
|
||||||
|
PARAM_ACTION_PROLOGUE;
|
||||||
|
PARAM_INT_OPT(start) { start = 0; }
|
||||||
|
PARAM_INT_OPT(stop) { stop = 0; }
|
||||||
|
PARAM_BOOL_OPT(safety) { safety = true; }
|
||||||
|
|
||||||
|
if (!ACTION_CALL_FROM_PSPRITE())
|
||||||
|
{
|
||||||
|
ACTION_RETURN_INT(0);
|
||||||
|
}
|
||||||
|
player_t *player = self->player;
|
||||||
|
if (!start && !stop)
|
||||||
|
{
|
||||||
|
start = -INT_MAX;
|
||||||
|
stop = PSP_TARGETCENTER - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for (int i = start; i <= stop; i++)
|
||||||
|
{
|
||||||
|
if (safety)
|
||||||
|
{
|
||||||
|
if (i >= PSP_TARGETCENTER)
|
||||||
|
break;
|
||||||
|
else if ((i >= PSP_STRIFEHANDS && i <= PSP_WEAPON) || (i == PSP_FLASH))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// [MC]Don't affect non-hardcoded layers unless it's really desired.
|
||||||
|
DPSprite *pspr = player->FindPSprite(i);
|
||||||
|
if (pspr != nullptr)
|
||||||
|
{
|
||||||
|
pspr->SetState(nullptr);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
ACTION_RETURN_INT(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -329,12 +329,13 @@ ACTOR Actor native //: Thinker
|
||||||
native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
|
native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false);
|
||||||
native state A_CheckRange(float distance, state label, bool two_dimension = false);
|
native state A_CheckRange(float distance, state label, bool two_dimension = false);
|
||||||
action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
|
||||||
|
action native int A_ClearOverlays(int start = 0, int stop = 0, bool safety = true);
|
||||||
|
|
||||||
native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
|
native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
|
||||||
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 bool A_Overlay(int layer, state start = "", bool nooverride = false);
|
||||||
action native A_WeaponOffset(float wx = 0, float wy = 32, int flags = 0);
|
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_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0);
|
||||||
action native A_OverlayFlags(int layer, int flags, bool set);
|
action native A_OverlayFlags(int layer, int flags, bool set);
|
||||||
|
|
Loading…
Reference in a new issue