[Scummvm-git-logs] scummvm master -> 53527c463f2c241892e2f19e2aefa9f21ccdbe87
neuromancer
noreply at scummvm.org
Sat Jan 15 19:26:35 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:
53527c463f HYPNO: fixes in game loading and video playback when looping in spider
Commit: 53527c463f2c241892e2f19e2aefa9f21ccdbe87
https://github.com/scummvm/scummvm/commit/53527c463f2c241892e2f19e2aefa9f21ccdbe87
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-01-15T20:25:35+01:00
Commit Message:
HYPNO: fixes in game loading and video playback when looping 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/spider/spider.cpp
diff --git a/engines/hypno/actions.cpp b/engines/hypno/actions.cpp
index 9900a03fde4..f740e132120 100644
--- a/engines/hypno/actions.cpp
+++ b/engines/hypno/actions.cpp
@@ -50,13 +50,11 @@ void HypnoEngine::runMenu(Hotspots hs) {
case AmbientAction:
runAmbient((Ambient *)action);
break;
- case CutsceneAction: {
- // Should not repeat the same
- Cutscene *cutscene = (Cutscene *) action;
- if (!_intros.contains(cutscene->path))
- runCutscene(cutscene);
- _intros[cutscene->path] = true;
- }
+ case IntroAction:
+ runIntro((Intro *)action);
+ break;
+ case CutsceneAction:
+ runCutscene((Cutscene *)action);
break;
case PaletteAction:
runPalette((Palette *)action);
@@ -117,7 +115,6 @@ void HypnoEngine::runMice(Mice *a) {
}
void HypnoEngine::runPalette(Palette *a) {
- //return; // remove when palette are working
loadPalette(a->path);
}
@@ -127,6 +124,17 @@ void HypnoEngine::runEscape() {
_escapeSequentialVideoToPlay.clear();
}
+void HypnoEngine::runIntro(Intro *a) {
+ // Should not repeat the same
+ if (_intros.contains(a->path))
+ return;
+
+ _intros[a->path] = true;
+ MVideo v(a->path, Common::Point(0, 0), false, true, false);
+ runIntro(v);
+}
+
+
void HypnoEngine::runCutscene(Cutscene *a) {
stopSound();
defaultCursor();
@@ -178,9 +186,14 @@ void HypnoEngine::runAmbient(Ambient *a) {
else
sframe = frame;
drawImage(*sframe, a->origin.x, a->origin.y, true);
- //loadImage(a->path, a->origin.x, a->origin.y, false, a->frameNumber);
} else {
- _nextSequentialVideoToPlay.push_back(MVideo(a->path, a->origin, false, a->fullscreen, a->flag == "/LOOP"));
+ bool loop = a->flag == "/LOOP";
+ if (loop) { // Avoid re-adding the same looping video
+ if (_intros.contains(a->path))
+ return;
+ _intros[a->path] = true;
+ }
+ _nextSequentialVideoToPlay.push_back(MVideo(a->path, a->origin, false, a->fullscreen, loop));
}
}
@@ -205,10 +218,9 @@ void HypnoEngine::runLoad(Load *a) {
}
void HypnoEngine::runLoadCheckpoint(LoadCheckpoint *a) {
- // TODO: this depends on the game
if (_checkpoint.empty())
error("Invalid checkpoint!");
- _nextLevel = _checkpoint;
+ loadGame(_checkpoint, _sceneState["GS_PUZZLELEVEL"], _sceneState["GS_COMBATLEVEL"]);
}
void HypnoEngine::runQuit(Quit *a) {
diff --git a/engines/hypno/grammar.h b/engines/hypno/grammar.h
index 96c12b45c4f..0cd25eccca9 100644
--- a/engines/hypno/grammar.h
+++ b/engines/hypno/grammar.h
@@ -75,6 +75,7 @@ enum ActionType {
QuitAction,
CutsceneAction,
PlayAction,
+ IntroAction,
AmbientAction,
WalNAction,
GlobalAction,
@@ -213,6 +214,15 @@ public:
Filename path;
};
+class Intro : public Action {
+public:
+ Intro(Filename path_) {
+ type = IntroAction;
+ path = path_;
+ }
+ Filename path;
+};
+
class Play : public Action {
public:
Play(Filename path_, Common::Point origin_, Common::String condition_, Common::String flag_) {
diff --git a/engines/hypno/grammar_mis.cpp b/engines/hypno/grammar_mis.cpp
index a4a0046abfd..cebfa2949ac 100644
--- a/engines/hypno/grammar_mis.cpp
+++ b/engines/hypno/grammar_mis.cpp
@@ -1391,7 +1391,7 @@ yyreduce:
case 18: /* line: INTRTOK FILENAME NUM NUM */
#line 177 "engines/hypno/grammar_mis.y"
{
- Cutscene *a = new Cutscene(Common::String("cine/") + (yyvsp[-2].s));
+ Intro *a = new Intro(Common::String("cine/") + (yyvsp[-2].s));
Hotspots *cur = stack->back();
Hotspot *hot = &cur->back();
hot->actions.push_back(a);
@@ -1403,7 +1403,7 @@ yyreduce:
case 19: /* line: INTRTOK FILENAME */
#line 184 "engines/hypno/grammar_mis.y"
{
- Cutscene *a = new Cutscene(Common::String("cine/") + (yyvsp[0].s));
+ Intro *a = new Intro(Common::String("cine/") + (yyvsp[0].s));
Hotspots *cur = stack->back();
Hotspot *hot = &cur->back();
hot->actions.push_back(a);
diff --git a/engines/hypno/grammar_mis.y b/engines/hypno/grammar_mis.y
index a44cff07292..c2e17d8bfbc 100644
--- a/engines/hypno/grammar_mis.y
+++ b/engines/hypno/grammar_mis.y
@@ -175,14 +175,14 @@ line: MENUTOK mflag mflag mflag {
debugC(1, kHypnoDebugParser, "PALE");
}
| INTRTOK FILENAME NUM NUM {
- Cutscene *a = new Cutscene(Common::String("cine/") + $2);
+ Intro *a = new Intro(Common::String("cine/") + $2);
Hotspots *cur = stack->back();
Hotspot *hot = &cur->back();
hot->actions.push_back(a);
debugC(1, kHypnoDebugParser, "INTRO %s %d %d", $2, $3, $4);
}
| INTRTOK FILENAME {
- Cutscene *a = new Cutscene(Common::String("cine/") + $2);
+ Intro *a = new Intro(Common::String("cine/") + $2);
Hotspots *cur = stack->back();
Hotspot *hot = &cur->back();
hot->actions.push_back(a);
diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index 128adad416a..c3137cc34b8 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -246,6 +246,9 @@ void HypnoEngine::runIntro(MVideo &video) {
void HypnoEngine::runCode(Code *code) { error("Function \"%s\" not implemented", __FUNCTION__); }
void HypnoEngine::showCredits() { error("Function \"%s\" not implemented", __FUNCTION__); }
+void HypnoEngine::loadGame(const Common::String &nextLevel, int puzzleDifficulty, int combatDifficulty) {
+ error("Function \"%s\" not implemented", __FUNCTION__);
+}
void HypnoEngine::loadImage(const Common::String &name, int x, int y, bool transparent, bool palette, int frameNumber) {
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index b1511180fa3..7b3755d42d7 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -124,6 +124,7 @@ public:
bool cursorExit(Common::Point);
bool cursorMask(Common::Point);
+ virtual void loadGame(const Common::String &nextLevel, int puzzleDifficulty, int combatDifficulty);
bool canLoadGameStateCurrently() override { return (isDemo() ? false : true); }
bool canSaveAutosaveCurrently() override { return false; }
bool canSaveGameStateCurrently() override { return (isDemo() ? false : true); }
@@ -161,6 +162,7 @@ public:
void runTimer(Timer *a);
void runQuit(Quit *a);
void runCutscene(Cutscene *a);
+ void runIntro(Intro *a);
void runPlay(Play *a);
void runPalette(Palette *a);
void runAmbient(Ambient *a);
@@ -312,6 +314,7 @@ public:
void rightClickedConversation(const Common::Point &mousePos) override;
void leftClickedConversation(const Common::Point &mousePos) override;
+ void loadGame(const Common::String &nextLevel, int puzzleDifficulty, int combatDifficulty) override;
Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
bool hasFeature(EngineFeature f) const override {
diff --git a/engines/hypno/spider/spider.cpp b/engines/hypno/spider/spider.cpp
index 07642f98391..da8afdcc1bd 100644
--- a/engines/hypno/spider/spider.cpp
+++ b/engines/hypno/spider/spider.cpp
@@ -617,7 +617,6 @@ void SpiderEngine::loadAssetsFullGame() {
loadSceneLevel("movie2.mi_", "decide5.mi_", prefix);
_levels["movie2.mi_"]->intros.push_back("cine/vrfs003s.smk");
- _levels["movie2.mi_"]->intros.push_back("cine/imsd017s.smk");
loadSceneLevel("decide5.mi_", "", prefix);
sc = (Scene *) _levels["decide5.mi_"];
@@ -691,13 +690,13 @@ void SpiderEngine::loadAssetsFullGame() {
loadSceneLevel("docoffi2.mi_", "c12a", prefix);
loadArcadeLevel("c12.mi_", "<chip_lives_with_spiderman>", prefix);
- _levels["c12.mi_"]->levelIfLose = "<vr_death>";
+ _levels["c12.mi_"]->levelIfLose = "<over_vr>";
_levels["c12.mi_"]->intros.push_back("cine/vrws010s.smk");
_levels["c12.mi_"]->intros.push_back("cine/cybs001s.smk");
_levels["c12a.mi_"] = _levels["c12.mi_"];
loadArcadeLevel("c12h.mi_", "<chip_lives_with_spiderman>", prefix);
- _levels["c12h.mi_"]->levelIfLose = "<vr_death>";
+ _levels["c12h.mi_"]->levelIfLose = "<over_vr>";
_levels["c12h.mi_"]->intros.push_back("cine/vrws010s.smk");
_levels["c12h.mi_"]->intros.push_back("cine/cybs001s.smk");
_levels["c12ah.mi_"] = _levels["c12h.mi_"];
@@ -772,13 +771,13 @@ void SpiderEngine::loadAssetsFullGame() {
_levels["c11sh.mi_"] = _levels["c11h.mi_"];
loadArcadeLevel("c12.mi_", "<chip_lives_with_shocker>", prefix);
- _levels["c12.mi_"]->levelIfLose = "<vr_death>";
+ _levels["c12.mi_"]->levelIfLose = "<over_vr>";
_levels["c12.mi_"]->intros.push_back("cine/vrwd001s.smk");
_levels["c12.mi_"]->intros.push_back("cine/cybs001s.smk");
_levels["c12s.mi_"] = _levels["c12.mi_"];
loadArcadeLevel("c12h.mi_", "<chip_lives_with_shocker>", prefix);
- _levels["c12h.mi_"]->levelIfLose = "<vr_death>";
+ _levels["c12h.mi_"]->levelIfLose = "<over_vr>";
_levels["c12h.mi_"]->intros.push_back("cine/vrwd001s.smk");
_levels["c12h.mi_"]->intros.push_back("cine/cybs001s.smk");
@@ -826,12 +825,12 @@ void SpiderEngine::loadAssetsFullGame() {
_levels["c11mh.mi_"] = _levels["c11h.mi_"];
loadArcadeLevel("c12.mi_", "<chip_lives_with_mason>", prefix);
- _levels["c12.mi_"]->levelIfLose = "<vr_death>";
+ _levels["c12.mi_"]->levelIfLose = "<over_vr>";
_levels["c12.mi_"]->intros.push_back("cine/cybs001s.smk");
_levels["c12m.mi_"] = _levels["c12.mi_"];
loadArcadeLevel("c12h.mi_", "<chip_lives_with_mason>", prefix);
- _levels["c12h.mi_"]->levelIfLose = "<vr_death>";
+ _levels["c12h.mi_"]->levelIfLose = "<over_vr>";
_levels["c12h.mi_"]->intros.push_back("cine/cybs001s.smk");
_levels["c12mh.mi_"] = _levels["c12h.mi_"];
@@ -1017,11 +1016,20 @@ Common::String SpiderEngine::findNextLevel(const Transition *trans) {
}
Common::Error SpiderEngine::loadGameStream(Common::SeekableReadStream *stream) {
+ int puzzleDifficulty = stream->readUint32LE();
+ int combatDifficulty = stream->readUint32LE();
+ const Common::String nextLevel = stream->readString();
+ loadGame(nextLevel, puzzleDifficulty, combatDifficulty);
+ return Common::kNoError;
+}
+
+void SpiderEngine::loadGame(const Common::String &nextLevel, int puzzleDifficulty, int combatDifficulty) {
+
// We don't want to continue with any sound from a previous game
stopSound();
- _sceneState["GS_PUZZLELEVEL"] = stream->readUint32LE();
- _sceneState["GS_COMBATLEVEL"] = stream->readUint32LE();
- _nextLevel = stream->readString();
+ _sceneState["GS_PUZZLELEVEL"] = puzzleDifficulty;
+ _sceneState["GS_COMBATLEVEL"] = combatDifficulty;
+ _nextLevel = nextLevel;
_checkpoint = _nextLevel;
// Reset played intros
@@ -1036,8 +1044,6 @@ Common::Error SpiderEngine::loadGameStream(Common::SeekableReadStream *stream) {
_isFuseUnreadable = false;
for (int i = 0; i < 7; i++)
ingredients[i] = 0;
-
- return Common::kNoError;
}
Common::Error SpiderEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
More information about the Scummvm-git-logs
mailing list