port map actors to DATA.R8 sequences
This commit is contained in:
@@ -1,156 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
|
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
|
||||||
* available to you under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation. For more information,
|
|
||||||
* see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using OpenRA.FileFormats;
|
|
||||||
using OpenRA.FileFormats.Graphics;
|
|
||||||
using OpenRA.Utility;
|
|
||||||
using OpenRA.Widgets;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.D2k.Widgets.Logic
|
|
||||||
{
|
|
||||||
public class D2kExtractGameFilesLogic
|
|
||||||
{
|
|
||||||
Widget panel;
|
|
||||||
ProgressBarWidget progressBar;
|
|
||||||
LabelWidget statusLabel;
|
|
||||||
Action continueLoading;
|
|
||||||
ButtonWidget retryButton, backButton;
|
|
||||||
Widget extractingContainer, copyFilesContainer;
|
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
|
||||||
public D2kExtractGameFilesLogic(Widget widget, Action continueLoading)
|
|
||||||
{
|
|
||||||
panel = widget.Get("EXTRACT_GAMEFILES_PANEL");
|
|
||||||
progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
|
|
||||||
statusLabel = panel.Get<LabelWidget>("STATUS_LABEL");
|
|
||||||
|
|
||||||
backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
|
|
||||||
backButton.OnClick = Ui.CloseWindow;
|
|
||||||
|
|
||||||
retryButton = panel.Get<ButtonWidget>("RETRY_BUTTON");
|
|
||||||
retryButton.OnClick = Extract;
|
|
||||||
|
|
||||||
extractingContainer = panel.Get("EXTRACTING");
|
|
||||||
copyFilesContainer = panel.Get("COPY_FILES");
|
|
||||||
|
|
||||||
Extract();
|
|
||||||
this.continueLoading = continueLoading;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Extract()
|
|
||||||
{
|
|
||||||
backButton.IsDisabled = () => true;
|
|
||||||
retryButton.IsDisabled = () => true;
|
|
||||||
copyFilesContainer.IsVisible = () => false;
|
|
||||||
extractingContainer.IsVisible = () => true;
|
|
||||||
|
|
||||||
var pathToDataR8 = Path.Combine(Platform.SupportDir, "Content/d2k/DATA.R8");
|
|
||||||
var pathToPalette = "mods/d2k/bits/d2k.pal";
|
|
||||||
var pathToSHPs = Path.Combine(Platform.SupportDir, "Content/d2k/SHPs");
|
|
||||||
var pathToTilesets = Path.Combine(Platform.SupportDir, "Content/d2k/Tilesets");
|
|
||||||
|
|
||||||
var extractGameFiles = new string[][]
|
|
||||||
{
|
|
||||||
new string[] { "--r8", pathToDataR8, pathToPalette, "102", "105", Path.Combine(pathToSHPs, "crates") },
|
|
||||||
new string[] { "--r8", pathToDataR8, pathToPalette, "107", "109", Path.Combine(pathToSHPs, "spicebloom") },
|
|
||||||
new string[] { "--r8", pathToDataR8, pathToPalette, "114", "129", Path.Combine(pathToSHPs, "rockcrater1") },
|
|
||||||
new string[] { "--r8", pathToDataR8, pathToPalette, "130", "145", Path.Combine(pathToSHPs, "rockcrater2") },
|
|
||||||
new string[] { "--r8", pathToDataR8, pathToPalette, "146", "161", Path.Combine(pathToSHPs, "sandcrater1") },
|
|
||||||
new string[] { "--r8", pathToDataR8, pathToPalette, "162", "177", Path.Combine(pathToSHPs, "sandcrater2") },
|
|
||||||
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBASE.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BASE"), "--tileset" },
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBASE.R8"), pathToPalette, "748", "749", Path.Combine(pathToSHPs, "spice0") },
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBAT.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BAT"), "--tileset" },
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXBGBS.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "BGBS"), "--tileset" },
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXICE.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "ICE"), "--tileset" },
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXTREE.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "TREE"), "--tileset" },
|
|
||||||
new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXWAST.R8"), pathToPalette, "0", "799", Path.Combine(pathToTilesets, "WAST"), "--tileset" },
|
|
||||||
////new string[] { "--r8", Path.Combine(Platform.SupportDir, "Content/d2k/BLOXXMAS.R8"), PathToPalette, "0", "799", Path.Combine(PathToTilesets, "XMAS"), "--tileset" },
|
|
||||||
};
|
|
||||||
|
|
||||||
var shpToCreate = new string[][]
|
|
||||||
{
|
|
||||||
new string[] { "--shp", Path.Combine(pathToSHPs, "rockcrater1.png"), "32" },
|
|
||||||
new string[] { "--shp", Path.Combine(pathToSHPs, "rockcrater2.png"), "32" },
|
|
||||||
new string[] { "--shp", Path.Combine(pathToSHPs, "sandcrater1.png"), "32" },
|
|
||||||
new string[] { "--shp", Path.Combine(pathToSHPs, "sandcrater2.png"), "32" },
|
|
||||||
new string[] { "--shp", Path.Combine(pathToSHPs, "spice0.png"), "32" },
|
|
||||||
};
|
|
||||||
|
|
||||||
var onError = (Action<string>)(s => Game.RunAfterTick(() =>
|
|
||||||
{
|
|
||||||
statusLabel.GetText = () => "Error: " + s;
|
|
||||||
backButton.IsDisabled = () => false;
|
|
||||||
retryButton.IsDisabled = () => false;
|
|
||||||
}));
|
|
||||||
|
|
||||||
var t = new Thread(_ =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (int i = 0; i < extractGameFiles.Length; i++)
|
|
||||||
{
|
|
||||||
progressBar.Percentage = i * 100 / extractGameFiles.Count();
|
|
||||||
statusLabel.GetText = () => "Extracting...";
|
|
||||||
Utility.Command.ConvertR8ToPng(extractGameFiles[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < shpToCreate.Length; i++)
|
|
||||||
{
|
|
||||||
progressBar.Percentage = i * 100 / shpToCreate.Count();
|
|
||||||
statusLabel.GetText = () => "Converting...";
|
|
||||||
Utility.Command.ConvertPngToShp(shpToCreate[i]);
|
|
||||||
File.Delete(shpToCreate[i][1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
statusLabel.GetText = () => "Building tilesets...";
|
|
||||||
int c = 0;
|
|
||||||
string[] TilesetArray = new string[] { "BASE", "BAT", "BGBS", "ICE", "TREE", "WAST" };
|
|
||||||
foreach (string set in TilesetArray)
|
|
||||||
{
|
|
||||||
progressBar.Percentage = c * 100 / TilesetArray.Count();
|
|
||||||
File.Delete(Path.Combine(pathToTilesets, "{0}.tsx".F(set)));
|
|
||||||
File.Copy("mods/d2k/tilesets/{0}.tsx".F(set), Path.Combine(pathToTilesets, "{0}.tsx".F(set)));
|
|
||||||
|
|
||||||
// TODO: this is ugly: a GUI will open and close immediately after some delay
|
|
||||||
Process p = new Process();
|
|
||||||
ProcessStartInfo TilesetBuilderProcessStartInfo = new ProcessStartInfo("OpenRA.TilesetBuilder.exe", Path.Combine(pathToTilesets, "{0}.png".F(set)) + " 32 --export Content/d2k/Tilesets");
|
|
||||||
p.StartInfo = TilesetBuilderProcessStartInfo;
|
|
||||||
p.Start();
|
|
||||||
p.WaitForExit();
|
|
||||||
File.Delete(Path.Combine(pathToTilesets, "{0}.tsx".F(set)));
|
|
||||||
File.Delete(Path.Combine(pathToTilesets, "{0}.png".F(set)));
|
|
||||||
File.Delete(Path.Combine(pathToTilesets, "{0}.yaml".F(set.ToLower())));
|
|
||||||
File.Delete(Path.Combine(pathToTilesets, "{0}.pal".F(set.ToLower())));
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Game.RunAfterTick(() =>
|
|
||||||
{
|
|
||||||
progressBar.Percentage = 100;
|
|
||||||
statusLabel.GetText = () => "Extraction and conversion complete.";
|
|
||||||
backButton.IsDisabled = () => false;
|
|
||||||
continueLoading();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
onError("Installation failed");
|
|
||||||
}
|
|
||||||
}) { IsBackground = true };
|
|
||||||
t.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +1,24 @@
|
|||||||
crate:
|
crate:
|
||||||
idle: crates
|
idle: DATA.R8
|
||||||
Start: 0
|
Start: 102
|
||||||
ZOffset: -511
|
ZOffset: -511
|
||||||
land: crates
|
Offset: -16,-16
|
||||||
Start: 0
|
land: DATA.R8
|
||||||
|
Start: 102
|
||||||
ZOffset: -511
|
ZOffset: -511
|
||||||
|
Offset: -16,-16
|
||||||
|
|
||||||
spicebloom:
|
spicebloom:
|
||||||
make:
|
make: DATA.R8
|
||||||
Start: 0
|
Start: 107
|
||||||
Length: 3
|
Length: 3
|
||||||
active:
|
Offset: -16,-16
|
||||||
Start: 2
|
active: DATA.R8
|
||||||
|
Start: 109
|
||||||
Length: 1
|
Length: 1
|
||||||
ZOffset: -511
|
ZOffset: -511
|
||||||
idle:
|
Offset: -16,-16
|
||||||
Start: 2
|
idle: DATA.R8
|
||||||
|
Start: 109
|
||||||
ZOffset: -511
|
ZOffset: -511
|
||||||
|
Offset: -16,-16
|
||||||
sandworm:
|
|
||||||
stand: wormsigns1
|
|
||||||
Start: 0
|
|
||||||
Length: *
|
|
||||||
run: wormsigns2
|
|
||||||
Start: 0
|
|
||||||
Facings: 15
|
|
||||||
Length: 1
|
|
||||||
die1: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
die2: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
die3: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
die4: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
die5: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
die6: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
die-crushed: wormsigns3
|
|
||||||
Start: 0
|
|
||||||
Length: 1
|
|
||||||
Tick: 1600
|
|
||||||
wormattack: wormjaw
|
|
||||||
Start: 0
|
|
||||||
Length: 15
|
|
||||||
|
|
||||||
plates:
|
|
||||||
idle:
|
|
||||||
Start: 0
|
|
||||||
Length: 6
|
|
||||||
scratched-idle:
|
|
||||||
Start: 0
|
|
||||||
Length: 6
|
|
||||||
damaged-idle:
|
|
||||||
Start: 0
|
|
||||||
Length: 6
|
|
||||||
critical-idle:
|
|
||||||
Start: 0
|
|
||||||
Length: 6
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# read bibs from DATA.R8
|
||||||
|
|
||||||
walla:
|
walla:
|
||||||
idle: DATA.R8
|
idle: DATA.R8
|
||||||
Frames: 2527, 2530, 2528, 2538, 2531, 2532, 2542, 2535, 2529, 2539, 2533, 2534, 2540, 2536, 2537, 2541
|
Frames: 2527, 2530, 2528, 2538, 2531, 2532, 2542, 2535, 2529, 2539, 2533, 2534, 2540, 2536, 2537, 2541
|
||||||
|
|||||||
Reference in New Issue
Block a user