Fix crash on fmv completion

This commit is contained in:
Paul Chote
2010-10-15 00:03:15 +13:00
parent 185ba80e99
commit 2a02df9411
3 changed files with 24 additions and 15 deletions

View File

@@ -31,6 +31,14 @@ namespace OpenRA.Widgets
public bool Paused { get { return paused; } }
readonly World world;
[ObjectCreator.UseCtor]
public VqaPlayerWidget( [ObjectCreator.Param] World world )
{
this.world = world;
}
public bool DrawOverlay = true;
public void Load(string filename)
{
@@ -148,7 +156,7 @@ namespace OpenRA.Widgets
Sound.StopVideo();
video.Reset();
videoSprite.sheet.Texture.SetData(video.FrameData);
OnComplete();
world.AddFrameEndTask(_ => OnComplete());
}
}
}

View File

@@ -119,9 +119,9 @@ namespace OpenRA
}
// Hacky workaround for orderManager visibility
public void OpenWindow(string widget)
public Widget OpenWindow(string widget)
{
Widget.OpenWindow(widget, new Dictionary<string,object>{{"world", this}, { "orderManager", orderManager }});
return Widget.OpenWindow(widget, new Dictionary<string,object>{{"world", this}, { "orderManager", orderManager }});
}
public Actor CreateActor( string name, TypeDictionary initDict )
@@ -163,16 +163,18 @@ namespace OpenRA
public bool DisableTick = false;
public void Tick()
{
if (DisableTick)
return;
actors.Do( x => x.Tick() );
Queries.WithTraitMultiple<ITick>().DoTimed( x =>
// Todo: Expose this as an order so it can be synced
if (!DisableTick)
{
x.Trait.Tick( x.Actor );
}, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
actors.Do( x => x.Tick() );
Queries.WithTraitMultiple<ITick>().DoTimed( x =>
{
x.Trait.Tick( x.Actor );
}, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
effects.DoTimed( e => e.Tick( this ), "[{2}] Effect: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
}
effects.DoTimed( e => e.Tick( this ), "[{2}] Effect: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold );
while (frameEndActions.Count != 0)
frameEndActions.Dequeue()(this);
Game.viewport.Tick();

View File

@@ -23,15 +23,14 @@ namespace OpenRA.Scripting
{
public static void PlayFMVFullscreen(World w, string movie, Action onComplete)
{
var playerRoot = Widget.OpenWindow("FMVPLAYER");
var playerRoot = w.OpenWindow("FMVPLAYER");
var player = playerRoot.GetWidget<VqaPlayerWidget>("PLAYER");
w.DisableTick = true;
Console.WriteLine("PlayFMV {0}",movie);
player.Load(movie);
// Mute world sounds
var oldModifier = Sound.SoundVolumeModifier;
// Todo: this also modifies vqa audio
//Sound.SoundVolumeModifier = 0f;
// Stop music while fmv plays