diff --git a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj index 410ccb7fa8..46cf9505e6 100644 --- a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj +++ b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj @@ -62,6 +62,7 @@ + diff --git a/OpenRA.Mods.D2k/Widgets/Logic/D2kDownloadPackagesLogic.cs b/OpenRA.Mods.D2k/Widgets/Logic/D2kDownloadPackagesLogic.cs new file mode 100644 index 0000000000..fc29ac206e --- /dev/null +++ b/OpenRA.Mods.D2k/Widgets/Logic/D2kDownloadPackagesLogic.cs @@ -0,0 +1,111 @@ +#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.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Net; +using OpenRA.FileFormats; +using OpenRA.Widgets; + +namespace OpenRA.Mods.D2k.Widgets.Logic +{ + public class D2kDownloadPackagesLogic + { + Widget panel; + Dictionary installData; + ProgressBarWidget progressBar; + LabelWidget statusLabel; + Action afterInstall; + + [ObjectCreator.UseCtor] + public D2kDownloadPackagesLogic(Widget widget, Dictionary installData, Action afterInstall) + { + this.installData = installData; + this.afterInstall = afterInstall; + + panel = widget.Get("INSTALL_DOWNLOAD_PANEL"); + progressBar = panel.Get("PROGRESS_BAR"); + statusLabel = panel.Get("STATUS_LABEL"); + + ShowDownloadDialog(); + } + + void ShowDownloadDialog() + { + statusLabel.GetText = () => "Initializing..."; + progressBar.SetIndeterminate(true); + var retryButton = panel.Get("RETRY_BUTTON"); + retryButton.IsVisible = () => false; + + var cancelButton = panel.Get("CANCEL_BUTTON"); + + // Save the package to a temp file + var file = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + var dest = new string[] { Platform.SupportDir, "Content", Game.modData.Manifest.Mods[0] }.Aggregate(Path.Combine); + + Action onDownloadProgress = i => + { + if (progressBar.Indeterminate) + progressBar.SetIndeterminate(false); + + progressBar.Percentage = i.ProgressPercentage; + statusLabel.GetText = () => "Downloading {1}/{2} kB ({0}%)".F(i.ProgressPercentage, i.BytesReceived / 1024, i.TotalBytesToReceive / 1024); + }; + + Action onExtractProgress = s => + { + Game.RunAfterTick(() => statusLabel.GetText = () => s); + }; + + Action onError = s => + { + Game.RunAfterTick(() => + { + statusLabel.GetText = () => "Error: "+s; + retryButton.IsVisible = () => true; + }); + }; + + Action onDownloadComplete = (i, cancelled) => + { + if (i.Error != null) + { + onError(Download.FormatErrorMessage(i.Error)); + return; + } + else if (cancelled) + { + onError("Download cancelled"); + return; + } + + // Automatically extract + statusLabel.GetText = () => "Extracting..."; + progressBar.SetIndeterminate(true); + if (InstallUtils.ExtractZip(file, dest, onExtractProgress, onError)) + { + Game.RunAfterTick(() => + { + Ui.CloseWindow(); + //afterInstall(); + }); + } + }; + + var dl = new Download(installData["PackageURL"], file, onDownloadProgress, onDownloadComplete); + + cancelButton.OnClick = () => { dl.Cancel(); Ui.CloseWindow(); }; + retryButton.OnClick = () => { dl.Cancel(); ShowDownloadDialog(); }; + } + } +} diff --git a/OpenRA.Mods.D2k/Widgets/Logic/D2kInstallLogic.cs b/OpenRA.Mods.D2k/Widgets/Logic/D2kInstallLogic.cs index f5249c58d6..b668c5824e 100644 --- a/OpenRA.Mods.D2k/Widgets/Logic/D2kInstallLogic.cs +++ b/OpenRA.Mods.D2k/Widgets/Logic/D2kInstallLogic.cs @@ -26,6 +26,9 @@ namespace OpenRA.Mods.D2k.Widgets.Logic { "installData", installData } }; + panel.Get("DOWNLOAD_BUTTON").OnClick = () => + Ui.OpenWindow("INSTALL_DOWNLOAD_PANEL", args); + panel.Get("COPY_BUTTON").OnClick = () => Ui.OpenWindow("INSTALL_FROMCD_PANEL", args); diff --git a/OpenRA.TilesetBuilder/OpenRA.TilesetBuilder.csproj b/OpenRA.TilesetBuilder/OpenRA.TilesetBuilder.csproj index 0ff8da637f..a91529cde9 100644 --- a/OpenRA.TilesetBuilder/OpenRA.TilesetBuilder.csproj +++ b/OpenRA.TilesetBuilder/OpenRA.TilesetBuilder.csproj @@ -18,7 +18,7 @@ true full false - . + ..\ DEBUG;TRACE prompt 4 diff --git a/mods/d2k/TODO b/mods/d2k/TODO index 5baf50f34b..adc0ad67ed 100644 --- a/mods/d2k/TODO +++ b/mods/d2k/TODO @@ -36,4 +36,7 @@ # black spots on buildings should be transparent # gamefile extraction (setup/setup.z) from CD fails # support patch 1.06 gamefiles: DATA.R8 has more frames and currently fails to extract, also featuring new terrain with white houses and new unit: grenade thrower -# mouse cursor has no transparency and is a little pixelish \ No newline at end of file +# mouse cursor has no transparency and is a little pixelish +# mouse cursor does not change for infantry-only areas (Rough) +# put TilesetBuilder.Export into OpenRA.Utility +# create a minimal Freeware auto-download version from patch 1.06 files \ No newline at end of file diff --git a/mods/d2k/chrome/gameinit.yaml b/mods/d2k/chrome/gameinit.yaml index 554d898d27..74a9183008 100644 --- a/mods/d2k/chrome/gameinit.yaml +++ b/mods/d2k/chrome/gameinit.yaml @@ -69,6 +69,13 @@ Background@INSTALL_PANEL: Height:25 Text:Copy Music Font:Bold + Button@DOWNLOAD_BUTTON: + X:PARENT_RIGHT - 560 + Y:PARENT_BOTTOM - 45 + Width:120 + Height:25 + Text:Download + Font:Bold Button@QUIT_BUTTON: X:PARENT_RIGHT - 140 Y:PARENT_BOTTOM - 45 @@ -77,6 +84,50 @@ Background@INSTALL_PANEL: Text:Quit Font:Bold +Background@INSTALL_DOWNLOAD_PANEL: + Logic:D2kDownloadPackagesLogic + X:(WINDOW_RIGHT - WIDTH)/2 + Y:(WINDOW_BOTTOM - HEIGHT)/2 + Width:500 + Height:160 + Children: + Label@TITLE: + X:0 + Y:20 + Width:PARENT_RIGHT + Height:25 + Text:Downloading Dune 2000 Content + Align:Center + Font:Bold + ProgressBar@PROGRESS_BAR: + X:50 + Y:55 + Width:PARENT_RIGHT - 100 + Height:25 + Label@STATUS_LABEL: + X:50 + Y:80 + Width:PARENT_RIGHT - 100 + Height:25 + Align:Left + Button@RETRY_BUTTON: + X:PARENT_RIGHT - 280 + Y:PARENT_BOTTOM - 45 + Width:120 + Height:25 + Visible: false + Text:Retry + Font:Bold + Key:return + Button@CANCEL_BUTTON: + X:PARENT_RIGHT - 140 + Y:PARENT_BOTTOM - 45 + Width:120 + Height:25 + Text:Cancel + Font:Bold + Key:escape + Background@INSTALL_FROMCD_PANEL: Logic:D2kInstallFromCDLogic X:(WINDOW_RIGHT - WIDTH)/2 diff --git a/mods/d2k/maps/test.oramap b/mods/d2k/maps/test.oramap index d48b2868a3..56a1d71f67 100644 Binary files a/mods/d2k/maps/test.oramap and b/mods/d2k/maps/test.oramap differ diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 7bcdb907af..5b41e764f5 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -93,6 +93,7 @@ Movies: LoadScreen: D2kLoadScreen InstallerMenuWidget: INSTALL_PANEL TestFile: carryall.shp + PackageURL: DunePatch106R8Data.zip ServerTraits: LobbyCommands diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index b2b510cc84..8447d4ef38 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -1,7 +1,7 @@ ^Vehicle: AppearsOnRadar: Mobile: - Crushes: crate + Crushes: crate, worm TerrainSpeeds: Sand: 80 Rock: 90 @@ -34,7 +34,7 @@ ^Tank: AppearsOnRadar: Mobile: - Crushes: crate + Crushes: crate, worm TerrainSpeeds: Sand: 80 Rock: 90 diff --git a/mods/d2k/rules/system.yaml b/mods/d2k/rules/system.yaml index bf2bff1e08..51f0441b64 100644 --- a/mods/d2k/rules/system.yaml +++ b/mods/d2k/rules/system.yaml @@ -283,4 +283,29 @@ SPICEBLOOM: SeedsResource: ResourceType: Spice RadarColorFromTerrain: - Terrain: Spice \ No newline at end of file + Terrain: Spice + +SANDWORM: + Inherits: ^Infantry + Buildable: + Owner: Creep + Valued: + Cost: 1000 + Tooltip: + Name: Sandworm + Description: Attracted by vibrations in the sand. Will eat units whole and has a large appetite. + Icon: sandwormdust + Health: + HP: 10000 + Mobile: + Speed: 5 + TerrainSpeeds: + Sand: 100 + Dune: 100 + AutoTarget: + AttackWander: + AttackLeap: + PrimaryWeapon: WormJaw + CanAttackGround: no + RenderInfantry: + BelowUnits: \ No newline at end of file diff --git a/mods/d2k/sequences.yaml b/mods/d2k/sequences.yaml index 7849bb732a..a92945873b 100644 --- a/mods/d2k/sequences.yaml +++ b/mods/d2k/sequences.yaml @@ -882,7 +882,6 @@ parach: Start: 5 Length: 11 - spicebloom: make: Start: 0 @@ -891,4 +890,40 @@ spicebloom: Start: 2 Length: 1 idle: - Start: 2 \ No newline at end of file + Start: 2 + +sandworm: + stand: wormsigns2 + Start: 0 + Length: * + Tick: 150 + run: sandwormdust + Start: 0 + Facings: 4 + Length: 5 + Tick: 150 + die1: sandwormdust + Start: 0 + Length: 1 + die2: sandwormdust + Start: 0 + Length: 1 + die3: sandwormdust + Start: 0 + Length: 1 + die4: sandwormdust + Start: 0 + Length: 1 + die5: sandwormdust + Start: 0 + Length: 1 + die6: sandwormdust + Start: 0 + Length: 1 + die-crushed: sandwormdust + Start: 0 + Length: 1 + Tick: 1600 + wormattack: sandwormmouth + Start: 0 + Length: 15 \ No newline at end of file diff --git a/mods/d2k/weapons.yaml b/mods/d2k/weapons.yaml index 7332824180..c9791b72c1 100644 --- a/mods/d2k/weapons.yaml +++ b/mods/d2k/weapons.yaml @@ -428,4 +428,15 @@ UnitExplodeSmall: Heavy: 25% Explosion: large_explosion InfDeath: 3 - ImpactSound: kaboom15 \ No newline at end of file + ImpactSound: kaboom15 + +WormJaw: + ROF: 10 + Range: 3 + Report: AI_WATTK + Warhead: + Spread: 5 + Versus: + Wood: 0% + Concrete: 0% + Damage: 100 \ No newline at end of file