mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- scriptified CustomBridge.OnDestroy.
This commit is contained in:
parent
7b7623d2c4
commit
3d73919092
4 changed files with 22 additions and 36 deletions
|
@ -1158,7 +1158,6 @@ set (PCH_SOURCES
|
||||||
g_inventory/a_weapons.cpp
|
g_inventory/a_weapons.cpp
|
||||||
g_strife/strife_sbar.cpp
|
g_strife/strife_sbar.cpp
|
||||||
g_shared/a_action.cpp
|
g_shared/a_action.cpp
|
||||||
g_shared/a_bridge.cpp
|
|
||||||
g_shared/a_decals.cpp
|
g_shared/a_decals.cpp
|
||||||
g_shared/a_fastprojectile.cpp
|
g_shared/a_fastprojectile.cpp
|
||||||
g_shared/a_flashfader.cpp
|
g_shared/a_flashfader.cpp
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
#include "actor.h"
|
|
||||||
#include "info.h"
|
|
||||||
#include "gi.h"
|
|
||||||
|
|
||||||
// Custom bridge --------------------------------------------------------
|
|
||||||
|
|
||||||
class ACustomBridge : public AActor
|
|
||||||
{
|
|
||||||
DECLARE_CLASS (ACustomBridge, AActor)
|
|
||||||
public:
|
|
||||||
void OnDestroy() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(ACustomBridge, false, false)
|
|
||||||
|
|
||||||
void ACustomBridge::OnDestroy()
|
|
||||||
{
|
|
||||||
// Hexen originally just set a flag to make the bridge balls remove themselves in A_BridgeOrbit.
|
|
||||||
// But this is not safe with custom bridge balls that do not necessarily call that function.
|
|
||||||
// So the best course of action is to look for all bridge balls here and destroy them ourselves.
|
|
||||||
|
|
||||||
TThinkerIterator<AActor> it;
|
|
||||||
AActor *thing;
|
|
||||||
|
|
||||||
while ((thing = it.Next()))
|
|
||||||
{
|
|
||||||
if (thing->target == this)
|
|
||||||
{
|
|
||||||
thing->Destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Super::OnDestroy();
|
|
||||||
}
|
|
|
@ -1290,7 +1290,7 @@ CCMD(clearnodecache)
|
||||||
}
|
}
|
||||||
catch (CRecoverableError &err)
|
catch (CRecoverableError &err)
|
||||||
{
|
{
|
||||||
Printf("%s", err.GetMessage());
|
Printf("%s\n", err.GetMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class BridgeBall : Actor
|
||||||
|
|
||||||
// The bridge itself -------------------------------------------------------
|
// The bridge itself -------------------------------------------------------
|
||||||
|
|
||||||
class CustomBridge : Actor native
|
class CustomBridge : Actor
|
||||||
{
|
{
|
||||||
const ORBIT_RADIUS = 15;
|
const ORBIT_RADIUS = 15;
|
||||||
|
|
||||||
|
@ -114,6 +114,26 @@ class CustomBridge : Actor native
|
||||||
A_SetRenderStyle(1., STYLE_Normal);
|
A_SetRenderStyle(1., STYLE_Normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void OnDestroy()
|
||||||
|
{
|
||||||
|
// Hexen originally just set a flag to make the bridge balls remove themselves in A_BridgeOrbit.
|
||||||
|
// But this is not safe with custom bridge balls that do not necessarily call that function.
|
||||||
|
// So the best course of action is to look for all bridge balls here and destroy them ourselves.
|
||||||
|
|
||||||
|
let it = ThinkerIterator.Create("Actor");
|
||||||
|
Actor thing;
|
||||||
|
|
||||||
|
while ((thing = Actor(it.Next())))
|
||||||
|
{
|
||||||
|
if (thing.target == self)
|
||||||
|
{
|
||||||
|
thing.Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Super.OnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void A_BridgeInit(class<Actor> balltype = "BridgeBall")
|
void A_BridgeInit(class<Actor> balltype = "BridgeBall")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue