mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Added activation type to WorldLine(Pre)Activated events
https://forum.zdoom.org/viewtopic.php?t=60232
This commit is contained in:
parent
83c513b6c9
commit
ba4cc1a6ca
4 changed files with 17 additions and 12 deletions
|
@ -404,16 +404,16 @@ void E_WorldThingDestroyed(AActor* actor)
|
||||||
handler->WorldThingDestroyed(actor);
|
handler->WorldThingDestroyed(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate)
|
void E_WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate)
|
||||||
{
|
{
|
||||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||||
handler->WorldLinePreActivated(line, actor, shouldactivate);
|
handler->WorldLinePreActivated(line, actor, activationType, shouldactivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_WorldLineActivated(line_t* line, AActor* actor)
|
void E_WorldLineActivated(line_t* line, AActor* actor, int activationType)
|
||||||
{
|
{
|
||||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||||
handler->WorldLineActivated(line, actor);
|
handler->WorldLineActivated(line, actor, activationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_PlayerEntered(int num, bool fromhub)
|
void E_PlayerEntered(int num, bool fromhub)
|
||||||
|
@ -545,6 +545,7 @@ DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageType);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageFlags);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageFlags);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageAngle);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageAngle);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ActivatedLine);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ActivatedLine);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ActivationType);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ShouldActivate);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, ShouldActivate);
|
||||||
|
|
||||||
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
|
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
|
||||||
|
@ -795,7 +796,7 @@ void DStaticEventHandler::WorldThingDestroyed(AActor* actor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DStaticEventHandler::WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate)
|
void DStaticEventHandler::WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate)
|
||||||
{
|
{
|
||||||
IFVIRTUAL(DStaticEventHandler, WorldLinePreActivated)
|
IFVIRTUAL(DStaticEventHandler, WorldLinePreActivated)
|
||||||
{
|
{
|
||||||
|
@ -805,6 +806,7 @@ void DStaticEventHandler::WorldLinePreActivated(line_t* line, AActor* actor, boo
|
||||||
FWorldEvent e = E_SetupWorldEvent();
|
FWorldEvent e = E_SetupWorldEvent();
|
||||||
e.Thing = actor;
|
e.Thing = actor;
|
||||||
e.ActivatedLine = line;
|
e.ActivatedLine = line;
|
||||||
|
e.ActivationType = activationType;
|
||||||
e.ShouldActivate = *shouldactivate;
|
e.ShouldActivate = *shouldactivate;
|
||||||
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||||
VMCall(func, params, 2, nullptr, 0);
|
VMCall(func, params, 2, nullptr, 0);
|
||||||
|
@ -812,7 +814,7 @@ void DStaticEventHandler::WorldLinePreActivated(line_t* line, AActor* actor, boo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DStaticEventHandler::WorldLineActivated(line_t* line, AActor* actor)
|
void DStaticEventHandler::WorldLineActivated(line_t* line, AActor* actor, int activationType)
|
||||||
{
|
{
|
||||||
IFVIRTUAL(DStaticEventHandler, WorldLineActivated)
|
IFVIRTUAL(DStaticEventHandler, WorldLineActivated)
|
||||||
{
|
{
|
||||||
|
@ -822,6 +824,7 @@ void DStaticEventHandler::WorldLineActivated(line_t* line, AActor* actor)
|
||||||
FWorldEvent e = E_SetupWorldEvent();
|
FWorldEvent e = E_SetupWorldEvent();
|
||||||
e.Thing = actor;
|
e.Thing = actor;
|
||||||
e.ActivatedLine = line;
|
e.ActivatedLine = line;
|
||||||
|
e.ActivationType = activationType;
|
||||||
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||||
VMCall(func, params, 2, nullptr, 0);
|
VMCall(func, params, 2, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,9 @@ void E_WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int d
|
||||||
// called before AActor::Destroy of each actor.
|
// called before AActor::Destroy of each actor.
|
||||||
void E_WorldThingDestroyed(AActor* actor);
|
void E_WorldThingDestroyed(AActor* actor);
|
||||||
// called in P_ActivateLine before executing special, set shouldactivate to false to prevent activation.
|
// called in P_ActivateLine before executing special, set shouldactivate to false to prevent activation.
|
||||||
void E_WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate);
|
void E_WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate);
|
||||||
// called in P_ActivateLine after successful special execution.
|
// called in P_ActivateLine after successful special execution.
|
||||||
void E_WorldLineActivated(line_t* line, AActor* actor);
|
void E_WorldLineActivated(line_t* line, AActor* actor, int activationType);
|
||||||
// same as ACS SCRIPT_Lightning
|
// same as ACS SCRIPT_Lightning
|
||||||
void E_WorldLightning();
|
void E_WorldLightning();
|
||||||
// this executes on every tick, before everything, only when in valid level and not paused
|
// this executes on every tick, before everything, only when in valid level and not paused
|
||||||
|
@ -143,8 +143,8 @@ public:
|
||||||
void WorldThingRevived(AActor* actor);
|
void WorldThingRevived(AActor* actor);
|
||||||
void WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle);
|
void WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle);
|
||||||
void WorldThingDestroyed(AActor* actor);
|
void WorldThingDestroyed(AActor* actor);
|
||||||
void WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate);
|
void WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate);
|
||||||
void WorldLineActivated(line_t* line, AActor* actor);
|
void WorldLineActivated(line_t* line, AActor* actor, int activationType);
|
||||||
void WorldLightning();
|
void WorldLightning();
|
||||||
void WorldTick();
|
void WorldTick();
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@ struct FWorldEvent
|
||||||
DAngle DamageAngle;
|
DAngle DamageAngle;
|
||||||
// for line(pre)activated
|
// for line(pre)activated
|
||||||
line_t* ActivatedLine = nullptr;
|
line_t* ActivatedLine = nullptr;
|
||||||
|
int ActivationType = 0;
|
||||||
bool ShouldActivate = true;
|
bool ShouldActivate = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
|
||||||
|
|
||||||
// [MK] Use WorldLinePreActivated to decide if activation should continue
|
// [MK] Use WorldLinePreActivated to decide if activation should continue
|
||||||
bool shouldactivate = true;
|
bool shouldactivate = true;
|
||||||
E_WorldLinePreActivated(line, mo, &shouldactivate);
|
E_WorldLinePreActivated(line, mo, activationType, &shouldactivate);
|
||||||
if ( !shouldactivate ) return false;
|
if ( !shouldactivate ) return false;
|
||||||
|
|
||||||
bool remote = (line->special != 7 && line->special != 8 && (line->special < 11 || line->special > 14));
|
bool remote = (line->special != 7 && line->special != 8 && (line->special < 11 || line->special > 14));
|
||||||
|
@ -206,7 +206,7 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
|
||||||
line->args[3], line->args[4]);
|
line->args[3], line->args[4]);
|
||||||
|
|
||||||
// [MK] Fire up WorldLineActivated
|
// [MK] Fire up WorldLineActivated
|
||||||
if ( buttonSuccess ) E_WorldLineActivated(line, mo);
|
if ( buttonSuccess ) E_WorldLineActivated(line, mo, activationType);
|
||||||
|
|
||||||
special = line->special;
|
special = line->special;
|
||||||
if (!repeat && buttonSuccess)
|
if (!repeat && buttonSuccess)
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct WorldEvent native play version("2.4")
|
||||||
native readonly double DamageAngle;
|
native readonly double DamageAngle;
|
||||||
// for line(pre)activated
|
// for line(pre)activated
|
||||||
native readonly Line ActivatedLine;
|
native readonly Line ActivatedLine;
|
||||||
|
native readonly int ActivationType;
|
||||||
native bool ShouldActivate;
|
native bool ShouldActivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue