diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..93d04de
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "assets/open-eggbert-legacy-assets"]
+ path = assets/open-eggbert-legacy-assets
+ url = https://code.nanoboot.org/openeggbert/open-eggbert-legacy-assets
+ branch = develop
diff --git a/assets/default-spritesheets/speedy_blupi_I.spritesheet.csv b/assets/default-spritesheets/speedy_blupi_I.spritesheet.csv
new file mode 100644
index 0000000..f4f4983
--- /dev/null
+++ b/assets/default-spritesheets/speedy_blupi_I.spritesheet.csv
@@ -0,0 +1,83 @@
+File;Group;Number in Group;Row;Column;X;Y;Width;Height;Notes;Tags;Number per file
+blupi000.blp;Yellow_Eggbert_Born;1;1;1;;0;28;20;;ok;1
+blupi000.blp;Yellow_Eggbert_Born;2;1;2;;0;28;0;;ok;2
+blupi000.blp;Yellow_Eggbert_Born;3;1;3;;0;28;3;;ok;3
+blupi000.blp;Yellow_Eggbert_Born;4;1;4;;0;28;0;;ok;4
+blupi000.blp;Yellow Bomb;1;1;5;;0;34;1;;ok;5
+blupi000.blp;Yellow Bomb;2;1;6;;0;38;0;;ok;6
+blupi000.blp;Yellow Bomb;3;1;7;;0;40;0;;ok;7
+blupi000.blp;Yellow Bomb;4;1;8;;0;42;0;;ok;8
+blupi000.blp;Yellow Bomb;5;1;9;;0;44;0;;ok;9
+blupi000.blp;Yellow Bomb;6;1;10;;0;45;0;;ok;10
+blupi000.blp;Yellow_Eggbert_Life;1;1;11;;0;17;1;;ok;11
+blupi000.blp;Yellow_Eggbert_Born;5;1;12;;0;28;2;;ok;12
+blupi000.blp;Yellow_Eggbert_Born;6;1;13;;0;28;2;;ok;13
+blupi000.blp;Yellow_Eggbert_Born;7;1;14;;0;28;1;;ok;14
+blupi000.blp;Yellow_Eggbert_Born;8;1;15;;0;28;1;;ok;15
+blupi000.blp;Yellow_Eggbert_Swimming_Right;1;1;16;;0;53;0;;ok;16
+blupi000.blp;Yellow_Eggbert_Swimming_Left;1;1;17;;0;60;0;;ok;17
+blupi000.blp;Yellow_Eggbert_Born;9;1;18;;0;28;1;;ok;18
+blupi000.blp;Yellow_Eggbert_Swimming_Left;2;1;19;;0;46;0;;ok;19
+blupi000.blp;Yellow_Eggbert_Swimming_Left;3;1;20;;0;46;0;;ok;20
+blupi000.blp;Yellow_Eggbert_Swimming_Right;2;1;21;;0;47;0;;ok;21
+blupi000.blp;Yellow_Eggbert_Swimming_Right;3;2;1;;32;47;32;;ok;22
+blupi000.blp;Yellow_Eggbert_Swimming_Left;4;2;2;;32;47;0;;ok;23
+blupi000.blp;Yellow_Eggbert_Swimming_Right;4;2;3;;32;48;0;;ok;24
+blupi000.blp;Yellow_Eggbert_Swimming_Right;5;2;4;;32;48;0;;ok;25
+blupi000.blp;Yellow_Eggbert_Swimming_Left;5;2;5;;32;48;0;;ok;26
+blupi000.blp;Yellow_Eggbert_Swimming_Left;6;2;6;;32;48;0;;ok;27
+blupi000.blp;Yellow_Eggbert_Swimming_Right;6;2;7;;32;49;0;;ok;28
+blupi000.blp;Yellow_Eggbert_Swimming_Right;7;2;8;;32;49;0;;ok;29
+blupi000.blp;Yellow_Eggbert_Swimming_Left;7;2;9;;32;49;0;;ok;30
+blupi000.blp;Yellow_Eggbert_Swimming_Right;8;2;10;;32;49;0;;ok;31
+blupi000.blp;Yellow_Eggbert_Swimming_Butt;1;2;11;;32;52;0;;ok;32
+blupi000.blp;Yellow_Eggbert_Swimming_Left;8;2;12;;32;54;0;;ok;33
+blupi000.blp;Yellow_Eggbert_Swimming_Right;9;2;13;;32;57;0;;ok;34
+blupi000.blp;Yellow_Eggbert_Swimming_Left;9;2;14;;32;58;0;;ok;35
+blupi000.blp;Yellow_Eggbert_Crouching_Left;1;2;15;;32;37;7;;ok;36
+blupi000.blp;Yellow_Eggbert_Crouching_Right;1;2;16;;32;37;0;;ok;37
+blupi000.blp;?;1;3;1;;71;37;43;;ok;38
+blupi000.blp;?;1;3;2;;71;37;0;;ok;39
+blupi000.blp;?;1;3;3;;71;35;1;;ok;40
+blupi000.blp;?;1;3;4;;71;35;0;;ok;41
+blupi000.blp;?;1;3;5;;71;36;0;;ok;42
+blupi000.blp;?;1;3;6;;71;36;0;;ok;43
+blupi000.blp;?;1;3;7;;71;33;1;;ok;44
+blupi000.blp;?;1;3;8;;71;34;0;;ok;45
+blupi000.blp;?;1;3;9;;71;34;0;;ok;46
+blupi000.blp;?;1;3;10;;71;35;0;;ok;47
+blupi000.blp;?;1;3;11;;71;36;0;;ok;48
+blupi000.blp;?;1;3;12;;71;37;0;;ok;49
+blupi000.blp;?;1;3;13;;71;37;0;;ok;50
+blupi000.blp;?;1;3;14;;71;39;0;;ok;51
+blupi000.blp;?;1;3;15;;71;32;1;;ok;52
+blupi000.blp;?;1;3;16;;71;32;0;;ok;53
+blupi000.blp;?;1;3;17;;71;32;0;;ok;54
+blupi000.blp;?;1;3;18;;71;32;0;;ok;55
+blupi000.blp;?;1;3;19;;71;34;0;;ok;56
+blupi000.blp;?;1;3;20;;71;36;0;whoops;ok;57
+blupi000.blp;?;1;3;21;;71;37;0;;ok;58
+blupi000.blp;?;1;3;22;;71;36;1;;ok;59
+blupi000.blp;?;1;4;1;;118;41;47;bouchnul se do hlavy;ok;60
+blupi000.blp;?;1;4;2;;118;30;1;;ok;61
+blupi000.blp;?;1;4;3;;118;31;0;;ok;62
+blupi000.blp;?;1;4;4;;118;31;0;;ok;63
+blupi000.blp;?;1;4;5;;118;32;0;;ok;64
+blupi000.blp;?;1;4;6;;118;32;0;;ok;65
+blupi000.blp;?;1;4;7;;118;32;0;;ok;66
+blupi000.blp;?;1;4;8;;118;32;0;;ok;67
+blupi000.blp;?;1;4;9;;118;32;0;;ok;68
+blupi000.blp;?;1;4;10;;118;33;0;;ok;69
+blupi000.blp;?;1;4;11;;118;33;0;;ok;70
+blupi000.blp;?;1;4;12;;118;33;0;;ok;71
+blupi000.blp;?;1;4;13;;118;33;0;;ok;72
+blupi000.blp;?;1;4;14;;118;33;0;;ok;73
+blupi000.blp;?;1;4;15;;118;36;0;;ok;74
+blupi000.blp;?;1;4;16;;118;36;0;;ok;75
+blupi000.blp;?;1;4;17;;118;36;0;;ok;76
+blupi000.blp;?;1;4;18;;118;37;0;;;77
+blupi000.blp;?;1;4;19;;118;37;0;;;78
+blupi000.blp;?;1;4;20;;118;36;0;;;79
+blupi000.blp;?;1;4;21;;118;36;0;;;80
+blupi000.blp;?;1;4;22;;118;36;0;;;81
+blupi000.blp;?;1;4;23;;118;36;1;;;82
diff --git a/assets/default-spritesheets/speedy_blupi_I.spritesheet.csv.computed.csv b/assets/default-spritesheets/speedy_blupi_I.spritesheet.csv.computed.csv
new file mode 100644
index 0000000..8f799c6
--- /dev/null
+++ b/assets/default-spritesheets/speedy_blupi_I.spritesheet.csv.computed.csv
@@ -0,0 +1,83 @@
+File;Group;Number in Group;Row;Column;X;Y;Width;Height;Notes;Tags;Number per file
+blupi000.blp;Yellow_Eggbert_Born;1;1;1;0;0;28;20;;ok;1
+blupi000.blp;Yellow_Eggbert_Born;2;1;2;28;0;28;20;;ok;2
+blupi000.blp;Yellow_Eggbert_Born;3;1;3;56;0;28;23;;ok;3
+blupi000.blp;Yellow_Eggbert_Born;4;1;4;84;0;28;23;;ok;4
+blupi000.blp;Yellow Bomb;1;1;5;112;0;34;24;;ok;5
+blupi000.blp;Yellow Bomb;2;1;6;146;0;38;24;;ok;6
+blupi000.blp;Yellow Bomb;3;1;7;184;0;40;24;;ok;7
+blupi000.blp;Yellow Bomb;4;1;8;224;0;42;24;;ok;8
+blupi000.blp;Yellow Bomb;5;1;9;266;0;44;24;;ok;9
+blupi000.blp;Yellow Bomb;6;1;10;310;0;45;24;;ok;10
+blupi000.blp;Yellow_Eggbert_Life;1;1;11;355;0;17;25;;ok;11
+blupi000.blp;Yellow_Eggbert_Born;5;1;12;372;0;28;27;;ok;12
+blupi000.blp;Yellow_Eggbert_Born;6;1;13;400;0;28;29;;ok;13
+blupi000.blp;Yellow_Eggbert_Born;7;1;14;428;0;28;30;;ok;14
+blupi000.blp;Yellow_Eggbert_Born;8;1;15;456;0;28;31;;ok;15
+blupi000.blp;Yellow_Eggbert_Swimming_Right;1;1;16;484;0;53;31;;ok;16
+blupi000.blp;Yellow_Eggbert_Swimming_Left;1;1;17;537;0;60;31;;ok;17
+blupi000.blp;Yellow_Eggbert_Born;9;1;18;597;0;28;32;;ok;18
+blupi000.blp;Yellow_Eggbert_Swimming_Left;2;1;19;625;0;46;32;;ok;19
+blupi000.blp;Yellow_Eggbert_Swimming_Left;3;1;20;671;0;46;32;;ok;20
+blupi000.blp;Yellow_Eggbert_Swimming_Right;2;1;21;717;0;47;32;;ok;21
+blupi000.blp;Yellow_Eggbert_Swimming_Right;3;2;1;0;32;47;32;;ok;22
+blupi000.blp;Yellow_Eggbert_Swimming_Left;4;2;2;47;32;47;32;;ok;23
+blupi000.blp;Yellow_Eggbert_Swimming_Right;4;2;3;94;32;48;32;;ok;24
+blupi000.blp;Yellow_Eggbert_Swimming_Right;5;2;4;142;32;48;32;;ok;25
+blupi000.blp;Yellow_Eggbert_Swimming_Left;5;2;5;190;32;48;32;;ok;26
+blupi000.blp;Yellow_Eggbert_Swimming_Left;6;2;6;238;32;48;32;;ok;27
+blupi000.blp;Yellow_Eggbert_Swimming_Right;6;2;7;286;32;49;32;;ok;28
+blupi000.blp;Yellow_Eggbert_Swimming_Right;7;2;8;335;32;49;32;;ok;29
+blupi000.blp;Yellow_Eggbert_Swimming_Left;7;2;9;384;32;49;32;;ok;30
+blupi000.blp;Yellow_Eggbert_Swimming_Right;8;2;10;433;32;49;32;;ok;31
+blupi000.blp;Yellow_Eggbert_Swimming_Butt;1;2;11;482;32;52;32;;ok;32
+blupi000.blp;Yellow_Eggbert_Swimming_Left;8;2;12;534;32;54;32;;ok;33
+blupi000.blp;Yellow_Eggbert_Swimming_Right;9;2;13;588;32;57;32;;ok;34
+blupi000.blp;Yellow_Eggbert_Swimming_Left;9;2;14;645;32;58;32;;ok;35
+blupi000.blp;Yellow_Eggbert_Crouching_Left;1;2;15;703;32;37;39;;ok;36
+blupi000.blp;Yellow_Eggbert_Crouching_Right;1;2;16;740;32;37;39;;ok;37
+blupi000.blp;?;1;3;1;0;71;37;43;;ok;38
+blupi000.blp;?;1;3;2;37;71;37;43;;ok;39
+blupi000.blp;?;1;3;3;74;71;35;44;;ok;40
+blupi000.blp;?;1;3;4;109;71;35;44;;ok;41
+blupi000.blp;?;1;3;5;144;71;36;44;;ok;42
+blupi000.blp;?;1;3;6;180;71;36;44;;ok;43
+blupi000.blp;?;1;3;7;216;71;33;45;;ok;44
+blupi000.blp;?;1;3;8;249;71;34;45;;ok;45
+blupi000.blp;?;1;3;9;283;71;34;45;;ok;46
+blupi000.blp;?;1;3;10;317;71;35;45;;ok;47
+blupi000.blp;?;1;3;11;352;71;36;45;;ok;48
+blupi000.blp;?;1;3;12;388;71;37;45;;ok;49
+blupi000.blp;?;1;3;13;425;71;37;45;;ok;50
+blupi000.blp;?;1;3;14;462;71;39;45;;ok;51
+blupi000.blp;?;1;3;15;501;71;32;46;;ok;52
+blupi000.blp;?;1;3;16;533;71;32;46;;ok;53
+blupi000.blp;?;1;3;17;565;71;32;46;;ok;54
+blupi000.blp;?;1;3;18;597;71;32;46;;ok;55
+blupi000.blp;?;1;3;19;629;71;34;46;;ok;56
+blupi000.blp;?;1;3;20;663;71;36;46;whoops;ok;57
+blupi000.blp;?;1;3;21;699;71;37;46;;ok;58
+blupi000.blp;?;1;3;22;736;71;36;47;;ok;59
+blupi000.blp;?;1;4;1;0;118;41;47;bouchnul se do hlavy;ok;60
+blupi000.blp;?;1;4;2;41;118;30;48;;ok;61
+blupi000.blp;?;1;4;3;71;118;31;48;;ok;62
+blupi000.blp;?;1;4;4;102;118;31;48;;ok;63
+blupi000.blp;?;1;4;5;133;118;32;48;;ok;64
+blupi000.blp;?;1;4;6;165;118;32;48;;ok;65
+blupi000.blp;?;1;4;7;197;118;32;48;;ok;66
+blupi000.blp;?;1;4;8;229;118;32;48;;ok;67
+blupi000.blp;?;1;4;9;261;118;32;48;;ok;68
+blupi000.blp;?;1;4;10;293;118;33;48;;ok;69
+blupi000.blp;?;1;4;11;326;118;33;48;;ok;70
+blupi000.blp;?;1;4;12;359;118;33;48;;ok;71
+blupi000.blp;?;1;4;13;392;118;33;48;;ok;72
+blupi000.blp;?;1;4;14;425;118;33;48;;ok;73
+blupi000.blp;?;1;4;15;458;118;36;48;;ok;74
+blupi000.blp;?;1;4;16;494;118;36;48;;ok;75
+blupi000.blp;?;1;4;17;530;118;36;48;;ok;76
+blupi000.blp;?;1;4;18;566;118;37;48;;;77
+blupi000.blp;?;1;4;19;603;118;37;48;;;78
+blupi000.blp;?;1;4;20;640;118;36;48;;;79
+blupi000.blp;?;1;4;21;676;118;36;48;;;80
+blupi000.blp;?;1;4;22;712;118;36;48;;;81
+blupi000.blp;?;1;4;23;748;118;36;49;;;82
diff --git a/assets/embedded_mods/open_eggbert_free_image24/.gitkeep b/assets/embedded_mods/open_eggbert_free_image24/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/open_eggbert_free_image24x2/.gitkeep b/assets/embedded_mods/open_eggbert_free_image24x2/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/open_eggbert_free_music/.gitkeep b/assets/embedded_mods/open_eggbert_free_music/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/open_eggbert_free_sound/.gitkeep b/assets/embedded_mods/open_eggbert_free_sound/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/speedy_blupi_demo_data/.gitkeep b/assets/embedded_mods/speedy_blupi_demo_data/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/speedy_blupi_demo_legacy_image08/.gitkeep b/assets/embedded_mods/speedy_blupi_demo_legacy_image08/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/speedy_blupi_demo_legacy_music/.gitkeep b/assets/embedded_mods/speedy_blupi_demo_legacy_music/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/embedded_mods/speedy_blupi_demo_legacy_sound/.gitkeep b/assets/embedded_mods/speedy_blupi_demo_legacy_sound/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/assets/open-eggbert-legacy-assets b/assets/open-eggbert-legacy-assets
new file mode 160000
index 0000000..1263d70
--- /dev/null
+++ b/assets/open-eggbert-legacy-assets
@@ -0,0 +1 @@
+Subproject commit 1263d7036ff848afd546b644c91dd80ca9f94b59
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..c392759
--- /dev/null
+++ b/build.sh
@@ -0,0 +1 @@
+./gradlew build $1
\ No newline at end of file
diff --git a/build_desktop.sh b/build_desktop.sh
new file mode 100755
index 0000000..bddbcfb
--- /dev/null
+++ b/build_desktop.sh
@@ -0,0 +1 @@
+./gradlew lwjgl3:dist
\ No newline at end of file
diff --git a/core/src/main/java/com/openeggbert/OpenEggbertMainClass.java b/core/src/main/java/com/openeggbert/OpenEggbertMainClass.java
index 8529d76..17ed6fd 100644
--- a/core/src/main/java/com/openeggbert/OpenEggbertMainClass.java
+++ b/core/src/main/java/com/openeggbert/OpenEggbertMainClass.java
@@ -1,16 +1,59 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// This program is free software: you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, either version 3
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert;
+import com.badlogic.gdx.Application;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
+import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
+import com.openeggbert.entity.common.GameSpace;
+import java.util.function.Function;
-/** {@link com.badlogic.gdx.ApplicationListener} implementation shared by all platforms. */
+/**
+ * {@link com.badlogic.gdx.ApplicationListener} implementation shared by all
+ * platforms.
+ */
public class OpenEggbertMainClass extends ApplicationAdapter {
+
private SpriteBatch batch;
private Texture image;
+ private GameSpace gameSpace = null;
+ private String currentDirectory;
+
+ public OpenEggbertMainClass() {
+
+ }
+
+ public OpenEggbertMainClass(GameSpace gameSpace, String currentDirectory) {
+ this.gameSpace = gameSpace;
+ this.currentDirectory = currentDirectory;
+ }
+
+ public OpenEggbertMainClass(String currentDirectory) {
+ this.gameSpace = null;
+ this.currentDirectory = currentDirectory;
+ }
@Override
public void create() {
@@ -22,7 +65,26 @@ public class OpenEggbertMainClass extends ApplicationAdapter {
public void render() {
ScreenUtils.clear(0.15f, 0.15f, 0.2f, 1f);
batch.begin();
- batch.draw(image, 140, 210);
+ Function removeCurrentDir = i -> i == null ? null : i.replace(currentDirectory + "/", "");
+ if (Gdx.app.getType() == Application.ApplicationType.Desktop && gameSpace != null) {
+ BitmapFont font;
+ font = new BitmapFont();
+ int x = 140;
+ font.draw(batch, "getFeatureLevel=" + gameSpace.getFeatureLevel(), 40, x);x+=25;
+ font.draw(batch, "getDataDirectory=" + removeCurrentDir.apply(gameSpace.getDataDirectory()), 40, x);x+=25;
+ font.draw(batch, "getImage08Directory=" + removeCurrentDir.apply(gameSpace.getImage08Directory()), 40, x);x+=25;
+ font.draw(batch, "getImage16Directory=" + removeCurrentDir.apply(gameSpace.getImage16Directory()), 40, x);x+=25;
+ font.draw(batch, "getImage24Directory=" + removeCurrentDir.apply(gameSpace.getImage24Directory()), 40, x);x+=25;
+ font.draw(batch, "getImage24x2Directory=" + removeCurrentDir.apply(gameSpace.getImage24x2Directory()), 40, x);x+=25;
+ font.draw(batch, "getSoundDirectory=" + removeCurrentDir.apply(gameSpace.getSoundDirectory()), 40, x);x+=25;
+ }
+
+ if (currentDirectory != null) {
+ BitmapFont font;
+ font = new BitmapFont();
+ font.draw(batch, currentDirectory, 40, 340);
+ }
+ //batch.draw(image, 140, 210);
batch.end();
}
diff --git a/core/src/main/java/com/openeggbert/compatibility/CompatibilityMode.java b/core/src/main/java/com/openeggbert/compatibility/FeatureLevel.java
similarity index 90%
rename from core/src/main/java/com/openeggbert/compatibility/CompatibilityMode.java
rename to core/src/main/java/com/openeggbert/compatibility/FeatureLevel.java
index 357e10c..3cf1b83 100644
--- a/core/src/main/java/com/openeggbert/compatibility/CompatibilityMode.java
+++ b/core/src/main/java/com/openeggbert/compatibility/FeatureLevel.java
@@ -17,8 +17,6 @@
// or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
-
-
package com.openeggbert.compatibility;
import lombok.Getter;
@@ -27,24 +25,22 @@ import lombok.Getter;
*
* @author robertvokac
*/
-public enum CompatibilityMode {
+public enum FeatureLevel {
SPEEDY_BLUPI_DEMO(ReleaseType.BLUPI, ReleaseVersion.DEMO),
SPEEDY_BLUPI_I(ReleaseType.BLUPI, ReleaseVersion.ONE),
SPEEDY_BLUPI_II(ReleaseType.BLUPI, ReleaseVersion.TWO),
SPEEDY_EGGBERT_DEMO(ReleaseType.EGGBERT, ReleaseVersion.DEMO),
SPEEDY_EGGBERT_1(ReleaseType.EGGBERT, ReleaseVersion.ONE),
SPEEDY_EGGBERT_2(ReleaseType.EGGBERT, ReleaseVersion.TWO),
- OPEN_EGGBERT(ReleaseType.OPEN, ReleaseVersion.THREE);
+ OPEN_EGGBERT_3(ReleaseType.OPEN, ReleaseVersion.THREE);
@Getter
private final ReleaseType releaseType;
@Getter
private final ReleaseVersion releaseVersion;
- private CompatibilityMode(ReleaseType releaseType, ReleaseVersion releaseVersion) {
+ private FeatureLevel(ReleaseType releaseType, ReleaseVersion releaseVersion) {
this.releaseType = releaseType;
this.releaseVersion = releaseVersion;
}
-
-
-
+
}
diff --git a/core/src/main/java/com/openeggbert/compatibility/ResolutionMode.java b/core/src/main/java/com/openeggbert/compatibility/ResolutionMode.java
index 73a8f95..55e540f 100644
--- a/core/src/main/java/com/openeggbert/compatibility/ResolutionMode.java
+++ b/core/src/main/java/com/openeggbert/compatibility/ResolutionMode.java
@@ -28,5 +28,6 @@ package com.openeggbert.compatibility;
public enum ResolutionMode {
RESOLUTION_640_480,
RESOLUTION_1280_960,
- RESOLUTION_SCALED;
+ RESOLUTION_SCALED,
+ RESOLUTION_KEEP;
}
diff --git a/core/src/main/java/com/openeggbert/entity/common/Cheat.java b/core/src/main/java/com/openeggbert/entity/common/Cheat.java
index c87f28d..be77cf8 100644
--- a/core/src/main/java/com/openeggbert/entity/common/Cheat.java
+++ b/core/src/main/java/com/openeggbert/entity/common/Cheat.java
@@ -21,7 +21,7 @@
package com.openeggbert.entity.common;
-import com.openeggbert.compatibility.CompatibilityMode;
+import com.openeggbert.compatibility.FeatureLevel;
import lombok.Getter;
/**
@@ -31,16 +31,16 @@ import lombok.Getter;
public enum Cheat {
MEGABLUPI(Utils.ALL__COMPATIBILITY_MODES);
- //todo
+ //todo//todo
@Getter
- private final CompatibilityMode[] compatibilityModes;
+ private final FeatureLevel[] compatibilityModes;
@Getter
private String note;
- Cheat (CompatibilityMode[] compatibilityModes) {
+ Cheat (FeatureLevel[] compatibilityModes) {
this(compatibilityModes, "");
}
- Cheat (CompatibilityMode[] compatibilityModes, String note) {
+ Cheat (FeatureLevel[] compatibilityModes, String note) {
this.compatibilityModes = compatibilityModes;
this.note = note;
}
diff --git a/core/src/main/java/com/openeggbert/entity/common/GameExecution.java b/core/src/main/java/com/openeggbert/entity/common/GameExecution.java
index 69fc21a..9f199c0 100644
--- a/core/src/main/java/com/openeggbert/entity/common/GameExecution.java
+++ b/core/src/main/java/com/openeggbert/entity/common/GameExecution.java
@@ -21,7 +21,7 @@
package com.openeggbert.entity.common;
-import com.openeggbert.compatibility.CompatibilityMode;
+import com.openeggbert.compatibility.FeatureLevel;
import com.openeggbert.compatibility.GraphicsMode;
import com.openeggbert.compatibility.ResolutionMode;
import lombok.Data;
@@ -32,7 +32,7 @@ import lombok.Data;
*/
@Data
public class GameExecution {
- private CompatibilityMode compatibilityMode;
+ private FeatureLevel compatibilityMode;
private ResolutionMode resolutionMode = ResolutionMode.RESOLUTION_640_480;
private GraphicsMode graphicsMode = GraphicsMode.ORIGINAL;
private Boolean cheatsEnabled = true;
diff --git a/core/src/main/java/com/openeggbert/entity/common/GameFile.java b/core/src/main/java/com/openeggbert/entity/common/GameFile.java
index 4711d4c..99c4597 100644
--- a/core/src/main/java/com/openeggbert/entity/common/GameFile.java
+++ b/core/src/main/java/com/openeggbert/entity/common/GameFile.java
@@ -20,7 +20,7 @@
package com.openeggbert.entity.common;
-import com.openeggbert.compatibility.CompatibilityMode;
+import com.openeggbert.compatibility.FeatureLevel;
/**
*
@@ -28,7 +28,7 @@ import com.openeggbert.compatibility.CompatibilityMode;
*/
public class GameFile {
- private CompatibilityMode compatibilityMode;
+ private FeatureLevel compatibilityMode;
private GameFileType gameFileType;
private String path;
private String name;
diff --git a/core/src/main/java/com/openeggbert/entity/common/GameSpace.java b/core/src/main/java/com/openeggbert/entity/common/GameSpace.java
new file mode 100644
index 0000000..147f8a8
--- /dev/null
+++ b/core/src/main/java/com/openeggbert/entity/common/GameSpace.java
@@ -0,0 +1,76 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// This program is free software: you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, either version 3
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+package com.openeggbert.entity.common;
+
+import com.openeggbert.compatibility.FeatureLevel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ *
+ * @author robertvokac
+ */
+@Data
+@AllArgsConstructor
+public class GameSpace {
+
+ private FeatureLevel featureLevel;
+ private String dataDirectory;
+ private String image08Directory;
+ private String image16Directory;
+ private String image24Directory;
+ private String image24x2Directory;
+ private String soundDirectory;
+ private String currenteDirectory;
+
+ public GameSpace() {
+
+ }
+
+
+ public boolean isValid() {
+ if (featureLevel == null) {
+ return false;
+ }
+ if (dataDirectory == null) {
+ return false;
+ }
+ if (image08Directory == null && image16Directory == null && image24Directory == null && image24x2Directory == null) {
+ return false;
+ }
+ if (soundDirectory == null) {
+ return false;
+ }
+ return true;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("featureLevel=" + featureLevel).append(" ");
+ sb.append("data=" + dataDirectory).append(" ");
+ sb.append("image08=" + image08Directory).append(" ");
+ sb.append("image16=" + image16Directory).append(" ");
+ sb.append("image24=" + image24Directory).append(" ");
+ sb.append("image24x2=" + image24x2Directory).append(" ");
+ sb.append("image24x2=" + image24x2Directory).append(" ");
+ sb.append("sound=" + soundDirectory);
+ return sb.toString();
+ }
+}
diff --git a/core/src/main/java/com/openeggbert/entity/common/OpenEggbertException.java b/core/src/main/java/com/openeggbert/entity/common/OpenEggbertException.java
new file mode 100644
index 0000000..9a2db7f
--- /dev/null
+++ b/core/src/main/java/com/openeggbert/entity/common/OpenEggbertException.java
@@ -0,0 +1,33 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// This program is free software: you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, either version 3
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+package com.openeggbert.entity.common;
+
+/**
+ *
+ * @author robertvokac
+ */
+public class OpenEggbertException extends RuntimeException{
+
+ public OpenEggbertException(String string) {
+ super(string);
+ }
+
+}
diff --git a/core/src/main/java/com/openeggbert/entity/common/ScreenType.java b/core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreen.java
similarity index 96%
rename from core/src/main/java/com/openeggbert/entity/common/ScreenType.java
rename to core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreen.java
index 06b16bb..5fd2a95 100644
--- a/core/src/main/java/com/openeggbert/entity/common/ScreenType.java
+++ b/core/src/main/java/com/openeggbert/entity/common/OpenEggbertScreen.java
@@ -25,6 +25,7 @@ package com.openeggbert.entity.common;
*
* @author robertvokac
*/
-public class ScreenType {
+public enum OpenEggbertScreen {
+ MAIN
}
diff --git a/core/src/main/java/com/openeggbert/entity/common/Utils.java b/core/src/main/java/com/openeggbert/entity/common/Utils.java
index fb522fe..53a6b53 100644
--- a/core/src/main/java/com/openeggbert/entity/common/Utils.java
+++ b/core/src/main/java/com/openeggbert/entity/common/Utils.java
@@ -21,7 +21,7 @@
package com.openeggbert.entity.common;
-import com.openeggbert.compatibility.CompatibilityMode;
+import com.openeggbert.compatibility.FeatureLevel;
/**
*
@@ -31,5 +31,5 @@ public class Utils {
private Utils() {
//Instantiate not needed.
}
- public static final CompatibilityMode[] ALL__COMPATIBILITY_MODES = CompatibilityMode.values();
+ public static final FeatureLevel[] ALL__COMPATIBILITY_MODES = FeatureLevel.values();
}
diff --git a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/DesktopUtils.java b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/DesktopUtils.java
new file mode 100644
index 0000000..494e206
--- /dev/null
+++ b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/DesktopUtils.java
@@ -0,0 +1,198 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// This program is free software: you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, either version 3
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+package com.openeggbert.lwjgl3;
+
+import com.openeggbert.compatibility.FeatureLevel;
+import com.openeggbert.entity.common.GameSpace;
+import com.openeggbert.entity.common.OpenEggbertException;
+import java.io.File;
+import java.net.URISyntaxException;
+import java.util.Optional;
+
+/**
+ *
+ * @author robertvokac
+ */
+public class DesktopUtils {
+
+ private DesktopUtils() {
+ //Not meant to be instantiated.
+ }
+
+ public static Optional tryToLoadGameSpace() {
+ String gameSpaceDirectoryFromEnvironmentVariable = System.getenv().getOrDefault("GAME_SPACE_DIRECTORY", "");
+ if (!gameSpaceDirectoryFromEnvironmentVariable.isBlank()) {
+ return tryToLoadGameSpaceFromEnvironmentVariable(gameSpaceDirectoryFromEnvironmentVariable);
+ }
+ Optional gameOptional = tryToLoadGameSpaceFromCurrentDirectory();
+ return gameOptional;
+ }
+
+ private static Optional tryToLoadGameSpaceFromEnvironmentVariable(String gameSpaceDirectoryFromEnvironmentVariable) {
+
+ File gameSpaceDirectory = new File(gameSpaceDirectoryFromEnvironmentVariable);
+
+ Optional gameSpace = tryToLoadGameSpaceFromDirectory(gameSpaceDirectory);
+ return gameSpace;
+
+ }
+
+ private static Optional tryToLoadGameSpaceFromDirectory(File gameSpaceDirectory) throws OpenEggbertException {
+ if (!gameSpaceDirectory.exists()) {
+ throw new OpenEggbertException("Directory does not exist: " + gameSpaceDirectory.getAbsolutePath());
+ }
+ FeatureLevel featureLevel = null;
+ try {
+ featureLevel = findFeatureLevelFromDirectory(gameSpaceDirectory);
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+ if (featureLevel == null) {
+ return Optional.empty();
+ }
+ GameSpace gameSpace = new GameSpace();
+ gameSpace.setCurrenteDirectory(new File(".").getAbsolutePath());
+ gameSpace.setFeatureLevel(featureLevel);
+ if (featureLevel == FeatureLevel.SPEEDY_BLUPI_DEMO) {
+ gameSpace.setDataDirectory(gameSpaceDirectory.getAbsolutePath() + "/" + "Data");
+ gameSpace.setImage08Directory(gameSpaceDirectory.getAbsolutePath() + "/" + "Image");
+ gameSpace.setSoundDirectory(gameSpaceDirectory.getAbsolutePath() + "/" + "Sound");
+
+ throwExceptionIfDirectoryDoesNotExist(gameSpace.getDataDirectory());
+ throwExceptionIfDirectoryDoesNotExist(gameSpace.getImage08Directory());
+ throwExceptionIfDirectoryDoesNotExist(gameSpace.getSoundDirectory());
+ return Optional.of(gameSpace);
+ }
+ gameSpace.setDataDirectory(gameSpaceDirectory.getAbsolutePath() + "/" + "DATA");
+ throwExceptionIfDirectoryDoesNotExist(gameSpace.getDataDirectory());
+ File image08Directory = new File(gameSpaceDirectory, "IMAGE08");
+ File image16Directory = new File(gameSpaceDirectory, "IMAGE16");
+ File soundDirectory = new File(gameSpaceDirectory, "SOUND");
+ gameSpace.setImage08Directory(image08Directory.getAbsolutePath());
+ gameSpace.setSoundDirectory(soundDirectory.getAbsolutePath());
+
+ if (featureLevel != FeatureLevel.SPEEDY_EGGBERT_DEMO) {
+ gameSpace.setImage16Directory(image16Directory.getAbsolutePath());
+ }
+
+ if (featureLevel != FeatureLevel.OPEN_EGGBERT_3) {
+ throwExceptionIfDirectoryDoesNotExist(image08Directory);
+ if (featureLevel != FeatureLevel.SPEEDY_EGGBERT_DEMO) {
+ throwExceptionIfDirectoryDoesNotExist(image16Directory);
+ }
+ throwExceptionIfDirectoryDoesNotExist(soundDirectory);
+ return Optional.of(gameSpace);
+ }
+ if (featureLevel == FeatureLevel.OPEN_EGGBERT_3) {
+
+ if (!image08Directory.exists()) {
+ image08Directory = null;
+ }
+ if (!image16Directory.exists()) {
+ image16Directory = null;
+ }
+ File image24Directory = new File(gameSpaceDirectory, "IMAGE24");
+ if (image24Directory.exists()) {
+ gameSpace.setImage24Directory(image24Directory.getAbsolutePath());
+ }
+
+ File image24x2Directory = new File(gameSpaceDirectory, "IMAGE24X2");
+ if (image24x2Directory.exists()) {
+ gameSpace.setImage24x2Directory(image24x2Directory.getAbsolutePath());
+ }
+ if (gameSpace.getImage08Directory() == null
+ && gameSpace.getImage16Directory() == null
+ && gameSpace.getImage24Directory() == null
+ && gameSpace.getImage24x2Directory() == null) {
+ throw new OpenEggbertException("Fatal error. At least one IMAGE* directory must exist in directory: " + gameSpaceDirectory.getAbsolutePath());
+ }
+ return Optional.of(gameSpace);
+ }
+ return Optional.empty();
+ }
+
+ private static Optional tryToLoadGameSpaceFromCurrentDirectory() {
+ try {
+ return tryToLoadGameSpaceFromDirectory(new File(DesktopUtils.getPathToDirectoryWhereJarIsRunning()));
+
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ return Optional.empty();
+ }
+ }
+
+ private static void throwExceptionIfDirectoryDoesNotExist(File directory) {
+
+ if (!directory.exists()) {
+ throw new OpenEggbertException("Directory does not exist: " + directory.getAbsolutePath());
+ }
+ }
+
+ private static void throwExceptionIfDirectoryDoesNotExist(String directoryString) {
+ throwExceptionIfDirectoryDoesNotExist(new File(directoryString));
+ }
+
+ public static FeatureLevel findFeatureLevelFromDirectory(File dir) {
+ final File image24Directory = new File(dir, "IMAGE24");
+ final File image24x2Directory = new File(dir, "IMAGE24x2");
+ if (image24Directory.exists() && image24x2Directory.exists()) {
+ return FeatureLevel.OPEN_EGGBERT_3;
+ }
+ if (new File(dir, "Data").exists() && new File(dir, "Image").exists() && new File(dir, "Sound").exists()) {
+ return FeatureLevel.SPEEDY_BLUPI_DEMO;
+ }
+ if (!new File(dir, "DATA").exists()) {
+ throw new OpenEggbertException("Directory does not exist: " + new File(dir, "DATA").getAbsolutePath());
+ }
+ final File image08Directory = new File(dir, "IMAGE08");
+ if (image08Directory.exists()) {
+ if (new File(image08Directory, "INSERT.BLP").exists()) {
+ //blupi
+ if (new File(image08Directory, "DECOR024.BLP").exists()) {
+ return FeatureLevel.SPEEDY_BLUPI_II;
+ } else {
+ return FeatureLevel.SPEEDY_BLUPI_I;
+ }
+ } else {
+ //eggbert
+ final File image16Directory = new File(dir, "IMAGE16");
+ if (!image16Directory.exists()) {
+ return FeatureLevel.SPEEDY_EGGBERT_DEMO;
+ }
+ if (new File(image08Directory, "DECOR024.BLP").exists() || new File(image08Directory, "decor024.blp").exists()) {
+ return FeatureLevel.SPEEDY_EGGBERT_2;
+ } else {
+ return FeatureLevel.SPEEDY_EGGBERT_1;
+ }
+ }
+ }
+ throw new OpenEggbertException("Directory is not compatible with any supported version: " + dir.getAbsolutePath());
+ }
+
+ public static String getPathToDirectoryWhereJarIsRunning() {
+ try {
+ return new File(DesktopUtils.class.getProtectionDomain().getCodeSource().getLocation()
+ .toURI()).getParentFile().getAbsolutePath();
+ } catch (URISyntaxException ex) {
+ throw new OpenEggbertException(ex.getMessage());
+ }
+
+ }
+}
diff --git a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java
index 2c8d779..d56c8fa 100644
--- a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java
+++ b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/Lwjgl3Launcher.java
@@ -1,8 +1,30 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// This program is free software: you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, either version 3
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+
package com.openeggbert.lwjgl3;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import com.openeggbert.OpenEggbertMainClass;
+import com.openeggbert.entity.common.GameSpace;
+import java.util.Optional;
/** Launches the desktop (LWJGL3) application. */
public class Lwjgl3Launcher {
@@ -12,19 +34,22 @@ public class Lwjgl3Launcher {
}
private static Lwjgl3Application createApplication() {
- return new Lwjgl3Application(new OpenEggbertMainClass(), getDefaultConfiguration());
+ Optional gameSpace = DesktopUtils.tryToLoadGameSpace();
+ String currentDirectory = DesktopUtils.getPathToDirectoryWhereJarIsRunning();
+ final OpenEggbertMainClass openEggbertMainClass = gameSpace.isPresent() ? new OpenEggbertMainClass(gameSpace.get(), currentDirectory) : new OpenEggbertMainClass(currentDirectory);
+ return new Lwjgl3Application(openEggbertMainClass, getDefaultConfiguration());
}
private static Lwjgl3ApplicationConfiguration getDefaultConfiguration() {
Lwjgl3ApplicationConfiguration configuration = new Lwjgl3ApplicationConfiguration();
- configuration.setTitle("open-eggbert");
+ configuration.setTitle("Blupi");
configuration.useVsync(true);
//// Limits FPS to the refresh rate of the currently active monitor.
configuration.setForegroundFPS(Lwjgl3ApplicationConfiguration.getDisplayMode().refreshRate);
//// If you remove the above line and set Vsync to false, you can get unlimited FPS, which can be
//// useful for testing performance, but can also be very stressful to some hardware.
//// You may also need to configure GPU drivers to fully disable Vsync; this can cause screen tearing.
- configuration.setWindowedMode(640, 480);
+ configuration.setWindowedMode(840, 480);
configuration.setWindowIcon("libgdx128.png", "libgdx64.png", "libgdx32.png", "libgdx16.png");
return configuration;
}