diff --git a/build.gradle b/build.gradle index e674ae2..2351eef 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,8 @@ -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:9.1.0' - } -} - allprojects { ext { - appName = 'Shattered Pixel Dungeon' - appPackageName = 'com.shatteredpixel.shatteredpixeldungeon' + appName = 'Pixel Dungeon: Shattered Web' + appPackageName = 'net.fredygames.pixeldungeonweb' appVersionCode = 896 appVersionName = '3.3.8' diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/WornKey.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/WornKey.java index 2730840..dffce40 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/WornKey.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/keys/WornKey.java @@ -49,7 +49,8 @@ public class WornKey extends Key { @Override public boolean doPickUp(Hero hero, int pos) { - if(!SPDSettings.supportNagged()){ + //web version: no supporter prompt (it linked to the original author's Patreon) + if(false){ try { Dungeon.saveAll(); Game.runOnRenderThread(new Callback() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java index 103129e..afe1fa2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/AboutScene.java @@ -234,7 +234,24 @@ public class AboutScene extends PixelScene { freesound.setRect(transifex.left()-10, transifex.bottom() + 8, colWidth+20, 0); content.add(freesound); - content.setSize( fullWidth, freesound.bottom()+10 + insets.bottom ); + //*** Browser version notice (FredyGames) *** + + addLine(freesound.bottom() + 4, content); + + CreditsBlock webPort = new CreditsBlock(true, + Window.TITLE_COLOR, + null, + null, + "This is _Pixel Dungeon: Shattered Web_, a modified version of Shattered Pixel Dungeon 3.3.8 that runs in the browser. " + + "It is built from the TeaVM web port by _glassesmonkey_, with the news and update checks removed and a new title banner. " + + "It is not an official release: please do not contact Evan Debenham about problems with it.\n\n" + + "Free software under the GNU GPL version 3.", + null, + null); + webPort.setRect(transifex.left()-10, freesound.bottom() + 12, colWidth+20, 0); + content.add(webPort); + + content.setSize( fullWidth, webPort.bottom()+10 + insets.bottom ); list.setRect( 0, 0, w, h ); list.scrollTo(0, 0); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index 7c4cb12..4a00875 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -172,7 +172,7 @@ public class TitleScene extends PixelScene { add(btnPlay); btnSupport = new SupportButton(GREY_TR, Messages.get(this, "support")); - add(btnSupport); + //web version: no supporter button (it linked to the original author's Patreon) btnRankings = new StyledButton(GREY_TR,Messages.get(this, "rankings")){ @Override @@ -195,7 +195,8 @@ public class TitleScene extends PixelScene { btnNews = new NewsButton(GREY_TR, Messages.get(this, "news")); btnNews.icon(Icons.get(Icons.NEWS)); - add(btnNews); + //web version: there is no news service (no network access), so the button is not shown + if (News.supportsNews()) add(btnNews); btnChanges = new ChangesButton(GREY_TR, Messages.get(this, "changes")); btnChanges.icon(Icons.get(Icons.CHANGES)); @@ -221,25 +222,36 @@ public class TitleScene extends PixelScene { float buttonAreaWidth = landscape() ? PixelScene.MIN_WIDTH_L-6 : PixelScene.MIN_WIDTH_P-2; float btnAreaLeft = insets.left + (w - buttonAreaWidth) / 2f; if (landscape()) { - btnPlay.setRect(btnAreaLeft, insets.top + topRegion+GAP, (buttonAreaWidth/2)-1, BTN_HEIGHT); + btnPlay.setRect(btnAreaLeft, insets.top + topRegion+GAP, buttonAreaWidth-2, BTN_HEIGHT); align(btnPlay); - btnSupport.setRect(btnPlay.right()+2, btnPlay.top(), btnPlay.width(), BTN_HEIGHT); - btnRankings.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, (float) (Math.floor(buttonAreaWidth/3f)-1), BTN_HEIGHT); - btnJournal.setRect(btnRankings.right()+2, btnRankings.top(), btnRankings.width(), BTN_HEIGHT); - btnNews.setRect(btnJournal.right()+2, btnJournal.top(), btnRankings.width(), BTN_HEIGHT); - btnSettings.setRect(btnRankings.left(), btnRankings.bottom() + GAP, btnRankings.width(), BTN_HEIGHT); - btnChanges.setRect(btnSettings.right()+2, btnSettings.top(), btnRankings.width(), BTN_HEIGHT); - btnAbout.setRect(btnChanges.right()+2, btnSettings.top(), btnRankings.width(), BTN_HEIGHT); + float thirdWidth = (float) (Math.floor(buttonAreaWidth/3f)-1); + if (News.supportsNews()) { + btnRankings.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, thirdWidth, BTN_HEIGHT); + btnJournal.setRect(btnRankings.right()+2, btnRankings.top(), btnRankings.width(), BTN_HEIGHT); + btnNews.setRect(btnJournal.right()+2, btnJournal.top(), btnRankings.width(), BTN_HEIGHT); + } else { + //without the news button, rankings and journal share the row + btnRankings.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, (buttonAreaWidth/2)-1, BTN_HEIGHT); + btnJournal.setRect(btnRankings.right()+2, btnRankings.top(), btnRankings.width(), BTN_HEIGHT); + } + btnSettings.setRect(btnRankings.left(), btnRankings.bottom() + GAP, thirdWidth, BTN_HEIGHT); + btnChanges.setRect(btnSettings.right()+2, btnSettings.top(), thirdWidth, BTN_HEIGHT); + btnAbout.setRect(btnChanges.right()+2, btnSettings.top(), thirdWidth, BTN_HEIGHT); } else { btnPlay.setRect(btnAreaLeft, insets.top + topRegion+GAP, buttonAreaWidth, BTN_HEIGHT); align(btnPlay); - btnSupport.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, btnPlay.width(), BTN_HEIGHT); - btnRankings.setRect(btnPlay.left(), btnSupport.bottom()+ GAP, (btnPlay.width()/2)-1, BTN_HEIGHT); + btnRankings.setRect(btnPlay.left(), btnPlay.bottom()+ GAP, (btnPlay.width()/2)-1, BTN_HEIGHT); btnJournal.setRect(btnRankings.right()+2, btnRankings.top(), btnRankings.width(), BTN_HEIGHT); - btnNews.setRect(btnRankings.left(), btnRankings.bottom()+ GAP, btnRankings.width(), BTN_HEIGHT); - btnChanges.setRect(btnNews.right()+2, btnNews.top(), btnNews.width(), BTN_HEIGHT); - btnSettings.setRect(btnNews.left(), btnNews.bottom()+GAP, btnRankings.width(), BTN_HEIGHT); - btnAbout.setRect(btnSettings.right()+2, btnSettings.top(), btnSettings.width(), BTN_HEIGHT); + if (News.supportsNews()) { + btnNews.setRect(btnRankings.left(), btnRankings.bottom()+ GAP, btnRankings.width(), BTN_HEIGHT); + btnChanges.setRect(btnNews.right()+2, btnNews.top(), btnNews.width(), BTN_HEIGHT); + btnSettings.setRect(btnNews.left(), btnNews.bottom()+GAP, btnRankings.width(), BTN_HEIGHT); + btnAbout.setRect(btnSettings.right()+2, btnSettings.top(), btnSettings.width(), BTN_HEIGHT); + } else { + btnChanges.setRect(btnRankings.left(), btnRankings.bottom()+ GAP, btnRankings.width(), BTN_HEIGHT); + btnSettings.setRect(btnChanges.right()+2, btnChanges.top(), btnChanges.width(), BTN_HEIGHT); + btnAbout.setRect(btnChanges.left(), btnChanges.bottom()+GAP, btnPlay.width(), BTN_HEIGHT); + } } version = new BitmapText( "v" + Game.version, pixelFont); diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dbc3ce4..0914f2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -5,3 +5,4 @@ networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=60ea723356d81263e8002fec0fcf9e2b0eee0c0850c7a3d7ab0a63f2ccc601f3 diff --git a/settings.gradle b/settings.gradle index 7903fdb..69c1082 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,16 +13,11 @@ include ':SPD-classes' include ':core' //platform modules -include ':android' -include ':ios' -include ':desktop' include ':web' //service modules include ':services' //updates include ':services:updates:debugUpdates' - include ':services:updates:githubUpdates' - //news + //news include ':services:news:debugNews' - include ':services:news:shatteredNews' diff --git a/web/build.gradle b/web/build.gradle index 9da2927..2dd0f29 100644 --- a/web/build.gradle +++ b/web/build.gradle @@ -19,7 +19,7 @@ dependencies { // SPD-classes keeps org.json as an implementation dependency; the web // target needs it explicitly because TeaVM compiles the whole reachable app. - implementation "org.json:json:20170516" + implementation "org.json:json:20250517" } tasks.register('webBuild', JavaExec) { diff --git a/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/BuildWeb.java b/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/BuildWeb.java index 03e0646..023027f 100644 --- a/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/BuildWeb.java +++ b/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/BuildWeb.java @@ -46,7 +46,7 @@ public class BuildWeb { boolean runAfterBuild = args.length > 0 && "run".equals(args[0]); WebBackend backend = new WebBackend() - .setHtmlTitle("Shattered Pixel Dungeon") + .setHtmlTitle("Pixel Dungeon: Shattered Web") .setHtmlWidth(720) .setHtmlHeight(1280) .setJettyPort(8080) @@ -71,7 +71,10 @@ public class BuildWeb { private static DefaultReflectionListener buildReflectionList() { DefaultReflectionListener listener = new DefaultReflectionListener(); - for (String className : collectGameClassNames()) { + //sorted, so that two builds register the classes in the same order and produce the same output + List classNames = collectGameClassNames(); + java.util.Collections.sort(classNames); + for (String className : classNames) { if (hasReflectableNoArgConstructor(className)) { listener.addClassOrPackage(className); } diff --git a/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/WebLauncher.java b/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/WebLauncher.java index ff54d87..59a7f4f 100644 --- a/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/WebLauncher.java +++ b/web/src/main/java/com/shatteredpixel/shatteredpixeldungeon/web/WebLauncher.java @@ -25,13 +25,13 @@ public class WebLauncher { Game.version = "3.3.8-WEB"; Game.versionCode = 896; - FileUtils.setDefaultFileProperties(Files.FileType.Local, "shattered-pixel-dungeon/"); + FileUtils.setDefaultFileProperties(Files.FileType.Local, "pixel-dungeon-shattered-web/"); FileUtils.setBundleCompression(false); WebApplicationConfiguration config = new WebApplicationConfiguration("canvas"); config.width = 0; config.height = 0; - config.storagePrefix = "shattered-pixel-dungeon"; + config.storagePrefix = "pixel-dungeon-shattered-web"; config.showDownloadLogs = true; config.preloadListener = assetLoader -> assetLoader.loadScript("freetype.js");