Merge commit '1fa37aaeb79d3ab1e5d4aa2b4376130e9f4826fb'

This commit is contained in:
Rachael Alexanderson 2016-12-18 20:55:45 -05:00
commit bedf4bccea
3 changed files with 38 additions and 4 deletions

View file

@ -6846,3 +6846,33 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
}
return 0;
}
DEFINE_ACTION_FUNCTION(AActor, A_SetSize)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(newradius);
PARAM_FLOAT_DEF(newheight);
PARAM_BOOL_DEF(testpos);
if (newradius < 0.) newradius = self->radius;
if (newheight < 0.) newheight = self->Height;
double oldradius = self->radius;
double oldheight = self->Height;
self->UnlinkFromWorld();
self->radius = newradius;
self->Height = newheight;
self->LinkToWorld();
if (testpos && !P_TestMobjLocation(self))
{
self->UnlinkFromWorld();
self->radius = oldradius;
self->Height = oldheight;
self->LinkToWorld();
ACTION_RETURN_BOOL(false);
}
ACTION_RETURN_BOOL(true);
}

View file

@ -8955,7 +8955,7 @@ ExpEmit FxIfStatement::Emit(VMFunctionBuilder *build)
size_t jumpspot = ~0u;
TArray<size_t> yes, no;
Condition->EmitCompare(build, false, yes, no);
Condition->EmitCompare(build, WhenTrue == nullptr, yes, no);
if (WhenTrue != nullptr)
{
@ -8964,11 +8964,14 @@ ExpEmit FxIfStatement::Emit(VMFunctionBuilder *build)
}
if (WhenFalse != nullptr)
{
if (!WhenTrue->CheckReturn()) jumpspot = build->Emit(OP_JMP, 0); // no need to emit a jump if the block returns.
build->BackpatchListToHere(no);
if (WhenTrue != nullptr)
{
if (!WhenTrue->CheckReturn()) jumpspot = build->Emit(OP_JMP, 0); // no need to emit a jump if the block returns.
build->BackpatchListToHere(no);
}
WhenFalse->EmitStatement(build);
if (jumpspot != ~0u) build->BackpatchToHere(jumpspot);
if (WhenTrue == nullptr) build->BackpatchListToHere(yes);
if (WhenTrue == nullptr) build->BackpatchListToHere(no);
}
else
{

View file

@ -793,6 +793,7 @@ class Actor : Thinker native
native bool A_CopySpriteFrame(int from, int to, int flags = 0);
native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
native void A_SetTranslation(name transname);
native bool A_SetSize(double newradius, double newheight = -1, bool testpos = false);
native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0);