From 20fb4abc9e082c1e5b8366313d1ff896b9079c27 Mon Sep 17 00:00:00 2001 From: Lemon-King Date: Sun, 2 Jun 2024 01:17:52 -0400 Subject: [PATCH] Add PWAD Mode (WIP) DOOM Compatibility, currently a work in progress. --- .../playersheets/hereticplayer.playersheet | 19 +++ resources/pwad/fontdefs.hxdd | 113 ++++++++++++++++++ resources/pwad/mapinfo.hxdd | 4 + src/main/java/lemon/hxdd/AppSettings.java | 1 + .../lemon/hxdd/builder/PackageBuilder.java | 55 +++++---- .../lemon/hxdd/gui/MainViewController.java | 2 + src/main/resources/lemon/hxdd/main-view.fxml | 37 ++---- 7 files changed, 183 insertions(+), 48 deletions(-) create mode 100644 resources/pwad/fontdefs.hxdd create mode 100644 resources/pwad/mapinfo.hxdd diff --git a/resources/assets/playersheets/hereticplayer.playersheet b/resources/assets/playersheets/hereticplayer.playersheet index 8de9f1c..4d5a3c2 100644 --- a/resources/assets/playersheets/hereticplayer.playersheet +++ b/resources/assets/playersheets/hereticplayer.playersheet @@ -14,7 +14,26 @@ "dexterity": [15,18] }, "xgame": { + "Fist": "Staff", "Chainsaw": "Gauntlets", + "Pistol": "GoldWand", + "Shotgun": "Crossbow", + "SuperShotgun": "Crossbow", + "Chaingun": "Blaster", + "RocketLauncher": "PhoenixRod", + "PlasmaRifle": "SkullRod", + "BFG9000": "Mace", + + "Clip": "GoldWandAmmo,BlasterAmmo", + "ClipBox": "GoldWandHefty,BlasterHefty", + "Shell": "CrossbowAmmo", + "ShellBox": "CrossbowHefty", + "RocketAmmo": "PhoenixRodAmmo", + "RocketBox": "PhoenixRodHefty", + "Cell": "SkullRodAmmo,MaceAmmo", + "CellPack": "SkullRodHefty,MaceHefty", + + "Backpack": "BagOfHolding", "FWeapAxe": "Gauntlets", "CWeapStaff": "Crossbow", diff --git a/resources/pwad/fontdefs.hxdd b/resources/pwad/fontdefs.hxdd new file mode 100644 index 0000000..ab4f407 --- /dev/null +++ b/resources/pwad/fontdefs.hxdd @@ -0,0 +1,113 @@ +BIGFONT +{ + % FONTB05 + ' FONTB07 + , FONTB12 + - FONTB13 + / FONTB15 + : FONTB26 + ? FONTB31 + + + 0 FONTB16 + 1 FONTB17 + 2 FONTB18 + 3 FONTB19 + 4 FONTB20 + 5 FONTB21 + 6 FONTB22 + 7 FONTB23 + 8 FONTB24 + 9 FONTB25 + + A FONTB33 + B FONTB34 + C FONTB35 + D FONTB36 + E FONTB37 + F FONTB38 + G FONTB39 + H FONTB40 + I FONTB41 + J FONTB42 + K FONTB43 + L FONTB44 + M FONTB45 + N FONTB46 + O FONTB47 + P FONTB48 + Q FONTB49 + R FONTB50 + S FONTB51 + T FONTB52 + U FONTB53 + V FONTB54 + W FONTB55 + X FONTB56 + Y FONTB57 + Z FONTB58 +} + +BIGFONTX +{ + % FONTB05 + ' FONTB07 + , FONTB12 + - FONTB13 + / FONTB15 + : FONTB26 + ? FONTB31 + + + 0 FONTB16 + 1 FONTB17 + 2 FONTB18 + 3 FONTB19 + 4 FONTB20 + 5 FONTB21 + 6 FONTB22 + 7 FONTB23 + 8 FONTB24 + 9 FONTB25 + + A FONTB33 + B FONTB34 + C FONTB35 + D FONTB36 + E FONTB37 + F FONTB38 + G FONTB39 + H FONTB40 + I FONTB41 + J FONTB42 + K FONTB43 + L FONTB44 + M FONTB45 + N FONTB46 + O FONTB47 + P FONTB48 + Q FONTB49 + R FONTB50 + S FONTB51 + T FONTB52 + U FONTB53 + V FONTB54 + W FONTB55 + X FONTB56 + Y FONTB57 + Z FONTB58 +} + +SMALLFONT +{ + Template FONTA%02d + BASE 1 + COUNT 59 +} + +SMALLFONT2 +{ + Template FONTA%02d + BASE 1 + COUNT 59 +} \ No newline at end of file diff --git a/resources/pwad/mapinfo.hxdd b/resources/pwad/mapinfo.hxdd new file mode 100644 index 0000000..af8adef --- /dev/null +++ b/resources/pwad/mapinfo.hxdd @@ -0,0 +1,4 @@ +GameInfo { + PlayerClasses = "DoomPlayer", "HXDDHereticPlayer", "HXDDFighterPlayer", "HXDDClericPlayer", "HXDDMagePlayer", "HX2PaladinPlayer", "HX2CrusaderPlayer", "HX2NecromancerPlayer","HX2AssassinPlayer", "HX2SuccubusPlayer" + AddEventHandlers = "HXDDWorldEventHandler", "PlayerSheetEventHandler" +} \ No newline at end of file diff --git a/src/main/java/lemon/hxdd/AppSettings.java b/src/main/java/lemon/hxdd/AppSettings.java index 21ad21c..0bf7439 100644 --- a/src/main/java/lemon/hxdd/AppSettings.java +++ b/src/main/java/lemon/hxdd/AppSettings.java @@ -48,6 +48,7 @@ public AppSettings() { prop_defaults.put("OPTION_ENABLE_H2", "false"); prop_defaults.put("OPTION_ENABLE_HX2", "false"); prop_defaults.put("OPTION_USE_HX2_TITLE_MUSIC", ""); + prop_defaults.put("OPTION_PWAD_MODE", "false"); this.prop = new Properties(); try { diff --git a/src/main/java/lemon/hxdd/builder/PackageBuilder.java b/src/main/java/lemon/hxdd/builder/PackageBuilder.java index 6d91a15..f7b417a 100644 --- a/src/main/java/lemon/hxdd/builder/PackageBuilder.java +++ b/src/main/java/lemon/hxdd/builder/PackageBuilder.java @@ -132,6 +132,8 @@ public void Start() { ExportHXDDFiles(); ApplyUserOptions(); + PWADModeSetup(); + WriteInstallLanguageLookup(); CreateHexenPalettePK3(); @@ -291,13 +293,17 @@ private WadFileOrganizer MergeAssets() { System.out.println("Merging asset tables"); this.app.controller.SetStageLabel("Merging Asset Tables"); + String OPTION_PWAD_MODE = this.app.settings.Get("OPTION_PWAD_MODE"); + WadFileOrganizer merged = new WadFileOrganizer(); this.wads.forEach((p) -> { WadFileOrganizer from = organized.get(p.getKey()); merged.MergeFrom(from, "lumps"); - merged.MergeFrom(from, "flats"); - merged.MergeFrom(from, "graphics"); - merged.MergeFrom(from, "patches"); + if (OPTION_PWAD_MODE.equals("false")) { + merged.MergeFrom(from, "flats"); + merged.MergeFrom(from, "graphics"); + merged.MergeFrom(from, "patches"); + } merged.MergeFrom(from, "sprites"); merged.MergeFrom(from, "sounds"); merged.MergeFrom(from, "music"); @@ -329,6 +335,10 @@ private void ExtractAssets() { } public void ExportMaps() { + String OPTION_PWAD_MODE = this.app.settings.Get("OPTION_PWAD_MODE"); + if (OPTION_PWAD_MODE.equals("true")) { + return; + } this.app.controller.SetCurrentProgress(0); this.wads.forEach((p) -> { Wad wad = p.getValue(); @@ -652,30 +662,27 @@ private void ExportHXDDFiles() { ZipAssets za = new ZipAssets(this.app); za.SetFile(this.app.settings.fileResources); - //ArrayList listGameInfo = za.GetFolderContents("assets"); za.ExtractFilesToFolder("assets", path); + } - /* - try { - ResourceWalker rwAssets = new ResourceWalker("assets"); - - int idx = 0; - for (Pair p : rwAssets.files) { - File source = p.getValue(); - File target = new File(path + "/" + p.getKey()); - if (source.isDirectory()) { - this.app.controller.SetCurrentLabel(String.format("Creating folder %s", p.getKey())); - target.mkdirs(); - } else { - this.app.controller.SetCurrentLabel(String.format("Copying %s", p.getKey())); - Files.copy(source.toPath(), target.toPath(), REPLACE_EXISTING); + private void PWADModeSetup() { + String OPTION_PWAD_MODE = this.app.settings.Get("OPTION_PWAD_MODE"); + if (OPTION_PWAD_MODE.equals("true")) { + System.out.println("PWAD Mode Setup"); + String path = this.app.settings.GetPath("temp"); + + final String[] fileDelete = new String[]{"fontdefs.hxdd", "mapinfo.hxdd", "iwadinfo.hxdd", "lockdefs.hxdd", "playpal.lmp", "colormap.lmp"}; + for (String s : fileDelete) { + File f = new File(path + "/" + s); + if (f.exists() && !f.delete()) { + System.out.printf("PWAD MODE: Failed to delete: %s", f.getName()); } - this.app.controller.SetCurrentProgress((double) ++idx / rwAssets.files.size()); } - } catch (IOException | URISyntaxException e) { - e.printStackTrace(); + + ZipAssets za = new ZipAssets(this.app); + za.SetFile(this.app.settings.fileResources); + za.ExtractFilesToFolder("pwad", path); } - */ } private boolean HasPAKFiles(String[] paths) { @@ -717,6 +724,10 @@ private void ExportHXDDFileByName(String source, String target) { // Create Hexen focused palette PK3 for wads using palette textures private void CreateHexenPalettePK3() { + String OPTION_PWAD_MODE = this.app.settings.Get("OPTION_PWAD_MODE"); + if(OPTION_PWAD_MODE.equals("true")) { + return; + } this.app.controller.SetCurrentLabel("Creating Hexen Palette PK3"); this.app.controller.SetCurrentProgress(-1); try { diff --git a/src/main/java/lemon/hxdd/gui/MainViewController.java b/src/main/java/lemon/hxdd/gui/MainViewController.java index 1a82846..17b50eb 100644 --- a/src/main/java/lemon/hxdd/gui/MainViewController.java +++ b/src/main/java/lemon/hxdd/gui/MainViewController.java @@ -91,6 +91,7 @@ public class MainViewController { public ChoiceBox cbKoraxLocale; public CheckBox cxDownloadTitleSteam; public CheckBox cxEnableHexenII; + public CheckBox cxEnablePWADMode; @FXML public Button btnOpenFolder; @@ -183,6 +184,7 @@ public void SetupView() { BindCheckBox("OPTION_USE_STEAM_ARTWORK",cxDownloadTitleSteam); BindCheckBox("OPTION_ENABLE_HX2", cxEnableHexenII); + BindCheckBox("OPTION_PWAD_MODE", cxEnablePWADMode); SetupChoiceBoxTitleScreen(); SetupChoiceBoxTitleMusic(); diff --git a/src/main/resources/lemon/hxdd/main-view.fxml b/src/main/resources/lemon/hxdd/main-view.fxml index 52224cc..a9d163a 100644 --- a/src/main/resources/lemon/hxdd/main-view.fxml +++ b/src/main/resources/lemon/hxdd/main-view.fxml @@ -1,31 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + @@ -592,6 +573,10 @@ + + + +