Populate the list from yaml; Define ra-allies movies; Additional polish.
This commit is contained in:
@@ -257,7 +257,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
int cachedFrame;
|
||||
int cachedFrame = -1;
|
||||
public int[,] FrameData { get
|
||||
{
|
||||
if (cachedFrame != currentFrame)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.FileFormats
|
||||
public readonly string[]
|
||||
Folders, Packages, Rules,
|
||||
Sequences, Chrome, Assemblies, ChromeLayout,
|
||||
Weapons, Voices, Music, TileSets;
|
||||
Weapons, Voices, Music, Movies, TileSets;
|
||||
|
||||
public readonly string ShellmapUid;
|
||||
|
||||
@@ -76,6 +76,7 @@ namespace OpenRA.FileFormats
|
||||
Weapons = YamlList(yaml, "Weapons");
|
||||
Voices = YamlList(yaml, "Voices");
|
||||
Music = YamlList(yaml, "Music");
|
||||
Movies = YamlList(yaml, "Movies");
|
||||
TileSets = YamlList(yaml, "TileSets");
|
||||
|
||||
ShellmapUid = yaml["ShellmapUid"].Value;
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace OpenRA
|
||||
public static Dictionary<string, WeaponInfo> Weapons;
|
||||
public static Dictionary<string, VoiceInfo> Voices;
|
||||
public static Dictionary<string, MusicInfo> Music;
|
||||
public static Dictionary<string, string> Movies;
|
||||
public static Dictionary<string, TileSet> TileSets;
|
||||
|
||||
public static void LoadRules(Manifest m, Map map)
|
||||
@@ -32,6 +33,7 @@ namespace OpenRA
|
||||
Weapons = LoadYamlRules(m.Weapons, map.Weapons, (k, _) => new WeaponInfo(k.Key.ToLowerInvariant(), k.Value));
|
||||
Voices = LoadYamlRules(m.Voices, map.Voices, (k, _) => new VoiceInfo(k.Value));
|
||||
Music = LoadYamlRules(m.Music, map.Music, (k, _) => new MusicInfo(k.Value));
|
||||
Movies = LoadYamlRules(m.Movies, new Dictionary<string,MiniYaml>(), (k, v) => k.Value.Value);
|
||||
|
||||
TileSets = new Dictionary<string, TileSet>();
|
||||
foreach (var file in m.TileSets)
|
||||
|
||||
@@ -16,17 +16,13 @@ namespace OpenRA.Widgets.Delegates
|
||||
{
|
||||
public class VideoPlayerDelegate : IWidgetDelegate
|
||||
{
|
||||
string Selected = null;
|
||||
string Selected;
|
||||
public VideoPlayerDelegate()
|
||||
{
|
||||
var bg = Widget.RootWidget.GetWidget("VIDEOPLAYER_MENU");
|
||||
var player = bg.GetWidget<VqaPlayerWidget>("VIDEOPLAYER");
|
||||
bg.GetWidget("BUTTON_PLAY").OnMouseUp = mi =>
|
||||
{
|
||||
if (Selected == null)
|
||||
return true;
|
||||
|
||||
player.Load(Selected);
|
||||
player.Play();
|
||||
return true;
|
||||
};
|
||||
@@ -53,14 +49,11 @@ namespace OpenRA.Widgets.Delegates
|
||||
var itemTemplate = vl.GetWidget<LabelWidget>("VIDEO_TEMPLATE");
|
||||
int offset = itemTemplate.Bounds.Y;
|
||||
|
||||
// Todo: pull into per-mod yaml / Manifest
|
||||
var tempVideos = new Dictionary<string,string>();
|
||||
tempVideos.Add("obel.vqa", "Obelisk ZZZZAAAAAP");
|
||||
tempVideos.Add("ally1.vqa", "Allies briefing #1");
|
||||
tempVideos.Add("ally10.vqa", "Allies briefing #10");
|
||||
Selected = Rules.Movies.Keys.FirstOrDefault();
|
||||
if (Selected != null)
|
||||
player.Load(Selected);
|
||||
|
||||
Selected = tempVideos.Keys.FirstOrDefault();
|
||||
foreach (var kv in tempVideos)
|
||||
foreach (var kv in Rules.Movies)
|
||||
{
|
||||
var video = kv.Key;
|
||||
var title = kv.Value;
|
||||
@@ -73,10 +66,8 @@ namespace OpenRA.Widgets.Delegates
|
||||
template.GetBackground = () => ((video == Selected) ? "dialog2" : null);
|
||||
template.OnMouseDown = mi =>
|
||||
{
|
||||
if (Selected == video)
|
||||
return true;
|
||||
player.Stop();
|
||||
Selected = video;
|
||||
player.Load(video);
|
||||
return true;
|
||||
};
|
||||
template.Parent = vl;
|
||||
|
||||
@@ -28,6 +28,12 @@ namespace OpenRA.Widgets
|
||||
if (filename == cachedVideo)
|
||||
return;
|
||||
|
||||
if (playing)
|
||||
{
|
||||
playing = false;
|
||||
Sound.StopVideoSoundtrack();
|
||||
}
|
||||
|
||||
cachedVideo = filename;
|
||||
video = new VqaReader(FileSystem.Open(filename));
|
||||
invLength = video.Framerate*1f/video.Frames;
|
||||
@@ -35,6 +41,7 @@ namespace OpenRA.Widgets
|
||||
var size = Math.Max(video.Width, video.Height);
|
||||
var textureSize = OpenRA.Graphics.Util.NextPowerOf2(size);
|
||||
videoSprite = new Sprite(new Sheet(new Size(textureSize,textureSize)), new Rectangle( 0, 0, video.Width, video.Height ), TextureChannel.Alpha);
|
||||
videoSprite.sheet.Texture.SetData(video.FrameData);
|
||||
|
||||
var scale = Math.Min(RenderBounds.Width / video.Width, RenderBounds.Height / video.Height);
|
||||
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale*video.Width)/2, RenderBounds.Y + (RenderBounds.Height - scale*video.Height)/2);
|
||||
@@ -45,38 +52,47 @@ namespace OpenRA.Widgets
|
||||
Stopwatch sw = new Stopwatch();
|
||||
public override void DrawInner(World world)
|
||||
{
|
||||
if (!playing)
|
||||
if (video == null)
|
||||
return;
|
||||
|
||||
var nextFrame = (int)float2.Lerp(0, video.Frames, (float)(sw.ElapsedTime()*invLength));
|
||||
if (nextFrame > video.Frames)
|
||||
if (playing)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
var nextFrame = (int)float2.Lerp(0, video.Frames, (float)(sw.ElapsedTime()*invLength));
|
||||
if (nextFrame > video.Frames)
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
while (nextFrame > video.CurrentFrame)
|
||||
{
|
||||
video.AdvanceFrame();
|
||||
if (nextFrame == video.CurrentFrame)
|
||||
videoSprite.sheet.Texture.SetData(video.FrameData);
|
||||
while (nextFrame > video.CurrentFrame)
|
||||
{
|
||||
video.AdvanceFrame();
|
||||
if (nextFrame == video.CurrentFrame)
|
||||
videoSprite.sheet.Texture.SetData(video.FrameData);
|
||||
}
|
||||
}
|
||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(videoSprite, videoOrigin, "chrome", videoSize);
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (playing || video == null)
|
||||
return;
|
||||
|
||||
playing = true;
|
||||
video.Reset();
|
||||
videoSprite.sheet.Texture.SetData(video.FrameData);
|
||||
sw.Reset();
|
||||
Sound.PlayVideoSoundtrack(video.AudioData);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (!playing || video == null)
|
||||
return;
|
||||
|
||||
playing = false;
|
||||
Sound.StopVideoSoundtrack();
|
||||
video.Reset();
|
||||
videoSprite.sheet.Texture.SetData(video.FrameData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ Packages:
|
||||
snow.mix
|
||||
interior.mix
|
||||
scores.mix
|
||||
~movies1.mix
|
||||
|
||||
Rules:
|
||||
mods/ra/defaults.yaml
|
||||
@@ -61,4 +62,7 @@ TileSets:
|
||||
Music:
|
||||
mods/ra/music.yaml
|
||||
|
||||
Movies:
|
||||
mods/ra/movies1.yaml
|
||||
|
||||
ShellmapUid:f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7
|
||||
|
||||
51
mods/ra/movies1.yaml
Normal file
51
mods/ra/movies1.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
aagun.vqa: a.a. gun shooting yak
|
||||
aftrmath.vqa: iron curtain destroyed
|
||||
ally1.vqa: get einstien
|
||||
ally2.vqa: clear the way for the convoy
|
||||
ally4.vqa: close the mountain pass
|
||||
ally5.vqa: rescue tanya
|
||||
ally6.vqa: find the iron curtain
|
||||
ally8.vqa: protect the tech centre
|
||||
ally9.vqa: rescue kosygin
|
||||
ally10.vqa: stop nukes
|
||||
ally10b.vqa: deactivate launch terminals
|
||||
ally11.vqa: clear the river
|
||||
ally12.vqa: infiltrate tech centers
|
||||
ally14.vqa: final assult on moscow
|
||||
allyend.vqa: stalin is dead
|
||||
allymorf.vqa: allied logo
|
||||
apcescpe.vqa: apc running away
|
||||
assess.vqa: allied found iron curtain
|
||||
battle.vqa: destroyed vechicles
|
||||
binoc.vqa: guy viewing tanks through binoculars
|
||||
bmap.vqa: dagger falls on map of europe & europe turns red
|
||||
brdgtilt.vqa: a bridge
|
||||
cronfail.vqa: chronosphere test failed
|
||||
crontest.vqa: chronosphere test ok
|
||||
destroyr.vqa: allied destroyers
|
||||
dud.vqa: dud missile in london
|
||||
elevator.vqa: inside soviet elevator
|
||||
flare.vqa: flare man
|
||||
frozen.vqa: frozen soldier
|
||||
grvestne.vqa: tanya adams r.i.p.
|
||||
landing.vqa: helicopter landing outside soviet base
|
||||
masasslt.vqa: assault on moscow
|
||||
mcv.vqa: mcv drives up
|
||||
mcv_land.vqa: helicopter lands near mcv
|
||||
montpass.vqa: truck drives over sign
|
||||
oildrum.vqa: artillery blows up barrels
|
||||
overrun.vqa: soldiers nearly run over
|
||||
prolog.vqa: einstien eliminating hitler
|
||||
redintro.vqa: red alert intro sequence
|
||||
shipsink.vqa: ship sinking
|
||||
shorbom1.vqa: ships attacking base
|
||||
shorbom2.vqa: ships attacking base again
|
||||
shorbomb.vqa: ships attacking another base
|
||||
snowbomb.vqa: base being blown up in the snow
|
||||
soviet1.vqa: kill the civillians
|
||||
sovtstar.vqa: soviets logo
|
||||
spy.vqa: spy infiltrating building
|
||||
tanya1.vqa: tanya being interrogated
|
||||
tanya2.vqa: tanya has been rescued
|
||||
toofar.vqa: bridge being blown up
|
||||
trinity.vqa: paris being nuked
|
||||
Reference in New Issue
Block a user