Skip to content

Commit

Permalink
Add PWAD Mode (WIP)
Browse files Browse the repository at this point in the history
DOOM Compatibility, currently a work in progress.
  • Loading branch information
Lemon-King committed Jun 2, 2024
1 parent 11ad001 commit 20fb4ab
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 48 deletions.
19 changes: 19 additions & 0 deletions resources/assets/playersheets/hereticplayer.playersheet
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
113 changes: 113 additions & 0 deletions resources/pwad/fontdefs.hxdd
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 4 additions & 0 deletions resources/pwad/mapinfo.hxdd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
GameInfo {
PlayerClasses = "DoomPlayer", "HXDDHereticPlayer", "HXDDFighterPlayer", "HXDDClericPlayer", "HXDDMagePlayer", "HX2PaladinPlayer", "HX2CrusaderPlayer", "HX2NecromancerPlayer","HX2AssassinPlayer", "HX2SuccubusPlayer"
AddEventHandlers = "HXDDWorldEventHandler", "PlayerSheetEventHandler"
}
1 change: 1 addition & 0 deletions src/main/java/lemon/hxdd/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
55 changes: 33 additions & 22 deletions src/main/java/lemon/hxdd/builder/PackageBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public void Start() {
ExportHXDDFiles();
ApplyUserOptions();

PWADModeSetup();

WriteInstallLanguageLookup();

CreateHexenPalettePK3();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -652,30 +662,27 @@ private void ExportHXDDFiles() {

ZipAssets za = new ZipAssets(this.app);
za.SetFile(this.app.settings.fileResources);
//ArrayList<String> listGameInfo = za.GetFolderContents("assets");
za.ExtractFilesToFolder("assets", path);
}

/*
try {
ResourceWalker rwAssets = new ResourceWalker("assets");
int idx = 0;
for (Pair<String, File> 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) {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/lemon/hxdd/gui/MainViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class MainViewController {
public ChoiceBox<ChoiceBoxItem> cbKoraxLocale;
public CheckBox cxDownloadTitleSteam;
public CheckBox cxEnableHexenII;
public CheckBox cxEnablePWADMode;
@FXML
public Button btnOpenFolder;

Expand Down Expand Up @@ -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();
Expand Down
37 changes: 11 additions & 26 deletions src/main/resources/lemon/hxdd/main-view.fxml
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.paint.LinearGradient?>
<?import javafx.scene.paint.Stop?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.text.*?>

<BorderPane maxWidth="756.0" prefWidth="740.0" xmlns="http://javafx.com/javafx/11.0.14-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="lemon.hxdd.gui.MainViewController">
<top>
Expand Down Expand Up @@ -592,6 +573,10 @@
</children>
</HBox>
<Separator layoutX="9.0" layoutY="118.0" prefWidth="360.0" />
<HBox alignment="CENTER_LEFT" layoutX="13.0" layoutY="301.0" prefHeight="35.0" prefWidth="352.0">
<children>
<CheckBox fx:id="cxEnablePWADMode" mnemonicParsing="false" text="Build as DOOM PWAD [DEVELOPMENT]" />
</children></HBox>
</children>
</AnchorPane>
</content>
Expand Down

0 comments on commit 20fb4ab

Please sign in to comment.