- allow the VM to run on one global stack per thread.
It is utterly pointless to require every function that wants to make a VM call to allocate a new stack first. The allocation overhead doubles the time to set up the call. With one stack, previously allocated memory can be reused. The only important thing is, if this ever gets used in a multithreaded environment to have the stack being declared as thread_local, although for ZDoom this is of no consequence. - eliminated all cases where native code was calling other native code through the VM interface. After scriptifying the game code, only 5 places were left which were quickly eliminated. This was mostly to ensure that the native VM function parameters do not need to be propagated further than absolutely necessary.
This commit is contained in:
parent
47884f8a71
commit
86544086df
23 changed files with 176 additions and 229 deletions
|
|
@ -89,24 +89,22 @@ void ACustomBridge::Destroy()
|
|||
// target pointer to center mobj
|
||||
// angle angle of ball
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
|
||||
static void BridgeOrbit(AActor *self)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
if (self->target == NULL)
|
||||
{ // Don't crash if somebody spawned this into the world
|
||||
// independantly of a Bridge actor.
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
// Set default values
|
||||
// Every five tics, Hexen moved the ball 3/256th of a revolution.
|
||||
DAngle rotationspeed = 45./32*3/5;
|
||||
DAngle rotationspeed = 45. / 32 * 3 / 5;
|
||||
double rotationradius = ORBIT_RADIUS;
|
||||
// If the bridge is custom, set non-default values if any.
|
||||
|
||||
// Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1°
|
||||
if (self->target->args[3] > 128) rotationspeed = 45./32 * (self->target->args[3]-256) / TICRATE;
|
||||
else if (self->target->args[3] > 0) rotationspeed = 45./32 * (self->target->args[3]) / TICRATE;
|
||||
if (self->target->args[3] > 128) rotationspeed = 45. / 32 * (self->target->args[3] - 256) / TICRATE;
|
||||
else if (self->target->args[3] > 0) rotationspeed = 45. / 32 * (self->target->args[3]) / TICRATE;
|
||||
// Set rotation radius
|
||||
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100);
|
||||
|
||||
|
|
@ -114,6 +112,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
|
|||
self->SetOrigin(self->target->Vec3Angle(rotationradius, self->Angles.Yaw, 0), true);
|
||||
self->floorz = self->target->floorz;
|
||||
self->ceilingz = self->target->ceilingz;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
BridgeOrbit(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +144,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeInit)
|
|||
ball = Spawn(balltype, self->Pos(), ALLOW_REPLACE);
|
||||
ball->Angles.Yaw = startangle + (45./32) * (256/ballcount) * i;
|
||||
ball->target = self;
|
||||
CALL_ACTION(A_BridgeOrbit, ball);
|
||||
BridgeOrbit(ball);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue