- fixed: Switch statement without a default jumped to the first first case label instead.

- removed placeholder code from scripted Marine.
This commit is contained in:
Christoph Oelckers 2016-11-21 22:20:25 +01:00
parent 135cfcf016
commit 3db712cd73
2 changed files with 7 additions and 9 deletions

View file

@ -8250,6 +8250,7 @@ ExpEmit FxSwitchStatement::Emit(VMFunctionBuilder *build)
}
size_t DefaultAddress = build->Emit(OP_JMP, 0);
TArray<size_t> BreakAddresses;
bool defaultset = false;
for (auto line : Content)
{
@ -8270,6 +8271,7 @@ ExpEmit FxSwitchStatement::Emit(VMFunctionBuilder *build)
else
{
build->BackpatchToHere(DefaultAddress);
defaultset = true;
}
break;
@ -8290,6 +8292,7 @@ ExpEmit FxSwitchStatement::Emit(VMFunctionBuilder *build)
{
build->BackpatchToHere(addr);
}
if (!defaultset) build->BackpatchToHere(DefaultAddress);
Content.Clear();
Content.ShrinkToFit();
return ExpEmit();

View file

@ -96,6 +96,7 @@ class ScriptedMarine : Actor
PLAY F 6 BRIGHT A_M_FirePistol(1);
PLAY A 4 A_FaceTarget;
PLAY A 0 A_M_Refire(0, "ShootEnd");
Goto Fireloop.Pistol;
ShootEnd:
PLAY A 5;
Goto See;
@ -226,18 +227,12 @@ class ScriptedMarine : Actor
//
//============================================================================
// placeholder to make it compile for the time being.
SpriteID GetSprite(State st)
{
return SpriteID(0);
}
override void Tick ()
{
Super.Tick ();
// Override the standard sprite, if desired
if (SpriteOverride != 0 && sprite == GetSprite(SpawnState))
if (SpriteOverride != 0 && sprite == SpawnState.sprite)
{
sprite = SpriteOverride;
}
@ -632,14 +627,14 @@ class ScriptedMarine : Actor
{
if (source == null)
{ // A valid actor class wasn't passed, so use the standard sprite
SpriteOverride = sprite = GetSprite(SpawnState);
SpriteOverride = sprite = SpawnState.sprite;
// Copy the standard scaling
Scale = Default.Scale;
}
else
{ // Use the same sprite and scaling the passed class spawns with
readonly<Actor> def = GetDefaultByType (source);
SpriteOverride = sprite = GetSprite(def.SpawnState);
SpriteOverride = sprite = def.SpawnState.sprite;
Scale = def.Scale;
}
}