[Scummvm-git-logs] scummvm master -> 8186f29f77834fbe3de6f7c619dfbc26d740abe5
neuromancer
noreply at scummvm.org
Sat Jun 18 08:00:11 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8186f29f77 HYPNO: fix timer usage during bus puzzle (hard) in spider
Commit: 8186f29f77834fbe3de6f7c619dfbc26d740abe5
https://github.com/scummvm/scummvm/commit/8186f29f77834fbe3de6f7c619dfbc26d740abe5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-06-18T10:00:10+02:00
Commit Message:
HYPNO: fix timer usage during bus puzzle (hard) in spider
Changed paths:
engines/hypno/actions.cpp
engines/hypno/grammar.h
engines/hypno/grammar_mis.cpp
engines/hypno/grammar_mis.y
engines/hypno/hypno.cpp
engines/hypno/hypno.h
engines/hypno/scene.cpp
engines/hypno/spider/hard.cpp
engines/hypno/spider/spider.cpp
diff --git a/engines/hypno/actions.cpp b/engines/hypno/actions.cpp
index f54933d4c57..1f0555dadff 100644
--- a/engines/hypno/actions.cpp
+++ b/engines/hypno/actions.cpp
@@ -93,6 +93,8 @@ void HypnoEngine::runTimer(Timer *a) {
return; // Do not start another timer
uint32 delay = a->delay / 1000;
+ if (a->flag == "vus0")
+ _keepTimerDuringScenes = true;
debugC(1, kHypnoDebugScene, "Starting timer with %d secons", delay);
if (delay == 0 || !startCountdown(delay))
diff --git a/engines/hypno/grammar.h b/engines/hypno/grammar.h
index 00c931ddafd..d01e528ab74 100644
--- a/engines/hypno/grammar.h
+++ b/engines/hypno/grammar.h
@@ -140,11 +140,13 @@ public:
class Timer : public Action {
public:
- Timer(uint32 delay_) {
+ Timer(uint32 delay_, Common::String flag_) {
type = TimerAction;
delay = delay_;
+ flag = flag_;
}
uint32 delay;
+ Common::String flag;
};
class Palette : public Action {
diff --git a/engines/hypno/grammar_mis.cpp b/engines/hypno/grammar_mis.cpp
index d4ce073c7cb..60840809da2 100644
--- a/engines/hypno/grammar_mis.cpp
+++ b/engines/hypno/grammar_mis.cpp
@@ -1334,11 +1334,11 @@ yyreduce:
case 11: /* line: TIMETOK NUM mflag */
#line 148 "engines/hypno/grammar_mis.y"
{
- Timer *a = new Timer((yyvsp[-1].i));
+ Timer *a = new Timer((yyvsp[-1].i), (yyvsp[0].s));
Hotspots *cur = stack->back();
Hotspot *hot = &cur->back();
hot->actions.push_back(a);
- debugC(1, kHypnoDebugParser, "TIME %d", (yyvsp[-1].i)); }
+ debugC(1, kHypnoDebugParser, "TIME %d %s", (yyvsp[-1].i), (yyvsp[0].s)); }
#line 1343 "engines/hypno/grammar_mis.cpp"
break;
diff --git a/engines/hypno/grammar_mis.y b/engines/hypno/grammar_mis.y
index c6e8c122477..5ad0c8d5f9c 100644
--- a/engines/hypno/grammar_mis.y
+++ b/engines/hypno/grammar_mis.y
@@ -146,11 +146,11 @@ line: MENUTOK mflag mflag mflag {
hot->actions.push_back(a);
debugC(1, kHypnoDebugParser, "ESC SUBMENU"); }
| TIMETOK NUM mflag {
- Timer *a = new Timer($2);
+ Timer *a = new Timer($2, $3);
Hotspots *cur = stack->back();
Hotspot *hot = &cur->back();
hot->actions.push_back(a);
- debugC(1, kHypnoDebugParser, "TIME %d", $2); }
+ debugC(1, kHypnoDebugParser, "TIME %d %s", $2, $3); }
| SWPTTOK NUM {
SwapPointer *a = new SwapPointer($2);
Hotspots *cur = stack->back();
diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index cb672307ee7..5edc9d6b726 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -57,7 +57,8 @@ HypnoEngine::HypnoEngine(OSystem *syst, const ADGameDescription *gd)
_defaultCursor(""), _defaultCursorIdx(0), _skipDefeatVideo(false),
_background(nullptr), _masks(nullptr), _musicRate(0), _musicStereo(false),
_additionalVideo(nullptr), _ammo(0), _maxAmmo(0), _skipNextVideo(false),
- _doNotStopSounds(false), _screenW(0), _screenH(0) { // Every games initializes its own resolution
+ _doNotStopSounds(false), _screenW(0), _screenH(0), // Every games initializes its own resolution
+ _keepTimerDuringScenes(false) {
_rnd = new Common::RandomSource("hypno");
_checkpoint = "";
@@ -622,6 +623,7 @@ bool HypnoEngine::startCountdown(uint32 delay) {
void HypnoEngine::removeTimers() {
_timerStarted = false;
+ _keepTimerDuringScenes = false;
g_system->getTimerManager()->removeTimerProc(&alarmCallback);
g_system->getTimerManager()->removeTimerProc(&countdownCallback);
}
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index f86b245d19a..a0527f135db 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -354,6 +354,7 @@ public:
// Timers
int32 _countdown;
bool _timerStarted;
+ bool _keepTimerDuringScenes;
bool startAlarm(uint32, Common::String *);
bool startCountdown(uint32);
void removeTimers();
diff --git a/engines/hypno/scene.cpp b/engines/hypno/scene.cpp
index f04774cfad3..2a45c8529a6 100644
--- a/engines/hypno/scene.cpp
+++ b/engines/hypno/scene.cpp
@@ -277,7 +277,6 @@ void HypnoEngine::runTransition(Transition *trans) {
void HypnoEngine::runScene(Scene *scene) {
changeScreenMode(scene->resolution);
_refreshConversation = false;
- _timerStarted = false;
Common::Event event;
Common::Point mousePos;
Common::List<uint32> videosToRemove;
@@ -298,7 +297,8 @@ void HypnoEngine::runScene(Scene *scene) {
if (lastCountdown == _countdown) {
} else if (_countdown > 0) {
uint32 c = 251; // red
- runMenu(stack.back());
+ if (stack.size() > 0)
+ runMenu(stack.back());
uint32 minutes = _countdown / 60;
uint32 seconds = _countdown % 60;
drawString("console", Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
@@ -306,8 +306,10 @@ void HypnoEngine::runScene(Scene *scene) {
} else {
assert(!scene->levelIfLose.empty());
_nextLevel = scene->levelIfLose;
- debugC(1, kHypnoDebugScene, "Finishing level and jumping to %s", _nextLevel.c_str());
+ debugC(1, kHypnoDebugScene, "Finishing level with timeout and jumping to %s", _nextLevel.c_str());
resetSceneState();
+ removeTimers();
+ _defaultCursorIdx = 0;
continue;
}
lastCountdown = _countdown;
@@ -557,7 +559,8 @@ void HypnoEngine::runScene(Scene *scene) {
_escapeSequentialVideoToPlay.clear();
_conversation.clear();
- removeTimers();
+ if (!_keepTimerDuringScenes)
+ removeTimers();
}
void HypnoEngine::showConversation() { error("Function \"%s\" not implemented", __FUNCTION__); }
diff --git a/engines/hypno/spider/hard.cpp b/engines/hypno/spider/hard.cpp
index 8ebedbd4c82..e0802deadd3 100644
--- a/engines/hypno/spider/hard.cpp
+++ b/engines/hypno/spider/hard.cpp
@@ -240,6 +240,7 @@ void SpiderEngine::checkMixture(Code *code) {
}
}
_nextLevel = "<after_bus_hard>";
+ removeTimers();
}
void SpiderEngine::runNote(Code *code) {
diff --git a/engines/hypno/spider/spider.cpp b/engines/hypno/spider/spider.cpp
index ba907c59168..965e7181daa 100644
--- a/engines/hypno/spider/spider.cpp
+++ b/engines/hypno/spider/spider.cpp
@@ -324,9 +324,19 @@ void SpiderEngine::loadAssetsFullGame() {
loadSceneLevel("bushard2.mi_", "", prefix);
sc = (Scene *) _levels["bushard2.mi_"];
+ sc->levelIfLose = "<over_bus>";
Escape *escape = new Escape();
- Hotspots *hs = sc->hots[1].smenu;
+ Hotspots *hs = &sc->hots;
+ Timer *tm = new Timer(600000, "vus0");
+ Actions ac = (*hs)[0].actions;
+ (*hs)[0].actions.clear();
+ (*hs)[0].actions.push_back(tm);
+
+ for (int i = 0; i < int(ac.size()); i++)
+ (*hs)[0].actions.push_back(ac[i]);
+
+ hs = sc->hots[1].smenu;
(*hs)[1].actions.push_back(escape);
cl = new ChangeLevel("<check_mixture>");
@@ -965,7 +975,7 @@ void SpiderEngine::loadAssetsFullGame() {
Transition *over_bus = new Transition("tryagain.mi_");
over_bus->intros.push_back("spider/cine/blcs002s.smk");
- over_bus->intros.push_back("spider/cine/apt04as.smk");
+ over_bus->intros.push_back("spider/cine/apts04as.smk");
_levels["<over_bus>"] = over_bus;
Transition *over_octo1 = new Transition("tryagain.mi_");
More information about the Scummvm-git-logs
mailing list