Merge branch 'maint'

This commit is contained in:
Christoph Oelckers 2013-09-13 10:17:38 +02:00
commit e4e26e7aa7

View file

@ -38,6 +38,7 @@ class ACustomBridge : public AActor
DECLARE_CLASS (ACustomBridge, AActor) DECLARE_CLASS (ACustomBridge, AActor)
public: public:
void BeginPlay (); void BeginPlay ();
void Destroy();
}; };
IMPLEMENT_CLASS(ACustomBridge) IMPLEMENT_CLASS(ACustomBridge)
@ -58,6 +59,24 @@ void ACustomBridge::BeginPlay ()
} }
} }
void ACustomBridge::Destroy()
{
// 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();
}
}
}
// Action functions for the non-Doom bridge -------------------------------- // Action functions for the non-Doom bridge --------------------------------
#define ORBIT_RADIUS 15 #define ORBIT_RADIUS 15
@ -89,10 +108,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
// Set rotation radius // Set rotation radius
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT)); if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT));
if (self->target->special1)
{
self->SetState (NULL);
}
self->angle += rotationspeed; self->angle += rotationspeed;
self->x = self->target->x + rotationradius * finecosine[self->angle >> ANGLETOFINESHIFT]; self->x = self->target->x + rotationradius * finecosine[self->angle >> ANGLETOFINESHIFT];
self->y = self->target->y + rotationradius * finesine[self->angle >> ANGLETOFINESHIFT]; self->y = self->target->y + rotationradius * finesine[self->angle >> ANGLETOFINESHIFT];
@ -115,7 +130,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
cy = self->y; cy = self->y;
cz = self->z; cz = self->z;
startangle = pr_orbit() << 24; startangle = pr_orbit() << 24;
self->special1 = 0;
// Spawn triad into world -- may be more than a triad now. // Spawn triad into world -- may be more than a triad now.
int ballcount = self->args[2]==0 ? 3 : self->args[2]; int ballcount = self->args[2]==0 ? 3 : self->args[2];
@ -129,14 +143,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
} }
} }
/* never used
void A_BridgeRemove (AActor *self)
{
self->special1 = true; // Removing the bridge
self->flags &= ~MF_SOLID;
self->SetState (&ABridge::States[S_FREE_BRIDGE]);
}
*/
// Invisible bridge -------------------------------------------------------- // Invisible bridge --------------------------------------------------------