[Scummvm-git-logs] scummvm master -> e99082f184d25ad81deab7c33e40d7ec55c22b4e
neuromancer
noreply at scummvm.org
Wed Aug 19 15:31:53 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
e99082f184 SCUMM: RA: unify code for double tap to skip sequences
Commit: e99082f184d25ad81deab7c33e40d7ec55c22b4e
https://github.com/scummvm/scummvm/commit/e99082f184d25ad81deab7c33e40d7ec55c22b4e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-08-19T17:31:38+02:00
Commit Message:
SCUMM: RA: unify code for double tap to skip sequences
Changed paths:
A engines/scumm/insane/rebel/rebel_touch.cpp
A engines/scumm/insane/rebel/rebel_touch.h
engines/scumm/insane/rebel1/menu.cpp
engines/scumm/insane/rebel1/rebel.h
engines/scumm/insane/rebel2/rebel.cpp
engines/scumm/insane/rebel2/rebel.h
engines/scumm/module.mk
diff --git a/engines/scumm/insane/rebel/rebel_touch.cpp b/engines/scumm/insane/rebel/rebel_touch.cpp
new file mode 100644
index 00000000000..df06f4afa3e
--- /dev/null
+++ b/engines/scumm/insane/rebel/rebel_touch.cpp
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+
+#include "scumm/insane/rebel/rebel_touch.h"
+
+namespace Scumm {
+
+const uint32 kRebelDoubleTapIntervalMs = 500;
+// Wider than a desktop double click: a finger lands less precisely.
+const int kRebelDoubleTapSlop = 32;
+
+RebelTouchTapDetector::RebelTouchTapDetector() :
+ _lastTapTime(0), _lastTapX(0), _lastTapY(0) {
+}
+
+void RebelTouchTapDetector::reset() {
+ _lastTapTime = 0;
+}
+
+bool RebelTouchTapDetector::addTap(int16 x, int16 y, uint32 now) {
+ const bool inTime = _lastTapTime != 0 && now - _lastTapTime <= kRebelDoubleTapIntervalMs;
+ const bool inPlace = ABS((int)x - (int)_lastTapX) <= kRebelDoubleTapSlop &&
+ ABS((int)y - (int)_lastTapY) <= kRebelDoubleTapSlop;
+
+ if (inTime && inPlace) {
+ reset();
+ return true;
+ }
+
+ _lastTapTime = now;
+ _lastTapX = x;
+ _lastTapY = y;
+ return false;
+}
+
+} // End of namespace Scumm
diff --git a/engines/scumm/insane/rebel/rebel_touch.h b/engines/scumm/insane/rebel/rebel_touch.h
new file mode 100644
index 00000000000..1edd9e515e9
--- /dev/null
+++ b/engines/scumm/insane/rebel/rebel_touch.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SCUMM_INSANE_REBEL_TOUCH_H
+#define SCUMM_INSANE_REBEL_TOUCH_H
+
+#include "common/scummsys.h"
+
+namespace Scumm {
+
+// Double rather than single, because a single tap is the gameplay fire button.
+class RebelTouchTapDetector {
+public:
+ RebelTouchTapDetector();
+
+ bool addTap(int16 x, int16 y, uint32 now);
+ void reset();
+
+private:
+ uint32 _lastTapTime;
+ int16 _lastTapX;
+ int16 _lastTapY;
+};
+
+} // End of namespace Scumm
+
+#endif
diff --git a/engines/scumm/insane/rebel1/menu.cpp b/engines/scumm/insane/rebel1/menu.cpp
index 0f55b7da6ec..8f5c548ebe3 100644
--- a/engines/scumm/insane/rebel1/menu.cpp
+++ b/engines/scumm/insane/rebel1/menu.cpp
@@ -682,7 +682,8 @@ bool InsaneRebel1::notifyEvent(const Common::Event &event) {
if (isTouchscreenActive() && !_interactiveVideoActive && !_menuActive &&
event.type == Common::EVENT_LBUTTONDOWN) {
- _vm->_smushVideoShouldFinish = true;
+ if (_touchTapDetector.addTap(event.mouse.x, event.mouse.y, _vm->_system->getMillis()))
+ _vm->_smushVideoShouldFinish = true;
return true;
}
diff --git a/engines/scumm/insane/rebel1/rebel.h b/engines/scumm/insane/rebel1/rebel.h
index 1ccaee5053c..1b77886e368 100644
--- a/engines/scumm/insane/rebel1/rebel.h
+++ b/engines/scumm/insane/rebel1/rebel.h
@@ -28,6 +28,7 @@
#include "scumm/insane/insane.h"
#include "scumm/insane/rebel/rebel_audio.h"
#include "scumm/insane/rebel/rebel_gamepad.h"
+#include "scumm/insane/rebel/rebel_touch.h"
#include "scumm/smush/rebel/smush_player_ra1.h"
namespace Scumm {
@@ -551,6 +552,7 @@ private:
bool _preserveInteractiveRuntimeState;
bool _interactiveVideoCheatSkipped;
RebelIOSGamepadControllerState _iosGamepadControllerState;
+ RebelTouchTapDetector _touchTapDetector;
// Path branching for levels with left/right alternative videos.
static const int32 kPathBranchCounter = 394;
diff --git a/engines/scumm/insane/rebel2/rebel.cpp b/engines/scumm/insane/rebel2/rebel.cpp
index 7fb5fabbb94..f7d3b1cb10f 100644
--- a/engines/scumm/insane/rebel2/rebel.cpp
+++ b/engines/scumm/insane/rebel2/rebel.cpp
@@ -147,6 +147,18 @@ bool isRebel2MenuState(InsaneRebel2::GameState state) {
state == InsaneRebel2::kStateTopPilots;
}
+bool InsaneRebel2::isTouchscreenActive() const {
+ return g_system->hasFeature(OSystem::kFeatureTouchscreen);
+}
+
+// Not a menu, where taps pick items, and not gameplay, where a tap fires.
+bool InsaneRebel2::isSkippableVideoState() const {
+ if (_menuInputActive || isRebel2MenuState(_gameState))
+ return false;
+
+ return _gameState != kStateGameplay || _rebelHandler == 0;
+}
+
InsaneRebel2::InsaneRebel2(ScummEngine_v7 *scumm) {
_vm = scumm;
@@ -768,6 +780,14 @@ bool InsaneRebel2::notifyEvent(const Common::Event &event) {
if (_vm->isPaused())
return false;
+ if (isTouchscreenActive() && event.type == Common::EVENT_LBUTTONDOWN &&
+ isSkippableVideoState() &&
+ _touchTapDetector.addTap(event.mouse.x, event.mouse.y, _vm->_system->getMillis())) {
+ debugC(DEBUG_INSANE, "Double tap - skipping video");
+ _vm->_smushVideoShouldFinish = true;
+ return true;
+ }
+
if (_rebelYodaMode && event.type == Common::EVENT_KEYDOWN && !event.kbdRepeat && event.kbd.hasFlags(Common::KBD_ALT)) {
switch (event.kbd.keycode) {
case Common::KEYCODE_m:
diff --git a/engines/scumm/insane/rebel2/rebel.h b/engines/scumm/insane/rebel2/rebel.h
index f274136b946..ecaec832099 100644
--- a/engines/scumm/insane/rebel2/rebel.h
+++ b/engines/scumm/insane/rebel2/rebel.h
@@ -29,6 +29,7 @@
#include "scumm/insane/insane.h"
#include "scumm/insane/rebel/rebel_audio.h"
#include "scumm/insane/rebel/rebel_gamepad.h"
+#include "scumm/insane/rebel/rebel_touch.h"
#include "common/keyboard.h"
#include "common/list.h"
@@ -370,6 +371,7 @@ public:
void centerGameplayAim();
bool _gameplaySectionActive;
RebelIOSGamepadControllerState _iosGamepadControllerState;
+ RebelTouchTapDetector _touchTapDetector;
int _currentPhase;
int _deathFrame;
@@ -392,6 +394,8 @@ public:
int32 processMouse() override;
+ bool isTouchscreenActive() const;
+ bool isSkippableVideoState() const;
Common::Point getGameplayAimPoint();
Common::Point getGameplayPointerPos();
Common::Point getRebelAutoPlayAimPoint();
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index d2e5f1dc058..46c1673a742 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -149,6 +149,7 @@ MODULE_OBJS += \
insane/insane_iact.o \
insane/rebel/rebel_audio.o \
insane/rebel/rebel_gamepad.o \
+ insane/rebel/rebel_touch.o \
insane/rebel1/rebel.o \
insane/rebel1/audio.o \
insane/rebel1/iact.o \
More information about the Scummvm-git-logs
mailing list