From edf4297854bb50fd15bf5eb9e1c7a190af55b066 Mon Sep 17 00:00:00 2001 From: Hendrik Brummermann Date: Fri, 15 Mar 2024 19:51:55 +0100 Subject: [PATCH 01/25] updated version --- app/android/client/build.gradle | 4 ++-- app/android/client/src/main/res/values/strings.xml | 2 +- build.ant.properties | 4 ++-- buildtools/mkdocs/mkdocs.yml | 2 +- sbin/runserver.bat | 2 +- sbin/runserver.sh | 2 +- src/games/stendhal/common/Debug.java | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) mode change 100755 => 100644 sbin/runserver.sh diff --git a/app/android/client/build.gradle b/app/android/client/build.gradle index 0df8dadc03..4eb2c4cede 100644 --- a/app/android/client/build.gradle +++ b/app/android/client/build.gradle @@ -10,8 +10,8 @@ android { applicationId namespace minSdk 21 targetSdk 32 - versionCode 1045005 - versionName "1.45.5" + versionCode 1046000 + versionName "1.46" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" targetSdkVersion 32 minSdkVersion 21 diff --git a/app/android/client/src/main/res/values/strings.xml b/app/android/client/src/main/res/values/strings.xml index 509a7d2152..aa87c7cc8f 100644 --- a/app/android/client/src/main/res/values/strings.xml +++ b/app/android/client/src/main/res/values/strings.xml @@ -5,6 +5,6 @@ Stendhal stendhalprod8gps5y99pu prod - 1.45.5 + 1.46 diff --git a/build.ant.properties b/build.ant.properties index ae798f782a..3b04c5bc0d 100644 --- a/build.ant.properties +++ b/build.ant.properties @@ -92,9 +92,9 @@ version_server = http://arianne.sourceforge.net/stendhal.version # current version of stendhal version.old = 1.45 -version = 1.45.5 +version = 1.46 # FIXME: dynamic method to set this property? -version.android = 1045005 +version.android = 1046000 # javac options javac.deprecation = true diff --git a/buildtools/mkdocs/mkdocs.yml b/buildtools/mkdocs/mkdocs.yml index efb1679ca2..c6a39f59dc 100644 --- a/buildtools/mkdocs/mkdocs.yml +++ b/buildtools/mkdocs/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Stendhal 1.45.5 Reference Documentation +site_name: Stendhal 1.46 Reference Documentation site_description: A fun, friendly, & free multiplayer online adventure game. copyright: Copyright © 2003-2024 Stendhal site_url: https://stendhalgame.org/ diff --git a/sbin/runserver.bat b/sbin/runserver.bat index 76f3be0d71..1e6936d3d2 100644 --- a/sbin/runserver.bat +++ b/sbin/runserver.bat @@ -1,6 +1,6 @@ @echo off -set STENDHAL_VERSION=1.45.5 +set STENDHAL_VERSION=1.46 set SERVER_JAR=stendhal-server-%STENDHAL_VERSION%.jar :: change to server directory diff --git a/sbin/runserver.sh b/sbin/runserver.sh old mode 100755 new mode 100644 index c0789a2dfc..d89e90c02c --- a/sbin/runserver.sh +++ b/sbin/runserver.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -STENDHAL_VERSION="1.45.5" +STENDHAL_VERSION="1.46" SERVER_JAR="stendhal-server-${STENDHAL_VERSION}.jar" # change to server directory diff --git a/src/games/stendhal/common/Debug.java b/src/games/stendhal/common/Debug.java index 4197a51287..709559945f 100644 --- a/src/games/stendhal/common/Debug.java +++ b/src/games/stendhal/common/Debug.java @@ -26,7 +26,7 @@ public class Debug { /** version. */ // Note: This line is updated by build.xml using a regexp so be sure to adjust it in case you modify this line. - public static final String VERSION = "1.45.5"; + public static final String VERSION = "1.46"; /** pre release suffix */ // Note: This line is updated by build.xml using a regexp so be sure to adjust it in case you modify this line. From 0b619f9d8cbcac707fa8117f4168e54f07562a38 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sat, 16 Mar 2024 18:35:53 -0700 Subject: [PATCH 02/25] Fix corpse & chest cursor when quick pickup enabled Closes: https://github.com/arianne/stendhal/issues/601 --- srcjs/stendhal/ui/component/ItemContainerImplementation.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts index dc8422dd25..77f3f37314 100644 --- a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts +++ b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts @@ -433,6 +433,11 @@ export class ItemContainerImplementation { */ private updateCursor(target: HTMLElement, item?: Item) { if (item) { + if (this.slot === "content" && stendhal.config.getBoolean("inventory.quick-pickup")) { + target.style.cursor = "url(" + stendhal.paths.sprites + + "/cursor/itempickupfromslot.png) 1 3, auto"; + return; + } target.style.cursor = item.getCursor(0, 0); return; } From 4fb31e2a7dd305c9b9f2346e4062ee13a3fa07b3 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sun, 17 Mar 2024 00:17:55 -0700 Subject: [PATCH 03/25] Revert "Fix multi-touch support in item inventories" This reverts commit 1551389c75243384b2eb94c0c12bfff28fd2c61d. --- .../component/ItemContainerImplementation.ts | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts index 77f3f37314..b56c07bc39 100644 --- a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts +++ b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts @@ -298,9 +298,6 @@ export class ItemContainerImplementation { } } - // clean up item held via touch - stendhal.ui.touch.setHolding(false); - event.stopPropagation(); event.preventDefault(); } @@ -338,10 +335,10 @@ export class ItemContainerImplementation { } // workaround to prevent accidentally using items when disengaging joystick - // no longer needed after fixing multi-touch support (tested on Windows touch-enabled device) - //~ if (stendhal.ui.gamewindow.joystick && stendhal.ui.gamewindow.joystick.isEngaged()) { - //~ return; - //~ } + // FIXME: a global solution would be better + if (stendhal.ui.gamewindow.joystick && stendhal.ui.gamewindow.joystick.isEngaged()) { + return; + } let event = stendhal.ui.html.extractPosition(evt); if ((event.target as any).dataItem) { @@ -360,7 +357,7 @@ export class ItemContainerImplementation { if (this.isRightClick(event) || long_touch) { const append = []; - if (long_touch) { + if (window['TouchEvent'] && evt instanceof TouchEvent && long_touch) { // XXX: better way to pass instance to action function? const tmp = this; // action to "hold" item for moving or dropping using touch @@ -368,7 +365,7 @@ export class ItemContainerImplementation { append.push({ title: "Hold", action: function(entity: any) { - tmp.onDragStart(evt as TouchEvent); + tmp.onDragStart(evt); } }); } @@ -401,23 +398,19 @@ export class ItemContainerImplementation { } private onTouchStart(evt: TouchEvent) { - // prevent default "mousedown" so we can call its handler manually - evt.preventDefault(); - const pos = stendhal.ui.html.extractPosition(evt); stendhal.ui.touch.onTouchStart(pos.pageX, pos.pageY); - this.onMouseDown(evt); } private onTouchEnd(evt: TouchEvent) { - // prevent default "mouseup" so we can call its handler manually - evt.preventDefault(); - stendhal.ui.touch.onTouchEnd(); - if (stendhal.ui.touch.holding()) { - this.onDrop(evt); - } else { + if (stendhal.ui.touch.isLongTouch(evt) && !stendhal.ui.touch.holding()) { this.onMouseUp(evt); + } else if (stendhal.ui.touch.holding()) { + evt.preventDefault(); + + this.onDrop(evt); + stendhal.ui.touch.setHolding(false); } // clean up touch handler stendhal.ui.touch.unsetOrigin(); From f1523798c786d6604540618933f58d097dc2151b Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sun, 17 Mar 2024 00:25:27 -0700 Subject: [PATCH 04/25] Fix redundant check --- srcjs/stendhal/ui/component/ItemContainerImplementation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts index b56c07bc39..63a69edfe6 100644 --- a/srcjs/stendhal/ui/component/ItemContainerImplementation.ts +++ b/srcjs/stendhal/ui/component/ItemContainerImplementation.ts @@ -357,7 +357,7 @@ export class ItemContainerImplementation { if (this.isRightClick(event) || long_touch) { const append = []; - if (window['TouchEvent'] && evt instanceof TouchEvent && long_touch) { + if (long_touch) { // XXX: better way to pass instance to action function? const tmp = this; // action to "hold" item for moving or dropping using touch @@ -365,7 +365,7 @@ export class ItemContainerImplementation { append.push({ title: "Hold", action: function(entity: any) { - tmp.onDragStart(evt); + tmp.onDragStart(evt as TouchEvent); } }); } From 6b57ebe3f868fc14cdcd3883aaf760814d7f208a Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sun, 17 Mar 2024 00:51:40 -0700 Subject: [PATCH 05/25] Update changes --- doc/CHANGES.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/CHANGES.txt b/doc/CHANGES.txt index 877aa3e0c6..28528387bb 100644 --- a/doc/CHANGES.txt +++ b/doc/CHANGES.txt @@ -58,7 +58,6 @@ Changelog - fixed difficult to move small floating windows - supports chat commands tab completion - supports text highlighting in speech bubbles -- fixed multi-touch support for item inventories *desktop client (non-Java)* - experimental desktop interface for the web client using Neutralinojs From 22fa54ab6adbca743b1ae247631c78a482fab645 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 18 Mar 2024 01:31:19 -0700 Subject: [PATCH 06/25] Fix controlling mute & volume level of single global music instance Closes: https://github.com/arianne/stendhal/issues/688 --- srcjs/stendhal/ui/SoundManager.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/srcjs/stendhal/ui/SoundManager.ts b/srcjs/stendhal/ui/SoundManager.ts index 5b4380fbab..09a65761d0 100644 --- a/srcjs/stendhal/ui/SoundManager.ts +++ b/srcjs/stendhal/ui/SoundManager.ts @@ -506,6 +506,8 @@ export class SoundManager { /** * Stops all currently playing sounds. * + * NOTE: this if for map changes & should not include single global music instance + * * @param includeGui {boolean} * If `true`, sounds on the gui layer will stopped as well (default: false). * @return {boolean} @@ -541,6 +543,11 @@ export class SoundManager { muted = muted && snd.muted; } } + // global music is not tracked in layer array + if (this.globalMusic) { + this.globalMusic.muted = true; + muted = muted && this.globalMusic.muted; + } return muted; } @@ -558,6 +565,11 @@ export class SoundManager { unmuted = unmuted && !snd.paused && !snd.muted; } } + // global music is not tracked in layer array + if (this.globalMusic) { + this.globalMusic.muted = false; + unmuted = unmuted && !this.globalMusic.paused && !this.globalMusic.muted; + } return unmuted; } @@ -680,6 +692,10 @@ export class SoundManager { } } } + // global music is not tracked in layer array + if (this.globalMusic && (layerName === "music" || layerName === "master")) { + this.applyAdjustedVolume(layerName, this.globalMusic); + } return true; } From 8af5ae1bbbd2754cc002b2401cf5e0ccea3e3c70 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 18 Mar 2024 03:05:57 -0700 Subject: [PATCH 07/25] Add option to enable/disable pinch & double-tap zoom Closes: https://github.com/arianne/stendhal/issues/687 --- .../java/org/stendhalgame/client/ClientView.java | 6 +++--- srcjs/stendhal.css | 5 ----- srcjs/stendhal.html | 1 + srcjs/stendhal/ui/dialog/SettingsDialog.ts | 8 ++++++++ srcjs/stendhal/util/ConfigManager.ts | 3 ++- srcjs/stendhal/util/SessionManager.ts | 15 +++++++++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/android/client/src/main/java/org/stendhalgame/client/ClientView.java b/app/android/client/src/main/java/org/stendhalgame/client/ClientView.java index 741dc787a2..ca2aa1e9bb 100644 --- a/app/android/client/src/main/java/org/stendhalgame/client/ClientView.java +++ b/app/android/client/src/main/java/org/stendhalgame/client/ClientView.java @@ -130,9 +130,9 @@ public class ClientView extends WebView { viewSettings.setLoadWithOverviewMode(true); viewSettings.setUseWideViewPort(true); - // disable zoom - viewSettings.setSupportZoom(false); - viewSettings.setBuiltInZoomControls(false); + // zoom controls + viewSettings.setSupportZoom(true); + viewSettings.setBuiltInZoomControls(true); viewSettings.setDisplayZoomControls(false); // allow autoplay of music diff --git a/srcjs/stendhal.css b/srcjs/stendhal.css index e4650cf928..f7c83976d7 100644 --- a/srcjs/stendhal.css +++ b/srcjs/stendhal.css @@ -8,11 +8,6 @@ overflow: hidden; } -/* disable double-tap zoom in browsers that support it */ -html { - touch-action: pan-x pan-y; /* manipulation does not work in Chrome */ -} - /* disable pull down refresh in browsers that support it */ html, body { overscroll-behavior: none; diff --git a/srcjs/stendhal.html b/srcjs/stendhal.html index 7537fb1933..80db155798 100644 --- a/srcjs/stendhal.html +++ b/srcjs/stendhal.html @@ -278,6 +278,7 @@ +
diff --git a/srcjs/stendhal/ui/dialog/SettingsDialog.ts b/srcjs/stendhal/ui/dialog/SettingsDialog.ts index e61b1d6812..67f65b1ab5 100644 --- a/srcjs/stendhal/ui/dialog/SettingsDialog.ts +++ b/srcjs/stendhal/ui/dialog/SettingsDialog.ts @@ -102,6 +102,14 @@ export class SettingsDialog extends DialogContentComponent { this.createCheckBox("chk_hidechat", "chat.autohide", "Chat panel will be hidden after sending text", "Chat panel will remain on-screen"); + // FIXME: are there unique properties for pinch & tap zooming? + this.createCheckBox("chk_zoom", "zoom.touch", + "Touch zooming enabled (may not work with all browsers)", + "Touch zooming disabled (may not work with all browsers)", + function() { + stendhal.session.update(); + }); + /* *** center panel *** */ diff --git a/srcjs/stendhal/util/ConfigManager.ts b/srcjs/stendhal/util/ConfigManager.ts index bcd234896f..7de915e65a 100644 --- a/srcjs/stendhal/util/ConfigManager.ts +++ b/srcjs/stendhal/util/ConfigManager.ts @@ -80,7 +80,8 @@ export class ConfigManager { "window.settings": "20,20", "window.shortcuts": "20,20", "window.trade": "200,100", - "window.travel-log": "160,50" + "window.travel-log": "160,50", + "zoom.touch": "false" }; /** diff --git a/srcjs/stendhal/util/SessionManager.ts b/srcjs/stendhal/util/SessionManager.ts index 1278ae50ef..b624943af6 100644 --- a/srcjs/stendhal/util/SessionManager.ts +++ b/srcjs/stendhal/util/SessionManager.ts @@ -75,6 +75,8 @@ export class SessionManager { } this.set(key, value); } + + this.update(); } /** @@ -175,6 +177,19 @@ export class SessionManager { return this.charname || ""; } + /** + * Syncs inteface with updated settings. + */ + update() { + if (stendhal.config.getBoolean("zoom.touch")) { + document.documentElement.style.removeProperty("touch-action"); + } else { + // disable double-tap zoom in browsers that support it + // NOTE: "manipulation" does not work in Chrome + document.documentElement.style.setProperty("touch-action", "pan-x pan-y"); + } + } + /** * Detects if test client is being used based on data path. * From 68f21d5eeb863f3868b41854998b001d34dca79d Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 18 Mar 2024 03:32:50 -0700 Subject: [PATCH 08/25] Support opening chat log context menu with touch Closes: https://github.com/arianne/stendhal/issues/603 --- doc/CHANGES.txt | 1 + .../stendhal/ui/component/ChatLogComponent.ts | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/doc/CHANGES.txt b/doc/CHANGES.txt index 28528387bb..246e09d926 100644 --- a/doc/CHANGES.txt +++ b/doc/CHANGES.txt @@ -58,6 +58,7 @@ Changelog - fixed difficult to move small floating windows - supports chat commands tab completion - supports text highlighting in speech bubbles +- fixed opening chat log context menu with touch *desktop client (non-Java)* - experimental desktop interface for the web client using Neutralinojs diff --git a/srcjs/stendhal/ui/component/ChatLogComponent.ts b/srcjs/stendhal/ui/component/ChatLogComponent.ts index 14399721cb..04e0c35222 100644 --- a/srcjs/stendhal/ui/component/ChatLogComponent.ts +++ b/srcjs/stendhal/ui/component/ChatLogComponent.ts @@ -36,6 +36,16 @@ export class ChatLogComponent extends Component { this.componentElement.addEventListener("mouseup", (evt: MouseEvent) => { this.onContextMenu(evt) }); + this.componentElement.addEventListener("touchstart", (evt: TouchEvent) => { + const pos = stendhal.ui.html.extractPosition(evt); + stendhal.ui.touch.onTouchStart(pos.pageX, pos.pageY); + }); + this.componentElement.addEventListener("touchend", (evt: TouchEvent) => { + stendhal.ui.touch.onTouchEnd(); + this.onContextMenu(evt) + // clean up + stendhal.ui.touch.unsetOrigin(); + }); this.scrollListener = (evt: Event) => { this.onScroll(); @@ -439,9 +449,21 @@ export class ChatLogComponent extends Component { /** * Handles creating a custom context menu with options "Clear" & "Copy". + * + * FIXME: text highlighting interferes with opening context menu with touch + * + * @param evt {any} + * Mouse or touch event. */ - private onContextMenu(evt: MouseEvent) { - if (!evt || evt.button != 2 || stendhal.ui.actionContextMenu.isOpen()) { + private onContextMenu(evt: any) { + if (!evt || stendhal.ui.actionContextMenu.isOpen()) { + return; + } + if (evt.type === "mouseup" && evt.button != 2) { + return; + } + if (evt.type === "touchend" && !stendhal.ui.touch.isLongTouch(evt)) { + evt.preventDefault(); return; } From e56d8680d9f63e33677f96ba1e67f64e04d01510 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 18 Mar 2024 12:51:54 -0700 Subject: [PATCH 09/25] Disable Android built-in about dialog Web client now has about dialog. --- .../src/main/java/org/stendhalgame/client/Menu.java | 2 ++ app/android/client/src/main/res/layout/activity_main.xml | 2 ++ doc/sources/audio-music.txt | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/app/android/client/src/main/java/org/stendhalgame/client/Menu.java b/app/android/client/src/main/java/org/stendhalgame/client/Menu.java index 813b89b3f5..1f2fcec7af 100644 --- a/app/android/client/src/main/java/org/stendhalgame/client/Menu.java +++ b/app/android/client/src/main/java/org/stendhalgame/client/Menu.java @@ -194,6 +194,7 @@ public class Menu { } }); + /* final Button btn_about = (Button) activity.findViewById(R.id.btn_about); btn_about.setOnClickListener(new ClickListener() { @Override @@ -244,6 +245,7 @@ public class Menu { builder.create().show(); } }); + */ final Button btn_quit = (Button) activity.findViewById(R.id.btn_quit); btn_quit.setOnClickListener(new ClickListener() { diff --git a/app/android/client/src/main/res/layout/activity_main.xml b/app/android/client/src/main/res/layout/activity_main.xml index 6fa5372f11..fe4445c4ef 100644 --- a/app/android/client/src/main/res/layout/activity_main.xml +++ b/app/android/client/src/main/res/layout/activity_main.xml @@ -75,6 +75,7 @@ android:background="#00000000" /> +