This commit is contained in:
Christoph Oelckers 2018-03-24 19:40:52 +01:00
commit 49ab99a383
5 changed files with 56 additions and 12 deletions

View file

@ -413,6 +413,12 @@ void E_WorldThingDestroyed(AActor* actor)
handler->WorldThingDestroyed(actor); handler->WorldThingDestroyed(actor);
} }
void E_WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate)
{
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
handler->WorldLinePreActivated(line, actor, shouldactivate);
}
void E_WorldLineActivated(line_t* line, AActor* actor) void E_WorldLineActivated(line_t* line, AActor* actor)
{ {
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next) for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
@ -548,6 +554,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, ShouldActivate);
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber); DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, IsReturn); DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, IsReturn);
@ -634,6 +641,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDied)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingRevived) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingRevived)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDamaged) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDamaged)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDestroyed) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldThingDestroyed)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLinePreActivated)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLineActivated) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLineActivated)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLightning) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldLightning)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldTick) DEFINE_EMPTY_HANDLER(DStaticEventHandler, WorldTick)
@ -796,6 +804,23 @@ void DStaticEventHandler::WorldThingDestroyed(AActor* actor)
} }
} }
void DStaticEventHandler::WorldLinePreActivated(line_t* line, AActor* actor, bool* shouldactivate)
{
IFVIRTUAL(DStaticEventHandler, WorldLinePreActivated)
{
// don't create excessive DObjects if not going to be processed anyway
if (func == DStaticEventHandler_WorldLinePreActivated_VMPtr)
return;
FWorldEvent e = E_SetupWorldEvent();
e.Thing = actor;
e.ActivatedLine = line;
e.ShouldActivate = *shouldactivate;
VMValue params[2] = { (DStaticEventHandler*)this, &e };
VMCall(func, params, 2, nullptr, 0);
*shouldactivate = e.ShouldActivate;
}
}
void DStaticEventHandler::WorldLineActivated(line_t* line, AActor* actor) void DStaticEventHandler::WorldLineActivated(line_t* line, AActor* actor)
{ {
IFVIRTUAL(DStaticEventHandler, WorldLineActivated) IFVIRTUAL(DStaticEventHandler, WorldLineActivated)

View file

@ -40,6 +40,8 @@ void E_WorldThingRevived(AActor* actor);
void E_WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle); void E_WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle);
// 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.
void E_WorldLinePreActivated(line_t* line, AActor* actor, 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);
// same as ACS SCRIPT_Lightning // same as ACS SCRIPT_Lightning
@ -141,6 +143,7 @@ public:
void WorldThingRevived(AActor*); void WorldThingRevived(AActor*);
void WorldThingDamaged(AActor*, AActor*, AActor*, int, FName, int, DAngle); void WorldThingDamaged(AActor*, AActor*, AActor*, int, FName, int, DAngle);
void WorldThingDestroyed(AActor*); void WorldThingDestroyed(AActor*);
void WorldLinePreActivated(line_t*, AActor*, bool*);
void WorldLineActivated(line_t*, AActor*); void WorldLineActivated(line_t*, AActor*);
void WorldLightning(); void WorldLightning();
void WorldTick(); void WorldTick();
@ -198,8 +201,9 @@ struct FWorldEvent
FName DamageType; FName DamageType;
int DamageFlags = 0; int DamageFlags = 0;
DAngle DamageAngle; DAngle DamageAngle;
// for lineactivated // for line(pre)activated
line_t* ActivatedLine = nullptr; line_t* ActivatedLine = nullptr;
bool ShouldActivate = true;
}; };
struct FPlayerEvent struct FPlayerEvent

View file

@ -189,6 +189,11 @@ bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVe
return false; return false;
} }
// [MK] Use WorldLinePreActivated to decide if activation should continue
bool shouldactivate = true;
E_WorldLinePreActivated(line, mo, &shouldactivate);
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));
if (line->locknumber > 0 && !P_CheckKeys (mo, line->locknumber, remote)) return false; if (line->locknumber > 0 && !P_CheckKeys (mo, line->locknumber, remote)) return false;

View file

@ -809,9 +809,17 @@ OpenALSoundRenderer::OpenALSoundRenderer()
} }
attribs.Clear(); attribs.Clear();
const ALchar *const version = alGetString(AL_VERSION);
if (strstr(version, "ALSOFT") == nullptr)
{
Printf(TEXTCOLOR_RED " You are using an unsupported OpenAL implementation\n"
" Install OpenAL Soft library for a better experience\n");
}
DPrintf(DMSG_SPAMMY, " Vendor: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR)); DPrintf(DMSG_SPAMMY, " Vendor: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VENDOR));
DPrintf(DMSG_SPAMMY, " Renderer: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER)); DPrintf(DMSG_SPAMMY, " Renderer: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_RENDERER));
DPrintf(DMSG_SPAMMY, " Version: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_VERSION)); DPrintf(DMSG_SPAMMY, " Version: " TEXTCOLOR_ORANGE"%s\n", version);
DPrintf(DMSG_SPAMMY, " Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS)); DPrintf(DMSG_SPAMMY, " Extensions: " TEXTCOLOR_ORANGE"%s\n", alGetString(AL_EXTENSIONS));
AL.EXT_source_distance_model = !!alIsExtensionPresent("AL_EXT_source_distance_model"); AL.EXT_source_distance_model = !!alIsExtensionPresent("AL_EXT_source_distance_model");

View file

@ -25,8 +25,9 @@ struct WorldEvent native play version("2.4")
native readonly Name DamageType; native readonly Name DamageType;
native readonly EDmgFlags DamageFlags; native readonly EDmgFlags DamageFlags;
native readonly double DamageAngle; native readonly double DamageAngle;
// for lineactivated // for line(pre)activated
native readonly Line ActivatedLine; native readonly Line ActivatedLine;
native bool ShouldActivate;
} }
struct PlayerEvent native play version("2.4") struct PlayerEvent native play version("2.4")
@ -302,6 +303,7 @@ class StaticEventHandler : Object native play version("2.4")
virtual native void WorldThingRevived(WorldEvent e); virtual native void WorldThingRevived(WorldEvent e);
virtual native void WorldThingDamaged(WorldEvent e); virtual native void WorldThingDamaged(WorldEvent e);
virtual native void WorldThingDestroyed(WorldEvent e); virtual native void WorldThingDestroyed(WorldEvent e);
virtual native void WorldLinePreActivated(WorldEvent e);
virtual native void WorldLineActivated(WorldEvent e); virtual native void WorldLineActivated(WorldEvent e);
virtual native void WorldLightning(WorldEvent e); // for the sake of completeness. virtual native void WorldLightning(WorldEvent e); // for the sake of completeness.
virtual native void WorldTick(); virtual native void WorldTick();